/* YouSee360 Scout — design system */
:root {
  --bg: #06070a;
  --bg-2: #0b0d12;
  --panel: #10131a;
  --panel-2: #161a23;
  --panel-3: #1d2230;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #eef1f6;
  --muted: #8d95a8;
  --faint: #5d6477;
  --blue: #2f8cff;
  --blue-2: #5aa8ff;
  --coral: #ff5e69; /* only for negative / bad */
  --cyan: #01e4e4;
  --green: #34d77f;
  --amber: #ffb547;
  --red: #ff5e69;
  --violet: #b16cea;
  --grad: linear-gradient(120deg, #2f8cff 0%, #01e4e4 55%, #34d77f 100%);
  --glow: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 10px 40px rgba(0, 0, 0, 0.45);
  --r: 14px;
  --r-sm: 9px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
svg { flex: none; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 Outfit, Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--blue-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(47, 140, 255, 0.4); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #232838; border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line-2); background: var(--panel-2);
  border-radius: 10px; padding: 8px 13px; cursor: pointer; white-space: nowrap; font-weight: 500; font-size: 13px;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.btn:hover:not(:disabled) { border-color: rgba(255, 255, 255, 0.28); background: var(--panel-3); text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 6px 24px rgba(47, 140, 255, 0.35); }
.btn.primary:hover:not(:disabled) { background: #4a9bff; border-color: #4a9bff; }
.btn.cyan { background: rgba(52, 215, 127, 0.12); border-color: rgba(52, 215, 127, 0.5); color: var(--green); }
.btn.go { background: var(--green); border-color: var(--green); color: #04150b; font-weight: 600; box-shadow: 0 6px 24px rgba(52, 215, 127, 0.3); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--panel-2); }
.btn.sm { padding: 5px 9px; font-size: 12px; border-radius: 8px; }
.btn.icon { padding: 7px; width: 34px; justify-content: center; }
.btn svg { width: 15px; height: 15px; flex: none; }
.input, select.input, textarea.input {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 12px; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: rgba(47, 140, 255, 0.7); box-shadow: 0 0 0 3px rgba(47, 140, 255, 0.15); }
textarea.input { resize: vertical; min-height: 90px; line-height: 1.55; }
label.field { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.check { display: inline-flex; gap: 7px; align-items: center; font-size: 13px; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--blue); width: 15px; height: 15px; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-rows: 60px 1fr; grid-template-columns: minmax(0, 1fr); height: 100vh; height: 100dvh; }
.topbar {
  display: flex; align-items: center; gap: 22px; padding: 0 18px; border-bottom: 1px solid var(--line);
  background: rgba(6, 7, 10, 0.85); backdrop-filter: blur(14px); position: relative; z-index: 20;
}
.brandmark { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: 0.01em; white-space: nowrap; }
.brandmark img { height: 46px; width: auto; }
.brandmark .sub { font-weight: 400; color: var(--muted); font-size: 13px; padding-left: 10px; border-left: 1px solid var(--line-2); }
.nav { display: flex; gap: 4px; }
.nav svg { width: 17px; height: 17px; }
.nav a {
  padding: 7px 14px; border-radius: 999px; color: var(--muted); font-weight: 500; display: inline-flex; gap: 8px; align-items: center;
}
.nav a:hover { color: var(--text); text-decoration: none; background: var(--panel); }
.nav a.active { color: var(--text); background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.nav .count { font-size: 11px; background: var(--blue); color: #fff; border-radius: 999px; padding: 0 7px; font-weight: 600; }
.topbar .spacer { flex: 1; }
.sys { display: flex; gap: 12px; font-size: 11.5px; color: var(--faint); }
.sys i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-right: 5px; box-shadow: 0 0 8px var(--green); }
.sys i.off { background: var(--amber); box-shadow: none; }
.view { display: none; height: 100%; min-height: 0; }
.view.active { display: block; }

/* ---------- scout ---------- */
.scout { display: grid; grid-template-columns: minmax(0, 1fr) 470px; height: 100%; }
.mapwrap { position: relative; min-height: 300px; }
#map { position: absolute; inset: 0; background: #0d1015; z-index: 0; } /* keep Leaflet's z-index 400+ panes under the toolbar and sheet */
.maptools {
  position: absolute; top: 14px; left: 14px; right: 14px; display: flex; gap: 10px; align-items: center; z-index: 5; flex-wrap: wrap; pointer-events: none;
}
.maptools > * { pointer-events: auto; }
.glass { background: rgba(12, 14, 19, 0.82); backdrop-filter: blur(14px); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--glow); }
.search { display: flex; align-items: center; gap: 8px; padding: 0 12px; width: min(340px, 100%); height: 42px; }
.search input { background: transparent; border: 0; outline: 0; width: 100%; }
.search svg { width: 16px; height: 16px; color: var(--muted); }
.drawtools { display: flex; padding: 4px; gap: 2px; }
.drawtools button { background: transparent; border: 0; padding: 7px 11px; border-radius: 8px; cursor: pointer; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
.drawtools button:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.drawtools button.on { background: var(--blue); color: #fff; }
.drawtools button:disabled { opacity: 0.4; cursor: progress; }
.drawtools svg { width: 15px; height: 15px; }
.nearme { display: inline-flex; align-items: center; gap: 7px; height: 42px; padding: 0 14px; color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; border-color: rgba(52, 215, 127, 0.5); }
.nearme svg { width: 17px; height: 17px; color: var(--green); }
.nearme:disabled { opacity: 0.7; cursor: wait; }
.hint { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); padding: 9px 16px; font-size: 13px; z-index: 5; }
.notice { position: absolute; bottom: 22px; left: 14px; max-width: 520px; padding: 11px 14px; font-size: 12.5px; z-index: 6; border-color: rgba(255, 181, 71, 0.5); }
.legend { position: absolute; right: 14px; bottom: 26px; padding: 8px 12px; font-size: 11px; color: var(--muted); display: flex; gap: 10px; z-index: 5; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend b { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

.side { border-left: 1px solid var(--line); background: var(--bg-2); display: flex; flex-direction: column; min-height: 0; }
.side-head { padding: 16px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.side-head > * { min-width: 0; } /* long scan names in the select must not widen the panel */
.side-head h2 { margin: 0; font-size: 15px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.grow { flex: 1; min-width: 0; }
.steps { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.steps .btn { justify-content: center; padding: 10px; }
.progress { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.bar { height: 5px; border-radius: 5px; background: var(--panel-3); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--grad); transition: width 0.4s; }
.sortbar { display: flex; gap: 4px; padding: 10px 16px; border-bottom: 1px solid var(--line); overflow-x: auto; align-items: center; }
.pill { padding: 4px 10px; border-radius: 999px; font-size: 12px; color: var(--muted); border: 1px solid transparent; background: transparent; cursor: pointer; white-space: nowrap; }
.pill:hover { color: var(--text); }
.pill.on { color: var(--text); background: var(--panel-2); border-color: var(--line-2); }
.list { overflow-y: auto; padding: 12px; display: grid; gap: 10px; align-content: start; flex: 1; }
.empty { color: var(--muted); text-align: center; padding: 40px 20px; font-size: 13px; }
.empty .big { font-size: 34px; margin-bottom: 8px; }

/* property card */
.pcard {
  display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 10px; border-radius: var(--r); background: var(--panel);
  border: 1px solid var(--line); cursor: pointer; transition: border-color 0.15s, transform 0.15s, background 0.15s; position: relative;
}
.pcard:hover { border-color: var(--line-2); background: var(--panel-2); }
.pcard.hl { border-color: var(--blue); }
.thumb { width: 92px; height: 92px; border-radius: 10px; background: var(--panel-3) center/cover no-repeat; position: relative; overflow: hidden; }
.thumb .ring { position: absolute; right: 5px; bottom: 5px; }
.pcard h3 { margin: 0; font-size: 14.5px; font-weight: 600; line-height: 1.25; }
.meta { color: var(--muted); font-size: 12px; }
.meta b { color: var(--text); font-weight: 500; }
.needs5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-top: 7px; }
.need-mini { font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.04em; }
.need-mini .t { height: 4px; border-radius: 3px; background: var(--panel-3); margin-top: 3px; overflow: hidden; }
.need-mini .t span { display: block; height: 100%; border-radius: 3px; }
.chanrow { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.stagechip { position: absolute; top: 10px; right: 10px; }

/* channel logo dots */
.cdot {
  width: 22px; height: 22px; border-radius: 6px; display: inline-grid; place-items: center; font-size: 10px; font-weight: 700; color: #fff;
  opacity: 0.22; filter: grayscale(1); position: relative;
}
.cdot.on { opacity: 1; filter: none; }
.cdot.unk { opacity: 0.5; filter: grayscale(1); outline: 1px dashed var(--faint); }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 3px 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.chip.good { color: var(--green); border-color: rgba(98, 227, 130, 0.35); background: rgba(98, 227, 130, 0.07); }
.chip.bad { color: var(--coral); border-color: rgba(255, 94, 105, 0.4); background: rgba(255, 94, 105, 0.08); }
.chip.warn { color: var(--amber); border-color: rgba(255, 181, 71, 0.4); background: rgba(255, 181, 71, 0.07); }
.chip.cyan { color: var(--cyan); border-color: rgba(1, 228, 228, 0.4); background: rgba(1, 228, 228, 0.07); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* score ring */
.ring { --v: 0; --c: var(--blue); width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--c) calc(var(--v) * 1%), rgba(255, 255, 255, 0.1) 0); }
.ring::before { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: rgba(8, 10, 14, 0.92); }
.ring b { position: relative; font-size: 13px; font-weight: 700; }
.ring.lg { width: 76px; height: 76px; }
.ring.lg::before { inset: 7px; }
.ring.lg b { font-size: 24px; }
.ring.xl { width: 116px; height: 116px; }
.ring.xl::before { inset: 9px; }
.ring.xl b { font-size: 36px; }
.ring small { position: relative; display: block; font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: -2px; text-align: center; }

/* ---------- drawer (property dossier) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(2px); z-index: 40; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(1020px, 100vw); background: var(--bg); border-left: 1px solid var(--line-2);
  z-index: 50; transform: translateX(102%); transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); display: flex; flex-direction: column;
  box-shadow: -30px 0 80px rgba(0, 0, 0, 0.5);
}
.drawer.open { transform: none; }
.drawer .scroll { overflow-y: auto; flex: 1; }
.hero { position: relative; height: 290px; display: grid; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 3px; background: var(--panel); }
.hero .ph { background: var(--panel-2) center/cover no-repeat; }
.hero .ph:first-child { grid-row: span 2; }
.hero .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(6, 7, 10, 0.25) 0%, rgba(6, 7, 10, 0.1) 35%, rgba(6, 7, 10, 0.96) 100%); pointer-events: none; }
.hero .top { position: absolute; top: 14px; left: 18px; right: 14px; display: flex; justify-content: space-between; gap: 8px; }
.hero .title { position: absolute; left: 24px; right: 24px; bottom: 18px; display: flex; align-items: flex-end; gap: 18px; }
.hero h1 { margin: 0 0 4px; font-size: 30px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.1; text-shadow: 0 2px 20px rgba(0, 0, 0, 0.6); }
.hero .sub { color: #c9cfdb; font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--bg-2); position: sticky; top: 0; z-index: 3; align-items: center; }
.sec { padding: 22px 24px; border-bottom: 1px solid var(--line); }
.sec h2 { margin: 0 0 14px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.sec h2 .rule { flex: 1; height: 1px; background: var(--line); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.needs-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.needbox { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 10px; display: grid; justify-items: center; gap: 8px; text-align: center; }
.needbox .lbl { font-size: 12px; font-weight: 500; }
.needbox .why { font-size: 11px; color: var(--muted); line-height: 1.35; }

/* channel matrix */
.chgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ch { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 11px; background: var(--panel); border: 1px solid var(--line); min-height: 56px; }
.ch .logo { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; flex: none; }
.ch .nm { font-size: 13px; font-weight: 500; line-height: 1.2; }
.ch .st { font-size: 11px; }
.ch.yes { border-color: rgba(98, 227, 130, 0.3); }
.ch.yes .st { color: var(--green); }
.ch.no .st { color: var(--coral); }
.ch.no .logo, .ch.unk .logo { filter: grayscale(1); opacity: 0.45; }
.ch.unk .st { color: var(--faint); }
a.ch:hover { text-decoration: none; border-color: var(--line-2); }

/* device frames */
.frames { display: grid; grid-template-columns: 1fr 150px; gap: 14px; align-items: start; }
.browser { border-radius: 10px; overflow: hidden; border: 1px solid var(--line-2); background: #0e1117; }
.browser .chrome { height: 24px; display: flex; align-items: center; gap: 5px; padding: 0 9px; background: #171b24; font-size: 10px; color: var(--faint); }
.browser .chrome i { width: 8px; height: 8px; border-radius: 50%; background: #2c3242; }
.browser .chrome span { margin-left: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.browser img { display: block; width: 100%; }
.phone { border-radius: 20px; border: 5px solid #1c212c; overflow: hidden; background: #000; aspect-ratio: 9/18; }
.phone img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.noshot { display: grid; place-items: center; aspect-ratio: 16/9.6; color: var(--faint); font-size: 13px; text-align: center; padding: 20px; background: repeating-linear-gradient(45deg, #0e1117, #0e1117 10px, #11151d 10px, #11151d 20px); }

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 7px 12px; font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* photos */
.gallery { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.gallery img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; background: var(--panel-2); cursor: zoom-in; transition: transform 0.15s; }
.gallery img:hover { transform: scale(1.03); }
.vibe { padding: 16px; border-radius: var(--r); background: linear-gradient(135deg, rgba(47, 140, 255, 0.14), rgba(52, 215, 127, 0.08)); border: 1px solid var(--line-2); }
.vibe .words { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.vibe .words span { font-size: 13px; font-weight: 600; padding: 3px 11px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }
.vibe p { margin: 0; font-size: 15px; line-height: 1.5; font-style: italic; color: #dfe4ee; }

/* reviews */
.review { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 12.5px; color: #cfd5e0; }
.review .who { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.stars { color: #ffc84a; letter-spacing: 1px; }
.quote { font-size: 14px; line-height: 1.55; color: #dfe4ee; margin: 0; }

/* services */
.svc { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 6px; }
.svc h4 { margin: 0; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.svc h4 span { color: var(--cyan); font-weight: 500; font-size: 12px; white-space: nowrap; }
.svc p { margin: 0; font-size: 12.5px; color: var(--muted); }

/* timeline */
.timeline { display: grid; gap: 8px; font-size: 12.5px; max-height: 260px; overflow-y: auto; }
.timeline div { display: grid; grid-template-columns: 110px 1fr; gap: 10px; color: var(--muted); }
.timeline b { color: var(--text); font-weight: 500; }

/* ---------- pipeline ---------- */
.pipe { display: flex; flex-direction: column; height: 100%; }
.pipe-head { padding: 16px 20px; display: flex; gap: 14px; align-items: center; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pipe-head h1 { margin: 0; font-size: 20px; font-weight: 600; }
.funnel { display: flex; gap: 2px; align-items: stretch; }
.funnel div { padding: 6px 12px; background: var(--panel); font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.2; }
.funnel div:first-child { border-radius: 10px 0 0 10px; }
.funnel div:last-child { border-radius: 0 10px 10px 0; }
.funnel b { display: block; font-size: 17px; color: var(--text); }
.board { flex: 1; overflow: auto; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(268px, 1fr); gap: 12px; padding: 16px 20px; align-items: start; min-height: 0; }
.col { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; max-height: 100%; min-height: 160px; }
.col.drop { border-color: var(--cyan); background: rgba(1, 228, 228, 0.04); }
.col-head { padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--line); }
.col-head .n { color: var(--muted); font-weight: 500; }
.col-body { padding: 10px; display: grid; gap: 8px; overflow-y: auto; align-content: start; }
.lcard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; cursor: grab; display: grid; gap: 8px; }
.lcard:hover { border-color: var(--line-2); }
.lcard .top { display: grid; grid-template-columns: 44px 1fr 40px; gap: 10px; align-items: center; }
.lcard .av { width: 44px; height: 44px; border-radius: 9px; background: var(--panel-3) center/cover; }
.lcard h4 { margin: 0; font-size: 13px; font-weight: 600; line-height: 1.25; }
.lcard .foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); }

/* ---------- brand editor ---------- */
.brandview { overflow-y: auto; height: 100%; }
.brand-wrap { max-width: 1100px; margin: 0 auto; padding: 26px 22px 80px; display: grid; gap: 18px; }
.brand-wrap h1 { margin: 0; font-size: 22px; }
.rows { display: grid; gap: 8px; }
.rowedit { display: grid; gap: 8px; align-items: start; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.savebar { position: sticky; bottom: 0; padding: 12px; display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: none; place-items: center; padding: 20px; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(3px); }
.modal.open { display: grid; }
.modal .box { width: min(760px, 100%); max-height: 92vh; overflow-y: auto; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--glow); }
.modal .head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal .head h3 { margin: 0; font-size: 16px; }
.modal .body { padding: 18px 20px; display: grid; gap: 14px; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 7px; cursor: pointer; color: var(--muted); font-size: 12.5px; }
.seg button.on { background: var(--panel-3); color: var(--text); }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.92); z-index: 80; display: none; place-items: center; cursor: zoom-out; }
.lightbox.open { display: grid; }
.lightbox img { max-width: 92vw; max-height: 90vh; border-radius: 10px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px); opacity: 0; z-index: 90; padding: 10px 16px; transition: all 0.25s; pointer-events: none; font-size: 13px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.spin { display: inline-block; width: 13px; height: 13px; border: 2px solid rgba(255, 255, 255, 0.2); border-top-color: var(--cyan); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--panel) 0%, var(--panel-2) 50%, var(--panel) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.muted { color: var(--muted); }
.small { font-size: 12px; }


/* score breakdown checklists */
.bd { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.bd .cat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.bd .cat h4 { margin: 0 0 8px; display: flex; justify-content: space-between; font-size: 13.5px; }
.bd ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; font-size: 12.5px; }
.bd li { display: grid; grid-template-columns: 16px 1fr; gap: 6px; color: #cfd5e0; }
.bd li .y { color: var(--green); } .bd li .n { color: var(--coral); } .bd li .q { color: var(--faint); }
.techrow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tech { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.tech .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.tech .v { font-size: 15px; font-weight: 600; margin-top: 3px; }
/* insights */
.insights { overflow-y: auto; height: 100%; }
.ins-wrap { max-width: 1200px; margin: 0 auto; padding: 24px 22px 80px; display: grid; gap: 18px; }
.ins-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 14px; }
.barlist { display: grid; gap: 8px; }
.barlist .r { display: grid; grid-template-columns: minmax(0, 1fr) 46px; gap: 10px; align-items: center; font-size: 13px; }
.barlist .t { height: 8px; border-radius: 6px; background: var(--panel-3); overflow: hidden; margin-top: 4px; }
.barlist .t span { display: block; height: 100%; border-radius: 6px; background: var(--grad); }
.barlist .n { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.kpis5 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi5 { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; gap: 8px; justify-items: start; }
.kpi5 .l { font-size: 12px; color: var(--muted); }
@media (max-width: 640px) { .techrow { grid-template-columns: 1fr; } }

/* ---------- send report (in person) ---------- */
.send { gap: 16px; }
.qrcard { display: grid; grid-template-columns: 150px 1fr; gap: 16px; align-items: center; padding: 14px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); }
.qrbox { width: 150px; height: 150px; border-radius: 12px; background: #fff; border: 0; padding: 0; display: grid; place-items: center; cursor: zoom-in; overflow: hidden; }
.qrbox svg { width: 100%; height: 100%; display: block; }
.qrtext { display: grid; gap: 6px; justify-items: start; }
.qrtext b { font-size: 15px; }
.sendgrp { display: grid; gap: 10px; padding: 14px; border-radius: var(--r); background: linear-gradient(135deg, rgba(52, 215, 127, 0.08), rgba(47, 140, 255, 0.05)); border: 1px solid rgba(52, 215, 127, 0.3); }
.btn.big { padding: 13px 16px; font-size: 15px; justify-content: center; border-radius: 12px; }
.sendrow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.sendrow .btn { justify-content: center; }
.msgedit summary { cursor: pointer; color: var(--blue-2); font-size: 13px; margin-bottom: 8px; }
.qrfull {
  position: fixed; inset: 0; z-index: 95; background: #fff; color: #0b0d12; display: grid; place-content: center; justify-items: center; gap: 10px;
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom)); text-align: center; cursor: zoom-out;
}
.qrfull .qrbig { width: min(82vw, 72vh, 520px); aspect-ratio: 1; }
.qrfull .qrbig svg { width: 100%; height: 100%; display: block; }
.qrfull b { font-size: 20px; }
.qrfull span { font-size: 15px; color: #444b5a; }
.qrfull small { color: #8d95a8; margin-top: 6px; }
@media (orientation: landscape) and (max-height: 520px) {
  .qrfull { grid-template-columns: auto auto; align-items: center; column-gap: 28px; }
  .qrfull .qrbig { grid-row: span 3; width: min(80vh, 46vw); }
}

/* field bar: Call / Go / Send report, pinned to the bottom of the dossier on phones */
.fieldbar { display: none; }
@media (max-width: 760px), (max-height: 520px) and (orientation: landscape) {
  .fieldbar {
    display: grid; grid-template-columns: auto auto 1fr; gap: 8px; position: sticky; bottom: 0; z-index: 4;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: rgba(8, 10, 14, 0.94); backdrop-filter: blur(14px); border-top: 1px solid var(--line-2);
  }
  .fieldbar .btn { min-height: 48px; justify-content: center; }
  .fieldbar .btn:not(.go) { flex-direction: column; gap: 1px; font-size: 10.5px; padding: 4px 14px; }
  .fieldbar .btn:not(.go) svg { width: 19px; height: 19px; }
  .fieldbar .btn.go { font-size: 16px; border-radius: 12px; }
  .actions #dSend { display: none; } /* it lives in the field bar on phones */
}
@media (max-width: 760px) {
  .qrcard { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .qrbox { width: min(230px, 64vw); height: min(230px, 64vw); }
  .qrtext { justify-items: center; }
  .sendrow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* =====================================================================
   Responsive: tablet, phone portrait, phone landscape
   ===================================================================== */
.grip, .mv, .optsbtn, .legend em { display: none; }
.legend i { font-style: normal; }
.scanopts { display: grid; gap: 12px; }
.lcard .mv { margin-top: -2px; }

/* ---- tablets & small laptops ---- */
@media (max-width: 1100px) {
  .sys, .brandmark .sub { display: none; }
  .scout { grid-template-columns: minmax(0, 1fr) min(400px, 44vw); }
  .grid2 { grid-template-columns: 1fr; }
  .topbar { gap: 14px; }
}

/* ---- portrait (tablet + phone): the property list becomes a bottom sheet over a full-bleed map ---- */
@media (max-width: 1100px) and (orientation: portrait) {
  .scout { display: block; position: relative; height: 100%; overflow: hidden; --sheet: 50%; }
  .scout[data-sheet='peek'] { --sheet: 150px; }
  .scout[data-sheet='full'] { --sheet: calc(100% - 66px); }
  .mapwrap { position: absolute; inset: 0; min-height: 0; }
  .side {
    position: absolute; left: 0; right: 0; bottom: 0; height: var(--sheet); z-index: 8; border-left: 0;
    border-top: 1px solid var(--line-2); border-radius: 20px 20px 0 0; box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.55);
    transition: height 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); overflow: hidden;
  }
  .side.dragging { transition: none; }
  .grip { display: grid; place-items: center; height: 26px; flex: none; cursor: grab; touch-action: none; }
  .grip span { width: 44px; height: 5px; border-radius: 5px; background: var(--line-2); }
  .grip:active span { background: var(--muted); }
  .side-head { padding: 0 14px 12px; gap: 10px; }
  .side-head .steps { order: -1; }
  .side-head .progress { order: -1; }
  .scout[data-sheet='peek'] .side-head > :not(.steps):not(.progress) { display: none; }
  .scout[data-sheet='peek'] .sortbar { display: none; }
  .hint, .legend, .notice { bottom: calc(var(--sheet) + 12px); transition: bottom 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
  .scout[data-sheet='full'] .legend { display: none; }
}

/* ---- phones (portrait & landscape below 760px wide) ---- */
@media (max-width: 760px) {
  .topbar { gap: 10px; padding: 0 max(12px, env(safe-area-inset-left)) 0 max(12px, env(safe-area-inset-right)); }
  .brandmark img { height: 34px; }
  .input, select.input, textarea.input, .search input, #recentScans { font-size: 16px !important; } /* stop iOS zoom-on-focus */
  .maptools { top: 10px; left: 10px; right: 10px; gap: 8px; }
  .search { flex: 1 1 100%; width: auto; height: 44px; }
  .drawtools span { display: none; }
  .drawtools button { padding: 9px 12px; }
  .legend { left: 10px; right: auto; max-width: calc(100% - 20px); font-size: 10px; gap: 8px; flex-wrap: wrap; padding: 6px 10px; }
  .notice { left: 10px; right: 10px; max-width: none; }
  .hint { width: max-content; max-width: calc(100% - 20px); text-align: center; font-size: 12.5px; }
  /* card: photo + name on top, score bars / channels / chips use the full card width */
  .pcard { grid-template-columns: 60px minmax(0, 1fr); gap: 4px 12px; padding: 12px; align-items: center; }
  .pcard > div:nth-child(2) { display: contents; }
  .thumb { width: 60px; height: 60px; grid-row: 1 / span 2; align-self: start; }
  .thumb .ring { right: 3px; bottom: 3px; width: 32px; height: 32px; }
  .thumb .ring b { font-size: 11px; }
  .pcard h3 { grid-column: 2; align-self: end; font-size: 15px; }
  .pcard .meta { grid-column: 2; align-self: start; }
  .pcard .needs5, .pcard .chanrow, .pcard .chips, .pcard > div > div:not(.needs5):not(.chanrow):not(.chips):not(.meta) { grid-column: 1 / -1; }
  .needs5 { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
  .need-mini { font-size: 9px; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .need-mini b { display: block; font-size: 15px; line-height: 1.2; margin-top: 1px; }
  .list { overflow-x: hidden; }
  .need-mini .t { height: 5px; }
  .chanrow { margin-top: 6px; }
  .cdot { width: 26px; height: 26px; font-size: 10.5px; }
  .sortbar { scrollbar-width: none; padding: 8px 12px; }
  .sortbar::-webkit-scrollbar { display: none; }
  .list { padding: 10px; }

  /* dossier: full screen */
  .drawer { width: 100vw; border-left: 0; }
  .hero { height: 230px; grid-template-columns: 1fr; }
  .hero .ph:not(:first-child) { display: none; }
  .hero .top { top: max(12px, env(safe-area-inset-top)); left: 14px; right: 12px; }
  .hero .top .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .hero .title { left: 16px; right: 16px; bottom: 14px; gap: 12px; }
  .hero h1 { font-size: 22px; }
  .hero .sub { font-size: 12px; }
  .hero .ring.lg { width: 62px; height: 62px; }
  .hero .ring.lg b { font-size: 19px; }
  .actions { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 10px 16px; -webkit-overflow-scrolling: touch; }
  .actions::-webkit-scrollbar, .hero .top .chips::-webkit-scrollbar { display: none; }
  .actions > * { flex: none; }
  .actions .grow { display: none; }
  .sec { padding: 18px 16px; }
  .needs-row { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 128px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; margin: 0 -16px; padding: 0 16px 4px; }
  .techrow { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .tech { padding: 10px; }
  .tech .k { font-size: 9.5px; letter-spacing: 0.05em; }
  .tech .v { font-size: 13px; }
  .needbox { scroll-snap-align: start; }
  .gallery { grid-template-columns: repeat(3, 1fr); }
  .frames { grid-template-columns: 1fr; }
  .frames .phone { width: 150px; justify-self: center; }
  .grid3 { grid-template-columns: 1fr; }
  /* services: a swipeable row instead of a very tall stack */
  .grid3:has(> .svc) { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 78%; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; margin: 0 -16px; padding: 0 16px 6px; scrollbar-width: none; }
  .grid3:has(> .svc)::-webkit-scrollbar { display: none; }
  .grid3 > .svc { scroll-snap-align: start; align-content: start; }
  .kv { grid-template-columns: 96px 1fr; }
  .timeline div { grid-template-columns: 84px 1fr; }
  .bd { grid-template-columns: 1fr; }
  .chgrid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

  /* modal: bottom sheet */
  .modal { padding: 0; place-items: end stretch; }
  .modal .box { width: 100%; max-height: 94dvh; border-radius: 20px 20px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .modal .head { position: sticky; top: 0; background: var(--bg-2); z-index: 2; flex-wrap: wrap; gap: 10px; padding-top: 14px; padding-bottom: 12px; }
  .modal .head h3 { flex: 1 1 100%; font-size: 15px; line-height: 1.3; padding-right: 48px; }
  .modal .head > .row { flex: 1 1 100%; }
  .modal .head .btn.icon { position: absolute; top: 10px; right: 12px; }
  .modal .body .row .btn { flex: 1 1 auto; justify-content: center; }
  .modal .head, .modal .body { padding-left: 16px; padding-right: 16px; }

  /* pipeline: one swipeable column per screen */
  .pipe-head { padding: 10px 14px 12px; gap: 8px; }
  .pipe-head h1 { font-size: 18px; flex: 1; }
  .pipe-head .spacer { display: none; }
  #csvBtn { order: 1; }
  #pipeSearch { order: 2; flex: 1 1 52%; width: auto !important; min-width: 0; }
  #pipeSort { order: 3; flex: 1 1 38%; width: auto !important; min-width: 0; }
  .funnel { order: 5; flex: 1 1 100%; overflow-x: auto; scrollbar-width: none; }
  .funnel div { flex: none; }
  #upgradeBtn { order: 6; flex: 1 1 100%; justify-content: center; }
  .board { grid-auto-columns: 86vw; gap: 10px; padding: 12px 14px; scroll-snap-type: x mandatory; scroll-padding: 0 14px; }
  .col { scroll-snap-align: start; }

  /* brand & insights */
  .brand-wrap, .ins-wrap { padding: 18px 14px 90px; }
  .rowedit { grid-template-columns: 1fr !important; }
  /* service: name + price on one line, description below */
  .rowedit:has([data-svc]) { grid-template-columns: minmax(0, 1fr) 96px !important; }
  .rowedit [data-f='blurb'] { grid-column: 1 / -1; }
  /* portfolio item: thumbnail and delete on top, fields full width below */
  .rowedit:has([data-list]) { grid-template-columns: 80px minmax(0, 1fr) 40px !important; }
  .rowedit:has([data-list]) > input { grid-column: 1 / -1; }
  .rowedit:has([data-list]) > :last-child:not(input) { grid-row: 1; grid-column: 3; }
  .ins-grid { grid-template-columns: minmax(0, 1fr); }
  .ins-wrap > *, .ins-grid > *, .brand-wrap > * { min-width: 0; }
  .ins-wrap .card .needs-row { margin: 0 -16px; }
  .kpis5 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi5 { padding: 12px; min-width: 0; }
  .kpi5 .l { overflow-wrap: anywhere; }
  .lightbox img { max-width: 100vw; border-radius: 0; }
}

/* ---- phones, either orientation: fold the scan options away so the list gets the room ---- */
@media (max-width: 760px), (max-height: 520px) and (orientation: landscape) {
  .optsbtn { display: inline-flex; flex: none; }
  .scanopts { display: none; }
  .side-head.opts-open .scanopts { display: grid; }
  .side-head h2 { gap: 8px; justify-content: flex-start; }
  .side-head h2 .ttl { display: none; }
  .side-head #recentScans { flex: 1; min-width: 0; max-width: none !important; }
  .legend { flex-wrap: nowrap; white-space: nowrap; }
  .legend i { display: none; }
  .legend em { display: inline; font-style: normal; }
}

/* ---- phone portrait: navigation moves to a bottom tab bar ---- */
@media (max-width: 760px) and (orientation: portrait) {
  :root { --tabbar: calc(60px + env(safe-area-inset-bottom)); }
  .shell { grid-template-rows: calc(44px + env(safe-area-inset-top)) 1fr; }
  .topbar { padding-top: env(safe-area-inset-top); backdrop-filter: none; background: var(--bg); }
  .brandmark img { height: 30px; }
  main { padding-bottom: var(--tabbar); }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: var(--tabbar);
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 6px 8px env(safe-area-inset-bottom);
    background: rgba(10, 12, 17, 0.94); backdrop-filter: blur(16px); border-top: 1px solid var(--line-2);
  }
  .nav a { flex-direction: column; justify-content: center; gap: 3px; padding: 4px 2px; border-radius: 12px; font-size: 10.5px; position: relative; min-width: 0; }
  .nav a.active { box-shadow: none; background: rgba(47, 140, 255, 0.14); color: var(--blue-2); }
  .nav svg { width: 21px; height: 21px; }
  .nav .lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav .count { position: absolute; top: 2px; left: calc(50% + 6px); font-size: 10px; padding: 0 6px; }
  .toast { bottom: calc(var(--tabbar) + 14px); }
  .scout[data-sheet='full'] { --sheet: calc(100% - 64px); }
}

/* ---- phone landscape: short screen, keep map and list side by side ---- */
@media (max-height: 520px) and (orientation: landscape) {
  .shell { grid-template-rows: 48px 1fr; }
  .topbar { gap: 10px; padding: 0 max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); }
  .brandmark img { height: 30px; }
  .sys, .brandmark .sub { display: none; }
  .nav a { padding: 6px 12px; }
  .nav .lbl { display: none; }
  .input, select.input, textarea.input, .search input { font-size: 16px; }
  .scout { grid-template-columns: minmax(0, 1fr) min(380px, 46vw); }
  .side { overflow-y: auto; padding-right: env(safe-area-inset-right); }
  .side-head { padding: 10px 12px; gap: 8px; }
  .sortbar { position: sticky; top: 0; z-index: 2; background: var(--bg-2); padding: 8px 12px; }
  .list { overflow: visible; flex: none; padding: 10px; }
  .maptools { top: 8px; left: max(8px, env(safe-area-inset-left)); right: 8px; flex-wrap: nowrap; }
  .search { height: 38px; width: auto; flex: 1 1 auto; min-width: 0; }
  .drawtools span { display: none; }
  .legend { font-size: 10px; gap: 8px; padding: 5px 9px; right: 8px; bottom: 10px; left: auto; max-width: calc(100% - 16px); flex-wrap: wrap; }
  .hint, .notice { bottom: 10px; }

  .drawer { width: 100vw; padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .hero { height: 170px; }
  .hero h1 { font-size: 22px; }
  .hero .title { bottom: 12px; }
  .actions { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 8px 16px; }
  .actions > * { flex: none; }
  .actions .grow { display: none; }
  .sec { padding: 16px 18px; }
  .needs-row { grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-flow: row; overflow: visible; margin: 0; padding: 0; gap: 8px; }
  .needbox { padding: 10px 6px; }
  .needbox .why { display: none; }
  .frames { grid-template-columns: 1fr 130px; }
  .gallery { grid-template-columns: repeat(5, 1fr); }
  .grid3 { grid-template-columns: repeat(3, 1fr); }

  .modal { padding: 8px; }
  .modal .box { max-height: calc(100dvh - 16px); border-radius: 16px; }

  .pipe-head { padding: 8px 14px; gap: 8px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .pipe-head > * { flex: none; }
  .pipe-head h1 { font-size: 16px; }
  .pipe-head .spacer { display: none; }
  .funnel b { font-size: 14px; }
  .funnel div { padding: 4px 9px; }
  .board { grid-auto-columns: minmax(260px, 42vw); padding: 10px 14px; scroll-snap-type: x proximity; }
  .col { scroll-snap-align: start; }
  .brand-wrap, .ins-wrap { padding: 16px max(16px, env(safe-area-inset-right)) 60px max(16px, env(safe-area-inset-left)); }
}

/* ---- touch devices: bigger targets, no hover lift, tap-to-move instead of drag ---- */
@media (pointer: coarse) {
  .btn { min-height: 40px; }
  .btn.sm { min-height: 34px; }
  .btn.icon { width: 40px; }
  .pill { padding: 7px 12px; }
  .seg button { padding: 8px 14px; }
  .check input { width: 18px; height: 18px; }
  .gallery img:hover { transform: none; }
  .lcard { cursor: pointer; }
  .lcard .mv { display: block; padding: 7px 10px; }
}
