/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--touch);
  padding: 0 16px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--text); font-weight: 600; font-size: 14.5px; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--danger); }
.btn-block { width: 100%; }
.btn-lg { min-height: 52px; font-size: 16px; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13.5px; }
.btn-icon { width: var(--touch); padding: 0; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: var(--s2); flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 auto; }

/* ---------- fields ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .field-label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.field .hint, .hint { font-size: 12.5px; color: var(--text-2); }
.input, .field input, .field select, .field textarea {
  width: 100%; min-height: var(--touch); padding: 10px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); background: var(--surface); color: var(--text); font-size: 16px;
}
.field textarea { min-height: 120px; font-family: var(--mono); font-size: 14px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: 3px solid var(--focus); outline-offset: 0; border-color: transparent; }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.error { margin: 0; font-size: 13px; color: var(--danger); font-weight: 600; }
.td-input { font-family: var(--mono) !important; font-size: 22px !important; letter-spacing: .5px; min-height: 56px !important; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s3); }

/* segmented control (radio group styled as buttons) */
.segmented { display: flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.segmented label { flex: 1; position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 10px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.segmented label + label span { border-left: 1px solid var(--line); }
.segmented input:checked + span { background: var(--primary-soft); color: var(--primary-text); }
.segmented input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -3px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4); box-shadow: var(--shadow-1); }
.card-title { display: flex; align-items: center; gap: 8px; margin-bottom: var(--s3); }
.card-title .icon { color: var(--primary-text); }
.card + .card { margin-top: 0; }
.section-label { font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--text-2); }

/* ---------- result ---------- */
.result-pos { font-family: var(--mono); font-size: 26px; font-weight: 600; line-height: 1.3; letter-spacing: .2px; }
.result-pos span { display: block; }
.result-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--s3) 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; }

/* ---------- chips & badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2); border: 1px solid transparent;
}
.chip .icon { width: 15px; height: 15px; }
.chip-primary { background: var(--primary-soft); color: var(--primary-text); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
button.chip { cursor: pointer; border-color: var(--line); }

.notice { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm); font-size: 13.5px; }
.notice .icon { margin-top: 1px; }
.notice-warn { background: var(--warn-soft); color: var(--warn); }
.notice-danger { background: var(--danger-soft); color: var(--danger); }
.notice-info { background: var(--primary-soft); color: var(--primary-text); }

/* ---------- disclosure ---------- */
details.more { border-top: 1px solid var(--line); margin-top: var(--s3); padding-top: var(--s2); }
details.more > summary {
  display: flex; align-items: center; gap: 6px; min-height: 36px; cursor: pointer; font-weight: 600; font-size: 14px;
  color: var(--primary-text); list-style: none;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "▸"; transition: transform .15s; }
details.more[open] > summary::before { transform: rotate(90deg); }
details.more > *:not(summary) { margin-top: var(--s2); }

table.compare { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.compare th, table.compare td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.compare th { color: var(--text-2); font-weight: 600; font-size: 12.5px; }
table.compare .r { text-align: right; }

/* ---------- lists ---------- */
.toolbar { display: flex; gap: var(--s2); align-items: center; }
.search { position: relative; flex: 1; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-2); }
.search input { padding-left: 40px; }
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.list-group {
  position: sticky; top: calc(-1 * var(--s4)); z-index: 1; display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 12.5px; font-weight: 700; color: var(--text-2);
}
.list-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; width: 100%;
  min-height: 60px; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left;
  color: inherit; text-decoration: none; cursor: pointer;
}
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--surface-2); }
.list-item.active { background: var(--primary-soft); box-shadow: inset 4px 0 0 var(--primary); }
.list-item .li-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .li-sub { font-size: 13px; color: var(--text-2); font-family: var(--mono); }
.list-item .li-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
/* plain checkboxes in select mode only (direct children); toggle switches have their own styles */
.list-item > input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--primary); }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line-strong); }
.dot.dot-sq { border-radius: 2px; width: 11px; height: 11px; }   /* GPS waypoint (square on the map too) */

.empty { text-align: center; padding: var(--s6) var(--s4); display: flex; flex-direction: column; align-items: center; gap: var(--s3); }
.empty .icon { width: 44px; height: 44px; color: var(--primary-text); stroke-width: 1.4; }
.empty p { max-width: 34ch; color: var(--text-2); }

/* choice cards (radio) */
.choices { display: flex; flex-direction: column; gap: var(--s2); }
.choice { position: relative; display: flex; gap: 12px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); cursor: pointer; }
.choice input { margin-top: 3px; width: 20px; height: 20px; accent-color: var(--primary); flex: none; }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.choice-title { font-weight: 650; }
.choice-desc { font-size: 13.5px; color: var(--text-2); }

/* switch */
.switch { display: flex; align-items: center; gap: 12px; min-height: var(--touch); cursor: pointer; }
.switch input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; border-radius: 13px; background: var(--line-strong); position: relative; flex: none; transition: background .15s; margin: 0; }
.switch input[type="checkbox"]::after { content: ""; position: absolute; width: 20px; height: 20px; top: 3px; left: 3px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: left .15s; }
.switch input[type="checkbox"]:checked { background: var(--primary); }
.switch input[type="checkbox"]:checked::after { left: 21px; }

/* ---------- dialog ---------- */
dialog.modal {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: var(--r-lg);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-2);
}
dialog.modal::backdrop { background: var(--scrim); }
.modal-head { display: flex; align-items: center; gap: var(--s2); padding: var(--s4) var(--s4) var(--s2); }
.modal-head h2 { font-size: 18px; flex: 1; }
.modal-body { padding: var(--s2) var(--s4) var(--s4); display: flex; flex-direction: column; gap: var(--s3); overflow-y: auto; }
.modal-foot { display: flex; gap: var(--s2); justify-content: flex-end; padding: var(--s3) var(--s4); border-top: 1px solid var(--line); }
@media (max-width: 1023px) {
  dialog.modal { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--r-lg) var(--r-lg) 0 0; }
  dialog.modal-viewport {
    position: fixed; top: var(--modal-viewport-top, 0px);
    bottom: calc(100% - var(--modal-viewport-top, 0px) - var(--modal-viewport-height, 100dvh));
    max-height: calc(var(--modal-viewport-height, 100dvh) - 12px);
  }
  dialog.modal-viewport[open] { display: flex; flex-direction: column; }
  .modal-viewport .modal-head, .modal-viewport .modal-foot { flex-shrink: 0; }
  .modal-viewport .modal-body { min-height: 0; overscroll-behavior: contain; }
  .modal-viewport .modal-foot { padding-bottom: max(var(--s3), env(safe-area-inset-bottom)); }
}

/* menu */
.menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 50; min-width: 240px; padding: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-2); display: flex; flex-direction: column;
}
.menu-pop button { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border: 0; background: none; border-radius: var(--r-sm); text-align: left; font-size: 14px; }
.menu-pop button:hover, .menu-pop button:focus-visible { background: var(--surface-2); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--s5) + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); opacity: 0;
  z-index: 3000; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: var(--r-sm); font-size: 14px;
  box-shadow: var(--shadow-2); pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 1023px) { .toast { bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); } }
.btn-danger-fill { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-fill:hover { filter: brightness(.95); background: var(--danger); }
.view > .stack > .btn-ghost.btn-sm { margin-left: -8px; }
.switch input[type="checkbox"]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.switch input[type="checkbox"]:disabled { opacity: .45; cursor: not-allowed; }
.check-row { grid-template-columns: auto minmax(0, 1fr) auto; cursor: default; }
.check-row:hover { background: transparent; }
.check-row .switch { min-height: 0; align-self: center; }

/* ---------- structured coordinate input ---------- */
fieldset.coord { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
fieldset.coord legend { padding: 0; margin-bottom: 6px; }
.coord-row { display: flex; gap: 8px; align-items: stretch; }
.coord-part { position: relative; display: flex; min-width: 0; }
.coord-part input {
  width: 100%; min-height: var(--touch); padding: 10px 22px 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); font-family: var(--mono); font-size: 18px; text-align: right;
}
.coord-part input:focus { outline: 3px solid var(--focus); outline-offset: 0; border-color: transparent; }
.coord-part input[aria-invalid="true"] { border-color: var(--danger); background: var(--danger-soft); }
.coord-sym { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: var(--text-2); font-size: 17px; pointer-events: none; }
.coord-deg { flex: 0 0 74px; }
.coord-min { flex: 0 0 68px; }
.coord-mdec, .coord-sec, .coord-wide { flex: 1 1 auto; }
.coord-hemi { flex: 0 0 96px; }
.coord-hemi span { min-height: var(--touch); font-size: 15px; }
fieldset.coord .error { margin: 0; }
/* My spots: compact list + details */
.sp { display: flex; flex-direction: column; gap: 10px; }
.sp-head { display: flex; align-items: center; gap: 6px; min-height: 36px; }
.sp-head h2 { font-size: 18px; margin: 0; }
.sp-count { font-size: 12px; color: var(--text-2); background: var(--surface-2); border-radius: 999px; padding: 1px 8px; }
.sp-head .btn-icon { width: 36px; min-height: 36px; }
.sp-head .btn-icon[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.sp-tools { display: flex; gap: 6px; }
.sp-tools .input { min-height: 36px; height: 36px; font-size: 13.5px; }
.sp-tools .search { flex: 1 1 55%; min-width: 0; }
.sp-tools .search input { padding-left: 34px; }
.sp-tools .search .icon { left: 10px; width: 16px; height: 16px; }
.sp-filter { flex: 1 1 45%; min-width: 0; }
.sp-sel { margin: 0; }
.sp .list-group { padding: 6px 12px; font-size: 12px; }
.sp .list-item { padding: 8px 12px; gap: 10px; min-height: 0; }
.sp .list-item .li-title { font-size: 14px; }
.sp .list-item .li-sub { font-size: 12px; }
.sp-back { margin-left: -8px; }
.sp-title { font-size: 18px; margin: 0; }
.sp-meta { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.sp-meta .dot { display: inline-block; }
.sp-card { padding: 14px; }
.sp-card .btn-row:empty { display: none; }
.sp-tools select.input { padding-top: 0; padding-bottom: 0; line-height: 34px; padding-left: 10px; }
.sp-card .result-pos { font-size: 22px; }
.sp-card .result-meta { flex-direction: row; flex-wrap: wrap; gap: 6px; }
/* My lists: soft separate rows instead of divider lines */
.lv-card { background: transparent !important; border: 0 !important; box-shadow: none !important; overflow: visible !important; display: flex; flex-direction: column; gap: 8px; }
.lv-card .list-group { position: static; background: none; border: 0; padding: 4px 2px 0; text-transform: uppercase; letter-spacing: .06em; font-size: 11.5px; }
.lv-card .list-item { border: 0 !important; border-radius: var(--r); background: var(--surface-2); padding: 12px 14px; }
.lv-card .list-item:hover { background: var(--surface-3, var(--surface-2)); }
.lv-card + .lv-card, .card + .lv-card, .lv-card + .card { margin-top: 18px; }
/* My spots: same soft separate rows as My lists */
.sp .list { background: transparent !important; border: 0 !important; box-shadow: none !important; display: flex; flex-direction: column; gap: 2px; }
.sp .list + .list { margin-top: 18px; }
.sp .list .list-group { background: var(--bg, var(--surface)); border: 0; padding: 6px 2px; text-transform: uppercase; letter-spacing: .06em; font-size: 11.5px; }
.sp .list .list-item { border: 0 !important; border-radius: var(--r); background: transparent; padding: 10px 14px; }
.sp .list .list-item:hover, .sp .list .sp-li-wrap:hover { background: var(--surface-2); }
/* A spot with routes: the routes button sits inside the same row highlight, on the right */
.sp .list .sp-li-wrap { border-radius: var(--r); }
.sp .list .sp-li-wrap > .list-item:hover { background: transparent; }

/* My lists: three-dot actions menu */
.lv-more { position: relative; display: inline-flex; }
.lv-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 50; min-width: 150px; padding: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.18); display: flex; flex-direction: column; }
.lv-menu[hidden] { display: none; }
.lv-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; color: var(--text); font: inherit; font-size: .9rem; text-align: left; border-radius: 6px; cursor: pointer; }
.lv-menu button:hover, .lv-menu button:focus-visible { background: var(--surface-2); }
.lv-menu button.danger { color: var(--danger, #dc2626); }
.lv-menu .icon { width: 16px; height: 16px; }
.lv-card:has(.lv-menu) { overflow: visible !important; }
.lv-card .list-item:has(.lv-menu:not([hidden])) { z-index: 5; position: relative; }

/* Lists hidden on the map (js/app/listvis.js): eye toggle in list rows and My spots headings; hidden lists are dimmed */
.lv-vis { color: var(--text-2); }
.lv-vis[aria-pressed="true"] { color: var(--text-3, var(--text-2)); opacity: .8; }
.sp .list-group .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp .list-group .lv-vis { width: 30px; height: 30px; min-height: 0; padding: 0; margin: -6px -4px -6px 0; }
.sp .list-group .lv-vis .icon { width: 17px; height: 17px; }
.lv-off { text-transform: none; letter-spacing: 0; font-weight: 500; }
.list.is-hidden .list-item, .list-item.is-hidden > :not(.lv-more) { opacity: .5; }

/* Lists search (views/lists.js): rows and cards are hidden in place while filtering */
.lv-search { display: block; flex: none; }
.lv-search input { padding-left: 38px; }
.lv-search .icon { left: 11px; width: 17px; height: 17px; }
.list-item[hidden], .lv-card[hidden] { display: none !important; }
.lv-none { margin: 0; }
.lv-hit { color: var(--primary); font-weight: 600; }

/* Add GPS check: "Start from a spot" search (views/settings.js) */
.chk-from .search input { padding-left: 38px; }
.chk-from .search .icon { left: 11px; width: 17px; height: 17px; }
.chk-from-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; max-height: 240px; overflow: auto; }
.chk-from-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: inherit; cursor: pointer; font: inherit; }
.chk-from-item:hover, .chk-from-item:focus-visible { border-color: var(--primary); }
.chk-from-item .dot { flex: none; }
.btn.is-on { color: var(--primary); border-color: var(--primary); }
.pick-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: -4px; }
.pick-row[hidden] { display: none; }
.pick-row .hint { margin: 0; }

/* Plan-gated accuracy options (views/settings.js accuracyCard) */
.chip-paid { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); border: 1px solid color-mix(in srgb, var(--primary) 40%, transparent); }
.choice.is-locked { opacity: .62; cursor: not-allowed; }
.choice.is-locked .chip-paid { opacity: 1; }
.accuracy-choice { align-items: flex-start; }
.accuracy-card { position: relative; }
.accuracy-card > .card-title { align-items: flex-start; }
.accuracy-card > .card-title h3 { min-width: 0; }
.accuracy-card > .card-title .accuracy-tooltip { top: 54px; }
.accuracy-select { display: flex; align-items: flex-start; gap: 12px; flex: 1; min-width: 0; cursor: inherit; }
.accuracy-copy { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.accuracy-copy .choice-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.accuracy-info { flex: none; margin-left: auto; }
.accuracy-info > button { width: 30px; min-height: 30px; color: var(--text-2); cursor: pointer; }
.accuracy-info > button .icon { width: 18px; height: 18px; }
.accuracy-tooltip { display: none; position: absolute; top: calc(100% - 4px); left: 12px; right: 12px; z-index: 60; padding: 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface-2); color: var(--text); box-shadow: var(--shadow-2); font-size: 13.5px; font-weight: 400; cursor: default; }
.accuracy-choice .accuracy-tooltip { top: 50px; }
.accuracy-tooltip p { margin: 8px 0 0; }
.accuracy-info:has([aria-expanded="true"]) .accuracy-tooltip, .accuracy-info:focus-within .accuracy-tooltip { display: block; }
.accuracy-choice:has(.accuracy-info:focus-within), .accuracy-choice:has([aria-expanded="true"]) { z-index: 2; }
@media (hover: hover) {
  .accuracy-info:hover .accuracy-tooltip { display: block; }
  .accuracy-choice:has(.accuracy-info:hover) { z-index: 2; }
}

/* Chain station information: hover, keyboard focus, or tap the information icon. */
.chain-card { position: relative; }
.chain-info { margin-left: auto; }
.chain-info > button { width: 30px; min-height: 30px; cursor: pointer; }
.chain-info > button .icon { width: 18px; height: 18px; color: var(--text-2); }
.chain-stations {
  display: none; position: absolute; top: 54px; left: var(--s4); right: var(--s4); z-index: 60;
  padding: 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--text); box-shadow: var(--shadow-2);
  max-height: 400px; overflow-y: auto;
}
.chain-info:has([aria-expanded="true"]) .chain-stations, .chain-info:focus-within .chain-stations { display: block; }
@media (hover: hover) { .chain-info:hover .chain-stations { display: block; } }
.chain-stations p { margin: 6px 0; }
.chain-stations ul { list-style: none; padding: 0; margin: 0; }
.chain-stations li { padding: 8px 0; border-top: 1px solid var(--line); }
.chain-station-name { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

/* ---------- tide card (js/app/tides.js) ---------- */
.td-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.td-now { display: flex; align-items: baseline; gap: 10px; margin-top: var(--s2); }
.td-h { font: 600 30px/1.1 var(--mono); color: var(--text); }
.td-dir { font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.td-next { margin: 4px 0 var(--s2); }
.td-graph { display: block; width: 100%; height: auto; margin: var(--s2) 0; background: var(--surface-2); border-radius: var(--r-sm); }
.td-grid { stroke: var(--line); stroke-width: 1; }
.td-ax, .td-lbl { font: 9px var(--mono); fill: var(--text-2); }
.td-lbl { fill: var(--text); }
.td-curve { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; }
.td-dot { fill: var(--primary); }
.td-nowline { stroke: var(--accent); stroke-width: 1.5; }
.td-foot { margin-top: 4px; }

/* ---------- Vessels and Weather sections (js/app/views/vessels.js, weather.js) ---------- */
.vs { display: flex; flex-direction: column; gap: var(--s4); }
.vs h2 { font-size: 22px; }
.vs h3 { font-size: 15px; }
.vs .view-head { align-items: center; flex-wrap: wrap; }
.vs-back { align-self: flex-start; margin-left: -8px; }
.vs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s3); }
.vs-card { display: flex; flex-direction: column; gap: var(--s3); color: inherit; text-decoration: none; transition: border-color .15s; }
.vs-card:hover { border-color: var(--primary); }
.vs-card-head { display: flex; gap: 12px; align-items: center; }
.vs-badge { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--primary-soft); color: var(--primary-text); }
.vs-badge .icon { width: 22px; height: 22px; }
.vs-badge-lg { width: 48px; height: 48px; }
.vs-mini { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.vs-mini dt, .vs-stats dt { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); }
.vs-mini dd { margin: 2px 0 0; font-size: 14px; font-weight: 600; }
.vs-mini-wide { margin-bottom: var(--s3); padding-bottom: var(--s3); border-bottom: 1px solid var(--line); }
.vs-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.vs-chips:empty { display: none; }
.vs-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: var(--s3); margin: 0; }
.vs-stats .card { padding: 12px 14px; }
.vs-stats dd { margin: 4px 0 0; font-size: 14px; color: var(--text-2); }
.vs-stats dd .mono { font-size: 22px; font-weight: 600; color: var(--text); }
.vs-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s4); align-items: start; }
.vs-cols > .stack { gap: var(--s4); }
.vs-notes { margin-top: var(--s3); white-space: pre-wrap; font-size: 14px; }
.vs-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.vs-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.vs-row:first-child { border-top: 0; padding-top: 0; }
.vs-row-icon { color: var(--text-2); flex: none; }
.vs-row-date { flex: none; width: 92px; color: var(--text-2); align-self: flex-start; padding-top: 2px; }
.vs-row-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.vs-row-main b { font-weight: 600; overflow-wrap: anywhere; }
.vs-row-acts { display: flex; gap: 2px; flex: none; }
.vs-row-acts .btn-icon { width: 36px; }
.vs-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.vs-wide { grid-column: 1 / -1; }
.vs-err { color: var(--danger); margin-top: var(--s3); }
.wx-card { display: flex; flex-direction: column; gap: 6px; }
.wx-card .card-title { margin-bottom: 0; }
@media (max-width: 900px) { .vs-cols { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) {
  .vs-form-grid { grid-template-columns: minmax(0, 1fr); }
  .vs-row { flex-wrap: wrap; }
  .vs-row-date { width: auto; }
  .vs-row-main { flex-basis: calc(100% - 120px); }
}

/* ---------- Update notice (js/app/update.js) ---------- */
.upd { position: fixed; z-index: 3000; left: 50%; bottom: calc(var(--status-h) + 16px); transform: translateX(-50%); width: min(520px, calc(100vw - 32px));
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); box-shadow: var(--shadow-2); animation: upd-in .2s ease-out; }
.upd[hidden] { display: none; }
.upd-icon { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--primary-soft); color: var(--primary-text); }
.upd-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.upd-body .small { color: var(--text-2); }
.upd-acts { display: flex; gap: 6px; flex: none; }
@keyframes upd-in { from { opacity: 0; transform: translate(-50%, 8px); } }
@media (max-width: 1023px) {
  .upd { bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px); flex-wrap: wrap; }
  .upd-acts { width: 100%; justify-content: flex-end; }
}
.wx-card.is-selected { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }

/* Spots list filter: multi-select picker that stays open until an outside tap */
.sp-filter.menu { position: relative; }
.sp-lists-btn { display: flex; align-items: center; gap: var(--s2); width: 100%; text-align: left; cursor: pointer; }
.sp-lists-btn .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-lists-btn svg { width: 18px; height: 18px; flex: none; opacity: .7; }
.sp-lists { top: calc(100% + 6px); bottom: auto; right: 0; left: auto; min-width: 220px; width: max-content; max-width: min(320px, calc(100vw - 24px)); max-height: 50vh; overflow-y: auto; padding: var(--s1) 0; }
.sp-list-opt { display: flex; align-items: center; gap: var(--s3); min-height: 44px; padding: 0 var(--s4); cursor: pointer; }
.sp-list-opt:hover { background: var(--surface-2); }
.sp-list-opt input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); flex: none; }
.sp-list-opt .dot { flex: none; }
.sp-list-opt span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-list-opt:first-child { border-bottom: 1px solid var(--border); }

/* Spot edit: map icon picker */
.sp-icons { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-icons button { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; padding: 0; }
.sp-icons button[aria-checked="true"] { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.sp-icons .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--muted, currentColor); }
.sp-icons .dot.dot-sq { border-radius: 2px; width: 13px; height: 13px; }

/* Spots list Show filter: inset toggle; the chosen option shows its name */
.sp-kind-tg { display: inline-flex; flex: none; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 1px 3px rgba(0,0,0,.22), inset 0 0 0 1px var(--line); }
.sp-kind-tg button { display: inline-flex; align-items: center; gap: 6px; height: 32px; min-width: 34px; padding: 0 9px; border: 0; border-radius: 999px; background: transparent; color: var(--text-2); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.sp-kind-tg button svg { width: 17px; height: 17px; flex: none; }
.sp-kind-tg button span { display: none; }
.sp-kind-tg button[aria-checked="true"] { background: var(--surface); color: var(--text); padding: 0 12px 0 10px; box-shadow: 0 1px 2px rgba(0,0,0,.18), 0 0 0 1px var(--line); }
.sp-kind-tg button[aria-checked="true"] span { display: inline; }
.sp-kind-tg button:hover:not([aria-checked="true"]) { color: var(--text); }
.sp-kind-tg button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

/* Tags: picker chips in the spot editor, tag line in Chart items and details */
.tg-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 40px; padding: 5px 8px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); cursor: text; }
.tg-pick:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.tg-chips { display: contents; }
.tg-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 2px 4px 2px 9px; border-radius: 999px; background: var(--surface-3); font-size: 13px; line-height: 22px; }
.tg-chip .dot { width: 8px; height: 8px; }
.tg-chip button { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent; color: var(--text-2); font-size: 16px; cursor: pointer; }
.tg-chip button:hover, .tg-chip button:focus-visible { background: rgba(127,127,127,.22); color: var(--text); }
.tg-in { flex: 1 1 120px; min-width: 100px; border: 0; outline: 0; background: transparent; color: inherit; font: inherit; padding: 4px 2px; }
.sp .list-item .sp-li-tags { font-family: inherit; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-meta { flex-wrap: wrap; }
.sp-tag { display: inline-flex; align-items: center; gap: 5px; margin-right: 8px; }
