:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #6b7785;
  --line: #e2e8f0;
  --brand: #2f6f6b;
  --brand-dark: #245855;
  --accent: #c98a3a;
  --ok: #2f8f5b;
  --warn: #c2410c;
  --bad: #b91c1c;
  --chip: #eef2f4;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
header.topbar {
  background: var(--brand); color: #fff; padding: 0 20px;
  display: flex; align-items: center; gap: 22px; height: 56px;
}
header.topbar .brand { font-weight: 700; font-size: 17px; color: #fff; display: flex; align-items: center; }
header.topbar .brand-logo { height: 38px; width: auto; display: block; }
header.topbar nav { display: flex; gap: 18px; flex: 1; }
header.topbar nav a { color: #dbece9; font-weight: 500; }
header.topbar nav a:hover, header.topbar nav a.active { color: #fff; text-decoration: none; }
header.topbar .who { color: #cfe3e0; font-size: 13px; }
main { max-width: 1140px; margin: 24px auto; padding: 0 20px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 24px 0 10px; }
.sub { color: var(--muted); margin: 0 0 18px; }
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 18px; margin-bottom: 18px;
}
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.card .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.card .value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.card .value.bad { color: var(--bad); }
.card .value.warn { color: var(--warn); }
.card .value.ok { color: var(--ok); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:hover td { background: #fafbfc; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--chip); color: var(--muted); }
.chip.draft { background: #eef2f4; color: #475569; }
.chip.sent { background: #dbeafe; color: #1d4ed8; }
.chip.partial { background: #fef3c7; color: #92400e; }
.chip.paid { background: #dcfce7; color: #166534; }
.chip.overdue { background: #fee2e2; color: #b91c1c; }
.chip.void { background: #e5e7eb; color: #6b7280; text-decoration: line-through; }
.btn {
  display: inline-block; background: var(--brand); color: #fff; border: none;
  padding: 8px 14px; border-radius: 7px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn.danger { background: #fff; color: var(--bad); border: 1px solid #fca5a5; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; font: inherit; background: #fff;
}
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.flash { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.login-wrap { max-width: 360px; margin: 80px auto; }
.login-wrap .brand { text-align: center; font-size: 22px; font-weight: 700; color: var(--brand); margin-bottom: 6px; }
.error-box { background: #fee2e2; border: 1px solid #fca5a5; color: #991b1b; padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }
.badge-rate { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; padding: 1px 7px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.bar { height: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); }
.bar > span.full { background: var(--bad); }
small.hint { color: var(--muted); font-size: 12px; }
