:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #1a2332;
  --muted: #5b6b7c;
  --line: #e3e8ee;
  --brand: #0b5cab;
  --brand-dark: #084a8a;
  --ok: #0f7b4c;
  --warn: #b45309;
  --bad: #b42318;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.06);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 16px 48px; }
.topbar {
  background: #0b1f33;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.brand { font-weight: 700; letter-spacing: .2px; }
.brand span { color: #8ec5ff; font-weight: 500; margin-left: 8px; font-size: .9rem; }
.nav { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.nav a { color: #d7e6f7; font-size: .95rem; }
.nav a.active { color: #fff; font-weight: 600; }
.userchip { color: #9fb4c9; font-size: .9rem; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
h1 { font-size: 1.45rem; margin: 0 0 12px; }
h2 { font-size: 1.1rem; margin: 0 0 10px; }
.muted { color: var(--muted); }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.stat {
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}
.stat .n { font-size: 1.5rem; font-weight: 700; }
.stat .l { color: var(--muted); font-size: .85rem; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tr:hover td { background: #fafbfd; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  background: #eef2f6;
  color: #334155;
}
.badge.New { background: #e8f1ff; color: #0b5cab; }
.badge.Contacted { background: #eef2ff; color: #4338ca; }
.badge.Booked { background: #e7f7ee; color: #0f7b4c; }
.badge.Done { background: #ecfdf3; color: #067647; }
.badge.Lost { background: #fef3f2; color: #b42318; }
.badge.Paid { background: #e7f7ee; color: #0f7b4c; }
.badge.Unpaid { background: #fff7ed; color: #b45309; }
.badge.Draft { background: #f1f5f9; color: #475569; }
.badge.Sent { background: #e8f1ff; color: #0b5cab; }
.badge.Accepted { background: #e7f7ee; color: #0f7b4c; }
.btn, button, input[type=submit] {
  appearance: none;
  border: 0;
  background: var(--brand);
  color: #fff;
  border-radius: 8px;
  padding: 9px 14px;
  font-weight: 600;
  cursor: pointer;
  font-size: .92rem;
}
.btn:hover, button:hover, input[type=submit]:hover { background: var(--brand-dark); }
.btn.secondary { background: #e8eef5; color: #0b1f33; }
.btn.danger { background: #b42318; }
.btn.small { padding: 6px 10px; font-size: .82rem; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%;
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  padding: 9px 10px;
  font: inherit;
  background: #fff;
}
textarea { min-height: 90px; resize: vertical; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.flash {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  background: #e7f7ee;
  color: #0f7b4c;
  border: 1px solid #b7ebc9;
}
.flash.err { background: #fef3f2; color: #b42318; border-color: #fecdca; }
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(160deg, #0b1f33, #0b5cab 70%);
}
.login-card { width: min(420px, 100%); }
.login-card h1 { margin-bottom: 4px; }
.stack > * + * { margin-top: 12px; }
.table-scroll { overflow-x: auto; }
.footer-note { color: var(--muted); font-size: .85rem; margin-top: 18px; }
@media (max-width: 700px) {
  th:nth-child(n+5), td:nth-child(n+5) { /* keep basic cols */ }
  .topbar { align-items: flex-start; }
}
@media print {
  .topbar, .actions, .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; }
}
