/* Layout: a field-survey console. A full-height Google map of East Java, a ledger of places on the
   left, a field-notes drawer on the right; Journey and Board views for the 60-day plan and ideas. */
:root {
  --bg: #EEF2EC; --surface: #FBFCFA; --surface-2: #F3F6F1; --ink: #16211A; --muted: #56665B; --line: #D3DCD1;
  --accent: #2F7A4C; --accent-ink: #F7FBF8; --accent-soft: #DCEBDF;
  --grower: #2F7A4C; --trader: #B07A12; --firm: #3B5FB0; --office: #5C6970; --buyer: #B3443A;
  --st-new: #7A877E; --st-contacted: #3B6FB0; --st-replied: #1F8A8A; --st-visited: #B07A12; --st-sampled: #7A4FB0; --st-qualified: #2F7A4C; --st-rejected: #A2453B;
  --warn: #9A5B08; --warn-soft: #FBF1DF; --shadow: 0 10px 30px rgba(22,33,26,.14);
  --f-display: 'Bricolage Grotesque', 'Trebuchet MS', sans-serif;
  --f-body: 'Public Sans', 'Segoe UI', Arial, sans-serif;
  --f-mono: 'JetBrains Mono', 'Courier New', monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #0F1512; --surface: #161F1A; --surface-2: #1C2620; --ink: #E6EEE8; --muted: #9AAEA2; --line: #2B3931;
  --accent: #62B781; --accent-ink: #0F1512; --accent-soft: #1F3428;
  --grower: #62B781; --trader: #DCA741; --firm: #86A3E6; --office: #9DABB3; --buyer: #E5847A;
  --st-new: #8D9C92; --st-contacted: #86A3E6; --st-replied: #5FC2C2; --st-visited: #DCA741; --st-sampled: #B79BE8; --st-qualified: #62B781; --st-rejected: #E5847A;
  --warn: #E2A447; --warn-soft: #2E2716; --shadow: 0 10px 30px rgba(0,0,0,.45); color-scheme: dark } }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 14px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.app { height: 100%; display: grid; grid-template-rows: auto auto 1fr; padding: 12px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px)); gap: 10px; }

.top { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mark { width: 34px; height: 34px; border-radius: 50% 50% 50% 8px; background: var(--accent); position: relative; flex: none; transform: rotate(-12deg); }
.mark::after { content: ""; position: absolute; left: 15px; top: 6px; width: 3px; height: 22px; border-radius: 2px; background: var(--accent-ink); opacity: .8; }
.brand h1 { font-family: var(--f-display); font-size: 22px; font-weight: 750; letter-spacing: -.01em; margin: 0; line-height: 1.1; }
.brand p { margin: 0; color: var(--muted); font-size: 13px; }
.countdown { margin-left: auto; display: grid; gap: 3px; min-width: 240px; flex: 0 1 380px; }
.countdown .row { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; color: var(--muted); }
.countdown b { font-family: var(--f-display); font-size: 16px; color: var(--ink); font-weight: 700; }
.track { height: 7px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.track span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.track .bar-steps { background: var(--st-contacted); }
.who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: 12px; color: var(--accent-ink); background: var(--accent); flex: none; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: none; padding: 8px 14px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab .n { font-family: var(--f-mono); font-size: 12px; color: var(--muted); margin-left: 4px; }
main { min-height: 0; position: relative; }
.view { height: 100%; min-height: 0; }

#view-map { display: grid; grid-template-columns: minmax(300px, 360px) 1fr; gap: 12px; }
.side { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.stat { padding: 10px 8px; text-align: center; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat b { display: block; font-family: var(--f-display); font-size: 20px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat-due b { color: var(--warn); }
.filters { padding: 10px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.input { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.g-grower { --c: var(--grower); } .g-trader { --c: var(--trader); } .g-firm { --c: var(--firm); } .g-office { --c: var(--office); } .g-buyer { --c: var(--buyer); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; background: var(--c, var(--muted)); }
.ring { width: 10px; height: 10px; border-radius: 50%; border: 2px dashed var(--muted); display: inline-block; }
/* Pin shapes, matching the map: circle grower, square trader, diamond company, triangle office, star buyer. */
.shape { width: 11px; height: 11px; display: inline-block; flex: none; background: var(--muted); }
.shape-grower { border-radius: 50%; }
.shape-trader { border-radius: 1px; }
.shape-firm { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.shape-office { clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.shape-buyer { clip-path: polygon(50% 0, 63% 35%, 100% 35%, 70% 57%, 81% 92%, 50% 70%, 19% 92%, 30% 57%, 0 35%, 37% 35%); width: 13px; height: 13px; }
.filter-row { display: flex; gap: 8px; }
.filter-row select { flex: 1; min-width: 0; }
.list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; }
.item { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: start; }
.item:hover { background: var(--surface-2); }
.item[aria-current="true"] { background: var(--accent-soft); }
.item .rk { font-family: var(--f-mono); font-size: 12px; color: var(--muted); padding-top: 2px; display: flex; align-items: center; gap: 5px; }
.item .nm { font-weight: 600; line-height: 1.3; min-width: 0; overflow-wrap: anywhere; }
.item .ar { font-size: 12px; color: var(--muted); }
.next { font-size: 12px; color: var(--st-contacted); margin-top: 2px; }
.next.late { color: var(--warn); font-weight: 600; }
.pill { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; white-space: nowrap; border: 1px solid currentColor; }
.s-new { color: var(--st-new); } .s-contacted { color: var(--st-contacted); } .s-replied { color: var(--st-replied); } .s-visited { color: var(--st-visited); } .s-sampled { color: var(--st-sampled); } .s-qualified { color: var(--st-qualified); } .s-rejected { color: var(--st-rejected); }
.tag { font-size: 11px; color: var(--muted); border: 1px dashed var(--line); border-radius: 4px; padding: 0 4px; }
.now-tag { color: var(--accent); border-color: var(--accent); font-weight: 600; font-family: var(--f-body); }
.side-foot { padding: 10px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 12px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 4px 6px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.empty { padding: 24px 16px; color: var(--muted); text-align: center; }

.mapwrap { position: relative; min-height: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface-2); }
#map { position: absolute; inset: 0; }
.map-msg { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 7; width: min(520px, calc(100% - 32px)); padding: 14px 16px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: 10px; box-shadow: var(--shadow); font-size: 13.5px; }
.legend { position: absolute; left: 10px; bottom: 26px; z-index: 5; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: grid; gap: 5px; font-size: 12px; box-shadow: var(--shadow); max-width: calc(100% - 20px); }
.legend .lg { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.legend .lg span { display: inline-flex; align-items: center; gap: 5px; }
.legend .lg-toggle { color: var(--muted); }
.legend .chip { padding: 2px 8px; font-size: 11px; }
.legend .lg-showing { margin-left: 6px; color: var(--ink); font-weight: 600; }
.legend .lg-showing.hint { font-weight: 400; }
.lg-btn { display: inline-flex; align-items: center; gap: 5px; border: 1px solid transparent; background: none; padding: 2px 7px; border-radius: 99px; font-size: 12px; cursor: pointer; color: var(--ink); }
.lg-btn:hover { border-color: var(--line); background: var(--surface-2); }
.lg-btn[aria-pressed="true"] { border-color: var(--ink); background: var(--surface-2); font-weight: 700; }
.lg-btn .n { font-family: var(--f-mono); font-size: 11px; color: var(--muted); }
.home-key { width: 10px; height: 10px; background: var(--ink); transform: rotate(45deg); display: inline-block; border-radius: 2px; }
.pick-hint { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 6; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 99px; font-weight: 600; display: flex; gap: 10px; align-items: center; }
.pick-hint button { background: none; border: 1px solid var(--bg); color: var(--bg); border-radius: 99px; padding: 2px 10px; cursor: pointer; }

.detail { position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100%); z-index: 10; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 0; }
.d-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); display: grid; gap: 6px; position: relative; }
.d-head .kicker { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); display: flex; gap: 8px; align-items: center; padding-right: 64px; }
.d-head h2 { font-family: var(--f-display); font-size: 21px; line-height: 1.2; margin: 0; text-wrap: balance; overflow-wrap: anywhere; padding-right: 40px; }
.d-close { position: absolute; top: 10px; right: 10px; }
.d-body { overflow-y: auto; padding: 12px 16px 16px; display: grid; gap: 14px; align-content: start; }
.d-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.d-actions select, .st-sel { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; }
#stSel.st-new { color: var(--st-new); } #stSel.st-contacted { color: var(--st-contacted); } #stSel.st-replied { color: var(--st-replied); } #stSel.st-visited { color: var(--st-visited); } #stSel.st-sampled { color: var(--st-sampled); } #stSel.st-qualified { color: var(--st-qualified); } #stSel.st-rejected { color: var(--st-rejected); }
.next-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); display: grid; gap: 6px; }
.next-box.late { border-color: var(--warn); background: var(--warn-soft); }
.next-row { display: grid; grid-template-columns: 1fr 140px auto auto; gap: 6px; align-items: center; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 6px 12px; font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.mono { font-family: var(--f-mono); font-size: 12.5px; }
.contact { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.contact .mono { user-select: all; overflow-wrap: anywhere; }
.flag { border-left: 3px solid var(--warn); padding: 6px 10px; background: var(--surface-2); border-radius: 0 8px 8px 0; font-size: 13px; }
.section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 0 0 6px; }
.notes { display: grid; gap: 8px; }
.note { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface); display: grid; gap: 4px; }
.note .meta { font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.note.finding { border-left: 3px solid var(--accent); }
.note p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.edit-note { display: grid; gap: 6px; }
.edit-note textarea { resize: vertical; }
.edit-note .row { display: flex; gap: 6px; justify-content: flex-end; }
.compose { display: grid; gap: 6px; }
.compose textarea { width: 100%; min-height: 64px; resize: vertical; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.compose .row { display: flex; gap: 8px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.compose .row-l { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hint { font-size: 12px; color: var(--muted); margin: 0; }
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.thumbs:empty { display: none; }
.thumb { position: relative; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; font-size: 11px; color: var(--muted); text-align: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(22,33,26,.75); color: #fff; font-size: 14px; line-height: 1; cursor: pointer; padding: 0; }
.thumbs.view .thumb { width: 96px; height: 96px; }
.thumbs.view { margin-top: 4px; }

#view-journey { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 12px; overflow: hidden; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.panel-head { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel-head h2 { font-family: var(--f-display); font-size: 18px; margin: 0; }
.panel-head p { margin: 0; color: var(--muted); font-size: 13px; }
.panel-body { overflow-y: auto; padding: 12px 16px; display: grid; gap: 14px; align-content: start; flex: 1; }
.phase { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px; background: var(--surface); }
.phase.now { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.phase.complete { opacity: .85; }
.phase-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.phase-head h3 { font-family: var(--f-display); font-size: 16px; margin: 0; display: flex; gap: 8px; align-items: center; }
.phase-pct { text-align: right; display: grid; }
.phase-pct b { font-family: var(--f-display); font-size: 20px; line-height: 1; font-variant-numeric: tabular-nums; }
.phase-pct span { font-size: 11.5px; color: var(--muted); }
.steps { display: grid; gap: 4px; }
.ms { display: grid; grid-template-columns: 118px 1fr auto; gap: 8px; align-items: start; padding: 6px 8px; border-radius: 8px; }
.ms:hover { background: var(--surface-2); }
.ms .st-sel { padding: 4px 6px; font-size: 12px; width: 118px; }
.ms.st-done .st-sel { color: var(--st-qualified); } .ms.st-doing .st-sel { color: var(--st-contacted); } .ms.st-blocked .st-sel { color: var(--st-rejected); }
.ms .t { min-width: 0; overflow-wrap: anywhere; padding-top: 4px; }
.ms.st-done .t { color: var(--muted); text-decoration: line-through; }
.ms.st-blocked .t { color: var(--st-rejected); }
.ms.goal { background: var(--accent-soft); }
.ms.goal .t { font-weight: 700; }
.ms .m { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; text-align: right; padding-top: 4px; }
.ms .late { color: var(--warn); font-weight: 700; }
.add-ms { display: grid; grid-template-columns: 1fr 140px 160px auto; gap: 8px; width: 100%; }

#view-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); display: grid; gap: 6px; }
.card p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.card .meta { font-size: 11.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.card .acts { display: flex; gap: 2px; }
.col-decision .panel-head h2 { color: var(--accent); }
.board-form { width: 100%; }

/* market radar */
#view-radar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.radar-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.radar-bar { padding: 10px 16px; border-bottom: 1px solid var(--line); display: grid; gap: 6px; }
.banner { margin: 10px 16px 0; background: var(--warn-soft); border: 1px solid var(--warn); color: var(--ink); border-radius: 10px; padding: 8px 12px; font-size: 13px; }
.lane-buyers { --c: var(--buyer); } .lane-rules { --c: var(--firm); } .lane-competitors { --c: var(--trader); } .lane-market { --c: var(--grower); }
.ritem { border: 1px solid var(--line); border-left: 4px solid var(--c, var(--line)); border-radius: 10px; padding: 10px 14px; background: var(--surface); display: grid; gap: 6px; }
.ritem.saved { background: var(--accent-soft); }
.ritem.dismissed { opacity: .6; }
.ritem h3 { font-family: var(--f-display); font-size: 16px; margin: 0; line-height: 1.3; overflow-wrap: anywhere; }
.rmeta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.lane-tag { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; color: var(--c); text-transform: uppercase; letter-spacing: .06em; font-size: 11px; }
.rel { font-family: var(--f-mono); font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.rel-hi { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.rel-mid { border-color: var(--muted); color: var(--ink); }
.rsum, .rbuyer { margin: 0; font-size: 13.5px; overflow-wrap: anywhere; }
.rbuyer { color: var(--buyer); }
.rtags { display: flex; flex-wrap: wrap; gap: 4px; }
.rorig { margin: -2px 0 0; font-size: 12px; overflow-wrap: anywhere; }
.phase-tag { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); vertical-align: 1px; }

/* radar list: clickable cards */
.ritem { cursor: pointer; }
.ritem:hover { border-color: var(--muted); }
.ritem:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ritem.unread h3 { font-weight: 800; }
.unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 7px; vertical-align: 2px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.digest-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: -6px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.brief-pick { font-size: 12px; padding: 2px 6px; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; }
.dhead { font-family: var(--f-display); font-size: 21px; line-height: 1.3; margin: 0; }
.boverview { margin: -6px 0 0; font-size: 14.5px; line-height: 1.6; }
.bgrid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.bsec h4, .rsec h4 { margin: 0 0 6px; font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.bsec ul, .bsec ol { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: 14px; line-height: 1.5; }
.bsec li { overflow-wrap: anywhere; }
.bsec li.lane-buyers, .bsec li.lane-rules, .bsec li.lane-competitors, .bsec li.lane-market { list-style: none; margin-left: -18px; }
.bsec .dot { background: var(--c); }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; text-align: left; }
.reader-article { display: grid; gap: 14px; }
.rhead { font-family: var(--f-display); font-size: 22px; line-height: 1.3; margin: 0; overflow-wrap: anywhere; }
.rsec p { margin: 0 0 6px; font-size: 14.5px; line-height: 1.6; overflow-wrap: anywhere; }
.rsec ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; line-height: 1.5; }
.rsec-impact { background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; }
.rsec-buyer { border: 1px solid var(--buyer); border-radius: 10px; padding: 10px 14px; }
.rfound { margin: 0; font-size: 12px; }

/* radar: card grid */
.radar-grid { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); align-items: start; }

/* digest page */
#view-digest { display: grid; grid-template-columns: minmax(230px, 290px) minmax(0, 1fr); gap: 12px; }
#digestList { gap: 6px; padding: 10px; }
.dig-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; text-align: left; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 9px 12px; cursor: pointer; font: inherit; }
.dig-item:hover { border-color: var(--muted); }
.dig-item.on { border-color: var(--accent); background: var(--accent-soft); }
.dig-item.quiet .dig-head { color: var(--muted); }
.dig-when { font-weight: 700; font-size: 13.5px; }
.dig-kind { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); align-self: center; }
.dig-item.weekly .dig-kind { color: var(--accent); }
.dig-head { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#digestBody { gap: 16px; padding: 18px 22px 24px; }
#digestBody .bgrid { grid-template-columns: 1fr 1fr; gap: 18px 24px; }
#digestBody .bsec:first-child { grid-column: 1 / -1; }

/* popup sheet: centred card on desktop, full screen on phones */
.sheet { position: fixed; inset: 0; z-index: 120; background: rgba(10,16,12,.5); display: grid; place-items: center; padding: 24px; }
.sheet[hidden] { display: none; }
.sheet-card { width: min(760px, 100%); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.sheet-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); }
.sheet-bar .btn.link { display: none; }
.sheet-title { flex: 1; font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-x { border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); width: 34px; height: 34px; border-radius: 99px; font-size: 20px; line-height: 1; cursor: pointer; }
.sheet-body { overflow-y: auto; padding: 18px 22px 24px; display: grid; gap: 12px; overscroll-behavior: contain; }
.sheet-foot { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 22px; border-top: 1px solid var(--line); background: var(--surface); }
.sheet-foot[hidden] { display: none; }
html.sheet-open, html.sheet-open body { overflow: hidden; }
.tab .ti { display: none; }

.run { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; display: grid; gap: 4px; }
.run-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.run-running .pill { color: var(--st-contacted); } .run-done .pill { color: var(--st-qualified); } .run-failed .pill { color: var(--st-rejected); }
.run details div { overflow-wrap: anywhere; }

.modal { position: fixed; inset: 0; z-index: 100; background: rgba(10,16,12,.45); display: grid; place-items: center; padding: 16px; }
.dialog { width: min(560px, 100%); max-height: calc(100% - 24px); overflow-y: auto; background: var(--surface); border-radius: 14px; border: 1px solid var(--line); box-shadow: var(--shadow); padding: 18px; display: grid; gap: 12px; }
.dialog h2 { font-family: var(--f-display); margin: 0; font-size: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid .full { grid-column: 1 / -1; }
label.f { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
label.f .input, label.f select, label.f textarea { font-weight: 400; color: var(--ink); }
label.f textarea { min-height: 70px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); resize: vertical; }
label.f select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.err { color: var(--st-rejected); font-size: 12.5px; margin: 0; }
.dialog .row { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.people { display: grid; gap: 6px; }
.person { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.person .who-t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast { position: fixed; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); z-index: 200; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 99px; font-weight: 600; box-shadow: var(--shadow); max-width: calc(100% - 32px); }

/* sign-in pages */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 28px; display: grid; gap: 14px; }
.auth-card h1 { font-family: var(--f-display); font-size: 26px; margin: 0; line-height: 1.15; }
.auth-card p { margin: 0; color: var(--muted); }
.auth-card form { display: grid; gap: 10px; }
.code-input { font-family: var(--f-mono); font-size: 24px; letter-spacing: 6px; text-align: center; }

@media (max-width: 860px) {
  .app { height: auto; min-height: 100%; }
  html, body { height: auto; }
  #view-map { grid-template-columns: 1fr; height: auto; }
  .mapwrap { height: 55vh; min-height: 320px; order: -1; }
  .list { overflow: visible; }
  .detail { position: fixed; inset: 0; width: 100%; border-radius: 0; }
  #view-journey, #view-board, #view-radar { grid-template-columns: 1fr; height: auto; }
  .panel, .panel-body { overflow: visible; }
  .countdown { margin-left: 0; flex-basis: 100%; }
  .add-ms { grid-template-columns: 1fr 1fr; }
  .add-ms .input:first-child { grid-column: 1 / -1; }
  .next-row { grid-template-columns: 1fr 1fr; }
  .next-row .input:first-child { grid-column: 1 / -1; }
  .ms { grid-template-columns: 1fr; }
  .ms .m { justify-content: flex-start; text-align: left; }
  .form-grid { grid-template-columns: 1fr; }
}

/* phones: app-style bottom tab bar, compact header, full-screen popups */
@media (max-width: 860px) {
  .app { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); gap: 8px; }
  .brand p { display: none; }
  .brand h1 { font-size: 19px; }
  .top { gap: 10px; }
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; border: 0; border-top: 1px solid var(--line); background: var(--surface); padding: 4px max(4px, env(safe-area-inset-left, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-right, 0px)); box-shadow: 0 -6px 20px rgba(0,0,0,.12); }
  .tab { position: relative; display: grid; justify-items: center; align-content: center; gap: 3px; padding: 7px 2px 4px; border: 0; border-radius: 12px; font-size: 11px; font-weight: 600; min-height: 54px; }
  .tab .ti { display: block; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tab[aria-selected="true"] { color: var(--accent); border: 0; }
  .tab[aria-selected="true"] .ti { stroke-width: 2.3; }
  .tab .n { display: none; }
  .tab #nRadar:not(:empty), .tab #nDigest:not(:empty) { display: block; position: absolute; top: 3px; left: calc(50% + 7px); margin: 0; min-width: 18px; padding: 0 5px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font: 700 10px/17px var(--f-body); text-align: center; }
  .toast { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
  .detail { z-index: 95; }
  .radar-grid { grid-template-columns: 1fr; }
  .radar-actions { width: 100%; justify-content: space-between; }
  .radar-actions .hint { flex-basis: 100%; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  #view-digest { grid-template-columns: 1fr; }
  .digest-index .panel-head { display: none; }
  #digestList { display: flex; overflow-x: auto; gap: 8px; padding: 10px 12px; scrollbar-width: none; }
  #digestList::-webkit-scrollbar { display: none; }
  .dig-item { flex: none; grid-template-columns: auto; padding: 7px 12px; border-radius: 99px; }
  .dig-item .dig-head, .dig-item .dig-kind { display: none; }
  .dig-item.weekly .dig-when::after { content: ' · week'; color: var(--accent); font-weight: 600; }
  #digestBody { padding: 16px; scroll-margin-top: 8px; }
  #digestBody .bgrid { grid-template-columns: 1fr; }
  .sheet { padding: 0; place-items: stretch; background: var(--surface); }
  .sheet-card { width: 100%; max-height: none; height: 100%; border: 0; border-radius: 0; box-shadow: none; }
  .sheet-bar { padding: calc(8px + env(safe-area-inset-top, 0px)) 10px 8px; position: sticky; top: 0; background: var(--surface); }
  .sheet-bar .btn.link { display: inline-flex; font-size: 14px; }
  .sheet-title { text-align: center; }
  .sheet-body { padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .sheet-foot { padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .sheet-foot .btn.primary { flex-basis: 100%; justify-content: center; }
  .sheet-foot .btn { flex: 1 1 auto; justify-content: center; }
}
@media (max-width: 860px) and (prefers-reduced-motion: no-preference) {
  .sheet:not([hidden]) .sheet-card { animation: sheet-up .22s ease-out; }
  @keyframes sheet-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
}
@media (prefers-reduced-motion: no-preference) { .item, .btn, .chip { transition: background-color .12s, border-color .12s; } }
@media (prefers-reduced-motion: reduce) { .track span { transition: none; } }
