:root {
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --border: #e6e6e6;
  --bg: #fafafa;
  --accent: #2b2b2b;
  --paid: #1e8246;
  --unpaid: #be5a14;
}
* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  margin: 0;
  padding: 0 20px 60px;
}
.wrap { max-width: 960px; margin: 0 auto; }
header.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 28px 0 20px; border-bottom: 1px solid var(--border); margin-bottom: 28px;
}
header.topbar h1 { font-size: 20px; margin: 0; letter-spacing: -0.01em; }
header.topbar .tag { color: var(--muted); font-size: 13px; }
.btn {
  display: inline-block; padding: 10px 18px; border-radius: 8px;
  background: var(--accent); color: #fff; text-decoration: none;
  font-size: 14px; font-weight: 600; border: none; cursor: pointer;
}
.btn:hover { opacity: 0.88; }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--border); }
table.invoices { width: 100%; border-collapse: collapse; margin-top: 10px; }
table.invoices th {
  text-align: left; font-size: 12px; letter-spacing: 0.03em; color: var(--muted);
  text-transform: uppercase; padding: 10px 12px; border-bottom: 1px solid var(--border);
}
table.invoices td {
  padding: 14px 12px; border-bottom: 1px solid var(--border); font-size: 14px;
}
table.invoices tr:hover { background: #fff; }
.status-pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.status-pill.paid { background: #e6f4ec; color: var(--paid); }
.status-pill.unpaid { background: #fbeee1; color: var(--unpaid); }
.status-pill.overdue { background: #fdeaea; color: #c0392b; }
.actions a { margin-right: 12px; font-size: 13px; text-decoration: none; color: var(--ink); font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 60px 0; }

form.invoice-form { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 28px; margin-top: 10px; }
form.invoice-form fieldset { border: none; padding: 0; margin: 0 0 24px; }
form.invoice-form legend { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); margin-bottom: 12px; padding: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff;
}
.field textarea { resize: vertical; }
table.items-table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
table.items-table th { text-align: left; font-size: 12px; color: var(--muted); padding: 6px 8px; }
table.items-table td { padding: 6px 8px; }
table.items-table input { width: 100%; }
.item-row .remove-item { color: #c0392b; background: none; border: none; cursor: pointer; font-size: 13px; font-weight: 600; }
#add-item { margin-top: 4px; }
.totals-preview { text-align: right; font-size: 14px; margin-top: 14px; color: var(--muted); }
.totals-preview strong { color: var(--ink); font-size: 16px; }
.form-actions { margin-top: 24px; display: flex; gap: 12px; }
.alert { background: #fdeaea; color: #c0392b; padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 20px; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
