/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --teal-900: #134e4a;
  --teal-800: #115e59;
  --teal-700: #0f766e;
  --teal-600: #0d9488;
  --teal-500: #14b8a6;
  --teal-400: #2dd4bf;
  --teal-300: #5eead4;
  --teal-100: #ccfbf1;
  --teal-50:  #f0fdfa;

  --cyan-500: #06b6d4;
  --cyan-100: #cffafe;

  --surface:  #ffffff;
  --surface2: #f8fffe;
  --border:   #d1faf4;
  --text:     #0f2927;
  --text-muted: #5f8f8a;

  --sidebar-w: 220px;
  --radius: 14px;
  --shadow: 0 4px 24px rgba(13,148,136,.10);
  --shadow-md: 0 8px 32px rgba(13,148,136,.16);
}

html, body {
  height: 100%;
  font-family: 'DM Sans', sans-serif;
  background: var(--teal-50);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}

/* ── Layout ── */
body { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--teal-900);
  display: flex;
  flex-direction: column;
  padding: 32px 16px 24px;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 36px;
}

.brand-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal-400), var(--cyan-500));
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(45,212,191,.4);
}

.brand-name {
  font-family: 'DM Serif Display', serif;
  font-size: 1.6rem;
  color: #fff;
  letter-spacing: -0.02em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,.55);
  font-family: 'DM Sans', sans-serif;
  font-size: .92rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .18s, color .18s;
  text-align: left;
  width: 100%;
}

.nav-item svg {
  width: 20px; height: 20px;
  flex-shrink: 0;
}

.nav-item:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.85); }
.nav-item.active { background: rgba(255,255,255,.13); color: #fff; }

.sidebar-users {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,.1);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  color: rgba(255,255,255,.65);
  font-size: .85rem;
}

.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  font-weight: 600;
  flex-shrink: 0;
}
.user-avatar.j { background: var(--teal-500); color: #fff; }
.user-avatar.s { background: var(--cyan-500); color: #fff; }

/* ── Main ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 40px 48px;
  min-height: 100vh;
}

/* ── Sections ── */
.section { display: none; animation: fadeIn .25s ease; }
.section.active { display: block; }

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

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
}

.section-title {
  font-family: 'DM Serif Display', serif;
  font-size: 2.2rem;
  color: var(--teal-900);
  letter-spacing: -.03em;
  line-height: 1.1;
}

.section-sub {
  color: var(--text-muted);
  font-size: .9rem;
  margin-top: 4px;
}

/* ── Buttons ── */
.btn-primary {
  background: var(--teal-600);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s, box-shadow .18s, transform .12s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--teal-700); box-shadow: var(--shadow); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .18s;
}
.btn-ghost:hover { background: var(--teal-50); }

/* ── Calendar ── */
.calendar-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 32px;
}

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.cal-month {
  font-family: 'DM Serif Display', serif;
  font-size: 1.4rem;
  color: var(--teal-800);
}

.cal-arrow {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 36px; height: 36px;
  cursor: pointer;
  font-size: 1rem;
  color: var(--teal-600);
  transition: background .15s;
}
.cal-arrow:hover { background: var(--teal-100); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
}

.cal-day-name {
  text-align: center;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .06em;
  text-transform: uppercase;
  padding-bottom: 12px;
}

.cal-days {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-cell {
  min-height: 56px;
  border-radius: 8px;
  padding: 6px;
  cursor: pointer;
  transition: background .15s;
  position: relative;
}
.cal-cell:hover { background: var(--teal-50); }
.cal-cell.other-month .cal-num { color: #c4d6d4; }
.cal-cell.today { background: var(--teal-100); }
.cal-cell.today .cal-num { color: var(--teal-700); font-weight: 700; }

.cal-num {
  font-size: .85rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
}

.cal-dot-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 4px;
}

.cal-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* events list */
.list-heading {
  font-family: 'DM Serif Display', serif;
  font-size: 1.2rem;
  color: var(--teal-800);
  margin-bottom: 16px;
}

.event-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--teal-500);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  animation: fadeIn .2s ease;
}

.event-info .event-title { font-weight: 600; color: var(--text); }
.event-info .event-meta  { font-size: .82rem; color: var(--text-muted); margin-top: 2px; }

.event-by {
  font-size: .78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--teal-100);
  color: var(--teal-700);
}

.delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #ccc;
  font-size: 1rem;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.delete-btn:hover { color: #e55; background: #fff0f0; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: .9rem;
}

/* ── Expenses ── */
.expense-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-label {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}

.summary-amount {
  font-family: 'DM Serif Display', serif;
  font-size: 2rem;
  color: var(--teal-700);
  letter-spacing: -.02em;
}

.expense-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  animation: fadeIn .2s ease;
}

.expense-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  background: var(--teal-100);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.expense-details { flex: 1; }
.expense-desc { font-weight: 600; color: var(--text); }
.expense-meta { font-size: .82rem; color: var(--text-muted); margin-top: 2px; }

.expense-right { text-align: right; display: flex; align-items: center; gap: 12px; }
.expense-amount { font-family: 'DM Serif Display', serif; font-size: 1.3rem; color: var(--teal-700); }

.category-badge {
  font-size: .72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--teal-50);
  color: var(--teal-600);
  border: 1px solid var(--border);
}

/* ── Notes ── */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.note-card {
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: var(--shadow);
  position: relative;
  animation: fadeIn .2s ease;
  transition: transform .18s, box-shadow .18s;
}
.note-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.note-card-title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.1rem;
  color: var(--teal-900);
  margin-bottom: 10px;
}

.note-card-content {
  font-size: .88rem;
  color: #555;
  white-space: pre-wrap;
  line-height: 1.6;
}

.note-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(0,0,0,.06);
}

.note-by {
  font-size: .75rem;
  font-weight: 600;
  color: var(--teal-600);
}

.note-date {
  font-size: .72rem;
  color: #aaa;
}

.note-delete {
  position: absolute;
  top: 12px; right: 12px;
}

/* ── Modals ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,30,28,.45);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: 20px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 24px 64px rgba(13,148,136,.2);
  animation: modalIn .22s cubic-bezier(.34,1.56,.64,1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.92) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 0;
}
.modal-header h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.3rem;
  color: var(--teal-900);
}
.modal-close {
  background: none;
  border: none;
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background .15s;
}
.modal-close:hover { background: var(--teal-50); }

.modal-body {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-body label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: .83rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.modal-body input,
.modal-body select,
.modal-body textarea {
  font-family: 'DM Sans', sans-serif;
  font-size: .95rem;
  color: var(--text);
  background: var(--teal-50);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  outline: none;
  transition: border-color .18s;
  resize: vertical;
}
.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus { border-color: var(--teal-500); }

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 0 28px 24px;
}

/* Color picker */
.color-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.color-swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform .15s, border-color .15s;
  display: block;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: var(--teal-900); transform: scale(1.1); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar {
    width: 64px;
    padding: 20px 8px;
  }
  .brand-name, .nav-item span, .sidebar-users span { display: none; }
  .sidebar-brand { justify-content: center; padding-bottom: 24px; }
  .nav-item { justify-content: center; padding: 12px; }
  .user-pill { justify-content: center; }
  .main { margin-left: 64px; padding: 24px 20px; }
  .expense-summary { grid-template-columns: 1fr; }
  .notes-grid { grid-template-columns: 1fr; }
}
