@import url('https://fonts.googleapis.com/css2?family=Public+Sans:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #EEF3FB;
  --surface: #FFFFFF;
  --ink: #16202E;
  --ink-muted: #5A6B80;
  --ink-faint: #8996A8;
  --accent: #1D4ED8;
  --accent-deep: #14295E;
  --accent-soft: #E3EBFB;
  --gold: #A9791F;
  --gold-soft: #F3EAD3;
  --border: #DCE4F2;
  --danger: #A23A2E;
  --danger-soft: #F5E7E4;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Public Sans', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.money, .mono { font-family: 'IBM Plex Mono', 'Courier New', monospace; font-variant-numeric: tabular-nums; }

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 216px;
  flex-shrink: 0;
  background: var(--accent-deep);
  color: #fff;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.brand { padding: 0 10px 22px; }
.brand-name { font-size: 17px; font-weight: 800; }
.brand-sub { font-size: 11px; color: #AFC2E8; font-family: 'IBM Plex Mono', monospace; margin-top: 2px; }
.nav-item {
  display: block;
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  color: #C6D5F2;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.12); color: #fff; font-weight: 700; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.12); }
.sidebar-user { font-size: 12.5px; font-weight: 600; color: #fff; }
.sidebar-logout { font-size: 11.5px; color: #AFC2E8; text-decoration: none; }
.sidebar-logout:hover { color: #fff; }

.content { flex: 1; padding: 26px 32px; min-width: 0; }

.section-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 20px; font-weight: 800; }
.section-head p { margin: 4px 0 0; font-size: 13px; color: var(--ink-muted); }

.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  flex: 1;
  min-width: 160px;
}
.stat-card.highlight { background: var(--accent-soft); border: none; }
.stat-card.negative { background: var(--danger-soft); border: none; }
.stat-label { font-size: 11.5px; font-weight: 600; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 8px; }
.stat-value { font-size: 22px; font-weight: 700; }
.stat-card.highlight .stat-label, .stat-card.highlight .stat-value { color: var(--accent-deep); }
.stat-card.negative .stat-label, .stat-card.negative .stat-value { color: var(--danger); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 13.5px; }
.card-head .sub { font-weight: 400; font-size: 12px; color: var(--ink-muted); font-family: 'IBM Plex Mono', monospace; margin-top: 2px; }

.two-col { display: flex; gap: 18px; flex-wrap: wrap; }
.two-col > .card { flex: 1; min-width: 320px; }

table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--ink-muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--border); }
td { padding: 12px 14px; font-size: 13.5px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #FAFBF9; }

.group-label {
  padding: 10px 18px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-top: 1px solid var(--border);
}
.group-label.first { border-top: none; }

.badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 5px;
  font-weight: 600;
  white-space: nowrap;
  display: inline-block;
}
.badge-neutral { background: var(--accent-soft); color: var(--accent-deep); }
.badge-gold { background: var(--gold-soft); color: var(--gold); }
.badge-muted { background: #EEF0ED; color: var(--ink-muted); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

.btn {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 7px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: 0.88; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--border); }
.btn-ghost:hover { background: #FAFBF9; }
.btn-danger-link { background: none; border: none; color: var(--ink-faint); cursor: pointer; font-size: 12px; padding: 0; }
.btn-danger-link:hover { color: var(--danger); }

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

.field { display: block; margin-bottom: 14px; }
.field-label { font-size: 11.5px; font-weight: 600; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 5px; display: block; }
.input, select.input, textarea.input {
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #FCFDFC;
  color: var(--ink);
  outline: none;
}
.input:focus, select.input:focus { border-color: var(--accent); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 20px; max-width: 640px; }

.line-item-row { display: grid; grid-template-columns: 1fr 70px 110px 32px; gap: 8px; align-items: center; margin-bottom: 8px; }
.add-line { font-size: 12.5px; color: var(--accent); cursor: pointer; font-weight: 600; background: none; border: none; padding: 0; }

.totals-row { display: flex; justify-content: flex-end; align-items: baseline; gap: 10px; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
.totals-row .label { font-size: 13px; color: var(--ink-muted); }
.totals-row .value { font-size: 16px; font-weight: 700; }

.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.pl-total {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 18px; background: var(--accent-soft); border-top: 1px solid var(--border);
}
.pl-total .label { font-weight: 800; font-size: 14px; color: var(--accent-deep); }
.pl-total .value { font-family: 'IBM Plex Mono', monospace; font-weight: 800; font-size: 16px; color: var(--accent-deep); }
.pl-section-label {
  font-size: 11.5px; font-weight: 700; color: var(--accent-deep);
  text-transform: uppercase; letter-spacing: 0.4px; padding: 14px 18px 6px;
}

.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 32px; width: 360px; }
.auth-card h1 { font-size: 19px; margin: 0 0 4px; }
.auth-card p.sub { font-size: 13px; color: var(--ink-muted); margin: 0 0 20px; }
.auth-error { background: var(--danger-soft); color: var(--danger); font-size: 13px; padding: 10px 12px; border-radius: 7px; margin-bottom: 14px; }

.flex-between { display: flex; justify-content: space-between; align-items: center; }
