:root {
  --bg: #f6f7f9;
  --card: #fff;
  --line: #e3e6ea;
  --text: #1c2024;
  --muted: #6b7480;
  --accent: #1f6feb;
  --danger: #c8372d;
  --ok: #1a7f45;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --card: #1c2024;
    --line: #2b3138;
    --text: #e8eaed;
    --muted: #9aa4b0;
    --accent: #5b9cff;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 80px; }

.top {
  display: flex; align-items: center; gap: 20px;
  padding: 12px 20px; background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.top nav { display: flex; gap: 16px; flex: 1; flex-wrap: wrap; }
.brand { font-weight: 600; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.top a { color: var(--text); }
.top a.on { color: var(--accent); font-weight: 600; }

h1 { font-size: 24px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
}
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; font-size: 13px; color: var(--muted);
}
.tile .num { display: block; font-size: 26px; font-weight: 600; color: var(--text); }
.tile .num.debt { color: var(--danger); }
form.row { align-items: center; gap: 8px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 500; }
th, td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
.feed td { font-size: 14px; }
.grow { width: 100%; }
.nowrap { white-space: nowrap; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.ok { color: var(--ok); }
.error { color: var(--danger); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); }
.badge.new { background: #e8f0ff; color: #1f4fa8; }
.badge.booked { background: #fff4e0; color: #8a5300; }
.badge.came { background: #e6f6ec; color: #1a7f45; }
.badge.client { background: #e6f6ec; color: #1a7f45; }
.badge.lost { background: #f2f3f5; color: #6b7480; }

input, select, textarea, button {
  font: inherit; color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}
textarea { width: 100%; resize: vertical; font-family: inherit; }
label { display: block; margin: 10px 0; font-size: 13px; color: var(--muted); }
label input, label select, label textarea { display: block; width: 100%; margin-top: 4px; color: var(--text); font-size: 15px; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 15px; }
label.check input { width: auto; margin: 0; }

button {
  background: var(--accent); color: #fff; border: none;
  padding: 9px 16px; border-radius: 8px; cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); padding: 5px 10px; font-size: 13px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.row { display: flex; gap: 12px; }
.row label { flex: 1; }
.field { padding-bottom: 6px; }
.sticky {
  position: sticky; bottom: 0; padding: 12px 0;
  background: linear-gradient(to top, var(--bg) 60%, transparent);
}
.login { max-width: 340px; margin: 12vh auto; }
.login input { width: 100%; margin-bottom: 12px; }
.slotline { margin: 6px 0; }
.slot { display: inline-block; margin: 2px 4px 2px 0; padding: 2px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.link { font-size: 13px; }
