* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #1d2733; }
#map { position: absolute; inset: 0 0 0 330px; }
#sidebar { position: absolute; top: 0; left: 0; bottom: 0; width: 330px; overflow-y: auto; background: #f7f9fb; border-right: 1px solid #d5dde5; padding: 0 14px 14px; z-index: 2; }
body.collapsed #sidebar { display: none; }
body.collapsed #map { left: 0; }
#expand { display: none; position: absolute; top: 10px; left: 10px; z-index: 3; }
body.collapsed #expand { display: block; }
header { display: flex; align-items: flex-start; gap: 8px; position: sticky; top: 0; background: #0f3d5e; color: #fff; margin: 0 -14px; padding: 12px 14px; }
header h1 { font-size: 17px; margin: 0; flex: 1; line-height: 1.25; }
header h1 span { display: block; font-weight: 400; font-size: 13px; opacity: .85; }
header button { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); }
section { border-bottom: 1px solid #e1e7ed; padding: 10px 0; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: #4a5b6c; margin: 0 0 6px; }
label { display: flex; align-items: center; gap: 6px; margin: 3px 0; cursor: pointer; }
label.basemap { margin-top: 8px; justify-content: space-between; }
button { font: inherit; padding: 5px 10px; border: 1px solid #9fb3c6; background: #fff; border-radius: 4px; cursor: pointer; }
button:hover { background: #e8f0f7; }
button.small { padding: 2px 8px; }
.btnrow { display: flex; flex-wrap: wrap; gap: 6px; }
.btnrow button.job { background: #0f3d5e; color: #fff; border-color: #0f3d5e; }
.btnrow button.job:hover { background: #18557f; }

/* Harbor list grouped by Great Lake (sidebar accordion) */
#goto > #btn-district { margin-bottom: 2px; }
.lakes { margin-top: 8px; }
.lake { border: 1px solid #d5dde5; border-radius: 6px; margin: 0 0 6px; background: #fff; overflow: hidden; }
.lake-head { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 8px 10px; background: #e8eef4; border: 0; border-radius: 0; font: inherit; font-weight: 600;
  color: #0f3d5e; text-align: left; cursor: pointer; }
.lake-head:hover { background: #dce6ef; }
.lake-title { display: inline-flex; align-items: center; gap: 6px; }
.lake-head .chev { display: inline-block; transition: transform .15s ease; font-size: 12px; color: #4a5b6c; }
.lake.open .lake-head .chev { transform: rotate(90deg); }
.lake-head .count { font-weight: 500; color: #4a5b6c; font-size: 12px; background: #fff; border: 1px solid #c9d3dd;
  border-radius: 999px; padding: 0 7px; line-height: 1.6; flex: none; }
.lake-body { display: none; padding: 8px; border-top: 1px solid #e1e7ed; background: #f7f9fb; }
.lake.open .lake-body { display: flex; }
.btnrow button.job.active { box-shadow: inset 0 0 0 2px #f0c14b; }
select { font: inherit; padding: 2px 4px; }
.years { display: flex; align-items: center; gap: 6px; }
.legend .row { display: flex; align-items: center; gap: 8px; margin: 2px 0; }
.legend .sw { width: 16px; height: 16px; border-radius: 3px; border: 1px solid rgba(0,0,0,.35); flex: none; }
.legend .dot { border-radius: 50%; }
.legend .n { margin-left: auto; color: #6b7c8d; font-size: 12px; }
.muted { color: #6b7c8d; font-size: 12px; margin: 6px 0 0; }
.note p { margin: 4px 0; font-size: 13px; }
.warn { color: #a3261b; font-weight: 600; }
#error { position: absolute; top: 10px; right: 60px; background: #fde8e6; border: 1px solid #e0a39c; color: #7a1d14; padding: 8px 12px; border-radius: 4px; z-index: 5; max-width: 420px; }
.maplibregl-popup-content { font-size: 13px; max-height: 320px; overflow-y: auto; }
.pop h3 { margin: 0 0 4px; font-size: 14px; }
.pop .item { border-top: 1px solid #e1e7ed; padding: 5px 0; }
.pop .item:first-of-type { border-top: 0; }
.pop .tag { display: inline-block; padding: 0 6px; border-radius: 3px; color: #fff; font-size: 11px; font-weight: 600; margin-right: 4px; }
.pop a { margin-right: 10px; }
.pop .id { color: #6b7c8d; font-size: 11px; word-break: break-all; }
.pop .depth { font-size: 18px; font-weight: 700; }
@media (max-width: 700px) {
  #sidebar { width: 100%; bottom: auto; max-height: 45%; border-right: 0; border-bottom: 1px solid #d5dde5; }
  #map { inset: 45% 0 0 0; }
  body.collapsed #map { inset: 0; }
  #expand { font-size: 20px; padding: 6px 12px; }
}

/* hex bin mode toggle + ramp legend */
.seg { display: inline-flex; border: 1px solid #9fb0c2; border-radius: 6px; overflow: hidden; margin: 4px 0 6px; }
.seg label { margin: 0; display: block; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 6px 10px; cursor: pointer; background: #fff; font-size: 13px; }
.seg input:checked + span { background: #0f3d5e; color: #fff; }
.seg input:focus-visible + span { outline: 2px solid #1f6fd1; }
.hexramp { height: 10px; border-radius: 3px; border: 1px solid #c9d3dd; }
.hexramp-lbl { display: flex; justify-content: space-between; font-size: 12px; color: #4b5866; }

/* shoalest-sounding area tool */
.maptool { position: absolute; top: 10px; right: 50px; z-index: 3; background: #0f3d5e; color: #fff; border-color: #0f3d5e; font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.maptool:hover { background: #18557f; }
body.drawing .maptool { background: #e8412c; border-color: #e8412c; }
.shoalcard { position: absolute; top: 52px; right: 50px; z-index: 4; width: 280px; max-width: calc(100% - 60px); max-height: calc(100% - 110px); overflow-y: auto;
  background: #fff; border: 1px solid #d5dde5; border-radius: 8px; padding: 10px 12px; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.shoalhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; color: #0f3d5e; }
.shoalcard .x { border: 0; font-size: 20px; line-height: 1; padding: 0 4px; background: transparent; }
.shoalcard .draft { justify-content: space-between; font-size: 13px; }
.shoalcard .draft input { width: 64px; font: inherit; padding: 3px 5px; border: 1px solid #9fb3c6; border-radius: 4px; }
.shoalcard button.primary { background: #0f3d5e; color: #fff; border-color: #0f3d5e; }
.shoalcard button:disabled { opacity: .45; cursor: default; }
#shoal-result { border-top: 1px solid #e1e7ed; margin-top: 8px; padding-top: 8px; }
#shoal-out .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #4a5b6c; }
#shoal-out .big { font-size: 28px; font-weight: 800; color: #a3261b; line-height: 1.1; }
#shoal-out .kv { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin: 3px 0; }
#shoal-out .kv b { text-align: right; word-break: break-all; }
#shoal-out .verdict { margin: 8px 0 4px; padding: 6px 8px; border-radius: 5px; font-size: 13px; font-weight: 600; }
#shoal-out .verdict.ok { background: #e4f5e8; color: #1d6b32; }
#shoal-out .verdict.bad { background: #fde8e6; color: #8a1d12; }
#shoal-out .verdict.warn { background: #fff4d6; color: #7a5b00; }
.warn.small { font-size: 12px; margin: 6px 0 0; }
@media (max-width: 700px) {
  .maptool { top: auto; bottom: 34px; right: 10px; padding: 10px 14px; font-size: 15px; }
  .shoalcard { top: auto; bottom: 84px; left: 10px; right: 10px; width: auto; max-width: none; max-height: 50%; }
  .shoalcard button { padding: 8px 12px; }
}

#loading { position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); background: rgba(255,255,255,.92); color: #1d2733; font-size: 12px; padding: 4px 10px; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.25); z-index: 5; pointer-events: none; }
#loading[hidden] { display: none; }
