/* Vessel Maintenance - engine-room log styling. System fonts only (works offline). */
:root {
  --hull: #0B2545;        /* sidebar, headings */
  --hull-2: #16407A;
  --spray: #8CC4FF;       /* highlights on dark */
  --bg: #E7EEF7;
  --surface: #FFFFFF;
  --surface-2: #F2F6FC;
  --line: #C9D7EA;
  --line-2: #E0E8F3;
  --ink: #12223A;
  --muted: #55678A;
  --accent: #1E63C4;
  --accent-ink: #FFFFFF;
  --over: #BE3328;
  --over-bg: #FBEAE8;
  --soon: #A86D00;
  --soon-bg: #FDF3DD;
  --ok: #2B7550;
  --ok-bg: #E5F2EA;
  --unk: #6E7C81;
  --display: "Bahnschrift", "DIN Alternate", "DIN 2014", "Barlow", "Segoe UI", system-ui, sans-serif;
  --body: "Segoe UI", "Segoe UI Variable Text", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --r: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; margin: 0; letter-spacing: .005em; }
h1 { font-size: 26px; line-height: 1.2; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
.num, .mono { font-family: var(--display); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.hide { display: none !important; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--hull); color: #D6E4F7; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 11px; align-items: center; padding: 20px 18px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark { width: 30px; height: 30px; color: var(--spray); flex: none; }
.brand-vessel { font-family: var(--display); font-size: 17px; font-weight: 600; color: #fff; line-height: 1.2; word-break: break-word; }
.brand-sub { font-size: 12px; color: #8EA9D1; }
.nav { display: flex; flex-direction: column; padding: 10px 8px; gap: 1px; flex: 1; overflow: auto; }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-radius: 5px; color: #C3D5F0; text-decoration: none; font-size: 14.5px; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.on { background: var(--hull-2); color: #fff; box-shadow: inset 3px 0 0 var(--spray); }
.side { background: linear-gradient(180deg, #0B2545 0%, #0E2D57 100%); }
.nav-low { margin-top: auto; }
.pill { font: 600 12px/1 var(--display); padding: 4px 7px; border-radius: 10px; background: rgba(255,255,255,.12); color: #fff; }
.pill:empty { display: none; }
.pill.over { background: var(--over); }
.pill.soon { background: #C98A12; }
.side-foot { padding: 12px 18px 16px; font-size: 12px; color: #7C97C2; border-top: 1px solid rgba(255,255,255,.08); }
.menu-btn { display: none; }
.main { padding: 26px 34px 60px; min-width: 0; outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { color: var(--muted); margin-top: 3px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 14px; font-weight: 500; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: #A9BDDB; background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #174F9E; }
.btn.danger { color: var(--over); }
.btn.danger:hover { border-color: var(--over); background: var(--over-bg); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn.sign { background: var(--hull); border-color: var(--hull); color: #fff; }
.btn.sign:hover { background: var(--hull-2); }
.btn:disabled { opacity: .55; cursor: default; }
input[type=text], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; font-size: 14.5px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(30,99,196,.18); }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 13px; font-weight: 600; color: #2E4266; margin-bottom: 4px; }
label.f > em { display: block; font-style: normal; font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.check { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 12px; cursor: pointer; }
.check input { margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input[type=search] { max-width: 300px; }
.toolbar select { width: auto; }
fieldset.seg { border: 0; padding: 0; margin: 0 0 12px; display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: #fff; }
fieldset.seg label { padding: 6px 13px; cursor: pointer; font-size: 14px; border-right: 1px solid var(--line); }
fieldset.seg label:last-child { border-right: 0; }
fieldset.seg input { position: absolute; opacity: 0; pointer-events: none; }
fieldset.seg label:has(input:checked) { background: var(--hull); color: #fff; }
fieldset.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- panels & tables ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.panel-body { padding: 16px; }
.empty { padding: 34px 20px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 4px; }
.empty .btn { margin-top: 12px; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #EEF4FC; }
table.t .r { text-align: right; }
.tablewrap { overflow-x: auto; }
.kv { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--line-2); color: #2E4266; white-space: nowrap; }
.tag.over { background: var(--over-bg); color: var(--over); }
.tag.soon { background: var(--soon-bg); color: var(--soon); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.crit { background: var(--hull); color: #fff; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: transparent; flex: none; }
.dot.overdue { background: var(--over); }
.dot.soon { background: #D4950F; }
.dot.ok { background: var(--ok); }

/* ---------- due board (the signature element) ---------- */
.due-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { text-decoration: none; color: var(--ink); display: inline-flex; align-items: baseline; gap: 8px; padding: 8px 14px; border: 1px solid var(--line); background: var(--surface); border-radius: 22px; cursor: pointer; font-size: 14px; }
.chip b { font: 600 18px/1 var(--display); }
.chip.on { border-color: var(--hull); box-shadow: inset 0 0 0 1px var(--hull); }
.chip.over b { color: var(--over); }
.chip.soon b { color: var(--soon); }
.chip.ok b { color: var(--ok); }
.due-group { margin-bottom: 22px; }
.due-group > h2 { font-size: 15px; color: var(--muted); font-weight: 600; margin: 0 0 8px 2px; }
.due-list { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.due-row { display: grid; grid-template-columns: 112px 1fr auto; gap: 16px; align-items: center; padding: 12px 16px 12px 0; border-bottom: 1px solid var(--line-2); }
.due-row:last-child { border-bottom: 0; }
.due-row:hover { background: #F5F8FD; }
.gauge { align-self: stretch; display: flex; flex-direction: column; justify-content: center; padding-left: 16px; border-left: 5px solid var(--unk); }
.gauge .big { font: 600 25px/1.05 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.gauge .u { font-size: 12px; color: var(--muted); }
.gauge .alt { font: 500 13px/1.3 var(--display); color: var(--muted); margin-top: 2px; }
.due-row.overdue .gauge { border-left-color: var(--over); }
.due-row.overdue .gauge .big { color: var(--over); }
.due-row.soon .gauge { border-left-color: #D4950F; }
.due-row.soon .gauge .big { color: var(--soon); }
.due-row.ok .gauge { border-left-color: #8DBFA4; }
.due-row.ok .gauge .big { color: var(--ok); }
.due-main { min-width: 0; }
.due-title { font-weight: 600; font-size: 15.5px; }
.due-title a { color: var(--ink); text-decoration: none; }
.due-title a:hover { color: var(--accent); text-decoration: underline; }
.due-comp { font-size: 13.5px; color: var(--muted); margin-top: 1px; }
.due-comp a { color: inherit; text-decoration: none; }
.due-comp a:hover { color: var(--accent); text-decoration: underline; }
.due-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.due-meta b { font-weight: 600; color: #33496E; }

.meter-strip { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.meter { display: flex; align-items: center; gap: 12px; padding: 9px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.meter .num { font-size: 20px; font-weight: 600; }
.meter .lbl { font-size: 13px; line-height: 1.25; }
.meter .lbl .muted { font-size: 12px; }

/* ---------- component tree ---------- */
.tree { list-style: none; margin: 0; padding: 0; }
.tree ul { list-style: none; margin: 0; padding: 0 0 0 26px; }
.node { display: flex; align-items: center; gap: 10px; padding: 7px 14px 7px 8px; border-bottom: 1px solid var(--line-2); }
.node:hover { background: #F2F7FD; }
.node .tw { width: 22px; height: 22px; border: 0; background: none; cursor: pointer; color: var(--muted); border-radius: 4px; flex: none; font-size: 11px; }
.node .tw:hover { background: var(--line-2); }
.node .tw.leaf { visibility: hidden; }
.node .code { font: 600 14px var(--display); font-variant-numeric: tabular-nums; min-width: 76px; color: var(--hull-2); }
.node .nm { flex: 1; min-width: 0; }
.node .nm a { color: var(--ink); text-decoration: none; font-weight: 500; }
.node .nm a:hover { color: var(--accent); text-decoration: underline; }
.node .info { font-size: 12.5px; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.node.archived .nm a, .node.archived .code { color: #9AA9C2; text-decoration: line-through; }
.tree > li > .node { background: var(--surface-2); }
.tree > li > .node .code { font-size: 15px; }

/* ---------- component page ---------- */
.comp-head h1 .num { color: var(--hull-2); margin-right: 10px; }
.comp-grid { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 10px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 11px 13px 10px; cursor: pointer; font-size: 14.5px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.tabs button .c { font: 600 12px var(--display); color: var(--muted); margin-left: 4px; }

/* history timeline */
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { display: grid; grid-template-columns: 96px 1fr; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.hist li:last-child { border-bottom: 0; }
.hist .when { font: 600 14px/1.3 var(--display); font-variant-numeric: tabular-nums; }
.hist .when .muted { font-weight: 500; font-size: 12.5px; display: block; }
.hist .what { font-weight: 600; }
.hist .rem { white-space: pre-wrap; margin-top: 3px; font-size: 14px; }
.hist .by { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.hist .row-acts { float: right; display: flex; gap: 4px; }
.kind { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 9px; margin-left: 6px; vertical-align: 1px; }
.kind.planned { background: #DCE9FB; color: #174F9E; }
.kind.unplanned { background: #EEE8F6; color: #5C3F86; }
.kind.defect { background: var(--over-bg); color: var(--over); }
.kind.note { background: var(--line-2); color: var(--muted); }

/* attachments */
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.thumb { width: 84px; height: 64px; border-radius: 5px; object-fit: cover; border: 1px solid var(--line); cursor: zoom-in; background: var(--surface-2); }
.filechip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 5px; font-size: 13px; background: var(--surface-2); color: var(--ink); text-decoration: none; max-width: 280px; }
.filechip:hover { border-color: var(--accent); }
.filechip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ext { font: 700 10.5px var(--display); background: var(--hull-2); color: #fff; padding: 2px 5px; border-radius: 3px; text-transform: uppercase; flex: none; }
.ext.pdf { background: #A8322A; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; padding: 16px; }
.doc { border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.doc .pv { height: 120px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--line-2); }
.doc .pv img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.doc .pv .ext { font-size: 15px; padding: 6px 10px; }
.doc .meta { padding: 9px 11px; font-size: 13px; flex: 1; }
.doc .meta a.fn { font-weight: 600; color: var(--ink); text-decoration: none; word-break: break-word; }
.doc .meta a.fn:hover { color: var(--accent); text-decoration: underline; }
.doc .acts { display: flex; gap: 4px; padding: 0 8px 8px; }
.drop { border: 2px dashed #B3C6E2; border-radius: 8px; padding: 18px; text-align: center; color: var(--muted); background: var(--surface-2); cursor: pointer; }
.drop.over { border-color: var(--accent); background: #E3EEFC; color: var(--accent); }
.drop input { display: none; }
.pending-files { list-style: none; padding: 0; margin: 8px 0 0; font-size: 13.5px; }
.pending-files li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px dotted var(--line); }

/* ---------- modal / toast / lightbox ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(8,22,46,.5); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; z-index: 50; animation: fade .12s ease-out; }
.modal { background: #fff; border-radius: 10px; width: 100%; max-width: 620px; box-shadow: 0 18px 50px rgba(0,0,0,.25); animation: rise .16s ease-out; }
.modal.wide { max-width: 820px; }
.modal-head { padding: 16px 20px 12px; border-bottom: 1px solid var(--line-2); display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.modal-head .sub { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.modal-body { padding: 18px 20px 6px; }
.modal-foot { padding: 12px 20px 16px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line-2); margin-top: 8px; }
.modal-foot .left { margin-right: auto; }
.x { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 2px 6px; border-radius: 4px; }
.x:hover { background: var(--line-2); }
.err { background: var(--over-bg); color: var(--over); padding: 8px 12px; border-radius: 6px; font-size: 14px; margin-bottom: 12px; }
.procedure { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 6px; padding: 10px 12px; white-space: pre-wrap; font-size: 14px; margin-bottom: 14px; max-height: 220px; overflow: auto; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--hull); color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14.5px; opacity: 0; pointer-events: none; transition: .2s; z-index: 70; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.bad { background: var(--over); }
.lightbox { position: fixed; inset: 0; background: rgba(4,12,28,.9); z-index: 80; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 100px); border-radius: 4px; }
.lightbox .cap { color: #DCE6F5; margin-top: 10px; font-size: 14px; }
.picklist { max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.picklist label { display: flex; gap: 9px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line-2); cursor: pointer; font-size: 14px; }
.picklist label:hover { background: var(--surface-2); }
.picklist .code { font: 600 13.5px var(--display); min-width: 70px; color: var(--hull-2); }
.spare-use { display: grid; grid-template-columns: 1fr 90px auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.low { color: var(--over); font-weight: 600; }
.welcome ol { padding-left: 20px; margin: 10px 0 0; }
.welcome li { margin-bottom: 6px; }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .comp-grid { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 240px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .menu-btn { display: block; position: fixed; top: 12px; left: 12px; z-index: 30; background: var(--hull); color: #fff; border: 0; border-radius: 6px; width: 38px; height: 38px; font-size: 18px; }
  .main { padding: 62px 16px 40px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .due-row { grid-template-columns: 90px 1fr; }
  .due-row .due-act { grid-column: 2; }
  .hist li { grid-template-columns: 1fr; gap: 4px; }
}

/* ---------- print (work list) ---------- */
@media print {
  body { background: #fff; font-size: 12px; }
  .side, .menu-btn, .actions, .due-filters, .no-print, .toast, .btn { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .due-list, .panel { border: 1px solid #999; }
  .due-row { break-inside: avoid; padding: 8px 10px 8px 0; grid-template-columns: 90px 1fr 140px; }
  .print-sign { display: block !important; border-bottom: 1px solid #555; height: 26px; font-size: 10px; color: #555; }
  a { color: inherit; text-decoration: none; }
}
.print-sign { display: none; }
.print-only { display: none; }
@media print { .print-only { display: block; } }

/* ---------- v1.1: back button, linked hours, quick hours ---------- */
.nav-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.nav-row .crumbs { margin: 0; }
.btn.back { background: #DCE8FA; border-color: #BCD1F0; color: var(--hull-2); font-weight: 600; }
.btn.back:hover { background: #CCDDF7; border-color: #9DBCE8; }
.hours-box { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px 4px; margin-bottom: 14px; background: var(--surface-2); }
.hb-title { display: block; font-size: 13px; font-weight: 600; color: #2E4266; margin-bottom: 8px; }
.hm-opt { display: flex; gap: 9px; align-items: flex-start; padding: 7px 8px; border-radius: 6px; cursor: pointer; margin-bottom: 4px; border: 1px solid transparent; }
.hm-opt:hover { background: #fff; }
.hm-opt:has(input:checked) { background: #fff; border-color: #9DBCE8; }
.hm-opt input { margin-top: 4px; }
.hm-fields { margin-top: 8px; }
.link-note { font-size: 13px; color: var(--muted); background: #EAF2FD; border-left: 3px solid #5C97E0; padding: 7px 10px; border-radius: 0 5px 5px 0; margin: 10px 0 0; }
.follower { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; }
.follower .num { color: var(--ink); font-weight: 600; }
.meter.quick-hours { gap: 14px; padding: 10px 12px 10px 14px; }
.quick-hours .lbl { display: flex; flex-direction: column; min-width: 130px; }
.quick-hours .lbl a { color: var(--ink); text-decoration: none; }
.quick-hours .lbl a:hover { color: var(--accent); text-decoration: underline; }
.quick-hours .now { font-size: 17px; font-weight: 600; color: var(--hull-2); }
.qh-in { display: flex; gap: 6px; }
.qh-in input { width: 116px; }
tr.linked-row td:first-child { padding-left: 30px; position: relative; }
tr.linked-row td:first-child::before { content: ""; position: absolute; left: 16px; top: 0; height: 22px; width: 9px; border-left: 2px solid #9DBCE8; border-bottom: 2px solid #9DBCE8; border-bottom-left-radius: 4px; }

/* ---------- v1.3: due page filters ---------- */
.due-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 14px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.due-opts .lbl { font-size: 13px; font-weight: 600; color: #2E4266; }
.due-opts fieldset.seg { margin: 0; }
.due-opts .win { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.due-opts .win input { width: 84px; }
.due-opts select { width: auto; max-width: 240px; }
.print-filter { margin: 0 0 10px; font-size: 12px; }

/* ---------- v1.4: gangway & tides ---------- */
:root { --gw-low: #1E63C4; --gw-high: #C2570C; }
.gw-now { display: flex; gap: 22px; flex-wrap: wrap; align-items: stretch; background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--line); border-radius: 8px; padding: 14px 18px; margin-bottom: 16px; }
.gw-now.st-low { border-left-color: var(--gw-low); }
.gw-now.st-high { border-left-color: var(--gw-high); }
.gw-now.st-either { border-left-color: #6B7FA6; }
.gw-now.st-none { border-left-color: var(--over); background: var(--over-bg); }
.gw-now-main { flex: 1 1 340px; }
.gw-now-k { font-size: 13px; color: var(--muted); }
.gw-now-v { font: 600 24px/1.2 var(--display); margin: 2px 0 6px; }
.gw-now.st-low .gw-now-v { color: var(--gw-low); }
.gw-now.st-high .gw-now-v { color: var(--gw-high); }
.gw-now.st-none .gw-now-v { color: var(--over); }
.gw-now-n { font-size: 14px; }
.gw-now-facts { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 14px; align-content: center; }
.gw-now-facts dt { color: var(--muted); }
.gw-now-facts dd { margin: 0; }
.gw-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.gw-legend span, .gw-tip div { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 16px; height: 3px; border-radius: 2px; background: var(--muted); }
.sw-low { background: var(--gw-low); }
.sw-high { background: var(--gw-high); }
.sw-tide { background: repeating-linear-gradient(90deg, #8193B2 0 4px, transparent 4px 7px); }
.sw-reach { height: 10px; background: #DCE8F7; border: 1px solid #B9CCE6; }
.gw-chart { position: relative; padding: 8px 12px 0; }
.gw-chart svg { width: 100%; height: auto; display: block; }
.gw-chart .g { stroke: #E3EAF4; stroke-width: 1; }
.gw-chart .gx { stroke: #EEF2F8; stroke-width: 1; }
.gw-chart .ax { font: 12px var(--body); fill: var(--muted); }
.gw-chart .reach { fill: #E4EEFA; }
.gw-chart .wharf { stroke: #12223A; stroke-width: 1.5; }
.gw-chart .wlab { font: 600 12px var(--body); fill: #12223A; }
.gw-chart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; }
.gw-chart .tide { stroke: #8193B2; stroke-dasharray: 5 4; stroke-width: 1.5; }
.gw-chart .lowp { stroke: var(--gw-low); }
.gw-chart .highp { stroke: var(--gw-high); }
.gw-chart .now { stroke: var(--over); stroke-width: 1.5; stroke-dasharray: 3 3; }
.gw-chart .nowlab { font: 600 11px var(--body); fill: var(--over); }
.gw-chart .xh { stroke: #12223A; stroke-width: 1; opacity: .5; }
.gw-tip { position: absolute; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-size: 13px; box-shadow: 0 6px 18px rgba(8,22,46,.14); pointer-events: none; width: 210px; }
.gw-tip div { display: flex; }
.gw-strip { display: flex; margin: 6px 16px 16px 60px; height: 26px; border-radius: 4px; overflow: hidden; gap: 2px; }
.gw-seg { display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; min-width: 0; }
.gw-seg.st-low { background: var(--gw-low); }
.gw-seg.st-high { background: var(--gw-high); }
.gw-seg.st-either { background: #C9D5E8; color: #22355A; }
.gw-seg.st-none { background: repeating-linear-gradient(135deg, #BE3328 0 6px, #D9574C 6px 12px); }
.gw-seg.st-nodata { background: #E6EAF0; color: var(--muted); }
.gw-seg.aground { box-shadow: inset 0 -5px 0 #12223A; }
.gw-pill { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 2px 9px; border-radius: 10px; white-space: nowrap; }
.gw-pill.st-low { background: #DCE8FA; color: #174F9E; }
.gw-pill.st-high { background: #FBE6D6; color: #9A3F04; }
.gw-pill.st-either { background: var(--line-2); color: #2E4266; }
.gw-pill.st-none { background: var(--over-bg); color: var(--over); }
.gw-pill.st-nodata { background: var(--line-2); color: var(--muted); }
table.gw-plan tr.day-start td { border-top: 2px solid var(--line); }
.gw-h { font-size: 14px; margin: 4px 0 10px; color: #2E4266; }
.gw-reach { font: 600 20px var(--display); color: var(--hull-2); padding: 6px 0; }
@media print { .gw-now, .gw-bom { break-inside: avoid; } .gw-strip { print-color-adjust: exact; -webkit-print-color-adjust: exact; } .gw-seg, .gw-pill { print-color-adjust: exact; -webkit-print-color-adjust: exact; } }
