:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #172026;
  --muted: #68737d;
  --line: #d9e0e5;
  --accent: #0f7b6c;
  --accent-strong: #0a5d52;
  --warn: #b95032;
  --soft: #e9f3f1;
  --shadow: 0 18px 45px rgba(19, 34, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

a {
  color: inherit;
}

.page {
  min-height: 100vh;
}

.topbar {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 42px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.main-nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.main-nav a {
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  padding: 8px 10px;
  text-decoration: none;
}

.main-nav a.active,
.main-nav a:hover {
  background: var(--soft);
  color: var(--accent-strong);
}

.brand {
  align-items: center;
  display: flex;
  gap: 12px;
  font-weight: 800;
}

.brand-mark {
  align-items: center;
  background: var(--accent);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-size: 18px;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.user-actions {
  align-items: center;
  display: flex;
  gap: 12px;
}

.shell {
  margin: 0 auto;
  max-width: 1180px;
  padding: 28px clamp(16px, 4vw, 42px) 48px;
}

.login-shell {
  align-items: center;
  display: grid;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin: 0 auto;
  max-width: 420px;
  padding: 28px;
  width: 100%;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: 0;
  margin-bottom: 8px;
}

h2 {
  font-size: 20px;
  letter-spacing: 0;
  margin-bottom: 16px;
}

h3 {
  font-size: 15px;
  margin-bottom: 8px;
}

.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 18px;
}

.summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 24px 0;
}

.page-heading {
  align-items: end;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.month-picker {
  align-items: end;
  display: flex;
  gap: 10px;
}

.content-grid {
  align-items: start;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

.panel,
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(19, 34, 42, 0.04);
}

.panel {
  padding: 20px;
}

.stat {
  padding: 18px;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.two-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  gap: 6px;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  min-height: 42px;
  padding: 10px 11px;
  width: 100%;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

.checkbox-row {
  align-items: center;
  display: flex;
  gap: 10px;
}

.checkbox-row input {
  min-height: auto;
  width: auto;
}

button,
.button {
  align-items: center;
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  text-decoration: none;
}

button:hover,
.button:hover {
  background: var(--accent-strong);
}

button:disabled,
.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button.secondary {
  background: #edf2f4;
  color: var(--ink);
}

.button.secondary:hover {
  background: #e0e8eb;
}

.switch {
  background: #c7d0d6;
  border-radius: 999px;
  height: 26px;
  min-height: 26px;
  padding: 3px;
  position: relative;
  width: 48px;
}

.switch:hover {
  background: #aebbc3;
}

.switch span {
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(23, 32, 38, 0.2);
  display: block;
  height: 20px;
  transform: translateX(0);
  transition: transform 140ms ease;
  width: 20px;
}

.switch.on {
  background: var(--accent);
}

.switch.on:hover {
  background: var(--accent-strong);
}

.switch.on span {
  transform: translateX(22px);
}

.message {
  border-radius: 6px;
  margin-bottom: 16px;
  padding: 11px 12px;
}

.message.error {
  background: #f8e8e4;
  color: #7d2e1b;
}

.message.success {
  background: var(--soft);
  color: var(--accent-strong);
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 8px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.amount {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.progress {
  background: #e8eef1;
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.progress span {
  background: var(--accent);
  display: block;
  height: 100%;
  max-width: 100%;
}

.progress.over span {
  background: var(--warn);
}

.category-chip {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}

.swatch {
  border-radius: 999px;
  display: inline-block;
  height: 10px;
  width: 10px;
}

.section-stack {
  display: grid;
  gap: 18px;
}

.empty {
  color: var(--muted);
  padding: 24px 0;
}

.split-detail {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 14px;
}

.inline-edit {
  display: contents;
}

.color-cell {
  align-items: center;
  display: flex;
  gap: 8px;
}

.color-cell input[type="color"] {
  min-height: 34px;
  padding: 2px;
  width: 48px;
}

.color-presets {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(5, 34px);
}

.color-presets button {
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
  height: 34px;
  min-height: 34px;
  padding: 0;
  width: 34px;
}

.action-cell {
  display: flex;
  gap: 8px;
}

@media (max-width: 860px) {
  .summary-grid,
  .content-grid,
  .two-cols {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-heading,
  .month-picker {
    align-items: stretch;
    flex-direction: column;
  }

  .main-nav,
  .user-actions {
    width: 100%;
  }
}
