/* BJP Field Hub — styles. Green & gold, light + dark, phone-first. */
:root {
  --green-900: #0b2e22;
  --green-800: #0f3d2e;
  --green-700: #155240;
  --green-600: #1c6b53;
  --green-100: #e3f1ea;
  --gold-500: #d4a017;
  --gold-400: #e2b73f;
  --gold-100: #fbf1d6;

  --bg: #f4f6f4;
  --surface: #ffffff;
  --surface-2: #f0f3f1;
  --line: #dde3df;
  --text: #16211c;
  --muted: #5e6b65;
  --faint: #8a958f;
  --brand: var(--green-800);
  --brand-ink: #ffffff;
  --accent: var(--gold-500);
  --accent-ink: #231a00;
  --ok: #1d7a4f;
  --ok-bg: #e2f4ea;
  --warn: #9a6400;
  --warn-bg: #fdf0d3;
  --bad: #b3261e;
  --bad-bg: #fbe4e2;
  --info: #1f5c99;
  --info-bg: #e3eefa;
  --shadow: 0 1px 2px rgba(16, 32, 24, .06), 0 4px 16px rgba(16, 32, 24, .06);
  --shadow-lg: 0 10px 40px rgba(10, 30, 20, .22);
  --radius: 14px;
  --radius-sm: 10px;
  --nav-h: 64px;
  --top-h: 56px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1411; --surface: #141d19; --surface-2: #1b2621; --line: #2a3832; --text: #e7eee9; --muted: #a2b0a9; --faint: #74827b;
    --brand: #1c6b53; --green-100: #173328; --gold-100: #3a2f10;
    --ok: #5fd39a; --ok-bg: #173a29; --warn: #f0c060; --warn-bg: #3b2f12; --bad: #ff8a80; --bad-bg: #3d1a18; --info: #8ec2ff; --info-bg: #15283d;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1411; --surface: #141d19; --surface-2: #1b2621; --line: #2a3832; --text: #e7eee9; --muted: #a2b0a9; --faint: #74827b;
  --brand: #1c6b53; --green-100: #173328; --gold-100: #3a2f10;
  --ok: #5fd39a; --ok-bg: #173a29; --warn: #f0c060; --warn-bg: #3b2f12; --bad: #ff8a80; --bad-bg: #3d1a18; --info: #8ec2ff; --info-bg: #15283d;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.25); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 16px; line-height: 1.45; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--green-600); }
a.btn, a.fab, a.quick, a.list-row { text-decoration: none; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 18px; height: 18px; }
svg.i.lg { width: 28px; height: 28px; }

/* ---------- boot / auth screens ---------- */
.boot { min-height: 100%; display: grid; place-items: center; color: var(--muted); }
.auth {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 500px at 50% -10%, var(--green-700), var(--green-900) 60%);
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface); border-radius: 20px; padding: 28px 24px 24px;
  box-shadow: var(--shadow-lg);
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand-mark {
  width: 48px; height: 48px; border-radius: 12px; background: var(--green-800); color: var(--gold-500);
  display: grid; place-items: center; font-weight: 800; font-size: 18px; letter-spacing: -.5px; flex: none;
  box-shadow: inset 0 0 0 2px var(--gold-500);
}
.brand h1 { font-size: 20px; margin: 0; letter-spacing: -.3px; }
.brand p { margin: 0; color: var(--muted); font-size: 14px; }
.auth h2 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.3px; }
.auth .lead { color: var(--muted); margin: 0 0 18px; font-size: 15px; }
.bio-btn {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px;
  border: 1.5px solid var(--green-600); background: var(--green-100); color: var(--text); text-align: left; margin-bottom: 18px;
}
.bio-btn svg { width: 34px; height: 34px; color: var(--green-600); }
.bio-btn b { display: block; font-size: 16px; }
.bio-btn span { color: var(--muted); font-size: 14px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 13px; margin: 0 0 16px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field small { display: block; color: var(--faint); font-size: 12.5px; margin-top: 5px; }
.input, select.input, textarea.input {
  width: 100%; height: 48px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; font-size: 16px;
}
textarea.input { height: auto; min-height: 84px; padding: 12px 14px; resize: vertical; }
.input:focus { border-color: var(--green-600); box-shadow: 0 0 0 4px color-mix(in srgb, var(--green-600) 18%, transparent); }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 52px; }
.pw-wrap button { position: absolute; right: 4px; top: 4px; width: 40px; height: 40px; border: 0; background: none; color: var(--muted); border-radius: 8px; display: grid; place-items: center; }
.check { display: flex; align-items: center; gap: 10px; margin: 4px 0 18px; font-size: 15px; user-select: none; }
.check input { width: 20px; height: 20px; accent-color: var(--green-600); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.err { background: var(--bad-bg); color: var(--bad); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 14px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 18px;
  border-radius: 12px; border: 0; font-weight: 650; font-size: 15.5px; white-space: nowrap; transition: transform .06s, filter .15s, background .15s;
  background: var(--surface-2); color: var(--text);
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.gold { background: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--bad-bg); color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.outline { background: transparent; border: 1.5px solid var(--line); }
.btn.block { width: 100%; }
.btn.sm { height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; display: grid; place-items: center; color: inherit; position: relative; }
.icon-btn:hover { background: var(--surface-2); }

/* ---------- app shell ---------- */
.shell { min-height: 100%; }
.sidebar { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: calc(var(--top-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 8px 0 16px;
  display: flex; align-items: center; gap: 8px; background: var(--green-800); color: #fff;
}
.topbar h1 { font-size: 19px; margin: 0; flex: 1; letter-spacing: -.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .icon-btn:hover { background: rgba(255,255,255,.1); }
.topbar .back { margin-left: -8px; }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: #5fd39a; display: inline-block; margin-left: 6px; vertical-align: middle; }
.conn-dot.off { background: #ff8a80; }
main.view { padding: 16px 16px calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); max-width: 1100px; margin: 0 auto; }
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
}
.navbtn {
  border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11.5px; font-weight: 600; color: var(--faint); position: relative; text-decoration: none;
}
.navbtn.on { color: var(--green-600); }
.navbtn.on::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
.badge {
  position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; line-height: 1;
}
.side-link .badge { position: static; margin-left: auto; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 250px 1fr; }
  .sidebar {
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; background: var(--green-900); color: #dfe9e4; padding: 18px 12px;
  }
  .sidebar .brand { padding: 0 8px; margin-bottom: 26px; }
  .sidebar .brand h1 { color: #fff; font-size: 17px; }
  .sidebar .brand p { color: #9fb8ad; font-size: 13px; }
  .side-link {
    display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: #cfe0d8; text-decoration: none; font-weight: 600; font-size: 15px; margin-bottom: 2px;
  }
  .side-link:hover { background: rgba(255,255,255,.06); color: #fff; }
  .side-link.on { background: rgba(212,160,23,.14); color: #fff; box-shadow: inset 3px 0 0 var(--gold-500); }
  .side-sep { height: 1px; background: rgba(255,255,255,.08); margin: 12px 8px; }
  .side-foot { margin-top: auto; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.05); display: flex; align-items: center; gap: 10px; }
  .side-foot .who { flex: 1; min-width: 0; }
  .side-foot b { display: block; color: #fff; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side-foot span { color: #9fb8ad; font-size: 12.5px; }
  .bottomnav { display: none; }
  .topbar { background: var(--bg); color: var(--text); border-bottom: 1px solid var(--line); padding-left: 28px; }
  .topbar .icon-btn:hover { background: var(--surface-2); }
  .topbar .mobile-only { display: none; }
  main.view { padding: 24px 28px 48px; }
}

/* ---------- common blocks ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
.card.pad { padding: 16px; }
.section-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 22px 2px 10px; }
.section-title .count { background: var(--surface-2); border-radius: 20px; padding: 1px 8px; font-size: 12px; letter-spacing: 0; }
.section-title .spacer { flex: 1; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.empty svg { width: 44px; height: 44px; color: var(--faint); margin: 0 auto 10px; stroke-width: 1.6; }
.empty b { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 20px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.info { background: var(--info-bg); color: var(--info); }
.pill.gray { background: var(--surface-2); color: var(--muted); }
.pill.gold { background: var(--gold-100); color: var(--warn); }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px; border-radius: 8px; background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 600; }
.chip.mono { font-family: var(--mono); font-size: 12.5px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.seg { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: 0 -2px; }
.seg::-webkit-scrollbar { display: none; }
.seg button {
  flex: none; height: 36px; padding: 0 14px; border-radius: 20px; border: 1.5px solid var(--line); background: var(--surface);
  font-weight: 600; font-size: 14px; color: var(--muted);
}
.seg button.on { background: var(--green-800); border-color: var(--green-800); color: #fff; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.money { font-variant-numeric: tabular-nums; font-weight: 750; }

/* ---------- search ---------- */
.hero-search { position: relative; }
.search-box {
  display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px;
  padding: 0 6px 0 14px; height: 56px; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s;
}
.search-box:focus-within { border-color: var(--green-600); box-shadow: 0 0 0 4px color-mix(in srgb, var(--green-600) 16%, transparent), var(--shadow); }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 17px; height: 100%; }
.search-box svg.lead { color: var(--faint); }
.search-hint { color: var(--muted); font-size: 13.5px; margin: 10px 2px 0; }
.results { display: grid; gap: 10px; }
@media (min-width: 700px) { .results.two { grid-template-columns: 1fr 1fr; } }
.result {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); text-align: left; width: 100%; transition: border-color .15s, transform .06s;
}
.result:hover { border-color: color-mix(in srgb, var(--green-600) 45%, var(--line)); }
.result:active { transform: scale(.995); }
.result .ico { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.result .ico.inv { background: var(--info-bg); color: var(--info); }
.result .ico.svc { background: var(--green-100); color: var(--green-600); }
.result .ico.part { background: var(--gold-100); color: var(--warn); }
.result .body { flex: 1; min-width: 0; }
.result .title { font-weight: 650; font-size: 15.5px; line-height: 1.3; }
.result .sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.result .meta { margin-top: 8px; }
.result .right { text-align: right; flex: none; }
.result .price { font-size: 18px; }
.stock-num { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.stock-lbl { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.recent { display: flex; flex-wrap: wrap; gap: 8px; }
.recent button { border: 1px solid var(--line); background: var(--surface); border-radius: 20px; padding: 6px 12px; font-size: 14px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 18px; }
@media (min-width: 700px) { .quick-grid { grid-template-columns: repeat(4, 1fr); } }
.quick {
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding: 16px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow); text-decoration: none; color: var(--text); font-weight: 650; position: relative;
}
.quick .qi { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--green-100); color: var(--green-600); }
.quick small { color: var(--muted); font-weight: 500; font-size: 13px; margin-top: -6px; }
.quick .badge { top: 12px; left: auto; right: 12px; }
.skeleton { height: 76px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--warn-bg); color: var(--warn); font-size: 14px; }
.notice.info { background: var(--info-bg); color: var(--info); }

/* ---------- price book ---------- */
.pb-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.pb-toolbar .search-box { flex: 1; height: 48px; box-shadow: none; border-radius: 12px; }
.cat-head { position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top)); z-index: 5; background: var(--bg); padding: 12px 2px 8px; margin: 0; font-size: 14px; font-weight: 750; color: var(--green-600); display: flex; gap: 8px; align-items: center; }
@media (min-width: 900px) { .cat-head { top: var(--top-h); } }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; width: 100%; text-align: left; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); }
.list-row .body { flex: 1; min-width: 0; }
.list-row .title { font-weight: 600; font-size: 15px; }
.list-row .sub { color: var(--muted); font-size: 13px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rates { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 700px) { .rates { grid-template-columns: repeat(4, 1fr); } }
.rate { padding: 12px; border-radius: 12px; background: var(--surface-2); }
.rate span { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.rate b { font-size: 18px; font-variant-numeric: tabular-nums; }

/* ---------- orders ---------- */
.order { display: block; width: 100%; text-align: left; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.order + .order { margin-top: 10px; }
.order .top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.order .num { font-family: var(--mono); font-weight: 700; font-size: 14px; }
.order .when { margin-left: auto; color: var(--faint); font-size: 13px; }
.order .lines { font-weight: 600; font-size: 15px; }
.order .foot > span { display: inline-flex; align-items: center; gap: 4px; }
.order .foot { display: flex; gap: 8px; align-items: center; margin-top: 8px; color: var(--muted); font-size: 13.5px; flex-wrap: wrap; }
.urg-rush { box-shadow: inset 4px 0 0 var(--gold-500), var(--shadow); }
.urg-emergency { box-shadow: inset 4px 0 0 var(--bad), var(--shadow); }
.line-card { border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: var(--surface); }
.line-card .row + .row { margin-top: 8px; }
.line-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 700; font-size: 14px; color: var(--muted); }
.line-head .spacer { flex: 1; }
.stepper { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 10px; height: 48px; overflow: hidden; }
.stepper button { width: 44px; height: 100%; border: 0; background: var(--surface-2); font-size: 20px; font-weight: 700; }
.stepper input { width: 100%; min-width: 0; border: 0; text-align: center; font-weight: 700; outline: none; background: none; height: 100%; }
.urgency { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.urgency button { height: 48px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 650; }
.urgency button.on[data-v="standard"] { border-color: var(--green-600); background: var(--green-100); color: var(--green-600); }
.urgency button.on[data-v="rush"] { border-color: var(--gold-500); background: var(--gold-100); color: var(--warn); }
.urgency button.on[data-v="emergency"] { border-color: var(--bad); background: var(--bad-bg); color: var(--bad); }
.sticky-actions {
  position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); margin: 16px -16px -16px; padding: 12px 16px;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); display: flex; gap: 10px; z-index: 6;
}
@media (min-width: 900px) { .sticky-actions { bottom: 0; margin: 20px 0 0; border-radius: 14px; border: 1px solid var(--line); } }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; padding: 6px 0; font-size: 14px; }
.timeline li::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--green-600); margin-top: 5px; flex: none; }
.photo-thumb { width: 100%; max-height: 260px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.photo-pick { display: flex; align-items: center; gap: 10px; }
.photo-pick img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; }
.fab {
  position: fixed; right: 16px; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 25; height: 56px; padding: 0 20px 0 16px;
  border-radius: 18px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 750; font-size: 15.5px; display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow-lg);
}
@media (min-width: 900px) { .fab { display: none; } }
.desk-only { display: none; }
@media (min-width: 900px) { .desk-only { display: inline-flex; } }

/* ---------- chat ---------- */
.chat-layout { display: grid; gap: 16px; }
@media (min-width: 900px) {
  .chat-layout { grid-template-columns: 300px 1fr; height: calc(100vh - var(--top-h) - 48px); }
  .chat-layout .threads { overflow: auto; }
}
.thread { display: flex; gap: 12px; align-items: center; padding: 12px; width: 100%; border: 0; background: none; text-align: left; border-radius: 12px; }
.thread:hover { background: var(--surface-2); }
.thread.on { background: var(--green-100); }
.thread .body { flex: 1; min-width: 0; }
.thread .title { font-weight: 650; display: flex; gap: 8px; align-items: baseline; }
.thread .title time { margin-left: auto; color: var(--faint); font-size: 12px; font-weight: 500; }
.thread .last { color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread .unread { background: var(--green-600); color: #fff; font-size: 12px; font-weight: 700; min-width: 22px; height: 22px; border-radius: 11px; display: grid; place-items: center; padding: 0 6px; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 15px; color: #fff; flex: none; position: relative;
  background: var(--green-600);
}
.avatar.sm { width: 32px; height: 32px; font-size: 12.5px; }
.avatar.team { background: var(--green-800); color: var(--gold-500); }
.avatar.desk { background: var(--gold-500); color: var(--accent-ink); }
.avatar .dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: #3ccf7f; border: 2px solid var(--surface); }
.convo { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-height: 0; }
.convo-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.convo-head b { flex: 1; }
.msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.msgs > :first-child { margin-top: auto; }
.day { align-self: center; font-size: 12px; font-weight: 700; color: var(--faint); margin: 10px 0 6px; text-transform: uppercase; letter-spacing: .5px; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 86%; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg .bubble { padding: 9px 13px; border-radius: 18px; background: var(--surface-2); font-size: 15.5px; word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; }
.msg.mine .bubble { background: var(--green-700); color: #fff; border-bottom-right-radius: 6px; }
.msg:not(.mine) .bubble { border-bottom-left-radius: 6px; }
.msg.system .bubble { background: var(--gold-100); color: var(--text); }
.msg .who { font-size: 12px; font-weight: 700; color: var(--muted); margin: 6px 0 2px 44px; }
.msg .bubble img { border-radius: 12px; margin: 2px 0 4px; max-height: 280px; cursor: zoom-in; }
.msg time { font-size: 11px; color: var(--faint); white-space: nowrap; margin-bottom: 4px; }
.msg .spacer-av { width: 32px; flex: none; }
.composer { display: flex; align-items: flex-end; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.composer textarea { flex: 1; resize: none; min-height: 44px; max-height: 140px; border: 1.5px solid var(--line); border-radius: 22px; padding: 10px 16px; outline: none; background: var(--bg); font-size: 16px; line-height: 1.35; }
.composer textarea:focus { border-color: var(--green-600); }
.send { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }
.attach-preview { display: flex; align-items: center; gap: 8px; padding: 8px 12px 0; }
.attach-preview img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; }
@media (max-width: 899px) {
  .chat-convo-view main.view { padding: 0; }
  .chat-convo-view .convo { position: fixed; inset: calc(var(--top-h) + env(safe-area-inset-top)) 0 calc(var(--nav-h) + env(safe-area-inset-bottom)) 0; border-radius: 0; border: 0; box-shadow: none; }
  .chat-convo-view .convo-head { display: none; }
}

/* ---------- sheets / modals ---------- */
.scrim { position: fixed; inset: 0; background: rgba(8, 20, 14, .5); z-index: 60; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: var(--surface); border-radius: 22px 22px 0 0;
  padding: 8px 18px calc(20px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); animation: up .22s cubic-bezier(.2,.8,.2,1);
}
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 12px; }
.sheet-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.sheet-head h2 { flex: 1; margin: 4px 0 0; font-size: 20px; line-height: 1.25; letter-spacing: -.2px; }
.sheet .actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.sheet .actions .btn { flex: 1; }
@media (min-width: 700px) {
  .scrim { align-items: center; padding: 24px; }
  .sheet { border-radius: 20px; padding: 16px 22px 22px; }
  .sheet .grab { display: none; }
}
.big-price { font-size: 34px; font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.loc-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.loc-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.loc-table td { padding: 10px 4px; border-bottom: 1px solid var(--line); }
.loc-table td.n, .loc-table th.n { text-align: right; font-variant-numeric: tabular-nums; }
.desc { white-space: pre-wrap; color: var(--text); font-size: 15px; background: var(--surface-2); padding: 12px; border-radius: 12px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 0; right: 0; top: calc(8px + env(safe-area-inset-top)); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toast {
  pointer-events: auto; max-width: 440px; width: 100%; background: var(--green-900); color: #fff; border-radius: 14px; padding: 12px 14px;
  box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; font-size: 14.5px; animation: drop .25s cubic-bezier(.2,.8,.2,1);
}
.toast.bad { background: #7a1c16; }
.toast b { display: block; }
.toast button { margin-left: auto; }
@keyframes drop { from { transform: translateY(-16px); opacity: 0; } }

/* ---------- team / settings ---------- */
.user-row { display: flex; align-items: center; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line); }
.user-row:last-child { border-bottom: 0; }
.user-row .body { flex: 1; min-width: 0; }
.user-row .title { font-weight: 650; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.user-row .sub { color: var(--muted); font-size: 13.5px; }
.settings-grid { display: grid; gap: 16px; }
@media (min-width: 1000px) { .settings-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.card h3 { margin: 0 0 4px; font-size: 17px; }
.card .hint { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.ladder-row { display: grid; grid-template-columns: 1fr 1fr 40px; gap: 8px; margin-bottom: 8px; align-items: center; }
.ladder-row .input { height: 42px; }
.device { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.device:last-child { border-bottom: 0; }
.device .body { flex: 1; }
.device .sub { color: var(--muted); font-size: 13px; }
.bio-hero { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: 14px; background: var(--green-100); margin-bottom: 14px; }
.bio-hero svg { width: 40px; height: 40px; color: var(--green-600); flex: none; }
.scan-video { width: 100%; border-radius: 14px; background: #000; aspect-ratio: 4/3; object-fit: cover; }
.scan-frame { position: relative; }
.scan-frame::after { content: ""; position: absolute; left: 12%; right: 12%; top: 40%; height: 20%; border: 3px solid var(--gold-500); border-radius: 10px; box-shadow: 0 0 0 999px rgba(0,0,0,.25); }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 90; display: grid; place-items: center; padding: 16px; }
.lightbox img { max-height: 100%; border-radius: 8px; }

/* phones: toasts sit above the bottom bar so they never cover the search box or chat header */
@media (max-width: 899px) {
  .toasts { top: auto; bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); flex-direction: column-reverse; }
  body:not(:has(.bottomnav)) .toasts { bottom: calc(16px + env(safe-area-inset-bottom)); }
  @keyframes drop { from { transform: translateY(16px); opacity: 0; } }
}

/* ---------- 6-tab bottom bar ---------- */
.bottomnav { grid-template-columns: repeat(6, 1fr); }
.navbtn { font-size: 10.5px; }
.quick-grid { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) { .quick-grid { grid-template-columns: repeat(3, 1fr); } }
.side-link svg.sm { margin-left: auto; opacity: .6; }

/* ---------- inspection reports ---------- */
.type-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-pick button { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); text-align: left; }
.type-pick button svg { color: var(--green-600); }
.type-pick button span { color: var(--muted); font-size: 13.5px; }
.type-pick button.on { border-color: var(--green-600); background: var(--green-100); }
.rep { max-width: 860px; margin: 0 auto; display: grid; gap: 14px; }
.rep .card h3 { margin-bottom: 12px; }
.rep-head .top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rep-head .num { font-family: var(--mono); font-weight: 800; font-size: 17px; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
.grid-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid-meta .span2 { grid-column: 1 / -1; }
.grid-addr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (min-width: 700px) {
  .grid2 { grid-template-columns: 1fr 1fr; }
  .grid-meta { grid-template-columns: repeat(3, 1fr); }
  .grid-addr { grid-template-columns: 1.2fr 1.6fr .6fr .8fr; }
}
.unit-wrap { position: relative; }
.unit-wrap .unit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 14px; font-weight: 600; pointer-events: none; }
.unit-wrap .input { padding-right: 44px; }
.chips.multi { gap: 6px; }
.chip-t { height: 36px; padding: 0 12px; border-radius: 18px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; color: var(--muted); }
.chip-t.on { background: var(--green-800); border-color: var(--green-800); color: #fff; }
.progress-card { position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top) + 6px); z-index: 7; padding: 12px 16px !important; }
@media (min-width: 900px) { .progress-card { top: calc(var(--top-h) + 6px); } }
.prog-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.prog-top .chips { margin-left: auto; }
.bar-track { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--green-600), var(--gold-500)); border-radius: 4px; transition: width .25s; }
.ck-sec { overflow: hidden; }
.ck-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 16px; border: 0; background: none; text-align: left; font-size: 16px; }
.ck-head b { flex: 1; }
.ck-head svg { transition: transform .2s; color: var(--faint); }
.ck-sec.open .ck-head svg { transform: rotate(90deg); }
.ck-count { font-size: 13px; font-weight: 700; color: var(--muted); background: var(--surface-2); padding: 2px 9px; border-radius: 12px; }
.ck-count.done { background: var(--ok-bg); color: var(--ok); }
.ck-body { display: none; border-top: 1px solid var(--line); }
.ck-sec.open .ck-body { display: block; }
.ck-item { padding: 12px 16px; border-bottom: 1px solid var(--line); border-left: 4px solid transparent; }
.ck-item.r-ok { border-left-color: var(--ok); }
.ck-item.r-monitor { border-left-color: var(--gold-500); }
.ck-item.r-repair { border-left-color: var(--bad); background: color-mix(in srgb, var(--bad-bg) 45%, transparent); }
.ck-item.r-na { border-left-color: var(--line); }
.ck-top { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.ck-label { flex: 1 1 220px; font-weight: 600; font-size: 15px; }
.rate { display: grid; grid-template-columns: repeat(4, minmax(58px, 1fr)); gap: 5px; flex: 1 1 280px; max-width: 380px; }
.rate.sev { grid-template-columns: repeat(3, 1fr); max-width: none; margin: 10px 0; }
.rate button { height: 42px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 700; font-size: 13.5px; color: var(--muted); }
.rate button.on.t-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.rate button.on.t-warn { background: var(--gold-500); border-color: var(--gold-500); color: var(--accent-ink); }
.rate button.on.t-bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.rate button.on.t-gray { background: var(--muted); border-color: var(--muted); color: #fff; }
.rate button[disabled] { opacity: .75; }
.ck-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 10px; }
.ck-fields label span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.ck-fields .input { height: 42px; }
.ck-extra { display: none; margin-top: 10px; }
.ck-extra.open { display: block; }
.ck-more { border: 0; background: none; color: var(--green-600); font-weight: 600; font-size: 13.5px; display: inline-flex; gap: 6px; align-items: center; padding: 8px 0 0; }
.ck-extra.open + .ck-more { display: none; }
.ck-foot { padding: 10px 16px; text-align: right; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.thumb { position: relative; width: 76px; height: 76px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.thumb button { position: absolute; top: 3px; right: 3px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; }
.thumb.add { display: grid; place-items: center; border: 2px dashed var(--line); color: var(--muted); cursor: pointer; background: var(--surface-2); }
.thumb.add.busy { opacity: .5; pointer-events: none; animation: sk 1s infinite; }
.cond-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (min-width: 700px) { .cond-pick { grid-template-columns: repeat(4, 1fr); } }
.cond-pick button { text-align: left; padding: 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 3px; }
.cond-pick button span { font-size: 12.5px; color: var(--muted); }
.cond-pick button.on.t-ok { border-color: var(--ok); background: var(--ok-bg); }
.cond-pick button.on.t-warn { border-color: var(--gold-500); background: var(--gold-100); }
.cond-pick button.on.t-bad { border-color: var(--bad); background: var(--bad-bg); }
.obs-card { border-left: 5px solid var(--line); margin-bottom: 10px; }
.obs-card.sev-minor { border-left-color: var(--ok); }
.obs-card.sev-moderate { border-left-color: var(--gold-500); }
.obs-card.sev-severe { border-left-color: var(--bad); }
.obs-top { display: flex; gap: 8px; align-items: center; }
.obs-top .ft-in { width: 110px; flex: none; }
.obs-top .ft-in .input { font-weight: 800; font-size: 18px; }
.obs-top select { flex: 1; min-width: 0; }
.grid-obs { display: grid; grid-template-columns: 1fr 110px; gap: 8px; }
.rec-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rec-row .check { flex: 1 1 240px; }
.rec-row .sm-in { height: 40px; flex: 0 1 180px; }
.save-state { flex: 1; font-size: 13px; color: var(--muted); align-self: center; min-width: 0; }
.save-state.bad { color: var(--bad); font-weight: 600; }
.rep-actions { flex-wrap: wrap; align-items: center; }
.rep-actions .btn { flex: 0 0 auto; }

/* price book: catalog fields */
.pb-right { display: flex; flex-direction: column; align-items: flex-end; text-align: right; flex: none; }
.price-row { display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 14px; }

/* remote access + QR */
.qr { background: #fff; padding: 6px; border-radius: 12px; width: 150px; flex: none; border: 1px solid var(--line); }
.qr svg { display: block; width: 100%; height: auto; }
.cred-row, .remote-live { display: flex; gap: 16px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.remote-url { font-family: var(--mono); font-weight: 700; font-size: 17px; word-break: break-all; }
.remote-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.remote-head h3 { margin: 0; }
.steps { margin: 0 0 14px; padding-left: 20px; line-height: 1.6; }
.steps li { margin-bottom: 4px; }
.rlog { max-height: 220px; overflow: auto; background: #0d1411; color: #cfe0d8; font-size: 11.5px; padding: 10px; border-radius: 10px; white-space: pre-wrap; word-break: break-all; margin-top: 10px; }
@media (min-width: 1000px) { .remote-card { grid-column: 1 / -1; } }

/* price cart */
.pb-item { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); }
.pb-item:last-child { border-bottom: 0; }
.pb-item .list-row { flex: 1; border-bottom: 0; min-width: 0; }
.cart-add { flex: none; width: 56px; border: 0; border-left: 1px solid var(--line); background: var(--surface); color: var(--green-600); display: grid; place-items: center; }
.cart-add:hover { background: var(--green-100); }
.cart-add.in { background: var(--green-600); color: #fff; font-size: 16px; }
.cart-top { position: relative; }
.cart-top .badge { position: static; margin-left: 2px; }
.topbar .cart-top { color: inherit; border-color: rgba(255,255,255,.35); }
@media (min-width: 900px) { .topbar .cart-top { border-color: var(--line); } }
.cart-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); z-index: 26; display: flex; align-items: center; gap: 10px;
  padding: 0 16px; height: 56px; border-radius: 16px; background: var(--green-800); color: #fff; text-decoration: none; box-shadow: var(--shadow-lg); animation: drop .2s;
}
.cart-bar span:first-of-type { flex: 1; }
.cart-bar .money { font-size: 18px; color: var(--gold-400); }
@media (min-width: 900px) { .cart-bar { left: auto; right: 28px; bottom: 24px; width: 380px; } }
body:has(.cart-bar) main.view { padding-bottom: calc(var(--nav-h) + 96px); }
.cart { max-width: 760px; margin: 0 auto; display: grid; gap: 14px; }
.cart-rule { display: flex; gap: 8px; align-items: flex-start; margin: 0; }
.cart-line { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.cart-line:last-child { border-bottom: 0; }
.cart-line.base { background: color-mix(in srgb, var(--ok-bg) 60%, transparent); box-shadow: inset 4px 0 0 var(--ok); }
.cart-line .body { flex: 1; min-width: 0; }
.cart-line .title { font-weight: 650; }
.cart-line s { opacity: .6; font-weight: 500; }
.cart-qty { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; flex: none; }
.cart-qty button { width: 36px; height: 36px; border: 0; background: var(--surface-2); display: grid; place-items: center; color: var(--text); }
.cart-qty span { min-width: 28px; text-align: center; font-weight: 700; }
.cart-amt { min-width: 84px; text-align: right; font-size: 16px; }
.cart-total { display: grid; gap: 6px; }
.row-between { display: flex; justify-content: space-between; gap: 12px; }
.row-between.grand { font-size: 22px; font-weight: 800; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; }
.ok-txt { color: var(--ok); font-weight: 600; }
@media (max-width: 520px) { .cart-line { flex-wrap: wrap; } .cart-line .body { flex-basis: 100%; } .cart-amt { margin-left: auto; } }
.topbar .btn.outline { color: inherit; border-color: rgba(255,255,255,.35); background: transparent; }
@media (min-width: 900px) { .topbar .btn.outline { border-color: var(--line); } }
.steps li.now { font-weight: 700; color: var(--text); background: var(--gold-100); border-radius: 8px; padding: 2px 6px; margin-left: -6px; }
