:root {
  --body: #12181F; --head: #0B1016; --card: #1B2530; --card-alt: #1F2935; --line: #364858; --btn: #222D3A;
  --btn-line: #506478; --text: #FFFFFF; --muted: #9FB1C0; --accent: #44B3E6; --green: #3FB950; --green-bg: #12462D;
  --red: #EB6969; --red-bg: #69221E; --amber: #E6841F; --amber-bg: #4A3417; --gray: #6E7F8E;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--body); color: var(--text); font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: none; }
header#top { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--head);
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
#who button { white-space: nowrap; }
#who { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; min-width: 0; }
#who .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
main { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; padding: 16px; }
footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 8px 16px; padding-bottom: max(8px, env(safe-area-inset-bottom));
  background: var(--head); color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
button, .btn { background: var(--btn); color: var(--text); border: 1px solid var(--btn-line); border-radius: 4px; padding: 7px 14px;
  font: inherit; font-size: 13px; font-weight: 600; letter-spacing: .4px; cursor: pointer; min-height: 36px; }
button:hover { background: #273542; }
button:disabled { opacity: .5; cursor: default; }
button.on { border-color: var(--accent); color: var(--accent); }
input, select { background: #0F151C; color: var(--text); border: 1px solid var(--btn-line); border-radius: 4px; padding: 9px 10px; font: inherit; width: 100%; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 18px 0 8px; color: #A5B9CA; letter-spacing: .6px; text-transform: uppercase; }
.muted { color: var(--muted); }
.pad { padding: 16px; }
.small { font-size: 12px; }
.err { color: var(--red); min-height: 20px; }
.login { max-width: 380px; margin: 8vh auto 0; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 24px; }
.login label { display: block; margin: 14px 0 6px; color: var(--muted); font-size: 13px; }
.login button { width: 100%; margin-top: 18px; min-height: 42px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 14px; min-width: 0; }
a.card { display: block; color: var(--text); }
a.card:hover { border-color: var(--accent); }
.card.alarm { border-color: var(--red); }
.vrow { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.vname { font-size: 18px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin-top: 10px; font-size: 13px; }
.kv span:nth-child(odd) { color: var(--muted); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 3px; font-size: 12px; font-weight: 700; letter-spacing: .5px; white-space: nowrap; }
.pill.online, .pill.ok { background: var(--green-bg); color: #8EE3A2; }
.pill.offline, .pill.critical, .pill.high { background: var(--red-bg); color: #FFB4B4; }
.pill.medium, .pill.warn { background: var(--amber-bg); color: #FFC57A; }
.pill.low, .pill.unknown, .pill.off { background: #2A3540; color: var(--muted); }
.vlisthead { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 18px 0 10px; }
.vlisthead h2 { margin: 0; }
.vlisthead input.vsearch { width: auto; flex: 0 1 320px; min-width: 0; padding: 7px 10px; }
@media (max-width: 640px) { .vlisthead input.vsearch { flex: 1 1 100%; order: 3; } }
.summary { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-bottom: 12px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.tabs button { flex: 0 0 auto; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #26323F; vertical-align: top; }
th { background: var(--card-alt); color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .4px; text-transform: uppercase; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #222E3A; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stale td { color: var(--gray); }
.empty { padding: 18px; color: var(--muted); }
.devices { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.trend-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.trend-controls select { width: auto; max-width: 100%; flex: 1 1 260px; }
svg.chart { width: 100%; height: auto; display: block; background: var(--card); border: 1px solid var(--line); border-radius: 6px; }
svg.chart .grid { stroke: #26323F; stroke-width: 1; }
svg.chart .axis { fill: var(--muted); font-size: 11px; }
svg.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; }
svg.chart .band { fill: rgba(68,179,230,.15); stroke: none; }
@media (max-width: 640px) {
  main { padding: 12px; }
  .grid, .devices { grid-template-columns: 1fr; }
  h1 { font-size: 19px; }
  #who .name { display: none; }
}
.card > .kv:first-child { margin-top: 0; }
@media (max-width: 420px) {
  #who { gap: 6px; }
  #who .pill { display: none; }
  #who button { padding: 7px 9px; font-size: 12px; }
}
a.btn { display: inline-flex; align-items: center; color: var(--text); }
.login.wide { max-width: 480px; }
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; color: var(--text); }
.brand .mark { width: 32px; height: 32px; border-radius: 6px; }
.brand i { width: 2px; height: 26px; background: #E8EEF4; border-radius: 1px; opacity: .85; }
.brand .word { height: 22px; width: auto; }
.brand b { font-size: 12px; font-weight: 700; letter-spacing: 2.5px; color: #E8EEF4; border-left: 2px solid #18D6F0; padding-left: 8px; line-height: 14px; }
@media (max-width: 420px) {
  .brand { gap: 8px; }
  .brand .mark { width: 28px; height: 28px; }
  .brand i, .brand b { display: none; }
  .brand .word { height: 19px; }
}
.logo { display: block; width: min(380px, 100%); height: auto; margin: 6vh auto 0; border-radius: 6px; }
.logo + .login { margin-top: 16px; }
.login.left { margin: 16px 0; }
.login .kv { margin-top: 6px; }
.qr { background: #FFFFFF; border-radius: 6px; padding: 8px; width: max-content; margin: 8px 0; }
.qr img { display: block; width: 200px; height: 200px; }
code.key { display: block; font: 15px/1.5 ui-monospace, Menlo, monospace; background: #0F151C; border: 1px solid var(--line); border-radius: 4px;
  padding: 8px 10px; word-break: break-all; letter-spacing: .5px; }
.ok { color: #8EE3A2; min-height: 20px; }
.notice { border-color: var(--amber); margin-bottom: 12px; }
.notice input { margin: 6px 0; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.addform { margin-bottom: 12px; }
.addform h2 { margin-top: 0; }
.addform label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.row3 { display: grid; grid-template-columns: 2fr 2fr 1fr auto; gap: 10px; align-items: end; }
.row3 .end button { width: 100%; }
td.actions { white-space: nowrap; }
td.actions button { margin: 2px 4px 2px 0; min-height: 32px; padding: 5px 10px; font-size: 12px; }
td select { width: auto; padding: 6px 8px; }
@media (max-width: 760px) { .row3 { grid-template-columns: 1fr; } }

/* Live-data watchdog */
.watchdog { display: none; position: sticky; top: 0; z-index: 20; padding: 8px 12px; text-align: center; font-weight: 700;
  letter-spacing: .5px; background: var(--red-bg); color: #FFB4B4; }
.watchdog.on { display: block; animation: blink 1s steps(2, start) infinite; }
.card.nolive { border-color: var(--red); }
.pill.blink { animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .watchdog.on, .pill.blink { animation: none; } }

/* Fleet map */
#fleetmap { isolation: isolate; z-index: 0; height: 56vh; min-height: 320px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 6px; background: #AAD3DF; }
#fleetmap .empty { background: var(--card); height: 100%; }
.leaflet-container { font: inherit; font-size: 13px; }
.vessel-icon { background: none; border: 0; }
.vmark { position: relative; width: 28px; height: 28px; cursor: pointer; }
.vmark svg { display: block; overflow: visible; }
.vmark polygon, .vmark circle { stroke: #0B1016; stroke-width: 1.5; stroke-linejoin: round; fill: var(--green); }
.vmark.alarm polygon, .vmark.alarm circle { fill: var(--red); }
.vmark.stale polygon, .vmark.stale circle { fill: var(--gray); }
.vmark.unverified polygon, .vmark.unverified circle { stroke: var(--amber); stroke-dasharray: 3 2; }
/* Anchor watch: anchor symbol at the reported anchor position and the alarm radius */
.anchor-icon { background: none; border: 0; }
.anchormark svg { display: block; overflow: visible; }
.anchormark .bg { fill: #0B1016; stroke: #F2B01E; stroke-width: 1.5; }
.anchormark path { fill: none; stroke: #F2B01E; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.anchormark.stale .bg, .anchormark.stale path { stroke: var(--gray); }
path.anchorring { stroke: #F2B01E; stroke-width: 2; stroke-dasharray: 6 5; fill: #F2B01E; fill-opacity: .08; }
path.anchorring.stale { stroke: #8C99A6; fill: #8C99A6; }
.vlabel { position: absolute; top: 27px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 11px; font-weight: 700;
  color: #0B1016; text-shadow: 0 0 2px #FFF, 0 0 2px #FFF, 0 0 3px #FFF; pointer-events: none; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--card); color: var(--text); border: 1px solid var(--line); box-shadow: 0 4px 16px rgba(0,0,0,.5); }
.leaflet-popup-content-wrapper { border-radius: 6px; }
.leaflet-popup-content { margin: 12px 14px; max-width: calc(100vw - 112px); }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.vpop .vrow { flex-wrap: wrap; align-items: flex-start; }
.vpop .vname { font-size: 15px; white-space: normal; padding-right: 14px; }
.vpop .kv { margin: 8px 0 10px; }
.vpop .err { min-height: 0; margin-top: 6px; }
.leaflet-container .vpop a.btn { color: var(--text); width: 100%; justify-content: center; }
@media (max-width: 640px) { #fleetmap { height: 48vh; min-height: 280px; } }

/* Weather */
td.nowrap { white-space: nowrap; }
svg.chart .nowline { stroke: var(--amber); stroke-width: 1.5; stroke-dasharray: 4 3; }
svg.chart .mark { fill: var(--accent); stroke: #0B1016; stroke-width: 1.5; }
svg.chart .marklabel { fill: var(--text); font-size: 11px; font-weight: 600; }

/* Fleet map weather layers */
/* Weather controls float on the map (top, right of the zoom buttons); a dark panel in every theme, like the map labels */
.mapwrap { position: relative; isolation: isolate; z-index: 0; margin-bottom: 8px; } /* the panel stays under the sticky header */
.mapwrap #fleetmap { margin-bottom: 0; }
.mapwrap .wxbar { position: absolute; z-index: 500; top: 10px; left: 54px; right: 10px; width: max-content; max-width: calc(100% - 64px);
  padding: 6px 8px; border: 1px solid #364858; border-radius: 6px; background: rgba(11, 16, 22, .9); box-shadow: 0 4px 16px rgba(0, 0, 0, .35);
  --paper: #0F151C; --paper-2: #1B2530; --ink: #FFFFFF; --ink-2: #C9D6E2; --ink-3: #9FB1C0; --rule: #506478; --blue-soft: #273542;
  --primary: #44B3E6; --on-primary: #0B1016; --text: #FFFFFF; --muted: #9FB1C0; color: #FFFFFF; }
.mapwrap .wxbar:has(.wxcontrols:not([hidden])) { width: auto; }
.mapwrap .wxbar .wxtop > select { min-width: 150px; min-height: 34px; padding: 5px 8px; }
.mapwrap .wxbar button { min-height: 32px; padding: 4px 10px; }
.mapwrap .wxbar .wxstatus:empty { display: none; }
.mapwrap .wxbar .wxstatus, .mapwrap .wxbar .muted { color: #9FB1C0; }
.mapwrap .wxbar .wxscale { width: min(280px, 100%); }
.wxtop { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.wxtop > select { width: auto; flex: 0 0 auto; min-width: 170px; }
.wxcontrols { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1 1 420px; }
.wxcontrols input[type=range] { width: auto; padding: 0; border: 0; background: none; accent-color: var(--accent); }
.wxcontrols input[type=range]:nth-of-type(1) { flex: 0 0 90px; }
.wxcontrols input[type=range]:nth-of-type(2) { flex: 1 1 180px; min-width: 140px; }
.wxtime { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 13px; }
.wxlegendrow { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 6px; }
.wxscale { width: 280px; height: 26px; }
.wxlegend { color: var(--text); }
.wxreadout { color: #18D6F0; font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
#fleetmap.wxon .leaflet-tile-pane { filter: grayscale(.6) brightness(.68) contrast(1.15); }
#fleetmap.wxon .vlabel { color: #FFF; text-shadow: 0 0 2px #000, 0 0 3px #000, 0 0 4px #000; }
.vwx { position: absolute; top: 43px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 12px; font-weight: 700;
  font-variant-numeric: tabular-nums; color: #FFF; background: rgba(6,18,30,.9); border: 1px solid #18D6F0; border-radius: 4px;
  padding: 1px 6px; pointer-events: none; }
.vwx[hidden] { display: none; }
.vpop .wxval { color: #18D6F0; font-weight: 700; }
.wxstatus { margin-top: 4px; }
canvas.wxcanvas { position: absolute; top: 0; left: 0; pointer-events: none; }
[hidden] { display: none !important; }

/* Sign-in: a stylised chart (web/chart.svg) beside the sign-in panel; header and footer hidden */
body.signin header#top, body.signin footer { display: none; }
body.signin main { max-width: none; padding: 0; display: flex; }
.signin-page { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 460px); min-height: 100vh; min-height: 100dvh; }
.signin-chart { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  padding: max(40px, env(safe-area-inset-top)) 48px 44px; background: #04121F url(/chart.svg) center / cover no-repeat; }
.signin-logo { display: block; width: min(420px, 80%); height: auto; border-radius: 8px; box-shadow: 0 10px 40px rgba(0, 10, 25, .55); }
.signin-about { max-width: 30em; color: #8EA7BD; font-size: 14px; }
.signin-about p { margin: 0; }
.signin-about .lead { color: #E8EEF4; font-size: 21px; line-height: 1.35; font-weight: 500; margin-bottom: 10px; text-wrap: balance; }
.signin-panel { display: flex; align-items: center; background: #0A2238; border-left: 1px solid #1B3D5C; padding: 48px 44px; }
.signin-form { width: 100%; max-width: 360px; }
.signin-form h1 { font-size: 26px; font-weight: 600; letter-spacing: -.2px; margin: 0 0 8px; }
.signin-form > p { margin: 0 0 22px; font-size: 14px; }
.signin-form label { display: block; margin: 16px 0 6px; color: #A9BED0; font-size: 13px; font-weight: 500; }
.signin-form input { background: #061829; border-color: #2A4E6E; padding: 11px 12px; font-size: 16px; border-radius: 6px; }
.signin-form input:focus { outline: 2px solid #18D6F0; outline-offset: -1px; border-color: transparent; }
.signin-form button.primary { width: 100%; margin-top: 26px; min-height: 46px; border-radius: 6px; border: 0; background: #18D6F0; color: #04121F;
  font-size: 15px; font-weight: 700; letter-spacing: .2px; }
.signin-form button.primary:hover { background: #4FE2F5; }
.signin-form button.primary:focus-visible { outline: 2px solid #E8EEF4; outline-offset: 2px; }
.signin-form button.primary:disabled { opacity: .7; }
.signin-form .err { margin-top: 12px; min-height: 20px; font-size: 14px; }
.signin-form .hint { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid #1B3D5C; color: #8EA7BD; font-size: 13px; }
@media (max-width: 820px) {
  .signin-page { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .signin-chart { padding: max(24px, env(safe-area-inset-top)) 22px 24px; gap: 18px; }
  .signin-logo { width: min(320px, 86%); }
  .signin-about .lead { font-size: 17px; margin-bottom: 0; }
  .signin-about p:not(.lead) { display: none; }
  .signin-panel { border-left: 0; border-top: 1px solid #1B3D5C; align-items: flex-start; padding: 28px 22px max(28px, env(safe-area-inset-bottom)); }
  .signin-form { max-width: none; }
  .signin-form h1 { font-size: 22px; }
}

/* Weather limits and alerts */
td.wxover { color: #FFC57A; font-weight: 700; }
.wxlimits { max-width: 720px; margin-top: 8px; }
.wxlimits h2 { margin-top: 0; }
.wxlimitgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 10px 0; }
.wxlimitgrid label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; }
label.check { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px; color: var(--text); font-size: 14px; }
label.check input { width: auto; }

/* Vessel pages in the hierarchy of the AMS remote pages (2026-12-03): header with menu, centred logo and theme;
   drawer navigation in groups; title block (page, vessel, connection, key figures); sections with ruled titles;
   cards with leader rows, unavailable readings last; bottom alarm strip. Drawing style: square, ruled, light or dark.
   Motion only for current readings; reduced motion turns it off. */
.hright { display: flex; align-items: center; gap: 8px; min-width: 0; }
.icon-button { display: grid; place-items: center; width: 40px; min-height: 40px; padding: 0; }
.icon-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: square; }
body:not(.vmode) #theme-toggle { display: none; }
#theme-toggle svg { display: none; }
#theme-toggle[data-choice="auto"] .theme-auto, #theme-toggle[data-choice="light"] .theme-light, #theme-toggle[data-choice="dark"] .theme-dark { display: block; }
#theme-toggle .fill { fill: currentColor; stroke: none; }

body.vmode {
  --paper: #f3f5f4; --paper-2: #e9eeec; --grid: #e0e6e4; --ink: #13202b; --ink-2: #364652; --ink-3: #56656f;
  --rule: #13202b; --rule-soft: #b6c1bf; --rule-faint: #d3dbd9; --blue: #1b5fc9; --blue-ink: #174d9f; --blue-soft: #dde6f6;
  --red: #b3261a; --red-ink: #8f1d13; --red-soft: #f7e0dc; --on-red: #ffffff; --amber: #8a5200; --amber-soft: #fbf0db;
  --green: #17734a; --primary: #13202b; --on-primary: #f3f5f4; --shadow: 0 10px 30px rgb(19 32 43 / .18);
  --water: #1b6fc9; --fuel: #b07a10; --oil: #7a6a3e;
  /* the shared names used by tables, forms and charts */
  --body: var(--paper); --head: var(--paper); --card: var(--paper); --card-alt: var(--paper-2); --line: var(--rule-soft); --btn: var(--paper);
  --btn-line: var(--rule); --text: var(--ink); --muted: var(--ink-3); --accent: var(--blue); --gray: var(--ink-3);
  --green-bg: #dcefe4; --red-bg: var(--red-soft); --amber-bg: var(--amber-soft);
  color-scheme: light;
}
:root[data-theme="dark"] body.vmode {
  --paper: #0b1828; --paper-2: #10213a; --grid: #12233a; --ink: #b4c7da; --ink-2: #93aac0; --ink-3: #7189a0;
  --rule: #5d7fa1; --rule-soft: #2b4566; --rule-faint: #1b2f4a; --blue: #6cc4ee; --blue-ink: #9fd8f5; --blue-soft: #15325a;
  --red: #8a2a1c; --red-ink: #ff9e8f; --red-soft: #3a1612; --on-red: #ffd9d2; --amber: #e2b06a; --amber-soft: #2c2312;
  --green: #74c79c; --primary: #6cc4ee; --on-primary: #0b1828; --shadow: 0 12px 34px rgb(0 0 0 / .45);
  --water: #5aa9ef; --fuel: #e2b06a; --oil: #b9a56e; --green-bg: #133826;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.vmode {
    --paper: #0b1828; --paper-2: #10213a; --grid: #12233a; --ink: #b4c7da; --ink-2: #93aac0; --ink-3: #7189a0;
    --rule: #5d7fa1; --rule-soft: #2b4566; --rule-faint: #1b2f4a; --blue: #6cc4ee; --blue-ink: #9fd8f5; --blue-soft: #15325a;
    --red: #8a2a1c; --red-ink: #ff9e8f; --red-soft: #3a1612; --on-red: #ffd9d2; --amber: #e2b06a; --amber-soft: #2c2312;
    --green: #74c79c; --primary: #6cc4ee; --on-primary: #0b1828; --shadow: 0 12px 34px rgb(0 0 0 / .45);
    --water: #5aa9ef; --fuel: #e2b06a; --oil: #b9a56e; --green-bg: #133826;
    color-scheme: dark;
  }
}
html:has(body.vmode) { background: var(--paper, #f3f5f4); }
body.vmode {
  background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px; color: var(--ink); font-variant-numeric: tabular-nums;
}
body.vmode main { max-width: 1080px; }
body.vmode button, body.vmode .btn { border-radius: 0; background: var(--paper); color: var(--ink); border-color: var(--rule); }
body.vmode button:hover:not(:disabled) { background: var(--blue-soft); }
body.vmode button.on { color: var(--on-primary); background: var(--primary); border-color: var(--primary); }
body.vmode input, body.vmode select { border-radius: 0; background: var(--paper); color: var(--ink); border-color: var(--rule); }
body.vmode :is(button, a, input, select, summary):focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
body.vmode .pill { border-radius: 0; background: transparent; border: 1px solid currentColor; padding: 1px 7px; }
body.vmode .pill.online, body.vmode .pill.ok { color: var(--green); }
body.vmode .pill.offline, body.vmode .pill.critical, body.vmode .pill.high { color: var(--red-ink); background: var(--red-soft); }
body.vmode .pill.medium, body.vmode .pill.warn { color: var(--amber); background: var(--amber-soft); }
body.vmode .pill.low, body.vmode .pill.unknown, body.vmode .pill.off { color: var(--ink-3); }
body.vmode .ok { color: var(--green); }
body.vmode .err { color: var(--red-ink); }
body.vmode footer { background: var(--paper); color: var(--ink-3); border-top-color: var(--rule); }
body.vmode .watchdog { background: var(--red); color: var(--on-red); }

/* Header: menu left, logo centred, account and theme right */
body.vmode header#top {
  display: grid; grid-template-columns: minmax(max-content, 1fr) minmax(0, auto) minmax(max-content, 1fr); gap: 10px;
  min-height: 60px; padding-left: max(16px, calc((100vw - 1080px) / 2 + 16px)); padding-right: max(16px, calc((100vw - 1080px) / 2 + 16px));
  background: var(--paper); border-bottom: 1px solid var(--rule);
}
.brandbox { display: contents; }
body.vmode #menu-toggle { grid-column: 1; justify-self: start; }
body.vmode header#top .brand { grid-column: 2; padding: 5px 10px; background: #0B1016; } /* the logo is drawn for a navy ground */
body.vmode .hright { grid-column: 3; justify-self: end; }
body.vmode #who { color: var(--ink-3); }
/* Below 1100 px the account controls take their room first and the logo fills what is left, centred there; the
   wordmark (then the FLEET label) is dropped when it does not fit, so the logo never runs under the controls. */
@media (max-width: 1100px) {
  body.vmode header#top { grid-template-columns: max-content minmax(0, 1fr) max-content; }
  body.vmode .brandbox { grid-column: 2; display: flex; justify-content: center; min-width: 0; overflow: hidden; container-type: inline-size; }
  body.vmode header#top .brand { max-width: 100%; }
}
@container (max-width: 300px) { body.vmode header#top .brand i, body.vmode header#top .brand b { display: none; } }
@container (max-width: 210px) { body.vmode header#top .brand .word { display: none; } }

/* Drawer: page groups as on the AMS remote pages */
.drawer { position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(340px, 88vw); overflow: auto;
  padding: max(12px, env(safe-area-inset-top)) 0 max(20px, env(safe-area-inset-bottom));
  background: var(--paper); border-right: 1px solid var(--rule); box-shadow: var(--shadow); animation: drawer-in .2s cubic-bezier(.16, 1, .3, 1) both; }
.drawer-backdrop { position: fixed; z-index: 39; inset: 0; background: rgb(0 0 0 / .25); }
.drawer-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px 12px 16px; border-bottom: 1px solid var(--rule);
  color: var(--ink-3); font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.drawer-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dnav { display: grid; }
.nav-top, .nav-group summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 16px;
  color: var(--ink); border-bottom: 1px solid var(--rule-faint); font-size: 14px; font-weight: 700; letter-spacing: .04em; cursor: pointer; }
.nav-top:hover, .nav-group summary:hover { background: var(--paper-2); }
.nav-group summary { list-style: none; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after { content: ""; width: 12px; height: 12px; color: var(--ink-3);
  background: linear-gradient(currentColor, currentColor) center / 12px 1.5px no-repeat, linear-gradient(currentColor, currentColor) center / 1.5px 12px no-repeat; }
.nav-group[open] summary { color: var(--blue-ink); }
.nav-group[open] summary::after { color: var(--blue-ink); background: linear-gradient(currentColor, currentColor) center / 12px 1.5px no-repeat; }
.nav-pages { display: grid; padding: 2px 0 6px; border-bottom: 1px solid var(--rule-faint); background: var(--paper-2); }
body.vmode .nav-pages button { width: 100%; min-height: 44px; padding: 8px 16px 8px 28px; color: var(--ink-2); background: transparent; border: 0;
  text-align: left; font-size: 14px; font-weight: 500; letter-spacing: 0; }
body.vmode .nav-pages button:hover { color: var(--ink); background: var(--blue-soft); }
body.vmode .nav-pages button.selected { color: var(--blue-ink); background: var(--blue-soft); font-weight: 700; }
@keyframes drawer-in { from { transform: translateX(-16px); opacity: .6; } }

/* Title block: page and vessel, connection state, key figures */
.vpage { display: flex; flex-direction: column; min-height: calc(100svh - 120px); }
.vpage > * { flex: none; }
.titleblock { margin: 4px 0 12px; background: var(--paper); border: 1px solid var(--rule); }
.titleblock > * + * { border-top: 1px solid var(--rule); }
.tb-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 12px 9px; }
.tb-head h1 { margin: 0; font-size: 21px; font-weight: 750; line-height: 1.15; letter-spacing: .03em; text-wrap: balance; }
.tb-vessel { margin: 0; flex: none; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); font-size: 13px; font-weight: 700; letter-spacing: .04em; text-align: right; }
.tb-conn { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 12px; font-size: 12px; }
.tb-conn::before { content: ""; flex: 0 0 9px; height: 9px; background: var(--amber); }
.tb-conn strong { color: var(--amber); font-weight: 700; letter-spacing: .06em; }
.tb-conn span { margin-left: auto; color: var(--ink-3); text-align: right; }
.tb-conn.fresh::before { background: var(--green); animation: live-tick 2.4s ease-out infinite; }
.tb-conn.fresh strong { color: var(--green); }
.tb-conn.offline::before { background: var(--red-ink); }
.tb-conn.offline strong { color: var(--red-ink); }
@keyframes live-tick { 0%, 70% { opacity: 1; } 85% { opacity: .35; } 100% { opacity: 1; } }
.vstats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.vstat { min-width: 0; padding: 8px 12px; }
.vstat + .vstat { border-left: 1px solid var(--rule-soft); }
.vstat span { display: block; color: var(--ink-3); font-size: 11px; font-weight: 750; letter-spacing: .1em; }
.vstat b { display: block; color: var(--ink); font-size: 18px; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vstat.bad b { color: var(--red-ink); }
.vstat.warn b { color: var(--amber); }

/* Page body: sections with ruled titles (AMS cluster titles) */
.vbody { padding: 0 0 16px; min-height: 240px; }
.vpage h2, .cathead h3 { display: flex; align-items: center; gap: 10px; margin: 14px 0 8px; color: var(--blue-ink); font-size: 14px; font-weight: 750;
  letter-spacing: .02em; text-transform: uppercase; }
.vpage h2::after, .cathead h3::after { content: ""; flex: 1; height: 1px; background: var(--blue); }
.vbody > h2:first-child { margin-top: 4px; }
.vbody.enter > * { animation: sheet-trace .32s cubic-bezier(.16, 1, .3, 1) both; }
.vbody.enter .egrid > * { animation: sheet-trace .32s cubic-bezier(.16, 1, .3, 1) .06s both; }
@keyframes sheet-trace { from { clip-path: inset(0 0 40% 0); } to { clip-path: inset(0 0 0 0); } }
.vhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.vhead h2 { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--rule); }
body.vmode .seg button { border: 0; min-height: 32px; padding: 4px 12px; font-size: 11.5px; }
.vbanner, .vnote { margin: 0 0 12px; padding: 9px 12px; color: var(--amber); background: var(--amber-soft); border: 1px dashed var(--amber); font-size: 13px; font-weight: 600; }
.vpage .tablewrap, .vpage .card, .vpage svg.chart { background: var(--paper); border: 1px solid var(--rule); border-radius: 0; }
.vpage th { background: var(--paper-2); color: var(--ink-2); border-bottom: 1px solid var(--rule); }
.vpage td { border-bottom: 1px dashed var(--rule-soft); }
.vpage tr.click:hover td { background: var(--blue-soft); }
.vpage .stale td { color: var(--ink-3); }
.vpage .empty { color: var(--ink-3); }
.vpage .muted { color: var(--ink-3); }
.vpage .card h2 { margin-top: 0; }
.vpage svg.chart .grid { stroke: var(--rule-faint); }
.vpage svg.chart .band { fill: var(--blue-soft); }
.vpage svg.chart .mark { stroke: var(--paper); }
.vpage .kv span:nth-child(odd) { color: var(--ink-2); }
.vpage td.wxover { color: var(--amber); }

/* Equipment: each category a section; cards have a ruled header and leader rows */
.catsec { margin-top: 6px; }
.cathead { display: flex; align-items: center; gap: 10px; }
.cathead h3 { flex: 1; min-width: 0; }
.catsec.hasalarm .cathead h3 { color: var(--red-ink); }
.catsec.hasalarm .cathead h3::after { background: var(--red-ink); }
.catcount { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; color: var(--ink-3); font-size: 12px; }
.egrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; align-items: start; }
.egrid + .egrid { margin-top: 12px; }
.egrid.g-tank { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.egrid.g-compact { grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); align-items: stretch; }
.ecard { display: flex; flex-direction: column; min-width: 0; padding: 0 12px 6px; background: var(--paper); border: 1px solid var(--rule); }
.ecard.empty { display: block; padding: 14px 12px; color: var(--ink-3); }
.ecard.okstate { border-left: 4px solid var(--green); }
.ecard.alarm { border-color: var(--red-ink); }
.ecard > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin: 0 -12px 2px; padding: 7px 12px; border-bottom: 1px solid var(--rule); }
.ecard.alarm > header { background: var(--red-soft); }
.etitle { display: flex; flex-direction: column; min-width: 0; }
.ename { color: var(--ink); font-size: 13px; font-weight: 750; letter-spacing: .02em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.earea { color: var(--ink-3); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.estat { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; padding-top: 3px; }
.eflag { color: var(--amber); font-size: 10px; font-weight: 750; letter-spacing: .08em; }
.ebadge { color: var(--amber); border: 1px solid var(--amber); padding: 0 4px; font-size: 9.5px; font-weight: 750; letter-spacing: .06em; }
.allunverified .ebadge { display: none; }
.edot { width: 9px; height: 9px; min-height: 0; flex: 0 0 auto; border: 1px solid var(--ink-3); } /* .ok also names a message colour */
.edot.ok { background: var(--green); border-color: var(--green); }
.edot.part { background: var(--amber); border-color: var(--amber); }
/* metric rows: name, leader line, reading; trace or level bar under it */
.mgrid { display: flex; flex-direction: column; }
.mtile { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 2px 8px; min-height: 40px; padding: 9px 0 7px; border-top: 1px dashed var(--rule-soft); }
.ecard > header + .mgrid > .mtile:first-child, .ecard > header + .chips + .mgrid > .mtile:first-child { border-top: 0; }
.tlabel { display: flex; align-items: baseline; gap: 8px; min-width: 0; color: var(--ink-2); font-size: 14px; overflow: hidden; white-space: nowrap; }
.tlabel::after { content: ""; flex: 1 1 16px; min-width: 16px; border-bottom: 1px solid var(--rule-soft); transform: translateY(-4px); }
.mtile > .tlabel { text-overflow: ellipsis; }
.tval { color: var(--ink); text-align: right; white-space: nowrap; }
.tval b, .tread b { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.unit { color: var(--ink-3); font-size: 13px; margin-left: 3px; }
.tnote { grid-column: 1 / -1; display: block; color: var(--amber); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-align: right; }
.tnote:empty { display: none; }
b.tick { animation: tick .9s ease-out; }
@keyframes tick { from { background: var(--blue-soft); } }
.spark { grid-column: 1 / -1; display: block; width: 100%; height: 14px; overflow: visible; }
.sline { fill: none; stroke: var(--blue); stroke-width: 1.3; opacity: .6; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.tbar { grid-column: 1 / -1; height: 6px; margin: 2px 0; border: 1px solid var(--rule); background: var(--paper); }
.tbar i { display: block; height: 100%; width: 0; background: var(--blue); transition: width .4s cubic-bezier(.16, 1, .3, 1); }
/* state rows: name, leader line, square indicator and state text (AMS status indicator) */
.chips { display: flex; flex-direction: column; }
.chip { display: flex; align-items: baseline; gap: 8px; min-height: 36px; padding: 8px 0 6px; border-top: 1px dashed var(--rule-soft); font-size: 14px; min-width: 0; }
.ecard > header + .chips > .chip:first-child, .cmain .chip { border-top: 0; }
.chip .chipcap { display: flex; flex: 1 1 auto; align-items: baseline; gap: 8px; min-width: 0; color: var(--ink-2); overflow: hidden; white-space: nowrap; }
.chip .chipcap::after { content: ""; flex: 1 1 16px; min-width: 16px; border-bottom: 1px solid var(--rule-soft); transform: translateY(-4px); }
.chip b { display: inline-flex; align-items: center; gap: 6px; flex: none; color: var(--ink-3); font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.chip b::before { content: ""; width: 8px; height: 8px; border: 1px solid currentColor; }
.chip.status.on b { color: var(--green); }
.chip.status.on b::before { background: currentColor; }
.chip.status.off b { color: var(--ink-2); }
.chip.status.inv.on b { color: var(--red-ink); }
.chip.status.inv.on b::before { background: currentColor; transform: rotate(45deg); }
.chip.status.inv.off b { color: var(--green); }
.chip.status.inv.off b::before { background: currentColor; transform: none; }
.chip.alarm.on b { color: var(--red-ink); animation: aflash 1s steps(2, start) infinite; }
.chip.alarm.on b::before { background: currentColor; transform: rotate(45deg); }
.chip.none b { color: var(--ink-3); }
.chip.stale b, .chip.stale.on b, .chip.stale.off b { color: var(--ink-3); animation: none; }
.chip.stale b::before { background: none !important; transform: none !important; }
.chip.big { padding: 10px 0 8px; }
.chip.big b { font-size: 13px; }
.cmain { border-bottom: 1px dashed var(--rule-soft); }
.k-compact .chips:empty { display: none; }
.k-compact .eflag:empty { display: none; }
.k-compact .eflag { margin-top: 2px; }
.k-compact .ename { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
/* tank: a section through the tank with level ticks */
.tankwrap { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: end; padding: 12px 0 10px; }
.tfacts { display: grid; gap: 4px; }
.tfacts > div { display: grid; gap: 0; padding-top: 4px; border-top: 1px solid var(--rule-soft); }
.tfacts .tlabel { font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--ink-3); text-transform: uppercase; }
.tfacts .tlabel::after { display: none; }
.tfacts .tval { text-align: left; }
.tfacts .tval b { font-size: 15px; }
.tank { display: flex; align-items: flex-end; gap: 12px; --c: var(--blue); }
.tank.water { --c: var(--water); } .tank.fuel { --c: var(--fuel); } .tank.oil { --c: var(--oil); }
.tbody { position: relative; flex: 0 0 auto; width: 48px; height: 96px; overflow: hidden; border: 1px solid var(--rule);
  background: repeating-linear-gradient(135deg, transparent 0 5px, var(--rule-faint) 5px 6px); }
.tfill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: color-mix(in srgb, var(--c) 30%, var(--paper)); border-top: 2px solid var(--c);
  transition: height .9s cubic-bezier(.16, 1, .3, 1); }
.twave { position: absolute; left: 0; bottom: 100%; width: 200%; height: 5px; margin-bottom: 1px; animation: wave 3.2s linear infinite; }
.twave path { fill: color-mix(in srgb, var(--c) 30%, var(--paper)); }
@keyframes wave { to { transform: translateX(-50%); } }
.tscale { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-evenly; align-items: flex-end; pointer-events: none; }
.tscale i { display: block; width: 8px; height: 1px; background: var(--rule); }
.tread { display: flex; flex-direction: column; gap: 1px; min-width: 60px; }
.tread .tlabel { font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--ink-3); text-transform: uppercase; }
.tread .tlabel::after { display: none; }
.tread b { font-size: 24px; letter-spacing: -.02em; }
.tread .tnote { text-align: left; }
/* not current: grey, hatched, no movement */
.stale .tval b, .stale.tval b, .tank.stale .tread b { color: var(--ink-3); }
.tank.stale .tfill, .stale .tbar i { background: repeating-linear-gradient(45deg, var(--rule-soft) 0 5px, var(--paper-2) 5px 10px); border-top-color: var(--ink-3); transition: none; }
.tank.stale .twave, .tank.nodata .twave { display: none; }
.stale .sline { stroke: var(--ink-3); }
.ecard.stale { border-color: var(--rule-soft); }
.ecard.stale .tnote.plain { display: none; } /* the card header already says NOT CURRENT */

/* Active alarm cards (AMS alarm list): priority and state, alarm text, then details */
.acards { display: grid; gap: 8px; }
.acard { padding: 10px 12px; background: var(--paper); border: 1px solid var(--rule); border-left: 4px solid var(--ink-3); }
.acard.p-critical, .acard.p-high { border-color: var(--red-ink); }
.acard.p-medium { border-color: var(--amber); }
.acard-head { display: block; color: var(--red-ink); font-size: 12px; font-weight: 750; letter-spacing: .08em; }
.acard.p-medium .acard-head { color: var(--amber); }
.acard.p-low .acard-head { color: var(--ink-3); }
.acard p { margin: 4px 0; font-size: 15px; font-weight: 600; line-height: 1.45; }
.acard .kv { margin-top: 4px; font-size: 12px; }
.acard.unack { animation: aflash 1s steps(2, start) infinite; }
@keyframes aflash { to { background: var(--red-soft); } }

/* Bottom alarm strip */
.alarmbar { position: sticky; bottom: 0; z-index: 15; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; margin-top: auto;
  padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); text-align: left; font-size: 13px; font-weight: 700; letter-spacing: .04em; }
body.vmode .alarmbar { border: 1px solid var(--rule); border-radius: 0; background: var(--paper); color: var(--ink); }
.alarmbar .abtag { flex: none; padding: 2px 6px; border: 1px solid currentColor; font-size: 11px; font-weight: 750; letter-spacing: .12em; }
.alarmbar .abtext { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alarmbar .abright { flex: 0 0 auto; font-size: 11px; font-weight: 600; opacity: .85; }
body.vmode .alarmbar.none { color: var(--green); }
body.vmode .alarmbar.acked, body.vmode .alarmbar.acked:hover { color: var(--amber); background: var(--amber-soft); border-color: var(--amber); }
body.vmode .alarmbar.unack, body.vmode .alarmbar.unack:hover { color: var(--on-red); background: var(--red); border-color: var(--red); }
.alarmbar.unack .abtag { animation: alarm-flag 1.6s steps(2, jump-none) infinite; }
@keyframes alarm-flag { from { background: transparent; } to { color: var(--red); background: var(--on-red); } }
body.vmode .alarmbar.stale, body.vmode .alarmbar.stale:hover { color: var(--amber); background: var(--amber-soft); border: 1px dashed var(--amber); }
body.vmode .alarmbar.stale .abtag { animation: none; }

@media (min-width: 900px) {
  .titleblock { display: grid; grid-template-columns: 2fr 1fr 1fr; }
  .titleblock > * + * { border-top: 0; }
  .tb-head { grid-column: 1; }
  .tb-conn { grid-column: 2 / -1; border-left: 1px solid var(--rule); }
  .vstats { grid-column: 1 / -1; border-top: 1px solid var(--rule) !important; }
}
@media (max-width: 760px) {
  .vstats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vstat:nth-child(3) { border-left: 0; }
  .vstat:nth-child(n+3) { border-top: 1px solid var(--rule-soft); }
  .alarmbar .abright { display: none; }
}
@media (max-width: 520px) {
  body.vmode header#top { grid-template-columns: max-content minmax(0, 1fr) max-content; padding-left: 12px; padding-right: 12px; gap: 6px; }
  body.vmode header#top .brand { justify-self: center; gap: 0; padding: 5px; }
  body.vmode header#top .brand .word, body.vmode header#top .brand i, body.vmode header#top .brand b { display: none; }
  body.vmode #who .pill { display: none; }
  body.vmode main { padding: 12px; }
  .tb-head { flex-wrap: wrap; }
  .tb-head h1 { font-size: 19px; }
  .tb-vessel { max-width: 100%; }
  .egrid.g-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vstat b { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .vpage *, .vpage *::before, .vpage *::after, .vpage { animation: none !important; transition: none !important; }
}

/* Fleet page tide strip: modelled sea level at one vessel, 6 h back to 24 h ahead (scoped to .tidestrip) */
.tidestrip { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px 4px; margin-bottom: 8px; }
.tidestrip[hidden] { display: none; }
.tidestrip .thead { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 13px; }
.tidestrip .thead b { color: #A5B9CA; letter-spacing: .6px; text-transform: uppercase; font-size: 13px; }
.tidestrip .thead select { width: auto; padding: 4px 8px; font-size: 13px; }
.tidestrip .tnow { color: #18D6F0; font-weight: 700; font-variant-numeric: tabular-nums; }
.tidestrip .tnow.stale { color: var(--gray); }
.tidestrip .tnext { font-variant-numeric: tabular-nums; white-space: pre; }
.tidestrip .tdisc { font-size: 11px; margin-left: auto; }
.tidestrip .tplot { min-height: 62px; display: flex; align-items: center; }
.tidestrip .tplot svg { display: block; width: 100%; height: 62px; overflow: visible; }
.tidestrip .tarea { fill: rgba(24, 214, 240, .12); stroke: none; }
.tidestrip .tline { fill: none; stroke: #18D6F0; stroke-width: 2; stroke-linejoin: round; }
.tidestrip .ttick { stroke: #506478; }
.tidestrip .tlab { fill: var(--muted); font-size: 10px; text-anchor: middle; font-variant-numeric: tabular-nums; }
.tidestrip .tex { fill: #E6EEF5; font-size: 10.5px; font-weight: 700; text-anchor: middle; font-variant-numeric: tabular-nums; }
.tidestrip .tex.past { fill: var(--gray); }
.tidestrip .thw { fill: #18D6F0; } .tidestrip .tlw { fill: #9FB1C0; }
.tidestrip .tnowline { stroke: #FFC57A; stroke-width: 1.5; stroke-dasharray: 3 3; }
.tidestrip .tnowdot { fill: #FFC57A; stroke: #0B1016; stroke-width: 1.5; }
.wxalerts { margin-top: 8px; }
@media (max-width: 640px) { .tidestrip .tdisc { margin-left: 0; flex-basis: 100%; } }

/* ---------------------------------------------------------------- cameras (video directly from the vessel) */
.camnote { margin: 0 0 10px; }
.camgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.camtile { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 0 10px 10px; background: var(--paper); border: 1px solid var(--rule); }
.camtile.big { grid-column: 1 / -1; }
.camtile.playing { border-color: var(--green); }
.camtile header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0 -10px; padding: 7px 10px; border-bottom: 1px solid var(--rule); }
.camstate { color: var(--ink-3); font-size: 11px; font-weight: 750; letter-spacing: .08em; }
.camstate.live { color: var(--green); } .camstate.wait { color: var(--amber); } .camstate.bad { color: var(--red-ink); }
.camstate.live::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; background: currentColor; vertical-align: 0; }
.camview { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #05080B; border: 1px solid var(--rule); }
.camview video { display: block; width: 100%; height: 100%; object-fit: contain; }
.cammsg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0; padding: 16px; color: #9FB1C0; font-size: 13px; text-align: center; }
.cammsg[hidden] { display: none; }
.camctl { display: flex; gap: 8px; }
@media (max-width: 560px) { .camgrid { grid-template-columns: 1fr; } }
/* key-value cards on vessel pages (station, devices): AMS leader rows */
.vpage .ecard > .kv { gap: 0 12px; margin: 0; }
.vpage .ecard > .kv > span { padding: 8px 0 7px; border-top: 1px dashed var(--rule-soft); font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.vpage .ecard > .kv > span:nth-child(-n+2) { border-top: 0; }
.vpage .ecard > .kv > span:nth-child(even) { color: var(--ink); font-weight: 600; text-align: right; }

/* tide strip on the light vessel pages */
.vpage .tidestrip { background: var(--paper); border: 1px solid var(--rule); border-radius: 0; }
.vpage .tidestrip .thead b { color: var(--blue-ink); }
.vpage .tidestrip .tnow { color: var(--blue-ink); }
.vpage .tidestrip .tline { stroke: var(--blue); }
.vpage .tidestrip .tarea { fill: var(--blue-soft); }
.vpage .tidestrip .thw { fill: var(--blue); } .vpage .tidestrip .tlw { fill: var(--ink-3); }
.vpage .tidestrip .tex { fill: var(--ink); } .vpage .tidestrip .tex.past { fill: var(--ink-3); }
.vpage .tidestrip .ttick { stroke: var(--rule-soft); }
.vpage .tidestrip .tnowline { stroke: var(--amber); } .vpage .tidestrip .tnowdot { fill: var(--amber); stroke: var(--paper); }
.vpage .mapwrap #fleetmap { border: 1px solid var(--rule); border-radius: 0; }
.vpage .vhead button { min-height: 32px; padding: 4px 12px; font-size: 12px; }
@media (max-width: 520px) {
  .mapwrap .wxbar { left: 50px; right: 8px; max-width: calc(100% - 58px); }
  .mapwrap .wxbar .wxcontrols input[type=range]:nth-of-type(1) { display: none; } /* opacity: keeps the panel small on phones */
  .mapwrap .wxbar .wxlab { display: none; }
  .mapwrap .wxbar .wxtop { flex-wrap: nowrap; gap: 6px; }
  .mapwrap .wxbar .wxtop > select { min-width: 0; width: 96px; flex: none; }
  .mapwrap .wxbar .wxcontrols { flex: 1 1 auto; flex-wrap: nowrap; gap: 6px; min-width: 0; }
  .mapwrap .wxbar .wxcontrols input[type=range]:nth-of-type(2) { flex: 1 1 40px; min-width: 40px; }
  .mapwrap .wxbar .wxtime { font-size: 11px; white-space: normal; line-height: 1.15; max-width: 74px; }
  .mapwrap .wxbar button { padding: 4px 7px; font-size: 12px; }
  .mapwrap .wxbar .wxlegendrow { margin-top: 4px; }
  .mapwrap .wxbar .wxlegend { font-size: 10px; line-height: 1.3; }
  .mapwrap .wxbar .wxstatus { margin-top: 2px; font-size: 10px; line-height: 1.3; }
  .vpage .mapwrap #fleetmap { height: 62vh; }
}
