@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #F6F5F1;
  --surface: #FFFFFF;
  --ink: #1B1F23;
  --ink-secondary: #6B6F76;
  --ink-muted: #9A9790;
  --border: #E4E2DC;
  --good: #0F6B3D;
  --bad: #C23B3B;
  --bad-bg: #FFF7F7;
  --bad-border: #F0B9B9;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Manrope', system-ui, sans-serif;
}

a { color: inherit; text-decoration: none; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 64px;
  flex-wrap: wrap;
  gap: 8px;
}

.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; }
.topbar .brand .mark { width: 26px; height: 26px; border-radius: 8px; background: var(--ink); }

.topbar nav { display: flex; gap: 22px; }
.topbar nav a, .topbar nav span.active {
  font-size: 14px; font-weight: 600; color: var(--ink-secondary); padding: 8px 2px;
}
.topbar nav span.active { color: var(--ink); border-bottom: 2px solid var(--ink); }

.avatar {
  width: 30px; height: 30px; border-radius: 999px; background: var(--ink); color: #fff;
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}

.container { max-width: 1100px; margin: 0 auto; padding: 24px 20px 80px 20px; }

.stats-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.stat-tile {
  flex: 1; min-width: 160px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px 18px;
}
.stat-tile .label { font-size: 12px; color: var(--ink-secondary); font-weight: 600; }
.stat-tile .value { font-size: 24px; font-weight: 800; display: block; margin-top: 4px; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }

.cat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 10px;
}
.cat-card.over { border-color: var(--bad-border); background: var(--bad-bg); }

.cat-card .head { display: flex; align-items: center; gap: 8px; }
.cat-card .dot { width: 10px; height: 10px; border-radius: 999px; flex-shrink: 0; }
.cat-card .name { font-size: 14px; font-weight: 700; flex: 1; }
.cat-card .pct { font-size: 12px; color: var(--ink-muted); }
.cat-card .amounts { display: flex; align-items: baseline; gap: 6px; }
.cat-card .spent { font-size: 16px; font-weight: 800; }
.cat-card .plan { font-size: 12px; color: var(--ink-muted); }

.bar-track { background: #EDEBE5; height: 8px; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; }

.remaining { font-size: 12px; color: var(--good); }
.remaining.bad { color: var(--bad); font-weight: 700; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }

.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-row label { font-size: 12px; font-weight: 700; color: var(--ink-secondary); }
.form-row input, .form-row select {
  font-family: 'Manrope', sans-serif; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border); font-size: 15px; width: 100%;
}
.form-row input[type="number"] { font-weight: 700; }

.btn-primary {
  background: var(--ink); color: #fff; border: none; border-radius: 10px;
  padding: 13px 18px; font-size: 14px; font-weight: 700; cursor: pointer; font-family: 'Manrope', sans-serif;
  width: 100%;
}
.btn-primary:disabled { background: #B9B7B0; cursor: not-allowed; }

.tx-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #EFEDE7; }
.tx-row:last-child { border-bottom: none; }
.tx-dot { width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; }
.tx-main { flex: 1; min-width: 0; }
.tx-main .t { font-size: 13px; font-weight: 600; }
.tx-main .m { font-size: 11px; color: var(--ink-muted); }
.tx-amount { font-size: 13px; font-weight: 700; white-space: nowrap; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; font-size: 13px; }
th { color: var(--ink-secondary); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; border-bottom: 1px solid var(--border); }
td { border-bottom: 1px solid #EFEDE7; }

.flash { background: #E9F6EF; border: 1px solid #BEE6CE; color: var(--good); border-radius: 10px; padding: 12px 14px; font-size: 13px; font-weight: 700; margin-bottom: 16px; }
.flash.error { background: var(--bad-bg); border-color: var(--bad-border); color: var(--bad); }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px 28px; }
.login-card h1 { font-size: 20px; margin: 0 0 4px 0; }
.login-card p.sub { font-size: 13px; color: var(--ink-secondary); margin: 0 0 20px 0; }

.settings-row {
  display: grid; grid-template-columns: 22px 1fr 90px 110px; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid #EFEDE7;
}
.settings-total { display: grid; grid-template-columns: 22px 1fr 90px 110px; gap: 12px; padding: 10px 0; font-weight: 800; }

.two-col { display: flex; gap: 24px; align-items: flex-start; }
.two-col .side { width: 320px; flex-shrink: 0; display: flex; flex-direction: column; gap: 16px; }
.two-col .main { flex: 1; min-width: 0; }

@media (max-width: 860px) {
  .two-col { flex-direction: column; }
  .two-col .side { width: 100%; }
  .topbar nav { order: 3; width: 100%; justify-content: center; }
  .settings-row, .settings-total { grid-template-columns: 18px 1fr 70px 90px; font-size: 13px; }
}
