@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #F1F1EA;
  --bg-alt: #E7E8DD;
  --panel: #FBFBF7;
  --ink: #21261F;
  --ink-soft: #5B6055;
  --forest: #2B3B2F;
  --forest-light: #3F5443;
  --ochre: #B9822E;
  --ochre-soft: #EFDBB0;
  --rust: #A6552B;
  --line: #D9DACC;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15.5px;
  line-height: 1.5;
}

h1, h2, h3, .brand {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--forest);
}

a { color: var(--forest); }

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--forest);
  color: #E9EAE1;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
}

.sidebar .brand {
  color: #fff;
  font-size: 1.3rem;
  margin: 0 0 2px 0;
}

.sidebar .subbrand {
  color: #B9C2B4;
  font-size: 0.82rem;
  margin-bottom: 34px;
}

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

.sidebar nav a {
  color: #DDE1D6;
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.95rem;
}

.sidebar nav a:hover { background: var(--forest-light); }
.sidebar nav a.active { background: var(--forest-light); color: #fff; font-weight: 500; }

.sidebar .user-box {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 0.85rem;
  color: #C6CCC0;
}

.sidebar .user-box form { margin-top: 6px; }

.sidebar .user-box button {
  background: none;
  border: none;
  color: #EFDBB0;
  cursor: pointer;
  padding: 0;
  font-size: 0.85rem;
  font-family: inherit;
}

main { padding: 36px 44px; max-width: 1080px; }

.page-title { margin: 0 0 6px 0; font-size: 1.7rem; }
.page-sub { color: var(--ink-soft); margin: 0 0 30px 0; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 30px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.stat .label { color: var(--ink-soft); font-size: 0.82rem; margin-bottom: 6px; }
.stat .value { font-family: 'Fraunces', serif; font-size: 1.6rem; color: var(--forest); }
.stat .value small { font-family: 'Inter', sans-serif; font-size: 0.9rem; color: var(--ink-soft); }

.panel-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 16px;
  margin-bottom: 30px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
}

.panel h2 { font-size: 1.05rem; margin: 0 0 14px 0; }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--ink-soft); font-weight: 500; font-size: 0.8rem; }
tr:last-child td { border-bottom: none; }
td.amount, th.amount { text-align: right; font-variant-numeric: tabular-nums; }

.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--ochre-soft);
  color: #6B4A11;
}

.card-form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
  max-width: 460px;
}

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 5px; }

input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--ink);
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--ochre);
  outline-offset: 1px;
  border-color: var(--ochre);
}

button, .btn {
  background: var(--forest);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 7px;
  font-size: 0.92rem;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

button:hover, .btn:hover { background: var(--forest-light); }

.btn-ghost {
  background: none;
  color: var(--rust);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: #fff; }

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.auth-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 34px 36px;
  width: 360px;
}

.auth-box h1 { font-size: 1.5rem; margin: 0 0 4px 0; }
.auth-box .subbrand { color: var(--ink-soft); font-size: 0.88rem; margin-bottom: 22px; }

.error {
  background: #F6E3DB;
  color: #7A3010;
  padding: 10px 14px;
  border-radius: 7px;
  font-size: 0.88rem;
  margin-bottom: 16px;
}

.success {
  background: #E2EADD;
  color: #2B4423;
  padding: 10px 14px;
  border-radius: 7px;
  font-size: 0.88rem;
  margin-bottom: 16px;
}

.empty {
  color: var(--ink-soft);
  font-size: 0.9rem;
  padding: 14px 0;
}

.hint {
  color: var(--ink-soft);
  font-size: 0.82rem;
  margin-top: 4px;
}

.progress-item { margin-bottom: 16px; }
.progress-item:last-child { margin-bottom: 0; }
.progress-item .row { display: flex; justify-content: space-between; font-size: 0.88rem; margin-bottom: 5px; }
.progress-item .row .cat { color: var(--ink); }
.progress-item .row .nums { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.progress-track {
  background: var(--bg-alt);
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--forest);
  border-radius: 20px;
}
.progress-fill.over { background: var(--rust); }

.notice-list { display: flex; flex-direction: column; gap: 8px; }
.notice {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--bg-alt);
  border-left: 3px solid var(--ochre);
  font-size: 0.9rem;
}
.notice.overdue { border-left-color: var(--rust); background: #F6E3DB; }
.notice .when { color: var(--ink-soft); font-size: 0.82rem; white-space: nowrap; margin-left: 12px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input[type="checkbox"] { width: auto; }

.receipt-link { font-size: 0.8rem; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; align-items: center; padding: 14px 18px; }
  .sidebar .subbrand { display: none; }
  .sidebar nav { flex-direction: row; margin-left: auto; }
  .sidebar .user-box { display: none; }
  main { padding: 22px 18px; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .panel-row { grid-template-columns: 1fr; }
}
