:root {
  --ink: #1c1915;
  --muted: #5e584e;
  --line: #e2d8c8;
  --paper: #f4efe6;
  --card: #fffdf8;
  --nav: #1b2420;
  --nav-ink: #f3ecdf;
  --brass: #9a6232;
  --rise: #9a6232;
  --cash: #8f2d2d;
  --order: #1f6b4a;
  --new: #1e4d73;
  --complaint: #7a3e12;
  --missed: #8f2d2d;
  --incoming: #1f6b4a;
  --outgoing: #1e4d73;
  --shadow: 0 1px 0 rgba(28, 25, 21, 0.04);
  font-family: "Segoe UI", "Nirmala UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 22px;
  background: var(--nav);
  color: var(--nav-ink);
}
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.brand strong { font-size: 20px; letter-spacing: -0.03em; }
.brand span { color: #d7b48a; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; }
.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav a {
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
  color: #d9d3c7;
}
.nav a.on, .nav a:hover { background: #2c3a34; color: white; }
.nav .count {
  display: inline-block;
  min-width: 1.2em;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brass);
  color: white;
  font-size: 12px;
  text-align: center;
}
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; color: #d9d3c7; }
.who button {
  background: transparent;
  border: 1px solid #4d5c54;
  color: var(--nav-ink);
  border-radius: 999px;
  padding: 5px 10px;
  cursor: pointer;
}

.wrap { width: min(1180px, calc(100% - 28px)); margin: 22px auto 48px; }
h1 { font-size: 34px; line-height: 1.1; margin: 0 0 6px; letter-spacing: -0.03em; }
.lede { margin: 0 0 16px; color: var(--muted); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.filters input, .filters select, .field input, .field select, .field textarea {
  border: 1px solid var(--line);
  background: white;
  border-radius: 10px;
  padding: 8px 10px;
  min-height: 40px;
}
.filters button, .primary, .ghost {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.filters button, .primary { background: var(--ink); color: #f7f1e7; }
.ghost { background: transparent; border: 1px solid var(--line); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 14px 0; }
.stat, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.stat { padding: 12px 14px; }
.stat b { display: block; font-size: 26px; letter-spacing: -0.04em; margin-top: 4px; }
.stat span, .panel h2 { color: var(--muted); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 12px; }
.panel { padding: 14px 14px 6px; overflow: auto; }
.panel h2 { margin: 0 0 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; }
tr.click:hover { background: #faf6ef; }
.name { font-weight: 650; text-decoration: none; }
.sub { color: var(--muted); font-size: 13px; }

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #efe7da;
}
.pill.INCOMING, .tone-order, .tone-dispatch { background: #e5f2eb; color: var(--incoming); }
.pill.OUTGOING, .tone-new, .tone-general { background: #e6eef5; color: var(--outgoing); }
.pill.MISSED, .tone-cash, .tone-money { background: #f8e6e6; color: var(--missed); }
.tone-rise, .tone-price, .tone-complaint { background: #f6eadf; color: var(--brass); }
.pill.tone-tour { background: #f3d48a; color: #5c3b00; font-weight: 650; }
.tour-action { background: #fff3cd; border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
.bar { height: 8px; background: #efe7da; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brass); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.chips a { text-decoration: none; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); }
.chips a.on { background: var(--ink); color: white; border-color: var(--ink); }

.banner {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f6eadf;
  color: #5c3b22;
}
.messages { list-style: none; padding: 0; }
.messages li { background: #e5f2eb; color: #145c38; padding: 10px 12px; border-radius: 12px; margin-bottom: 10px; }

.split { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field textarea { min-height: 90px; }
.error { color: var(--missed); font-size: 13px; }
.pager { display: flex; gap: 12px; margin-top: 12px; }
.maplink { color: var(--outgoing); }

.jumbotron { background: transparent; }
.desk-links { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.desk-links a { text-decoration: none; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid, .split, .topbar { display: block; }
  .who { margin: 10px 0 0; }
  .nav { margin-top: 10px; }
  .wrap { width: min(100% - 20px, 1180px); }
}
