:root {
  --border: #1a1a1a;
  --head: #3b3f45;
  --head-text: #ffffff;
  --teal: #2bb3c0;
  --teal-dark: #1f8a95;
  --red: #d83a3a;
  --green: #2e9e4f;
  --yellow: #f4c542;
  --blue: #2f6fdb;
  --row-alt: #f5f6f8;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Roboto, system-ui, sans-serif;
  background: #ffffff;
  color: #1a1a1a;
}
.app { padding: 24px; }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.btn {
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: filter .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:hover { filter: brightness(1.07); }
.btn-red { background: var(--red); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-icon {
  padding: 8px 10px;
  background: #f0f1f3;
  border: 1px solid #c9ccd2;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
}
.badge-range {
  background: var(--yellow);
  color: #2a2a2a;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.spacer { flex: 1; }

/* ---------- Calendar ---------- */
.cal-wrap { position: relative; }
.calendar {
  width: 300px;
  background: #fff;
  border: 1px solid #c9ccd2;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0,0,0,.15);
  font-size: 13px;
  user-select: none;
}
.cal-head {
  background: var(--teal);
  color: #fff;
  padding: 12px 14px;
}
.cal-range { font-weight: 700; font-size: 14px; }
.cal-sub { opacity: .9; font-size: 12px; margin-top: 2px; }
.cal-month {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  font-weight: 700;
}
.cal-nav {
  background: none; border: none; cursor: pointer;
  font-size: 16px; color: #333; font-weight: 700;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 0 10px 8px;
}
.cal-dow, .cal-day {
  text-align: center;
  padding: 6px 0;
  font-size: 13px;
}
.cal-dow { color: #888; font-weight: 600; }
.cal-day { cursor: pointer; border-radius: 6px; }
.cal-day.empty { cursor: default; }
.cal-day:hover:not(.empty) { background: #eef2f6; }
.cal-day.muted { color: #bbb; }
.cal-day.range { background: rgba(47,111,219,.18); border-radius: 0; }
.cal-day.edge {
  background: var(--blue); color: #fff; font-weight: 700;
  border-radius: 8px;
}
.cal-day.edge.range-start { border-radius: 8px 0 0 8px; }
.cal-day.edge.range-end { border-radius: 0 8px 8px 0; }
.cal-actions { padding: 10px 12px; }
.cal-actions .btn { width: 100%; justify-content: center; background: var(--teal); color:#fff; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table.fin {
  border-collapse: collapse;
  border: 3px solid var(--border);
  width: 100%;
  min-width: 720px;
  background: #fff;
}
table.fin th, table.fin td {
  border: 2px solid var(--border);
  padding: 10px 12px;
  text-align: center;
}
table.fin thead th {
  background: var(--head);
  color: var(--head-text);
  font-size: 16px;
  font-weight: 700;
  position: relative;
}
table.fin tbody td { font-size: 15px; }
table.fin tbody tr:nth-child(even) { background: var(--row-alt); }
.num { font-variant-numeric: tabular-nums; }
.expense { color: var(--red); }
.income { color: var(--green); }

/* sort arrows */
.sort-arrows {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  margin-left: 6px;
  cursor: pointer;
  line-height: 0.7;
  font-size: 10px;
}
.sort-arrows .up.active, .sort-arrows .down.active { color: var(--yellow); }
.sort-arrows .up, .sort-arrows .down { color: rgba(255,255,255,.55); }

/* project filter cell */
.proj-head {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
}
.proj-pill {
  background: #e7e9ec; color: #2a2a2a; border: 1px solid #b9bdc4;
  border-radius: 6px; padding: 3px 10px; font-size: 14px;
  display: inline-flex; align-items: center; gap: 6px;
}
.proj-pill:hover { background: #dcdee2; }

/* dropdown */
.dd-wrap { position: relative; }
.dropdown {
  position: absolute; z-index: 50; top: calc(100% + 6px); left: 0;
  width: 240px; background: #fff; border: 1px solid #c9ccd2;
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18);
  padding: 8px; font-size: 14px; color: #1a1a1a;
}
.dd-search {
  width: 100%; padding: 7px 9px; border: 1px solid #c9ccd2;
  border-radius: 6px; font-size: 14px; margin-bottom: 8px;
}
.dd-list { max-height: 200px; overflow-y: auto; }
.dd-item { display: flex; align-items: center; gap: 8px; padding: 5px 4px; cursor: pointer; }
.dd-item:hover { background: #f0f2f5; border-radius: 4px; }
.dd-actions { display: flex; gap: 8px; margin-top: 8px; }
.dd-actions .btn { flex: 1; justify-content: center; padding: 6px; font-size: 13px; }

.empty-row td { color: #999; font-style: italic; }
