:root {
  --ink: #10293B;
  --ink-2: #3D5566;
  --ink-3: #6B8190;
  --water: #E4ECEF;
  --surface: #FFFFFF;
  --rule: #C9D6DB;
  --rule-soft: #DDE6EA;
  --signal: #F2B600;
  --alert: #B3261E;
  --alert-bg: #FBEAE8;
  --warn: #8A5A00;
  --warn-bg: #FFF4D6;
  --ok: #1E6B4F;
  --focus: #1B6FB5;
  --radius-s: 4px;
  --radius-m: 8px;
  --font: "Barlow", system-ui, sans-serif;
  --font-cond: "Barlow Condensed", "Barlow", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 400 15px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--water);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-s);
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
  font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #1C3D55; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--water); border-color: transparent; }
.btn-danger { color: var(--alert); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

label.field { display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); }
label.field > span { font-weight: 500; }
input, select, textarea {
  height: 36px; padding: 0 10px; border: 1px solid var(--rule); border-radius: var(--radius-s);
  background: var(--surface); min-width: 0; width: 100%;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px rgba(27,111,181,.15); }
.field-error { color: var(--alert); font-size: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink-2); }
.check input { width: auto; height: auto; }

/* ---------- login ---------- */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 16px;
}
.login form {
  width: min(380px, 100%); background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius-m); padding: 32px 28px; display: grid; gap: 16px;
}
.wordmark { font: 700 34px/1 var(--font-cond); letter-spacing: .5px; margin: 0; }
.login p { margin: 0; color: var(--ink-2); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 340px 1fr; min-height: 100vh; }
.topbar {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 16px;
  height: 52px; padding: 0 16px; background: var(--ink); color: #fff;
}
.topbar .wordmark { font-size: 24px; }
.topbar .agency { color: #A9BDC9; font-size: 14px; }
.topbar .spacer { flex: 1; }
.topbar .btn-quiet { color: #DCE6EC; }
.topbar .btn-quiet:hover { background: rgba(255,255,255,.08); }

/* ---------- escale list ---------- */
.rail {
  border-right: 1px solid var(--rule); background: var(--surface);
  display: flex; flex-direction: column; min-height: 0; height: calc(100vh - 52px); position: sticky; top: 0;
}
.rail-head { padding: 12px; display: grid; gap: 8px; border-bottom: 1px solid var(--rule-soft); }
.rail-tools { display: flex; gap: 8px; }
.rail-tools select { width: auto; }
.rail-list { overflow-y: auto; flex: 1; }
.call {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; width: 100%;
  padding: 12px 14px; border: 0; border-bottom: 1px solid var(--rule-soft);
  background: none; text-align: left; cursor: pointer;
}
.call:hover { background: #F4F8F9; }
.call[aria-current="true"] { background: var(--water); box-shadow: inset 3px 0 0 var(--ink); }
.call-vessel { font: 600 19px/1.15 var(--font-cond); letter-spacing: .3px; }
.call-ref { font-size: 12px; color: var(--ink-3); justify-self: end; align-self: center; }
.call-meta { grid-column: 1 / -1; font-size: 13px; color: var(--ink-2); display: flex; gap: 10px; flex-wrap: wrap; }
.call-status { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--ink-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rule); flex: none; }
.dot.on { background: var(--signal); box-shadow: 0 0 0 2px rgba(242,182,0,.25); }
.flag-alert { color: var(--alert); font-weight: 600; }
.empty { padding: 32px 20px; color: var(--ink-2); }
.empty p { margin: 0 0 12px; }

/* ---------- detail ---------- */
.detail { padding: 20px 24px 48px; min-width: 0; }
.detail-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.detail-title { flex: 1; min-width: 240px; }
.vessel-name { font: 700 40px/1 var(--font-cond); letter-spacing: .5px; margin: 0 0 6px; }
.detail-sub { color: var(--ink-2); display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; }
.detail-sub b { color: var(--ink); font-weight: 600; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* passage track — the signature element */
.track { margin: 22px 0 8px; padding: 18px 8px 4px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-m); overflow-x: auto; }
.track ol { list-style: none; margin: 0; padding: 0 8px; display: grid; grid-template-columns: repeat(11, minmax(86px, 1fr)); min-width: 946px; position: relative; }
.track li { position: relative; text-align: center; padding-top: 22px; font-size: 12px; color: var(--ink-3); line-height: 1.25; }
.track li::before { /* line segment */
  content: ""; position: absolute; top: 7px; left: -50%; width: 100%; height: 2px; background: var(--rule);
}
.track li:first-child::before { display: none; }
.track li::after { /* station */
  content: ""; position: absolute; top: 2px; left: 50%; width: 12px; height: 12px; margin-left: -6px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--rule);
}
.track li.done { color: var(--ink-2); }
.track li.done::before, .track li.now::before { background: var(--ink); }
.track li.done::after { background: var(--ink); border-color: var(--ink); }
.track li.now { color: var(--ink); font-weight: 600; }
.track li.now::after {
  width: 18px; height: 18px; top: -1px; margin-left: -9px;
  background: var(--signal); border: 3px solid var(--ink);
}
.track li .t { display: block; font-size: 11px; color: var(--ink-3); font-weight: 400; margin-top: 2px; }
.track-note { font-size: 13px; color: var(--ink-2); margin: 6px 4px 0; }
.track-cancelled { padding: 12px 16px; color: var(--alert); font-weight: 600; }

.cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; margin-top: 20px; }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-m); }
.panel + .panel { margin-top: 16px; }
.panel h2 { font: 600 20px/1.2 var(--font-cond); margin: 0; padding: 14px 16px 10px; display: flex; align-items: center; gap: 8px; }
.panel h2 .count { font: 500 13px var(--font); color: var(--ink-3); }
.panel h2 .btn { margin-left: auto; height: 30px; font-size: 13px; font-family: var(--font); }
.panel-body { padding: 0 16px 16px; }

/* SOF log */
.quick-add { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: 8px; padding: 0 16px 14px; border-bottom: 1px solid var(--rule-soft); align-items: end; }
.quick-add .more { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.log { list-style: none; margin: 0; padding: 0; }
.log-day { padding: 10px 16px 4px; font-weight: 600; font-size: 13px; color: var(--ink-2); background: #F6F9FA; border-bottom: 1px solid var(--rule-soft); }
.log-item { display: grid; grid-template-columns: 92px 1fr auto; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--rule-soft); align-items: start; }
.log-time { font-weight: 600; }
.log-time small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12px; }
.log-text { min-width: 0; }
.log-text .who { font-size: 12px; color: var(--ink-3); }
.log-item.stops .log-time { color: var(--warn); }
.tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 3px; background: var(--water); color: var(--ink-2); margin-left: 6px; vertical-align: 1px; }
.tag.stop { background: var(--warn-bg); color: var(--warn); }
.tag.hidden { background: #EEE; color: #555; }

/* alerts */
.alert { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; padding: 10px 16px; border-top: 1px solid var(--rule-soft); }
.alert:first-child { border-top: 0; }
.alert-title { font-weight: 600; font-size: 14px; }
.alert-msg { grid-column: 1 / -1; font-size: 13px; color: var(--ink-2); }
.alert.critical { background: var(--alert-bg); box-shadow: inset 3px 0 0 var(--alert); }
.alert.critical .alert-title { color: var(--alert); }
.alert.warning { background: var(--warn-bg); box-shadow: inset 3px 0 0 var(--signal); }
.alert.acknowledged { opacity: .65; }
.alert .btn { height: 26px; padding: 0 8px; font-size: 12px; }

/* facts */
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; text-align: right; font-weight: 500; }

/* parties */
.party { display: flex; justify-content: space-between; gap: 8px; padding: 8px 16px; border-top: 1px solid var(--rule-soft); font-size: 14px; }
.party small { color: var(--ink-3); display: block; }
.party-rights { font-size: 12px; color: var(--ink-3); text-align: right; }

/* dialog */
dialog { border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 0; width: min(640px, calc(100vw - 32px)); color: var(--ink); }
dialog::backdrop { background: rgba(16,41,59,.45); }
dialog form { display: grid; gap: 14px; padding: 22px; }
dialog h2 { font: 600 24px/1.1 var(--font-cond); margin: 0; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.suggest { border: 1px solid var(--rule); border-radius: var(--radius-s); max-height: 180px; overflow: auto; margin-top: 4px; }
.suggest button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; cursor: pointer; }
.suggest button:hover, .suggest button:focus { background: var(--water); }

#toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--radius-s); font-size: 14px; z-index: 10; max-width: calc(100vw - 32px);
}
#toast.error { background: var(--alert); }

/* SOF print view */
.sof-sheet { background: #fff; max-width: 900px; margin: 0 auto; padding: 32px; }
.sof-sheet h1 { font: 700 30px/1 var(--font-cond); margin: 0 0 16px; }
.sof-sheet table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sof-sheet th, .sof-sheet td { border: 1px solid #9FB1BA; padding: 5px 8px; text-align: left; vertical-align: top; }
.sof-sheet th { background: #EEF3F5; font-weight: 600; }
.sof-boxes { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid #9FB1BA; margin-bottom: 16px; }
.sof-boxes div { padding: 6px 8px; border: 1px solid #DCE4E8; font-size: 12px; color: var(--ink-2); }
.sof-boxes b { display: block; color: var(--ink); font-size: 14px; }
.sof-sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 40px; font-size: 13px; }
.sof-sign div { border-top: 1px solid var(--ink); padding-top: 6px; }
.sof-tools { max-width: 900px; margin: 16px auto; display: flex; gap: 8px; padding: 0 16px; }

@media print {
  body { background: #fff; }
  .sof-tools, .topbar { display: none; }
  .sof-sheet { padding: 0; }
}

/* ---------- small screens: boarding agent on the quay ---------- */
.back-link { display: none; margin-bottom: 8px; }
@media (max-width: 960px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; border-right: 0; }
  .shell.has-detail .rail { display: none; }
  .shell:not(.has-detail) .detail { display: none; }
  .detail { padding: 14px 16px 40px; }
  .vessel-name { font-size: 32px; }
  .quick-add { grid-template-columns: 1fr 1fr; }
  .quick-add .more { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .log-item { grid-template-columns: 70px 1fr; }
  .log-item .btn { grid-column: 2; justify-self: start; }
  .back-link { display: inline-flex; }
  .topbar .agency { display: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .track li.now::after { animation: arrive .5s ease-out; }
  @keyframes arrive { from { transform: scale(.4); } to { transform: scale(1); } }
}

/* ---------- navigation ---------- */
.topnav { display: flex; gap: 4px; margin-left: 8px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.topnav a { color: #C9D7E0; text-decoration: none; padding: 6px 10px; border-radius: var(--radius-s); font-weight: 500; }
.topnav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.topnav a[aria-current="true"] { color: #fff; box-shadow: inset 0 -2px 0 var(--signal); border-radius: 0; }
.muted { color: var(--ink-3); font-size: 13px; margin: 0; }
.notice { margin: 16px 0 0; padding: 10px 14px; background: var(--warn-bg); border-left: 3px solid var(--signal); color: var(--warn); font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.disb-link { text-decoration: none; color: inherit; }
.disb-link:hover { background: #F4F8F9; }

/* ---------- PDA ---------- */
.pda-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 20px; margin-top: 18px; align-items: start; }
.pda-inputs { position: sticky; top: 12px; }
.pda-inputs h2 { font-size: 17px; padding-bottom: 6px; }
.pda-checks { display: grid; gap: 10px; }
.span-all { grid-column: 1 / -1; }
.pda-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.pda-table th, .pda-table td { padding: 7px 8px; border-bottom: 1px solid var(--rule-soft); text-align: left; vertical-align: top; }
.pda-table thead th { font-size: 12px; color: var(--ink-3); font-weight: 500; border-bottom: 1px solid var(--rule); }
.pda-table .num { text-align: right; white-space: nowrap; }
.pda-table tr.sec th { padding-top: 14px; font: 600 16px/1.2 var(--font-cond); color: var(--ink-2); border-bottom: 1px solid var(--rule); }
.pda-table tfoot th, .pda-table tfoot td { border-top: 2px solid var(--ink); border-bottom: 0; font-size: 15px; padding-top: 10px; }
.pda-table .explain, .explain { display: block; font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.pda-table .adj { width: 96px; height: 30px; text-align: right; }
.pda-table .x { height: 28px; padding: 0 6px; font-size: 12px; }
.pda-table .actions-cell { white-space: nowrap; text-align: right; }
.pda-table .actions-cell .btn { height: 30px; font-size: 13px; }
.pda-save { display: flex; justify-content: flex-end; padding: 0 16px 16px; }
.pda-sheet .pda-head { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.pda-sheet .pda-head h1 { margin: 0 0 4px; }
.pda-sheet .pda-head p { margin: 0; font-size: 13px; color: var(--ink-2); }
.pda-ref { text-align: right; font-size: 13px; }
.pda-ref b { font: 600 20px/1.2 var(--font-cond); }
.pda-sheet .num { text-align: right; white-space: nowrap; }
.pda-sheet tfoot th, .pda-sheet .pda-total th { background: #EEF3F5; }
.pda-sheet .pda-total { break-inside: avoid; }
.pda-foot { font-size: 13px; color: var(--ink-2); }
@media (max-width: 1100px) { .pda-layout { grid-template-columns: 1fr; } .pda-inputs { position: static; } }
@media (max-width: 760px) { .topnav a { padding: 6px; } .pda-table .x { display: none; } }
.check { align-items: flex-start; }
.check input { flex: none; margin-top: 4px; }

/* ---------- FDA ---------- */
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
.fda-table select, .fda-table .note { height: 30px; font-size: 13px; min-width: 120px; }
.fda-table .note { min-width: 180px; }
.fda-table tr.needs-note td { background: var(--warn-bg); }
.num.up, dd.up { color: var(--alert); }
.num.down, dd.down { color: var(--ok); }
.add-line { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.add-line input, .add-line select { width: auto; flex: 1 1 140px; }
.add-line .btn { flex: none; }
.money-facts { max-width: 420px; }
fieldset.pick { border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 8px 12px; max-height: 220px; overflow: auto; display: grid; gap: 6px; }
fieldset.pick legend { font-size: 13px; color: var(--ink-2); padding: 0 4px; }

/* ---------- husbandry ---------- */
.cols > div > .panel + .panel, .cols > div > .panel + section { margin-top: 16px; }
.srv-list { list-style: none; margin: 0; padding: 0; }
.srv { display: grid; grid-template-columns: minmax(0, 1fr) 120px 130px; gap: 2px 14px; padding: 10px 16px; border-top: 1px solid var(--rule-soft); color: inherit; text-decoration: none; }
.srv:hover { background: #F4F8F9; }
.srv.is-off { opacity: .55; }
.srv-name { font-weight: 600; }
.srv-name small { font-weight: 400; color: var(--ink-2); }
.srv-meta { grid-column: 1; font-size: 13px; color: var(--ink-2); }
.srv-progress { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 12px; color: var(--ink-2); }
.srv-progress .bar { display: block; height: 6px; background: var(--water); border-radius: 3px; overflow: hidden; margin-bottom: 4px; }
.srv-progress .bar span { display: block; height: 100%; background: var(--ink); }
.srv-amt { grid-column: 3; grid-row: 1 / span 2; align-self: center; text-align: right; font-weight: 600; font-size: 14px; }
.srv-amt small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12px; }
.ts-table select, .ts-table input { height: 30px; font-size: 13px; }
.ts-table input[type="datetime-local"] { min-width: 170px; }
.ts-table tr.st-done td:first-child { text-decoration: line-through; color: var(--ink-3); }
.ts-table tr.st-delayed td { background: var(--warn-bg); }
.srv-form { display: grid; gap: 12px; }
.inline-3 { display: flex; gap: 6px; }
.inline-3 > * { min-width: 0; }
.fee-box { display: grid; gap: 4px; padding: 10px 12px; background: var(--water); border-radius: var(--radius-s); }
.fee-box span:first-child { font-size: 13px; color: var(--ink-2); }
.fee-box b { font-size: 18px; }
.fee-box small { color: var(--ink-3); font-size: 12px; }
.fx { width: 80px; height: 30px; margin-right: 6px; }
@media (max-width: 760px) { .srv { grid-template-columns: 1fr auto; } .srv-progress { grid-column: 1; grid-row: auto; } .srv-amt { grid-column: 2; grid-row: 1; } }
.ts-table { min-width: 760px; }
.ts-table td:first-child { min-width: 150px; }
.ts-table select { min-width: 120px; }
.ts-table input[data-field="note"] { min-width: 170px; }
.ts-table { min-width: 620px; }
.ts-times input { display: block; width: 190px; }
.ts-times input + input { margin-top: 4px; }
.ts-table input[data-field="note"] { min-width: 140px; width: 100%; }

/* ---------- cash boxes */
.cash-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0; }
.cash-sum > div { background: var(--water); border-radius: var(--radius-s); padding: 10px 12px; display: grid; gap: 2px; }
.cash-sum dt { font-size: 13px; color: var(--ink-2); }
.cash-sum dd { margin: 0; font: 600 22px/1.2 var(--font-cond); font-variant-numeric: tabular-nums; }
.cash-sum dd small { font: 500 13px var(--font); color: var(--ink-3); }
.cash-sum dd.due { color: var(--warn); }
.cash-sum > div > small { font-size: 12px; color: var(--ink-3); }
.cash-head { margin-top: 16px; }
.cash-mini { list-style: none; margin: 12px 0 0; padding: 0; }
.cash-mini li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--rule-soft); font-size: 14px; }
.cash-mini li small { display: block; font-size: 12px; color: var(--ink-3); }
.cash-mini .in { color: var(--ok); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cash-mini .out { white-space: nowrap; font-variant-numeric: tabular-nums; }
.cash-mini .is-off, .cash-table .is-off { opacity: .5; }
.cash-mini .is-off .out, .cash-table .is-off td.num { text-decoration: line-through; }
.cash-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
.cash-form .span-2 { grid-column: span 2; }
.cash-form [hidden] { display: none; }
.cash-table { min-width: 760px; }
.cash-table td { vertical-align: top; }
.cash-table .row-actions { white-space: nowrap; text-align: right; }
.cash-table .row-actions .btn { height: 28px; font-size: 13px; padding: 0 8px; }
.file-btn { cursor: pointer; height: 28px; font-size: 13px; padding: 0 8px; display: inline-flex; align-items: center; }
@media (max-width: 760px) {
  .cash-form { grid-template-columns: 1fr; }
  .cash-form .span-2 { grid-column: auto; }
}
@media (max-width: 480px) {
  .topbar { gap: 4px; padding-left: 12px; padding-right: 8px; }
  .topbar .wordmark { font-size: 20px; }
  .topnav { margin-left: 0; gap: 0; }
  .topnav a { white-space: nowrap; font-size: 14px; padding: 6px 7px; }
  .topbar #logout { padding: 0 8px; font-size: 14px; white-space: nowrap; }
}
#cash-h + .panel-body .cash-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cash-sum dd small { font: 500 12px var(--font); color: var(--ink-3); }
.cur-amt select { flex: 0 0 84px; }
.mv-filter { height: 30px; font: 400 13px var(--font); width: auto; }
.mv-filter:first-of-type { margin-left: auto; }
.is-general { background: #F4F8F9; }
.cash-table td.num small, .pda-table td.num small { color: var(--ink-3); font-size: 11px; }
@media (max-width: 480px) { .mv-filter { max-width: 92px; } }
#cash-rec .cash-form { border-bottom: 1px solid var(--rule-soft); }
#cash-rec .cash-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#cash-rec .cash-form .span-2 { grid-column: 1 / -1; }
.cash-head { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 760px) { .cash-head { grid-template-columns: repeat(2, minmax(0, 1fr)); } #cash-rec .cash-form { grid-template-columns: 1fr; } }
.cash-bal { text-align: right; }
.neg, dd.neg { color: var(--alert); }
/* ---------- notifications */
.bell { position: relative; font-size: 18px; padding: 0 10px; }
.bell b { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--signal); color: #13293A; font: 700 11px/18px var(--font); }
.bell-pop { position: absolute; top: 52px; right: 12px; width: min(380px, calc(100vw - 24px)); max-height: 70vh; overflow: auto; background: var(--surface, #fff); color: var(--ink, #13293A); border-radius: var(--radius-s); box-shadow: 0 8px 28px rgba(0,0,0,.18); z-index: 50; }
.topbar { position: relative; }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--rule-soft); }
.bell-head .btn { color: var(--ink-2); height: 28px; font-size: 13px; }
.bell-pop ul { list-style: none; margin: 0; padding: 0; }
.bell-pop li a { display: block; padding: 10px 12px; border-bottom: 1px solid var(--rule-soft); color: inherit; text-decoration: none; font-size: 14px; }
.bell-pop li.unread a { background: #FFF8E1; font-weight: 500; }
.bell-pop li a:hover { background: var(--water); }
.bell-pop li small { display: block; color: var(--ink-3); font-size: 12px; margin-top: 2px; font-weight: 400; }
.qa { display: block; margin-top: 4px; padding: 4px 8px; background: #FFF8E1; border-radius: 4px; font-size: 12px; color: var(--ink-2); }
.btn-s { height: 28px; font-size: 13px; padding: 0 10px; }
.cash-table td.row-actions { white-space: normal; min-width: 150px; text-align: right; }
.cash-table td.row-actions .btn { margin: 2px 0 2px 4px; }
@media (max-width: 480px) {
  .topbar .wordmark { font-size: 18px; }
  .topnav a { font-size: 13px; padding: 6px 5px; }
  .bell { padding: 0 4px; font-size: 16px; }
  .topbar #logout { font-size: 13px; padding: 0 4px; }
}
.wait-list { list-style: none; margin: 0; padding: 0 16px 8px; }
.wait-list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--rule-soft); }
.wait-what small { display: block; color: var(--ink-3); font-size: 12px; }
.wait-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.waiting { border-left: 3px solid var(--signal); }
@media (max-width: 600px) { .wait-list li { flex-direction: column; align-items: stretch; } .wait-btns { justify-content: flex-start; } }
/* ---------- funds of a call */
.funds-parties { margin-top: 14px; }
.sub-h { font: 600 15px var(--font-cond); margin: 16px 0 0; color: var(--ink-2); text-transform: uppercase; letter-spacing: .4px; }
.funds-list li > span:last-child { text-align: right; }
.funds-list li small { display: block; font-size: 11px; color: var(--ink-3); }
.funds-list .x { height: 22px; font-size: 12px; padding: 0 6px; }
.funds-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: start; }
.funds-parties td small a { white-space: nowrap; }
@media (max-width: 480px) { .funds-parties { font-size: 13px; } .funds-parties td, .funds-parties th { padding-left: 4px; padding-right: 4px; } }
/* ---------- line-up & daily report */
.lu-table td small.act, .act { display: inline-block; font-size: 10px; font-weight: 700; color: var(--ok); margin-left: 2px; }
.lu-ours td:first-child + td b a { color: var(--ink); }
.lu-other td, .lu-shared td { color: var(--ink-2); }
.lu-sheet .sub-h { margin-top: 18px; }
.lu-sheet .table-wrap { overflow: visible; }
.dr-in { font: inherit; border: 1px solid #9FB1BA; border-radius: 4px; padding: 3px 6px; width: 100%; max-width: 220px; }
textarea.dr-in { max-width: none; }
.dr-bar { height: 8px; background: #E4ECEF; border-radius: 4px; overflow: hidden; margin: 4px 0 16px; }
.dr-bar span { display: block; height: 100%; background: var(--signal); }
.sof-sheet h3 { font: 600 16px var(--font-cond); margin: 18px 0 8px; text-transform: uppercase; letter-spacing: .3px; }
@media print { .dr-in { border: 0; padding: 0; } }
.lu-table { table-layout: fixed; min-width: 900px; }
.lu-table th:nth-child(1) { width: 32px; } .lu-table th:nth-child(2) { width: 15%; } .lu-table th:nth-child(3) { width: 13%; }
.lu-table th:last-child { width: 120px; }
.lu-sheet .lu-table { min-width: 0; font-size: 12px; }
.lu-sheet .lu-table th:last-child { width: auto; }
.lu-table td .x { display: inline-block; }
@media (max-width: 480px) {
  .topbar .spacer { display: none; }
  .topnav { flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .topnav::-webkit-scrollbar { display: none; }
}
@media (max-width: 480px) { .topbar { min-width: 0; max-width: 100vw; overflow: hidden; } .topbar .wordmark, .bell, .topbar #logout { flex-shrink: 0; } }
/* ---------- cargo operations */
.op-card { border: 1px solid var(--rule-soft); border-radius: var(--radius-s); padding: 10px 12px; margin-bottom: 12px; }
.op-card h4 { margin: 0 0 6px; font: 600 16px var(--font-cond); display: flex; justify-content: space-between; align-items: center; }
.op-card.is-off { opacity: .55; }
.dr-hist { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 20px; align-items: start; }
.dr-chart { width: 100%; height: auto; }
.dr-chart .grid { stroke: #E1E8EC; }
.dr-chart .ax { font: 10px var(--font); fill: var(--ink-3); }
.dr-chart .ax-c { fill: #8A6A00; }
.dr-chart .bar { fill: var(--ink-2); }
.dr-chart .cum { fill: none; stroke: var(--signal); stroke-width: 2.5; }
.dr-chart .cum-dot { fill: #fff; stroke: var(--signal); stroke-width: 2; }
.chart-key { font-size: 11px; color: var(--ink-3); margin: 4px 0 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.chart-key span { display: inline-block; width: 14px; height: 8px; }
.k-bar { background: var(--ink-2); } .k-cum { background: var(--signal); height: 3px !important; margin-left: 10px; }
.amended { display: inline-block; margin-left: 10px; padding: 2px 8px; font: 700 13px var(--font); letter-spacing: 1px; color: #fff; background: var(--alert); border-radius: 3px; vertical-align: middle; }
.amend-note { margin: -6px 0 14px; padding: 8px 12px; background: var(--alert-bg); color: var(--alert); font-size: 13px; border-left: 3px solid var(--alert); }
.sof-boxes small { display: block; font-size: 11px; color: var(--ink-3); margin-top: 2px; }
@media (max-width: 760px) { .dr-hist { grid-template-columns: 1fr; } }
@media print { .no-print { display: none !important; } }
@media screen and (max-width: 760px) {
  .sof-tools { flex-wrap: wrap; }
  .sof-sheet { padding: 16px; }
  .sof-boxes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sof-boxes > div { min-width: 0; overflow-wrap: anywhere; }
  .dr-in { max-width: 100%; box-sizing: border-box; }
  .sof-sheet table { display: block; overflow-x: auto; }
}
.dr-start { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dr-start input { width: auto; }
.sof-boxes div small { display: block; font-size: 11px; color: var(--ink-3); }
.lu-etc .est { color: var(--warn); font-weight: 700; }
.lu-etc .x { padding: 0 4px; height: 22px; }
.lu-table td, .lu-table th { padding-right: 10px; }
.lu-table td.lu-etc { white-space: nowrap; }
.lu-table th.th-etc { width: 132px; }
.lu-sheet .lu-table th.th-etc { width: 92px; }
.lu-sheet .lu-table td.lu-etc { white-space: normal; }
.lu-table.lu-screen { min-width: 1120px; }
.lu-screen th:nth-child(4) { width: 9%; } .lu-screen th:nth-child(5) { width: 56px; } .lu-screen th:nth-child(6) { width: 92px; }
.lu-screen th:nth-child(7) { width: 72px; } .lu-screen th:nth-child(8) { width: 56px; }
.lu-screen th:nth-child(9), .lu-screen th:nth-child(10), .lu-screen th:nth-child(12) { width: 68px; }
dialog:has(.lu-hist) { width: min(980px, 96vw); }
.lu-hist td { vertical-align: top; font-size: 13px; }
.lu-hist tr.lh-alert td { background: color-mix(in srgb, var(--warn) 8%, transparent); }
.lu-hist .lh-aff { margin-top: 4px; font-size: 12px; color: var(--warn); font-weight: 600; }
.lu-rights td { vertical-align: middle; }

/* ---------------- client portal (agency side) */
.nav-n { display: inline-block; min-width: 18px; height: 18px; margin-left: 6px; padding: 0 5px; border-radius: 9px; background: var(--signal); color: #13293A; font: 700 11px/18px var(--font); text-align: center; }
.client-dec { margin: 8px 0 0; padding: 6px 10px; border-radius: var(--radius-s); font-weight: 600; }
.client-dec.approved { background: #E3F2EA; color: var(--ok); }
.client-dec.rejected { background: var(--alert-bg); color: var(--alert); }
.cp-threads { display: flex; flex-wrap: wrap; gap: 8px; }
.count.warn { background: var(--warn-bg); color: var(--warn); }
.warn-t { color: var(--warn); }
dialog:has(form.wide) { width: min(900px, 96vw); }
dialog:has(form.thread) { width: min(640px, 96vw); }
.msgs { max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 12px; }
.msg { max-width: 82%; }
.msg.them { align-self: flex-start; }
.msg.us { align-self: flex-end; text-align: right; }
.msg-b { display: inline-block; padding: 8px 12px; border-radius: 12px; background: var(--water); text-align: left; white-space: normal; overflow-wrap: anywhere; }
.msg.us .msg-b { background: var(--ink); color: #fff; }
.msg small { display: block; color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.msg-v { font-family: var(--font-cond); letter-spacing: .02em; }
.inbox { list-style: none; margin: 0; padding: 0; }
.inbox li + li { border-top: 1px solid var(--rule-soft); }
.inbox button { all: unset; box-sizing: border-box; display: block; width: 100%; padding: 12px 8px; cursor: pointer; position: relative; }
.inbox button:hover { background: var(--water); }
.inbox button:focus-visible { outline: 2px solid var(--focus); }
.ib-top { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.ib-top small { margin-left: auto; color: var(--ink-3); }
.ib-last { display: block; color: var(--ink-2); margin-top: 2px; padding-right: 36px; }
.inbox li.unread .ib-last { color: var(--ink); font-weight: 600; }
.ib-n { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); min-width: 22px; height: 22px; border-radius: 11px; background: var(--signal); font: 700 12px/22px var(--font); text-align: center; }
.ib-n { position: static; transform: none; display: inline-block; min-width: 22px; padding: 0 6px; }
.ib-last { padding-right: 0; }
.cp-pays { list-style: none; margin: 0; padding: 0; }
.cp-pays li { padding: 10px 0; border-top: 1px solid var(--rule-soft); }
.cp-pays li small { display: block; }
.cp-p1 { display: flex; justify-content: space-between; gap: 8px; }
.cp-p2 { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.ok-t { color: var(--ok); } .bad-t { color: var(--alert); }
form.wide input[type=checkbox] { width: 18px; height: 18px; }
.svc-grid { max-height: 60vh; overflow: auto; }
.svc-grid td, .svc-grid th { text-align: center; } .svc-grid td:first-child, .svc-grid th:first-child { text-align: left; }
.svc-grid input[type=checkbox] { width: 18px; height: 18px; }
.bell-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--rule-soft); font-size: 13px; }
.bell-foot .check { margin: 0; }

/* ---------------- surveys */
.sv-form fieldset { border: 1px solid var(--rule-soft); border-radius: var(--radius-m); padding: 10px 14px 12px; margin: 0 0 14px; min-width: 0; }
.sv-form legend { font: 600 14px/1 var(--font); padding: 0 6px; color: var(--ink-2); }
.sv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.sv-grid .span-all, .sv-form .span-all { grid-column: 1 / -1; }
.sv-dr { border-collapse: collapse; width: 100%; }
.sv-dr th, .sv-dr td { padding: 3px 4px; text-align: left; font-size: 13px; }
.sv-dr input, .sv-dr select { width: 100%; min-width: 64px; padding: 5px 6px; font: inherit; border: 1px solid var(--rule); border-radius: var(--radius-s); }
.sv-form p input { width: 90px; padding: 4px 6px; border: 1px solid var(--rule); border-radius: var(--radius-s); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
.sv-sec { margin: 10px 0 4px; font-size: 14px; color: var(--ink-2); }
.sv-item { display: grid; grid-template-columns: minmax(0, 2fr) auto minmax(0, 2fr) auto; gap: 8px; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--rule-soft); }
.sv-item.not_ok { background: var(--alert-bg); } .sv-item.open .sv-lab::after { content: ' •'; color: var(--warn); }
.sv-st { display: flex; gap: 10px; white-space: nowrap; font-size: 13px; }
.sv-rem input { width: 100%; padding: 5px 6px; border: 1px solid var(--rule); border-radius: var(--radius-s); }
.sv-ph { display: flex; gap: 4px; align-items: center; }
.sv-thumb img { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; display: block; }
.sv-up { cursor: pointer; }
.sv-files > div { margin: 6px 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sv-result { background: var(--water); border-radius: var(--radius-m); padding: 10px 14px; margin-bottom: 14px; }
.sv-result h3 { margin: 0 0 6px; }
.sv-res { width: 100%; border-collapse: collapse; font-size: 13px; }
.sv-res td, .sv-res th { padding: 4px 6px; border-bottom: 1px solid var(--rule-soft); text-align: left; }
.sv-res .num, .sv-res th.num { text-align: right; }
.sv-actions { display: flex; gap: 8px; justify-content: flex-end; }
.sv-sheet .sv-big { font-size: 16px; padding: 8px 12px; background: #F5F8F9; border-left: 4px solid var(--ink); }
.sv-sheet .num { text-align: right; } .sv-sheet tr.sec th { background: #EEF3F5; }
.sv-pics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sv-pics img { width: 100%; height: 160px; object-fit: cover; border: 1px solid #9FB1BA; }
.sv-pics figcaption { font-size: 12px; color: var(--ink-2); }
@media (max-width: 760px) {
  .sv-grid, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .sv-item { grid-template-columns: minmax(0, 1fr); }
  .sv-dr { display: block; overflow-x: auto; }
}
.sv-form p select { width: auto; display: inline-block; padding: 4px 6px; }
.sv-sheet .pda-head { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 12px; }
.sv-sheet .pda-head h1 { margin: 0 0 6px; } .sv-sheet .pda-head p { margin: 0 0 2px; font-size: 14px; color: var(--ink-2); }

/* line-up import */
.li-form { max-width: 620px; }
.li-drop { display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center; padding: 22px 16px; margin: 12px 0; border: 2px dashed var(--rule); border-radius: 10px; cursor: pointer; }
.li-drop.over, .li-drop:hover { border-color: var(--ink-2); }
.li-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.li-drop small { color: var(--ink-2); max-width: 46ch; }
.li-name { font-weight: 600; }
.li-recent ul { margin: 6px 0 0; padding-left: 18px; }
.li-recent li { margin: 3px 0; }
.li-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.li-filters [aria-pressed="true"] { background: var(--ink); color: #fff; }
.li-help { font-size: 12px; }
.li-table { min-width: 1100px; }
.li-table td { vertical-align: top; }
.li-table th:first-child { width: 28px; }
.li-table tr.li-on td { background: color-mix(in srgb, var(--ok) 7%, transparent); }
.li-rem { max-width: 340px; }
.li-diff { font-size: 12px; min-width: 200px; }
.li-badge { display: inline-block; padding: 2px 7px; border-radius: 10px; font-size: 11px; font-weight: 700; white-space: nowrap; background: var(--water); color: var(--ink-2); }
.li-badge.li-new { background: #e3f4e8; color: #1f7a3c; }
.li-badge.li-upd { background: var(--warn-bg); color: var(--warn); }
.li-badge.li-miss { background: var(--alert-bg); color: var(--alert); }
.li-badge.li-ours { background: #e2ecfb; color: #1d4f99; }

/* line-up per terminal */
.lu-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 18px; border-bottom: 1px solid var(--rule); }
.lu-tabs a { padding: 8px 12px; border-radius: var(--radius-m) var(--radius-m) 0 0; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 14px; border: 1px solid transparent; border-bottom: 0; margin-bottom: -1px; }
.lu-tabs a[aria-selected="true"] { background: var(--surface); color: var(--ink); border-color: var(--rule); }
.lu-tabs a.lu-tab-empty { color: var(--ink-3); font-weight: 500; }
.lu-tabs .count { font-weight: 500; color: var(--ink-3); }
.lu-sum { max-width: 720px; margin-bottom: 18px; }
.lu-sum td a { font-weight: 600; }
.lu-sum-total td { font-weight: 700; border-top: 2px solid var(--rule); }
.lu-term { display: inline-block; margin-top: 2px; padding: 0 6px; border-radius: 8px; background: var(--water); color: var(--ink-2); font-size: 11px; font-weight: 600; }

/* ports */
.pt-table td { vertical-align: top; }
.pt-off td { color: var(--ink-3); }
.pt-rules span { display: block; font-size: 12px; color: var(--ink-2); }
.pt-info { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 6px 16px; margin: 0; }
.pt-info dt { font-weight: 600; color: var(--ink-2); }
.pt-info dd { margin: 0; white-space: pre-line; }
.pt-contacts input { width: 100%; min-width: 90px; }
@media (max-width: 640px) { .pt-info { grid-template-columns: 1fr; } .pt-info dd { margin-bottom: 8px; } }
.past-toggle { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; margin: 6px 0 12px; border-radius: var(--radius-m); background: var(--water); font-size: 14px; }
/* top bar: menu on one line, scrolls when the window is narrow */
.topbar .agency, .topnav a { white-space: nowrap; }
.topnav { flex: 0 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
@media (max-width: 1360px) { .topbar > .agency:not(#me-btn) { display: none; } }

/* vessels */
.vs-search { display: flex; gap: 8px; margin-top: 16px; max-width: 560px; }
.vs-search input { flex: 1; }
.vs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-top: 16px; align-items: start; }
.vs-grid .panel + .panel { margin-top: 0; }
.vs-grid .pt-info { grid-template-columns: minmax(110px, 160px) 1fr; }
.vs-files { list-style: none; margin: 0; padding: 0; }
.vs-files li { padding: 6px 0; border-bottom: 1px solid var(--rule); display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.vs-form { max-width: 820px; }
.vp-review { max-width: 760px; }
.vp-review tr.vp-different td { background: var(--warn-bg); }
.vp-review tr.vp-same td { color: var(--ink-3); }
.vp-hint { margin: -4px 0 10px; font-size: 13px; }

/* PDA check */
.pc-lines input { width: 100%; min-width: 80px; }
.pc-lines td:first-child input { min-width: 260px; }
.pc-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.pc-cards > div { background: var(--water); border-radius: var(--radius-m); padding: 12px 14px; }
.pc-cards small { display: block; color: var(--ink-2); font-size: 12px; }
.pc-cards b { font: 700 22px/1.2 var(--font-cond); }
.pc-cards .pc-up b { color: var(--alert); }
.pc-cards .pc-down b { color: var(--ok); }
.pc-remarks { list-style: none; padding: 0; margin: 0 0 12px; }
.pc-remarks li { padding: 8px 12px; margin: 4px 0; border-left: 4px solid var(--rule); background: var(--surface); border-radius: 4px; font-size: 14px; }
.pc-remarks .pc-info { border-color: var(--ink); font-weight: 600; }
.pc-remarks .pc-high { border-color: var(--alert); background: var(--alert-bg); }
.pc-remarks .pc-med { border-color: var(--warn); background: var(--warn-bg); }
.pc-remarks .pc-low { border-color: var(--rule); }
.pc-table td { vertical-align: top; }
.pc-table td:last-child { max-width: 320px; }
.pc-sheet .panel { border: 0; box-shadow: none; }
@media print { .pc-sheet details { display: none; } }

/* ---------- agency logo + footer (app and prints) */
.tb-logo { height: 30px; width: auto; margin: 0 4px 0 12px; border-radius: 4px; background: #fff; padding: 2px; }
.app-foot { grid-column: 1 / -1; font-size: 11px; color: var(--ink-2); text-align: center; padding: 10px 16px; border-top: 1px solid #DCE4E8; background: #fff; }
.sheet-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.sheet-brand b { font: 700 20px/1.1 var(--font-cond); }
.sheet-logo { height: 64px; width: auto; display: block; }
.pda-head .sheet-logo { margin-bottom: 6px; }
.sheet-foot { margin-top: 28px; padding-top: 8px; border-top: 1px solid #9FB1BA; font-size: 10px; line-height: 1.4; color: #44525C; text-align: center; }
.brand-logo-row { display: flex; align-items: center; gap: 12px; margin: 8px 0 14px; }
.sof-sheet .sheet-wrap { width: 100%; border-collapse: collapse; font-size: inherit; }
.sof-sheet .sheet-wrap > tbody > tr > td, .sof-sheet .sheet-wrap > tfoot > tr > td { border: 0; padding: 0; background: none; }
.sheet-wrap-space { height: 0; }
@media print {
  @page { margin: 12mm; }
  .app-foot { display: none; }
  .sheet-wrap-space { height: 18mm; }
  .sof-sheet { max-width: none; }
  .sof-boxes { grid-template-columns: repeat(3, 1fr); }
  .sheet-foot { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; background: #fff; }
}

/* ---------- Mail (Outlook) */
.mail-layout { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 16px; margin-top: 16px; align-items: start; }
.mail-tabs { display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid var(--rule-soft); align-items: center; }
.mail-tabs [aria-current="true"] { background: var(--water); font-weight: 600; }
.mail-tabs input { flex: 1; min-width: 0; height: 32px; }
.mail-items { list-style: none; margin: 0; padding: 0; max-height: calc(100vh - 260px); overflow-y: auto; }
.mail-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--rule-soft); padding: 10px 12px; cursor: pointer; font: inherit; color: inherit; }
.mail-item:hover, .mail-item.on { background: var(--water); }
.mail-item.unread .mi-who, .mail-item.unread .mi-sub { font-weight: 700; }
.mail-item.unread { box-shadow: inset 3px 0 0 var(--signal); }
.mi-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-date { font-size: 12px; color: var(--ink-3); }
.mi-sub { grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-pre { grid-column: 1 / -1; font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-subj { font: 600 22px/1.2 var(--font-cond); margin: 0 0 8px; }
.mail-meta { font-size: 13px; line-height: 1.5; margin: 0 0 10px; }
.mail-att { display: flex; flex-wrap: wrap; gap: 6px; }
.mail-body { width: 100%; min-height: 300px; border: 1px solid var(--rule-soft); border-radius: 6px; margin-top: 10px; background: #fff; }
dialog.dlg-wide { width: min(820px, 96vw); }
.mail-edit { min-height: 220px; max-height: 50vh; overflow-y: auto; border: 1px solid var(--rule); border-radius: 6px; padding: 10px; background: #fff; font-size: 14px; line-height: 1.45; }
.mail-edit:focus { outline: 2px solid var(--focus, #2E6FD8); }
.mail-edit table td { padding: 3px 8px; }
@media (max-width: 960px) { .mail-layout { grid-template-columns: 1fr; } .mail-items { max-height: 50vh; } }

/* ---------- agency domain: its logo on the sign-in page */
.login-logo { display: block; height: 72px; width: auto; margin: 0 0 10px; }
.wordmark small { display: block; font-size: 15px; font-weight: 500; color: var(--ink-2); margin-top: 4px; }

.btn-ai{background:linear-gradient(90deg,#efe7ff,#e3f1ff);border-color:#b9a8e6;color:#3b2a7a}
.btn-ai:disabled{opacity:.7}
.ai-box{border:1px solid #c9bdf0;background:#f7f4ff;border-radius:8px;padding:8px 12px;margin:6px 0 10px;font-size:13px}
.ai-box p{margin:3px 0}
.ai-miss{color:#8a5a00}

.rq.rq-on{outline:2px solid var(--brand-accent,#F2B600)}
.rq-top{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}
.rq-kind{display:inline-block;padding:1px 8px;border-radius:4px;background:#e3f1ff;color:#13293a;font-size:12px}
.rq-kind.services{background:#e9f7ec}
dl.rq-dl{display:grid;grid-template-columns:120px 1fr;gap:4px 12px;margin:10px 0}
dl.rq-dl dt{color:#667;font-size:13px}dl.rq-dl dd{margin:0}

/* services done by the agency, packages */
.pk-box { display: grid; gap: 6px; padding: 10px 16px 14px; border-top: 1px solid var(--rule-soft); }
.pk-box .sub-h { margin: 6px 0 0; }
.pk-on { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 6px 10px; border-radius: var(--radius-s); background: var(--water); font-size: 14px; }
.pk-on .pk-amt { color: var(--ok); white-space: nowrap; }
.pk-note { margin: 0; font-size: 13px; color: var(--warn); }
.pk-sug { margin: 0; font-size: 13px; color: var(--ink-2); }
.pk-sug::before { content: "+ "; color: var(--ok); font-weight: 600; }
.price-box { margin-bottom: 4px; }
.pc-table input { width: 100%; min-width: 60px; }
.pc-opts { display: flex; flex-wrap: wrap; gap: 16px; margin: 10px 0; }
.sp-table select { min-width: 120px; }
.sp-table tr.sp-own td:first-child b::after { content: "agency"; font-size: 11px; font-weight: 400; margin-left: 6px; padding: 1px 6px; border-radius: 3px; background: var(--water); color: var(--ink-2); }
.pk-form select[multiple] { min-height: 120px; }
.quo-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; padding: 6px 10px; border-radius: var(--radius-s); color: var(--ink); text-decoration: none; font-size: 14px; }
.quo-row:hover { background: var(--water); }
.quo-desc { display: block; margin-top: 4px; width: 100%; }
.quo-disc td { color: var(--ok); }
.topnav { overflow: visible; }
.nav-more { position: relative; }
.nav-more summary { list-style: none; cursor: pointer; color: #C9D7E0; padding: 6px 10px; border-radius: var(--radius-s); font-weight: 500; white-space: nowrap; }
.nav-more summary::-webkit-details-marker { display: none; }
.nav-more summary::after { content: " ▾"; font-size: 11px; }
.nav-more[open] summary, .nav-more summary:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-more.has-current summary { color: #fff; box-shadow: inset 0 -2px 0 var(--signal); border-radius: 0; }
.nav-more-in { position: absolute; top: 100%; left: 0; z-index: 50; min-width: 170px; display: grid; padding: 6px; background: var(--ink); border-radius: var(--radius-m); box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.nav-more-in a { white-space: nowrap; }
.nav-more-in a[aria-current="true"] { box-shadow: inset 3px 0 0 var(--signal); }
@media (max-width: 1100px) { .topnav { flex-wrap: wrap; } }

/* ===== Nora, the assistant of the agency app (same figure as the client space) ===== */

.nora { --n-navy: var(--brand, #13293A); --n-gold: var(--brand-accent, #F2B600); position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); z-index: 60; font-size: 15px; }
.nora-launch { width: 72px; height: 72px; border-radius: 50%; border: 3px solid #fff; padding: 0; background: #fff; box-shadow: 0 6px 20px rgba(16,41,59,.28); cursor: pointer; position: relative; }
.nora-launch:focus-visible { outline: 3px solid var(--focus, #1B6FB5); outline-offset: 2px; }
.nora.is-open .nora-launch { display: none; }
.nora-bubble { position: absolute; right: 80px; bottom: 18px; white-space: nowrap; background: #fff; color: var(--ink, #10293B); padding: 8px 12px; border-radius: 14px 14px 2px 14px; box-shadow: 0 4px 14px rgba(16,41,59,.18); font-size: 14px; }
.nora-panel { width: min(390px, calc(100vw - 32px)); height: min(620px, calc(100vh - 40px)); background: #fff; border-radius: 18px; box-shadow: 0 12px 40px rgba(16,41,59,.3); display: flex; flex-direction: column; overflow: hidden; }
.nora-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--n-navy); color: #fff; }
.nora-face { width: 64px; height: 64px; flex: 0 0 64px; border-radius: 50%; background: #fff; overflow: hidden; }
.nora-who { flex: 1 1 auto; min-width: 0; display: grid; }
.nora-who b { font-size: 17px; }
.nora-who small { opacity: .8; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nora-ic { background: transparent; border: 0; color: #fff; font-size: 16px; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; opacity: .65; }
.nora-ic.on, .nora-ic:hover { opacity: 1; background: rgba(255,255,255,.14); }
.nora-lang { max-width: 92px; color: #10293B; background: #fff; font-size: 12px; border-radius: 6px; border: 0; padding: 4px; }
.nora-log { flex: 1 1 auto; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 8px; background: #F4F7F8; }
.nora-m { max-width: 86%; padding: 9px 12px; border-radius: 14px; line-height: 1.4; white-space: pre-wrap; word-wrap: break-word; }
.nora-m.nm-nora { align-self: flex-start; background: #fff; border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(16,41,59,.08); }
.nora-m.nm-me { align-self: flex-end; background: var(--n-navy); color: #fff; border-bottom-right-radius: 4px; }
.nora-m.typing { display: flex; gap: 4px; padding: 12px 14px; }
.nora-m.typing i { width: 7px; height: 7px; border-radius: 50%; background: #9AB0BC; animation: nora-dot 1s infinite; }
.nora-m.typing i:nth-child(2) { animation-delay: .15s; } .nora-m.typing i:nth-child(3) { animation-delay: .3s; }
.nora-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.nora-chips button { border: 1px solid var(--n-navy); background: #fff; color: var(--n-navy); border-radius: 16px; padding: 5px 11px; font: inherit; font-size: 13px; cursor: pointer; }
.nora-chips button:hover { background: var(--n-navy); color: #fff; }
.nora-card { align-self: stretch; background: #fff; border: 1px solid #DDE6EA; border-left: 3px solid var(--n-gold); border-radius: 10px; padding: 10px 12px; display: grid; gap: 4px; font-size: 14px; }
.nora-card small { color: #6B8190; }
.nora-card ul { margin: 4px 0; padding-left: 18px; }
.nora-card li span { float: right; font-weight: 600; }
.nora-card p { margin: 2px 0; }
.nora-ok { color: #1E6B4F; }
.nora-acts { display: flex; gap: 6px; margin-top: 4px; }
.nora-in { display: flex; gap: 6px; padding: 10px; border-top: 1px solid #DDE6EA; align-items: center; }
.nora-in input { flex: 1 1 auto; min-width: 0; border: 1px solid #C9D6DB; border-radius: 20px; padding: 9px 14px; font: inherit; }
.nora-mic, .nora-send { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; border: 0; cursor: pointer; font-size: 17px; }
.nora-send { background: var(--n-navy); color: #fff; }
.nora-mic { background: #E4ECEF; }
.nora-mic.on { background: #B3261E; color: #fff; animation: nora-pulse 1.2s infinite; }

/* the figure */
.nora-svg { width: 100%; height: 100%; display: block; }
.nora-svg .n-bg { fill: #E9F0F3; }
.nora-svg .n-body { fill: var(--n-navy); }
.nora-svg .n-shirt { fill: #fff; }
.nora-svg .n-badge { fill: var(--n-gold); }
.nora-svg .n-skin { fill: #D9A27C; }
.nora-svg .n-hair { fill: #2B1B14; }
.nora-svg .n-brows path { fill: none; stroke: #2B1B14; stroke-width: 2; stroke-linecap: round; transition: transform .3s; }
.nora-svg .n-eye ellipse { fill: #23170F; }
.nora-svg .n-glint { fill: #fff; }
.nora-svg .n-eyes { transform-origin: 60px 56px; transition: transform .25s; }
.nora-svg .n-blush { fill: #E58A7A; opacity: .35; }
.nora-svg .n-nose { fill: none; stroke: #B07A58; stroke-width: 1.4; stroke-linecap: round; }
.nora-svg .n-smile { fill: none; stroke: #8E3B2E; stroke-width: 2.4; stroke-linecap: round; }
.nora-svg .n-mouth { fill: #8E3B2E; opacity: 0; transform-origin: 60px 72px; }
.nora-svg .n-set { fill: none; stroke: #3D4A52; stroke-width: 2.6; stroke-linecap: round; }
.nora-svg .n-ear { fill: #3D4A52; }
.nora-svg .n-mic { fill: var(--n-gold); }
.nora-svg .n-fig { transform-origin: 60px 120px; animation: nora-breathe 4s ease-in-out infinite; }
.nora-svg .n-hand { transform-origin: 96px 118px; transform: rotate(40deg) translateY(30px); opacity: 0; transition: opacity .2s; }
.nora-svg .n-dots { opacity: 0; }
.nora-svg .n-dots circle { fill: #9AB0BC; }
:is(.nora, .nora-anim).blink .n-eyes { transform: scaleY(.1); }
:is(.nora, .nora-anim).is-thinking .n-eyes { transform: translate(2px, -2px); }
:is(.nora, .nora-anim).is-thinking .n-brows path:first-child { transform: translateY(-2px); }
:is(.nora, .nora-anim).is-thinking .n-dots { opacity: 1; animation: nora-dot 1.2s infinite; }
:is(.nora, .nora-anim).is-listening .nora-face, .nora.is-listening .nora-launch { box-shadow: 0 0 0 4px var(--n-gold); animation: nora-pulse 1.3s infinite; }
:is(.nora, .nora-anim).is-listening .n-brows path { transform: translateY(-2px); }
:is(.nora, .nora-anim).is-talking .n-smile { opacity: 0; }
:is(.nora, .nora-anim).is-talking .n-mouth { opacity: 1; animation: nora-talk .32s ease-in-out infinite alternate; }
:is(.nora, .nora-anim).is-talking.word .n-mouth { transform: scaleY(1.5); }
:is(.nora, .nora-anim).is-wave .n-hand { opacity: 1; animation: nora-wave .65s ease-in-out 4 alternate; }
@keyframes nora-breathe { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-1.2px) } }
@keyframes nora-talk { from { transform: scaleY(.35) } to { transform: scaleY(1.25) } }
@keyframes nora-wave { from { transform: rotate(-10deg) translateY(0) } to { transform: rotate(22deg) translateY(0) } }
@keyframes nora-dot { 0%, 100% { opacity: .3 } 50% { opacity: 1 } }
@keyframes nora-pulse { 0%, 100% { box-shadow: 0 0 0 3px var(--n-gold, #F2B600) } 50% { box-shadow: 0 0 0 9px rgba(242,182,0,.25) } }
@media (prefers-reduced-motion: reduce) { .nora * { animation: none !important; transition: none !important; } }
@media (max-width: 520px) { .nora-panel { position: fixed; inset: auto 8px 8px 8px; width: auto; height: min(88vh, 640px); } .nora-bubble { display: none; } }
/* two assistants: tabs, launcher with both faces, Ammar's figure */
.nora-launch { width: 96px; border-radius: 40px; display: flex; align-items: center; justify-content: center; overflow: visible; }
.nl-face { width: 60px; height: 60px; border-radius: 50%; overflow: hidden; border: 2px solid #fff; background: #fff; flex: 0 0 60px; }
.nl-field { margin-left: -24px; }
.nora-tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid #DDE6EA; }
.nora-tabs button { display: flex; gap: 8px; align-items: center; background: #fff; border: 0; padding: 8px 10px; cursor: pointer; text-align: left; font: inherit; border-bottom: 3px solid transparent; }
.nora-tabs button[aria-selected="true"] { border-bottom-color: var(--n-gold); background: #F8FAFB; }
.nora-tabs b { display: block; font-size: 14px; color: #10293B; }
.nora-tabs small { color: #6B8190; font-size: 12px; }
.nt-face { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%; overflow: hidden; background: #fff; display: block; }
.nora-hand { display: flex; align-items: center; gap: 10px; grid-template-columns: none; }
.nora-hand span:nth-child(2) { flex: 1 1 auto; }
.nora-svg .n-vest { fill: #F2B600; }
.nora-svg .n-strip { stroke: #E9EEF1; stroke-width: 3; }
.nora-svg .n-helmet { fill: #F7F7F2; stroke: #C9D0D4; stroke-width: 1; }
.nora-svg .n-hband { stroke: #C9D0D4; stroke-width: 3; }
.nora-svg .n-beard { fill: #2B1B14; opacity: .82; }
.nora-svg .n-mous { fill: none; stroke: #2B1B14; stroke-width: 3; stroke-linecap: round; }
.nora-svg .n-ear2 { fill: #C68E68; }
.nora-svg .n-radio { fill: #2E3A42; }
.nora.ag-field .nora-head .n-skin, .nl-field .n-skin, .nt-face .n-skin { }
.nora.is-thinking .nora-face .n-eyes, .nora.blink .nora-face .n-eyes { }

/* welcome tour */
.tour { position: fixed; inset: 0; z-index: 80; }
.tour-hole { position: fixed; display: none; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(10,25,36,.55); transition: all .35s ease; pointer-events: none; outline: 3px solid var(--brand-accent, #F2B600); }
.tour:not(:has(.tour-hole[style*="block"])) { background: rgba(10,25,36,.55); }
.tour-card { --n-navy: var(--brand, #13293A); --n-gold: var(--brand-accent, #F2B600); position: fixed; width: min(360px, calc(100vw - 24px)); display: flex; gap: 12px; align-items: flex-start;
  background: #fff; border-radius: 16px; padding: 14px; box-shadow: 0 14px 40px rgba(0,0,0,.3); transition: left .35s ease, top .35s ease, bottom .35s ease; }
.tour-card.tour-center { left: 50% !important; top: 50% !important; bottom: auto !important; transform: translate(-50%, -50%); width: min(440px, calc(100vw - 24px)); }
.tour-face { width: 84px; height: 84px; flex: 0 0 84px; border-radius: 50%; overflow: hidden; background: #E9F0F3; }
.tour-body { flex: 1 1 auto; min-width: 0; }
.tour-body b { color: #10293B; }
.tour-body p { margin: 6px 0 10px; line-height: 1.45; color: #23343F; }
.tour-acts { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.tour-acts small { margin-right: auto; color: #6B8190; }
.tour-snd { color: #10293B; opacity: .45; }
.tour-snd.on { opacity: 1; background: #E4ECEF; }
@media (max-width: 520px) { .tour-card:not(.tour-center) { left: 12px !important; right: 12px; width: auto; top: auto !important; bottom: 12px !important; } .tour-face { width: 60px; height: 60px; flex-basis: 60px; } }

.app-nora .nora-launch { width: 72px; }
.nora-point { position: fixed; z-index: 70; border-radius: 10px; outline: 3px solid var(--signal, #F2B600); box-shadow: 0 0 0 6px rgba(242,182,0,.3); pointer-events: none; animation: nora-pulse 1.1s 4; transition: all .3s; }
.nora-point b { position: absolute; top: -30px; left: 0; background: var(--signal, #F2B600); color: #10293B; font-size: 13px; padding: 3px 9px; border-radius: 10px; white-space: nowrap; }

/* port map */
.pm-map { height: 420px; border-radius: var(--radius-m, 8px); overflow: hidden; z-index: 0; }
.pm-edit { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; font-size: 14px; }
.pm-edit select { margin-left: 6px; }
.pm-msg { color: var(--alert, #B3261E); }
.pm-ic span { display: inline-block; transform: translate(-50%, -50%); white-space: nowrap; font: 600 12px/1 var(--font, system-ui); padding: 4px 7px; border-radius: 12px; color: #fff; background: #10293B; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.pm-ic.pm-port span { background: #F2B600; color: #10293B; font-size: 15px; padding: 5px 8px; }
.pm-ic.pm-pilot span { background: #B3261E; }
.pm-ic.pm-anch span { background: #1B6FB5; }
@media (max-width: 600px) { .pm-map { height: 300px; } }
.imp-table th { vertical-align: bottom; min-width: 130px; }
.imp-table th small { display: block; font-weight: 400; color: var(--ink-3); margin-bottom: 4px; }
.imp-table th select { width: 100%; font-size: 13px; }
.imp-table td { font-size: 13px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog.dlg-wide:has(.imp) { width: min(1100px, 96vw); }
.imp, .imp #imp-prev { min-width: 0; max-width: 100%; }
.imp .table-wrap { overflow-x: auto; max-width: 100%; }
.imp .grid-2 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.pda-bank { margin-top: 18px; break-inside: avoid; }
.pda-bank h3 { font-size: 14px; margin: 0 0 6px; }
.pda-bank table { width: auto; font-size: 13px; border-collapse: collapse; }
.pda-bank td { padding: 3px 14px 3px 0; border: 0; vertical-align: top; }
.pda-bank td:first-child { color: var(--ink-2, #556); white-space: nowrap; }
.v-contacts { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 6px; font-size: 13px; }
.vs-grid .pt-info { grid-template-columns: auto 1fr; }
.vs-grid .pt-info dd { overflow-wrap: anywhere; min-width: 0; }
.sig-preview { background: #fff; border: 1px solid var(--line, #d7dee3); border-radius: 8px; padding: 4px 16px 14px; color: #222; }
