:root {
  --ink: #0f1d1e;
  --ink-2: #4a5b5c;
  --ink-3: #7d8c8d;
  --line: #e2ebea;
  --bg: #f4faf9;
  --card: #ffffff;
  --head: #052a2c;
  --head-2: #0a3a3d;
  --teal: #0e6b66;
  --teal-2: #13897f;
  --mint: #2ec4b6;
  --mint-soft: #e5f6f3;
  --free: #22c460;
  --partial: #f49f0c;
  --full: #fe5348;
  --maint: #9aa3a6;
  --vessel: #374850;
  --overstay: #e26c6d;
  --pedestal: #c43ad8;
  --amber: #f59e0b;
  --red: #ef4444;
  --shadow: 0 10px 30px rgba(4, 38, 40, 0.16), 0 2px 6px rgba(4, 38, 40, 0.08);
  font-family: Heebo, system-ui, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--head); overflow: hidden; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- top bar ---------- */
.topbar {
  height: 68px; display: flex; align-items: center; gap: 18px; padding: 0 22px;
  background: linear-gradient(180deg, #06302f 0%, var(--head) 100%); color: #fff; position: relative; z-index: 5;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.icon-btn { background: none; border: 0; color: #fff; padding: 6px; cursor: pointer; }
.icon-btn svg { width: 24px; height: 24px; }
.brand { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.brand img { height: 44px; display: block; }
.brand span { font-weight: 800; font-size: 13px; letter-spacing: 0.06em; margin-top: 3px; }
.divider { width: 1px; height: 36px; background: rgba(255,255,255,0.22); }
.client { display: flex; flex-direction: column; line-height: 1.15; }
.client strong { font-weight: 700; font-size: 15px; letter-spacing: 0.2em; }
.client small { font-size: 10.5px; letter-spacing: 0.12em; color: #7fd8cc; margin-top: 3px; }
.modules { display: flex; gap: 4px; margin-left: 18px; background: rgba(255,255,255,0.06); padding: 4px; border-radius: 999px; }
.modules a { padding: 8px 16px; border-radius: 999px; font-size: 14.5px; font-weight: 500; color: rgba(255,255,255,0.72); cursor: pointer; }
.modules a.active { background: #fff; color: var(--head); font-weight: 600; }
.search { margin-left: auto; display: flex; align-items: center; gap: 8px; background: #fff; color: var(--ink-3); border-radius: 999px; padding: 0 16px; height: 42px; width: 290px; }
.search input { border: 0; outline: 0; font: inherit; font-size: 14px; width: 100%; color: var(--ink); }
.lang { display: flex; align-items: center; gap: 7px; font-size: 14px; }
.lang span { color: rgba(255,255,255,0.55); }
.user { display: flex; align-items: center; gap: 10px; }
.user .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--mint); color: var(--head); display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.user div { display: flex; flex-direction: column; line-height: 1.15; }
.user b { font-size: 13.5px; font-weight: 600; }
.user small { font-size: 11.5px; color: rgba(255,255,255,0.6); }

/* ---------- stage ---------- */
#stage { position: absolute; inset: 68px 0 0 0; }
#gl { width: 100%; height: 100%; display: block; }
.card { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); }

.map-tools { position: absolute; top: 18px; left: 22px; display: flex; gap: 10px; z-index: 3; }
.pill-toggle { display: flex; background: #fff; border-radius: 999px; padding: 5px; box-shadow: var(--shadow); }
.pill-toggle button { width: 44px; height: 40px; border-radius: 999px; border: 0; background: none; color: var(--teal); display: grid; place-items: center; cursor: pointer; }
.pill-toggle button.on { background: var(--mint-soft); }
.seg { display: flex; background: #fff; border-radius: 999px; padding: 5px; box-shadow: var(--shadow); }
.seg button { border: 0; background: none; font: inherit; font-weight: 700; font-size: 13.5px; color: var(--ink-2); padding: 0 16px; border-radius: 999px; cursor: pointer; }
.seg button.on { background: var(--teal); color: #fff; }

/* KPI strip */
.kpis { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; z-index: 3; }
.kpi { background: rgba(255,255,255,0.97); border-radius: 16px; box-shadow: var(--shadow); padding: 11px 18px 12px; min-width: 150px; }
.kpi .k { font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi .k i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.kpi .v { font-size: 26px; font-weight: 800; line-height: 1.1; margin-top: 2px; letter-spacing: -0.01em; }
.kpi .v small { font-size: 13px; font-weight: 500; color: var(--ink-3); margin-left: 4px; letter-spacing: 0; }
.kpi .bar { height: 5px; background: #e9f0ef; border-radius: 9px; margin-top: 7px; overflow: hidden; }
.kpi .bar b { display: block; height: 100%; background: linear-gradient(90deg, var(--teal-2), var(--mint)); border-radius: 9px; }
.kpi.alert .v { color: #d63c3c; }

/* legend as filter */
.legend { position: absolute; left: 22px; bottom: 64px; width: 300px; padding: 16px 16px 12px; z-index: 3; }
.legend h6 { margin: 0 0 8px; font-size: 11.5px; letter-spacing: 0.12em; color: var(--ink-3); font-weight: 700; }
.legend h6:not(:first-child) { margin-top: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px 5px 8px; font-size: 12.5px; font-weight: 500; color: var(--ink); background: #fff; cursor: pointer; }
.chip i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.chip i.round { border-radius: 50%; }
.chip b { color: var(--ink-3); font-weight: 600; font-size: 12px; }
.chip.on { border-color: var(--teal); background: var(--mint-soft); }
.hatch { background: repeating-linear-gradient(45deg, #b8c0c2 0 2px, #fff 2px 4px); }

/* optimisation CTA */
.opt { position: absolute; right: 22px; bottom: 26px; width: 440px; padding: 16px 18px; z-index: 3; display: flex; gap: 14px; align-items: center; }
.opt .spark { width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(135deg, var(--teal), var(--mint)); color: #fff; display: grid; place-items: center; flex: none; }
.opt .spark svg { width: 24px; height: 24px; }
.opt h5 { margin: 0; font-size: 15px; font-weight: 700; }
.opt p { margin: 2px 0 0; font-size: 13px; color: var(--ink-2); line-height: 1.35; }
.opt p b { color: var(--teal); }
.btn { border: 0; font: inherit; font-weight: 600; font-size: 14px; border-radius: 999px; padding: 10px 18px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.btn.primary { background: var(--teal); color: #fff; }
.btn.ghost { background: #fff; color: var(--teal); border: 1.5px solid var(--teal); }
.btn.danger { background: #fff; color: #d63c3c; border: 1.5px solid #f2b8b8; }
.btn svg { width: 17px; height: 17px; }

/* berth panel */
.panel { position: absolute; top: 18px; right: 22px; bottom: 26px; width: 392px; z-index: 4; padding: 22px 22px 18px; display: flex; flex-direction: column; overflow: hidden; }
.panel .ph { display: flex; justify-content: space-between; align-items: flex-start; }
.panel .ph h3 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.panel .ph small { color: var(--ink-3); font-size: 13px; font-weight: 500; }
.panel .close { color: var(--ink-3); }
.status-row { display: flex; gap: 8px; margin: 12px 0 14px; flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 5px 11px; border-radius: 999px; }
.tag i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tag.red { color: #d63c3c; background: #ffeceb; }
.tag.green { color: #12924a; background: #e4f8ec; }
.tag.amber { color: #b26b00; background: #fff3dc; }
.tag.teal { color: var(--teal); background: var(--mint-soft); }
.tag.grey { color: var(--ink-2); background: #eef2f2; }
.vessel-hero { display: flex; gap: 14px; align-items: center; padding: 14px; background: var(--bg); border-radius: 14px; }
.vessel-hero .ic { width: 46px; height: 46px; border-radius: 12px; background: #fff; display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.vessel-hero .ic img { width: 34px; }
.vessel-hero h4 { margin: 0; font-size: 18px; font-weight: 700; }
.vessel-hero p { margin: 1px 0 0; font-size: 13px; color: var(--ink-2); }
.flag { font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 5px; background: #fff; border: 1px solid var(--line); margin-left: 6px; vertical-align: 2px; }
.sect { margin-top: 14px; }
.sect h6 { margin: 0 0 8px; font-size: 11.5px; letter-spacing: 0.1em; color: var(--ink-3); font-weight: 700; text-transform: uppercase; display: flex; align-items: center; gap: 10px; }
.sect h6::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 14px; }
.f label { display: block; font-size: 12px; color: var(--ink-3); }
.f div { font-size: 15px; font-weight: 600; margin-top: 1px; }
.f div.warn { color: #c2410c; }
.f div.ok { color: #12924a; }
.meter { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: linear-gradient(135deg, #fbf3fd, #f6f0ff); border: 1px solid #efe2f7; }
.meter .dot { width: 34px; height: 34px; border-radius: 10px; background: var(--pedestal); color: #fff; display: grid; place-items: center; flex: none; }
.meter .dot svg { width: 18px; height: 18px; }
.meter b { font-size: 15px; }
.meter small { display: block; color: var(--ink-2); font-size: 12px; }
.meter .live { margin-left: auto; text-align: right; }
.meter .live b { color: #8a1fa0; font-size: 18px; }
.panel .actions { margin-top: auto; display: flex; gap: 10px; padding-top: 14px; }
.panel .actions .btn { flex: 1; justify-content: center; }

.coords { position: absolute; left: 22px; bottom: 22px; z-index: 3; width: 300px; color: #6fe0cf; font-size: 12.5px; font-weight: 500; }
.coords i { display: block; height: 6px; border-radius: 9px; margin-top: 6px; background: linear-gradient(90deg, #07a98e, #68cadb); }

.caption { position: absolute; left: 50%; bottom: 60px; transform: translateX(-50%); z-index: 6; pointer-events: none; }

body.shot .search input::placeholder { color: #8a9a9b; }
[hidden] { display: none !important; }

.client img { height: 40px; display: block; }

/* ---------- live (interactive) mode ---------- */
body.live .vscreen { top: 18px; bottom: 26px; }
body.live #vbill { top: 18px; bottom: 26px; }
body.live #vphone { top: 40px; left: auto; right: 12%; transform: scale(0.92); transform-origin: 100% 0; }
body.live #vfeed { top: 120px; left: 8%; }
body.live .modules a { cursor: pointer; }
body.live .t1 tbody tr:hover td { background: #f6fbfa; }
.live-hint { position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 16; background: rgba(5, 42, 44, 0.82); color: #dff7f3; font-size: 13.5px; padding: 9px 16px; border-radius: 999px; white-space: nowrap; transition: opacity .4s; pointer-events: none; }
.live-hint b { color: #fff; }
body.live #vgain { z-index: 6; }

@media (max-width: 1100px) {
  .search, .user div, .lang span { display: none; }
  .modules { margin-left: 6px; }
  .modules a { padding: 7px 11px; font-size: 13px; }
  .kpis { left: 22px; right: 22px; transform: none; top: 74px; overflow-x: auto; justify-content: flex-start; }
  .kpi { min-width: 128px; padding: 9px 12px; }
  .kpi .v { font-size: 20px; }
}
@media (max-width: 720px) {
  .topbar { gap: 10px; padding: 0 12px; height: 60px; }
  #stage { top: 60px; }
  .brand img { height: 34px; } .client img { height: 30px; } .divider { height: 28px; }
  .menu, .user { display: none; }
  .modules { position: fixed; left: 8px; right: 8px; bottom: 10px; z-index: 30; justify-content: space-between; background: rgba(5,42,44,.92); }
  .modules a { flex: 1; text-align: center; padding: 9px 4px; font-size: 12.5px; }
  .legend, .coords, .opt, .live-hint { display: none; }
  .map-tools { top: 12px; left: 12px; }
  .kpis { top: 66px; left: 12px; right: 12px; }
  .panel { left: 8px; right: 8px; width: auto; top: auto; bottom: 64px; max-height: 62%; overflow-y: auto; }
  body.live .vscreen { left: 6px; right: 6px; bottom: 64px; padding: 16px; overflow: auto; }
  body.live #vbill { left: 8px; right: 8px; width: auto; bottom: 64px; top: auto; max-height: 70%; overflow: auto; }
  body.live #vphone { left: 50%; right: auto; top: 10px; transform: translateX(-50%) scale(0.72); transform-origin: 50% 0; }
  body.live #vfeed { display: none !important; }
}

/* data attribution (OSM ODbL + Esri) */
.attrib { position: absolute; right: 22px; bottom: 6px; z-index: 3; font-size: 10.5px; color: rgba(255,255,255,0.78); text-shadow: 0 1px 3px rgba(0,0,0,0.5); pointer-events: none; }
body.video .attrib { display: none; }
@media (max-width: 720px) { .attrib { top: 152px; left: 12px; right: auto; bottom: auto; max-width: 72%; text-align: left; font-size: 9.5px; } }
