/* Xtream CRM — shared styles. Dispatch is desktop-first; tech view is mobile-first. */
:root {
  --ink: #17202a;
  --muted: #5b6b7a;
  --line: #dfe6ec;
  --bg: #f4f7f9;
  --card: #ffffff;
  --brand: #0f7a5c;
  --brand-dark: #0a5c45;
  --accent: #e8a13a;
  --danger: #c0392b;
  --ok: #1e7d32;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--brand); }
h1, h2, h3 { margin: 0 0 8px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); font-size: 0.9em; }
.small { font-size: 0.85em; }

header.topbar { background: var(--ink); color: #fff; padding: 12px 16px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
header.topbar h1 { font-size: 1.25rem; margin: 0; }
header.topbar .sub { color: #b9c6d2; font-size: 0.9em; }
header.topbar .spacer { flex: 1; }
.badge-sample { background: var(--accent); color: #231a05; font-weight: 700; font-size: 0.72rem; padding: 2px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.04em; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 16px; }
.grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 16px; }
#map { height: 420px; border-radius: var(--radius); border: 1px solid var(--line); }

table { width: 100%; border-collapse: collapse; font-size: 0.92em; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.pill.scheduled { background: #e3ecf7; color: #274b73; }
.pill.en_route { background: #fdf0d3; color: #7a5a12; }
.pill.on_site { background: #d9f0dd; color: var(--ok); }
.pill.done { background: #e6e6e6; color: #555; }

button, input, select, textarea { font: inherit; }
input, select, textarea { width: 100%; padding: 9px 10px; border: 1px solid #c4cfd8; border-radius: 8px; margin-bottom: 8px; background: #fff; }
label { display: block; font-size: 0.85em; color: var(--muted); margin-bottom: 3px; }
button { cursor: pointer; border: none; border-radius: 8px; padding: 10px 14px; font-weight: 600; }
.btn { background: var(--brand); color: #fff; }
.btn:hover { background: var(--brand-dark); }
.btn.secondary { background: #e8eef2; color: var(--ink); }
.btn.danger { background: #fbe9e7; color: var(--danger); }
.btn.ghost { background: transparent; color: var(--brand); padding: 6px 8px; }
.btn.big { width: 100%; padding: 16px; font-size: 1.1rem; }
/* Touch floor (fix pass, Bot 45 finding 2): every tap target in the
   knock flow is at least 44px tall. .btn.field is the 44px field button;
   .btn.small was referenced by popups and table actions but never
   defined, so those rendered ~34px — now it keeps the 44px floor with
   a smaller font instead of shrinking. box-sizing is border-box, so
   min-height includes the padding. */
.btn.field { min-height: 44px; padding: 12px 16px; }
.btn.small { min-height: 44px; padding: 10px 12px; font-size: 0.9em; }
.btn:disabled { opacity: 0.5; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1; min-width: 120px; }
.notice.warn { background: #fdf6e3; border-color: #ecd9a0; }
.error { background: #fdecea; border: 1px solid #f5c6c0; color: #7a1f16; border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; }
.notice { background: #d9f0dd; border: 1px solid #a8d5b5; color: #14532d; border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.6rem; }
.jobcard { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; background: #fff; }
.jobcard.active { border-color: var(--brand); box-shadow: 0 0 0 2px #cde9dd; }
.jobcard h3 { font-size: 1.05rem; }
.dist { font-weight: 700; }
footer { color: var(--muted); font-size: 0.85em; padding: 8px 16px 24px; }

/* v1.1 additions: referral partner pages, quote/estimate/survey, admin cards */
.pill.quote { background: #e3ecf7; color: #274b73; }
.pill.estimate_sent { background: #efe6f7; color: #5b2d8e; }
.pill.approved { background: #d9f0dd; color: var(--ok); }
.pill.warn { background: #fdf0d3; color: #7a5a12; }
.pill.ok { background: #d9f0dd; color: var(--ok); }
.pill.seed { background: #f3e2c7; color: #6b4a12; border: 1px dashed #b98a1d; }
tr.seed-row td { background: #fdf6e3; }
tr.me td { background: #eef6f1; }
.stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; min-width: 110px; }
.stat strong { display: block; font-size: 1.25rem; }
.stat span { color: var(--muted); font-size: 0.82em; }
.qr-wrap { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.qr-wrap canvas { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.linkrow { display: flex; gap: 8px; }
.linkrow input { flex: 1; margin-bottom: 0; }
.rowform { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.rowform > * { flex: 1; min-width: 130px; }
.rowform button { flex: 0 0 auto; }
.checkline { display: flex; gap: 8px; align-items: center; color: var(--ink); font-size: 0.95em; }
.checkline input { width: auto; margin: 0; }
.tos { max-height: 180px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: var(--bg); font-size: 0.92em; white-space: pre-wrap; margin-bottom: 10px; }
.stars { display: flex; gap: 4px; margin: 6px 0; }
.stars button { background: none; border: 1px solid var(--line); color: #c4cfd8; font-size: 1.8rem; padding: 2px 10px; }
.stars button.on { color: var(--accent); border-color: var(--accent); }
.photogrid { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.photogrid img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.qr { width: 90px; height: 90px; }
