:root {
  --bg: #e6e6e6;
  --paper: #ffffff;
  --ink: #2c2c2c;
  --muted: #6d6d6d;
  --line: #d5d5d5;
  --teal: #1f6f8a;
  --nav: #f3f3f3;
  --paid: #1b7a32;
  --paid-bg: #e7f6ea;
  --unpaid: #c46b00;
  --unpaid-bg: #fff3e4;
  --overdue: #c0392b;
  --overdue-bg: #fdecea;
  --booked: #1f6f8a;
  --booked-bg: #e7f3f7;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--teal); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

.shell { display: flex; min-height: 100vh; }
.nav {
  width: 104px;
  background: var(--nav);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 8px;
  gap: 6px;
  flex: none;
}
.nav a {
  width: 84px;
  min-height: 72px;
  border-radius: 8px;
  color: #444;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  text-align: center;
}
.nav a svg { width: 26px; height: 26px; }
.nav a.active, .nav a:hover { background: var(--teal); color: white; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top {
  height: 42px;
  background: white;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  font-size: 13px;
  color: var(--muted);
}
.top strong { color: var(--ink); font-weight: 600; }
.page { padding: 22px 26px 28px; }
.heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
h1 { font-weight: 400; font-size: 28px; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn, button.btn, a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 4px;
  border: 1px solid #c8c8c8;
  background: white;
  color: var(--ink);
  cursor: pointer;
}
.btn.primary { background: var(--teal); border-color: var(--teal); color: white; }
.btn.danger { border-color: #e2b4b0; color: var(--overdue); }
.find { height: 32px; border: 1px solid #c8c8c8; border-radius: 4px; padding: 0 8px; background: white; min-width: 180px; }
.card { background: white; border: 1px solid var(--line); border-radius: 4px; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #f7f7f7;
}
td { padding: 10px 12px; border-bottom: 1px solid #eee; font-size: 14px; vertical-align: middle; }
tr.click:hover td { background: #f3fafb; cursor: pointer; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pill {
  display: inline-block;
  min-width: 74px;
  text-align: center;
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
}
.pill.paid { background: var(--paid-bg); color: var(--paid); }
.pill.unpaid { background: var(--unpaid-bg); color: var(--unpaid); }
.pill.overdue { background: var(--overdue-bg); color: var(--overdue); }
.pill.booked { background: var(--booked-bg); color: var(--booked); }
.pill.closed { background: #eee; color: #555; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.stat { padding: 16px 18px; }
.stat .n { font-size: 32px; line-height: 1; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 4px; }
.stat.paid .n { color: var(--paid); }
.stat.unpaid .n { color: var(--unpaid); }
.stat.overdue .n { color: var(--overdue); }
.grid2 { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 12px; }
.section { padding: 14px 16px 18px; margin-bottom: 12px; }
.section h2 {
  margin: 0 0 12px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
  font-weight: 700;
}
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.wide { grid-column: 1 / -1; }
.field span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.field input, .field select, .field textarea {
  height: 34px;
  border: 1px solid #cfcfcf;
  border-radius: 3px;
  padding: 0 8px;
  background: white;
}
.field textarea { height: 78px; padding: 8px; resize: vertical; }
.portal th { background: var(--teal); color: white; border-bottom: none; }
.portal td input, .portal td select {
  width: 100%;
  height: 30px;
  border: 1px solid #ddd;
  border-radius: 3px;
  padding: 0 6px;
  background: white;
}
.totals { width: 300px; margin-left: auto; margin-top: 8px; }
.totals div { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid #eee; }
.totals .grand { font-size: 18px; }
.note { color: var(--muted); font-size: 13px; }
.foot {
  margin-top: auto;
  height: 28px;
  border-top: 1px solid var(--line);
  background: #f7f7f7;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  padding: 0 16px;
}
.bars { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding: 8px 4px 0; }
.bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bars .bit { width: 100%; background: var(--teal); border-radius: 2px 2px 0 0; min-height: 2px; }
.bars .mo { font-size: 10px; color: var(--muted); margin-top: 4px; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login { width: 390px; max-width: 100%; background: white; border: 1px solid var(--line); padding: 28px 26px 22px; }
.login h1 { font-size: 34px; margin-bottom: 2px; }
.login .sub { margin: 0 0 16px; color: var(--muted); }
.login .field { margin-bottom: 10px; }
.captcha { display: flex; gap: 10px; align-items: center; margin: 2px 0 12px; }
.captcha img { border: 1px solid var(--line); height: 56px; background: white; }
.err { background: var(--overdue-bg); color: var(--overdue); padding: 8px 10px; margin-bottom: 10px; font-size: 14px; }
.filters { margin: 0 0 10px; }
.filters a { margin-right: 12px; font-size: 13px; }
.filters a.on { font-weight: 700; }
.paper { width: 820px; max-width: 100%; margin: 24px auto; background: white; border: 1px solid var(--line); padding: 36px 40px; }
.paper h1 { font-size: 22px; }
.paper table th { background: var(--teal); color: white; }
.right { text-align: right; }
@media print {
  .noprint { display: none !important; }
  body { background: white; }
  .paper { border: none; margin: 0; width: auto; }
}
@media (max-width: 900px) {
  .shell { display: block; }
  .nav { width: auto; flex-direction: row; overflow: auto; border-right: none; border-bottom: 1px solid var(--line); }
  .stats, .grid2, .fields { grid-template-columns: 1fr; }
}
