:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #1c2330;
  --muted: #6b7585;
  --line: #e3e7ee;
  --accent: #0e7c66;
  --accent-soft: #e0f2ee;
  --sale: #2b6cb0;
  --rent: #2f855a;
  --gone: #9aa3b2;
  --danger: #c0392b;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 30, 50, .08), 0 4px 14px rgba(20, 30, 50, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 14px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--ink);
  /* Kills iOS double-tap-to-zoom (and its 300 ms tap delay). Deliberately NOT
     user-scalable=no in the viewport meta: this keeps pinch-to-zoom working, so
     photos and the map can still be zoomed. Browsers intersect touch-action with
     ancestors, so this covers the whole page. */
  touch-action: manipulation;
}
h1 { font-size: 18px; margin: 0; }
h3 { margin: 0 0 10px; font-size: 14px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
.center { text-align: center; padding: 14px; }

header {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 10px 20px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 900;
}
.brand { display: flex; align-items: baseline; gap: 12px; }
nav { display: flex; gap: 4px; }
.tab {
  border: 0; background: transparent; padding: 8px 14px; border-radius: 8px;
  font-size: 14px; cursor: pointer; color: var(--muted);
}
.tab:hover { background: var(--bg); }
.tab.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

main { max-width: 1280px; margin: 0 auto; padding: 16px 20px 60px; }
.tabpane { display: none; }
.tabpane.active { display: block; }

/* filters — wrapped in <details>; the summary only shows on phones (mobile block at the end) */
.filtersum { display: none; }
.filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px; margin-bottom: 12px;
}
.filters select, .filters input {
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font: inherit; min-width: 0;
}
.filters input[type=number] { width: 110px; }
.filters input[type=search] { width: 190px; }
#occ-filter { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); white-space: nowrap; }
/* suburb multi-picker */
.subpick { position: relative; display: inline-block; }
.subbtn { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; color: var(--ink); cursor: pointer; }
.subbtn.active { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.subpanel { position: absolute; z-index: 950; top: calc(100% + 4px); left: 0; width: 250px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 22px rgba(0,0,0,.16); padding: 8px; }
.subpanel-top { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.subpanel-top input { flex: 1 1 auto; min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
.miniseg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex: 0 0 auto; }
.miniseg button { border: 0; background: #fff; padding: 6px 9px; cursor: pointer; font: inherit; font-size: 12px; color: var(--muted); }
.miniseg button.on { background: var(--accent); color: #fff; }
.suboptions { max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.subopt { display: flex; align-items: center; gap: 7px; padding: 5px 8px; font-size: 13px; cursor: pointer; }
.subopt:hover { background: var(--bg); }
.subpanel-bot { display: flex; justify-content: space-between; margin-top: 6px; }
.subpanel-bot .btn, .subpanel-bot .ghostbtn { padding: 5px 12px; margin: 0; }
#occ-filter label { display: inline-flex; gap: 4px; align-items: center; }
#occ-filter input[type=date] { width: 140px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button {
  border: 0; background: #fff; padding: 7px 12px; cursor: pointer; font: inherit;
  color: var(--muted); border-right: 1px solid var(--line);
}
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: #fff; }
.chk { display: flex; gap: 5px; align-items: center; color: var(--muted); white-space: nowrap; }
.count { margin: 2px 4px 10px; }
.ghostbtn {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  padding: 7px 12px; border-radius: 8px; font: inherit; cursor: pointer; margin-left: auto;
}
.ghostbtn:hover { background: var(--bg); color: var(--ink); }
.maptools {
  display: flex; align-items: center; gap: 12px; margin-bottom: 10px;
}
.runbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.runbar select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; }
.runlog {
  margin: 12px 0 0; padding: 10px 12px; background: #0f1722; color: #d6e2f0;
  border-radius: 8px; font: 12px/1.5 ui-monospace, Consolas, monospace;
  max-height: 280px; overflow: auto; white-space: pre-wrap; word-break: break-word;
}
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line);
  border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite;
  vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* cards grid */
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(252px, 1fr));
}
.lcard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; box-shadow: var(--shadow);
  transition: transform .08s ease;
  display: flex; flex-direction: column;
}
.lcard:hover { transform: translateY(-2px); }
.lcard .ph {
  height: 160px; background: #dde3ea center/cover no-repeat; position: relative;
}
.lcard .ph .badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 5px; }
.badge {
  font-size: 11px; font-weight: 700; letter-spacing: .3px; padding: 2px 8px;
  border-radius: 20px; color: #fff; background: var(--sale);
}
.badge.rent { background: var(--rent); }
.badge.gone { background: var(--gone); }
.badge.cut { background: var(--danger); }
.badge.link { background: #805ad5; }
.badge.dev { background: #b7791f; }
.badge.offer { background: #d69e2e; }
.badge.grade-A { background: #2f855a; }
.badge.grade-B { background: #0e7c66; }
.badge.grade-C { background: #2b6cb0; }
.badge.grade-D { background: #7a5cc0; }
.badge.grade-E { background: #b7791f; }
.badge.grade-F { background: #c0392b; }
.lcard .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.price { font-size: 17px; font-weight: 700; }
.price .was { font-size: 12px; font-weight: 400; color: var(--danger); text-decoration: line-through; margin-left: 6px; }
.tttl { font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.chip {
  font-size: 11.5px; background: var(--bg); border: 1px solid var(--line);
  padding: 1px 7px; border-radius: 14px; color: var(--muted); white-space: nowrap;
}
.meta { margin-top: auto; padding-top: 6px; font-size: 12px; color: var(--muted); }

.btn {
  background: var(--accent); color: #fff; border: 0; padding: 9px 22px;
  border-radius: 8px; font: inherit; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }

/* map */
#map { height: calc(100vh - 240px); min-height: 460px; border-radius: var(--radius); border: 1px solid var(--line); }

/* areas tab */
.areas-wrap { display: flex; gap: 12px; align-items: stretch; }
.areas-side { flex: 0 0 260px; display: flex; flex-direction: column; gap: 6px; }
.areas-main { flex: 1 1 auto; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
#a-map { height: calc(100vh - 300px); min-height: 440px; border-radius: var(--radius); border: 1px solid var(--line); }
.area-list { overflow-y: auto; height: calc(100vh - 300px); min-height: 440px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.area-item { display: flex; align-items: center; gap: 7px; padding: 7px 9px; cursor: pointer; border-bottom: 1px solid var(--line); font-size: 13px; }
.area-item:hover { background: var(--bg); }
.area-item.on { background: var(--accent-soft); }
.area-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.area-nm { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.area-meta { color: var(--muted); font-size: 11px; white-space: nowrap; }
.areas-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mergebox { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }
.mergebox select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; max-width: 240px; }
.place-dot { width: 16px; height: 16px; border-radius: 50%; background: #c0392b; border: 2px solid #fff; box-shadow: 0 0 4px rgba(0,0,0,.55); cursor: grab; }
.place-dot:active { cursor: grabbing; }

/* groups (saved filters + notifications) */
.badge.notif, .badge.new { background: var(--danger); }
.tab .badge.notif { margin-left: 5px; font-size: 10px; padding: 1px 6px; vertical-align: middle; }
.group-list { display: flex; flex-direction: column; gap: 8px; }
.group-item { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.group-main { min-width: 0; }
.group-name { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.group-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.group-actions .btn, .group-actions .ghostbtn { padding: 5px 10px; margin: 0; }
.legend { display: flex; align-items: center; gap: 8px; color: var(--muted); margin-left: auto; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot.sale { background: var(--sale); } .dot.rent { background: var(--rent); } .dot.gone { background: var(--gone); }
.popup { width: 200px; }
.popup img { width: 100%; height: 100px; object-fit: cover; border-radius: 6px; }
.popup .price { font-size: 14px; }
.popup a { color: var(--accent); cursor: pointer; }
.modal-map { height: 280px; border-radius: 10px; border: 1px solid var(--line); margin: 12px 0; }
.lm-tip { background: #7a5cc0; color: #fff; border: 0; font-size: 11px; font-weight: 600; padding: 1px 6px; box-shadow: none; }
.lm-tip::before { display: none; }

/* insights */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 14px; }
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow);
}
.kpi .v { font-size: 20px; font-weight: 700; }
.kpi .l { font-size: 12px; color: var(--muted); }
.kpi.grade-A .v { color: #2f855a; }
.kpi.grade-B .v { color: #0e7c66; }
.kpi.grade-C .v { color: #2b6cb0; }
.kpi.grade-D .v { color: #7a5cc0; }
.kpi.grade-E .v { color: #b7791f; }
.kpi.grade-F .v { color: #c0392b; }
.charts { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); margin-bottom: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); margin-bottom: 14px;
}
.card.chart { height: 330px; margin-bottom: 0; }
.card.chart canvas { max-height: 270px; }
.card.chart.wide { grid-column: 1 / -1; height: 420px; }
.card.chart.wide canvas { max-height: 360px; }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; }
.tbl tr:hover td { background: var(--bg); }
.tbl .clickable { color: var(--accent); cursor: pointer; }
.neg { color: var(--danger); font-weight: 600; }
.pos { color: var(--rent); font-weight: 600; }

/* modal */
.overlay {
  position: fixed; inset: 0; background: rgba(18, 24, 38, .55); z-index: 1000;
  display: flex; justify-content: center; align-items: flex-start; padding: 30px 14px;
  overflow-y: auto;
}
.modal {
  background: var(--card); border-radius: 14px; max-width: 880px; width: 100%;
  position: relative; padding: 20px 22px; margin-bottom: 40px;
}
.close {
  position: absolute; right: 10px; top: 8px; border: 0; background: transparent;
  font-size: 26px; cursor: pointer; color: var(--muted); z-index: 5;
}
.gallery .main {
  width: 100%; height: 380px; object-fit: cover; border-radius: 10px; background: #dde3ea;
}
.gallery .thumbs { display: flex; gap: 6px; overflow-x: auto; margin-top: 6px; padding-bottom: 4px; }
.gallery .thumbs img {
  width: 86px; height: 58px; object-fit: cover; border-radius: 6px; cursor: pointer;
  opacity: .75; flex: 0 0 auto;
}
.gallery .thumbs img:hover, .gallery .thumbs img.on { opacity: 1; outline: 2px solid var(--accent); }
.dhead { display: flex; justify-content: space-between; gap: 14px; align-items: baseline; flex-wrap: wrap; margin: 12px 0 4px; }
.dhead-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; flex: 0 0 auto; }
.dhead-actions .btn { text-align: center; white-space: nowrap; }
.btn.ghost { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); filter: none; }
.dhead .price { font-size: 24px; }
.dgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .dgrid { grid-template-columns: 1fr; } }
.desc { white-space: pre-wrap; }
.linkcard {
  display: flex; gap: 10px; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px; margin-top: 8px; cursor: pointer; align-items: center;
}
.linkcard:hover { background: var(--bg); }
.linkcard img { width: 92px; height: 64px; object-fit: cover; border-radius: 6px; }
.evt { display: flex; gap: 10px; font-size: 12.5px; padding: 3px 0; }
.evt .t { color: var(--muted); white-space: nowrap; }
.charts-modal { height: 220px; }

/* login page */
.loginpage { display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px; }
.loginbox {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px 24px; width: 100%; max-width: 340px;
  display: flex; flex-direction: column; gap: 12px; text-align: center;
}
.loginmark { font-size: 44px; line-height: 1; }
.loginbox h1 { font-size: 17px; }
.loginbox input { padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 16px; }
.loginbox .err { color: var(--danger); margin: 0; font-size: 13px; }

/* swipe-to-dismiss (inside an open group) */
.lcard { transition: transform .18s ease, opacity .18s ease; }
/* pan-y: vertical scrolling still belongs to the browser, horizontal comes to us */
.lcard.swipeable { touch-action: pan-y; }
.lcard.armed { box-shadow: inset 0 0 0 3px var(--danger), var(--shadow); }

/* undo bar */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 1100;
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 24px);
  background: #1c2330; color: #fff; border-radius: 10px; padding: 10px 14px;
  box-shadow: 0 6px 24px rgba(0,0,0,.3); font-size: 13px;
}
.toast button {
  border: 0; background: transparent; color: #7fd8c4; font: inherit; font-weight: 700;
  cursor: pointer; padding: 4px 6px;
}

/* push notifications (Groups tab) */
.notifbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.notifbar .ghostbtn { margin-left: 0; }

/* ======== phones ======== */
@media (max-width: 760px) {
  /* 16px = iOS Safari won't zoom the page when a field is focused */
  input, select, textarea { font-size: 16px; }

  header { flex-direction: column; align-items: stretch; gap: 6px; padding: 8px 12px; }
  .brand { justify-content: space-between; gap: 8px; }
  nav { overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  nav::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; white-space: nowrap; padding: 8px 11px; }
  main { padding: 12px 12px 48px; }

  /* collapsible filter bar */
  .filtersum {
    display: block; list-style: none; cursor: pointer; font-weight: 600;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 11px 13px; margin-bottom: 12px;
  }
  .filtersum::-webkit-details-marker { display: none; }
  .filtersum::after { content: "▾"; float: right; color: var(--muted); }
  .filterwrap[open] .filtersum { margin-bottom: 8px; }
  .filterwrap[open] .filtersum::after { content: "▴"; }

  .filters .seg { width: 100%; }
  .filters .seg button { flex: 1 1 0; padding: 9px 6px; }
  .subpick { flex: 1 1 100%; }
  .subbtn { width: 100%; text-align: left; padding: 9px 10px; }
  .subpanel { width: min(300px, calc(100vw - 34px)); }
  .filters select { flex: 1 1 140px; }
  .filters input[type=number] { width: auto; flex: 1 1 120px; }
  .filters input[type=search] { width: auto; flex: 1 1 100%; }
  #occ-filter { flex-wrap: wrap; white-space: normal; }
  #occ-filter input[type=date] { width: auto; }
  .ghostbtn { margin-left: 0; }
  #f-savegroup, #f-reset { flex: 1 1 auto; }

  /* charts: the 380px min column overflowed narrow screens */
  .charts { grid-template-columns: 1fr; }
  .card.chart, .card.chart.wide { height: 290px; }
  .card.chart canvas, .card.chart.wide canvas { max-height: 230px; }
  .card { padding: 12px; }
  .card:not(.chart) { overflow-x: auto; }   /* wide tables scroll instead of squashing */
  /* Scoped to .card on purpose: the detail modal's Overview table is also .tbl, and it
     has no scroll container — a min-width there drags the whole modal column off-screen. */
  .card .tbl { min-width: 580px; }
  .maptools { flex-wrap: wrap; }
  #worst-grade button { padding: 7px 8px; font-size: 13px; }
  .runbar select { flex: 1 1 100%; width: 100%; }   /* long preset labels blew past the edge */

  #map { height: 65vh; min-height: 340px; }

  .areas-wrap { flex-direction: column; }
  .areas-side { flex: 1 1 auto; }
  .area-list { height: 190px; min-height: 0; }
  #a-map { height: 55vh; min-height: 300px; }
  .mergebox select { max-width: 150px; }

  .group-item { flex-direction: column; align-items: stretch; }
  .group-actions { flex-wrap: wrap; }
  .group-actions .btn, .group-actions .ghostbtn { flex: 1 1 auto; }

  /* modal goes full-screen */
  .noscroll { overflow: hidden; }           /* page behind the modal must not scroll (set in app.js) */
  .overlay { padding: 0; }
  .modal { border-radius: 0; padding: 12px 12px 28px; margin-bottom: 0; min-height: 100%; }
  /* Sits over the photo, and in a full-screen standalone PWA it's the main way out —
     so: 44px (Apple's minimum touch target) with its own contrast. */
  .close {
    right: 8px; top: 8px; width: 44px; height: 44px; line-height: 44px; padding: 0;
    font-size: 30px; border-radius: 50%; background: rgba(20, 26, 38, .62); color: #fff;
  }
  .gallery .main { height: 210px; }
  .gallery .thumbs img { width: 70px; height: 48px; }
  .dhead { gap: 8px; margin-top: 10px; }
  .dhead .price { font-size: 20px; }
  .dhead-actions { flex-direction: row; flex-wrap: wrap; width: 100%; }
  .dhead-actions .btn { flex: 1 1 auto; }
  .modal-map, .charts-modal { height: 220px; }
  .dgrid { gap: 14px; }
  .dgrid .tbl td { padding: 5px 6px; word-break: break-word; }
  .dgrid .tbl td:first-child { width: 42%; }   /* key/value, not a data grid */
  .evt { flex-wrap: wrap; gap: 4px 8px; }
  .linkcard img { width: 74px; height: 52px; }
}

/* ---- print → PDF ----
   "Download this property as a PDF" = print the open detail modal. The browser's own
   print-to-PDF does the work; everything else on the page is hidden. */
@media print {
  @page { margin: 12mm; }
  html, body { overflow: visible !important; height: auto; background: #fff; }
  body > *:not(#overlay) { display: none !important; }
  #overlay:not(.hidden) {
    position: static; display: block; padding: 0; background: none; overflow: visible;
  }
  .modal { max-width: none; padding: 0; margin: 0; border-radius: 0; }
  .close, .dhead-actions { display: none !important; }
  a[href]::after { content: ""; }                    /* no URL footnotes */
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  /* Paper reads closer than a screen — everything drops a few points so more of the
     listing fits per page. Sizes are set outright because the app hardcodes px. */
  body { font-size: 10.5px; line-height: 1.42; }
  h3 { font-size: 11px; margin: 0 0 5px; break-after: avoid; }
  .dhead .price { font-size: 15px; }
  .price .was { font-size: 10px; }
  .tttl { font-size: 11.5px; }
  .small, .muted.small { font-size: 9px; }
  .tbl { font-size: 9.5px; }
  .tbl td { padding: 2px 5px; }
  .evt { font-size: 9.5px; padding: 1px 0; }
  .chip { font-size: 9px; }
  .badge { font-size: 8px; padding: 1px 5px; }

  /* Page one: cover photo, the header, then the description and the map side by side.
     `display: contents` dissolves .gallery and .dgrid so their children become flex
     items of the modal, and `order` lays them out in reading order for paper —
     the photo strip (order 99) drops to its own pages at the end.
     (app.js swaps every src to the CDN original before printing, so they stay sharp.) */
  #modalBody { display: flex; flex-flow: row wrap; align-items: flex-start; column-gap: 3%; }
  .gallery, .dgrid { display: contents; }
  .gallery .main { order: 0; flex: 0 0 100%; height: 300px; }
  .dhead { order: 1; flex: 0 0 100%; }
  .dgrid > div:first-child { order: 2; flex: 0 0 48.5%; }   /* description + features */
  .modal-map { order: 3; flex: 0 0 48.5%; height: 300px; }  /* app.js redraws it at this width */
  .dgrid > div:last-child { order: 4; flex: 0 0 100%; margin-top: 12px; }
  .charts-modal { order: 5; flex: 0 0 100%; height: 170px; }
  #modalBody > h3, .linkcard { order: 6; flex: 0 0 100%; }
  .desc, .tbl, .evt, .linkcard { orphans: 3; widows: 3; }   /* no 1-2 line stragglers */

  /* app.js moves the strip out of #modalBody for the print — Chrome ignores break-inside
     inside a flex container — so these rules match on the class alone, not via .gallery. */
  .thumbs {
    break-before: page;
    display: block; overflow: visible; font-size: 0;   /* font-size:0 eats inline-block gaps */
  }
  .thumbs::before {
    content: "Photos"; display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px;
  }
  /* inline-block, NOT grid: Chrome ignores break-inside on grid items, so photos were
     being sliced in half by the page break. In block flow it honours it. */
  .thumbs img {
    display: inline-block; width: 32.8%; height: 150px; margin: 0 0.8% 5px 0;
    opacity: 1; outline: none;
  }
  .thumbs img:nth-child(3n) { margin-right: 0; }
  .gallery img, .thumbs img, .modal-map, .charts-modal, .tbl, .linkcard, .evt { break-inside: avoid; }
}
