/* Route Sales: shared styles for the salesperson app and dashboard. */
:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #eef2f1;
  --text: #17211f;
  --muted: #5d6b68;
  --line: #d9e0de;
  --brand: #0d6b5e;
  --brand-ink: #ffffff;
  --brand-soft: #dcefeb;
  --accent: #c77700;
  --good: #1b7f3b;
  --good-soft: #e1f3e6;
  --warn: #a35a00;
  --warn-soft: #fff1d9;
  --bad: #b3261e;
  --bad-soft: #fbe4e2;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .05);
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1514;
    --surface: #18201f;
    --surface-2: #212b29;
    --text: #e6eeec;
    --muted: #9aaba7;
    --line: #2e3a38;
    --brand: #3fb7a3;
    --brand-ink: #062a25;
    --brand-soft: #173a35;
    --accent: #f0a73a;
    --good: #5fd08a;
    --good-soft: #163524;
    --warn: #f0a73a;
    --warn-soft: #3a2b12;
    --bad: #ff8a80;
    --bad-soft: #3d1d1b;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto,
    "Noto Sans", sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.25rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.hidden, [hidden] { display: none !important; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
}
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}
.btn.danger { color: var(--bad); }
.btn.small { min-height: 34px; padding: 0 10px; font-size: .875rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.ghost { border-color: transparent; background: transparent; }

.field { display: block; }
.field > span {
  display: block;
  font-size: .875rem;
  color: var(--muted);
  margin-bottom: 4px;
}
input[type=text], input[type=tel], input[type=password],
input[type=number], input[type=date], input[type=search],
select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.brand { background: var(--brand-soft); color: var(--brand); }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor; display: inline-block;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 10px;
  z-index: 2000;
  max-width: calc(100% - 32px);
  font-weight: 600;
}

.sheet-bg {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .4);
  z-index: 1500; display: flex; align-items: flex-end;
  justify-content: center;
}
.sheet {
  background: var(--surface);
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  overflow: auto;
  border-radius: 16px 16px 0 0;
  padding: 16px;
}
@media (min-width: 720px) {
  .sheet-bg { align-items: center; }
  .sheet { border-radius: 16px; }
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
table.data th, table.data td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
table.data th {
  font-size: .8rem;
  color: var(--muted);
  font-weight: 600;
  position: sticky;
  top: 0;
  background: var(--surface);
}
table.data tr.click { cursor: pointer; }
table.data tr.click:hover td { background: var(--surface-2); }
table.data tfoot td { font-weight: 700; border-bottom: none; }
.table-wrap { overflow-x: auto; }

/* Leaflet sits inside cards. */
.map { height: 320px; border-radius: 10px; z-index: 0; }
.leaflet-container { background: var(--surface-2); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
