:root, [data-theme="light"] {
  --bg: #f7f9fb;
  --surface: #ffffff;
  --elevated: #ffffff;
  --fg: #161d25;
  --fg-2: #2a323c;
  --muted: #586573;
  --muted-2: #74828f;
  --border: #d6dee6;
  --border-2: #e3e9ef;
  --fill: #eef2f6;
  --fill-2: #f2f5f8;
  --accent: #1f5e9e;
  --brand: #1f5e9e;
  --brand-1: #eaf1f8;
  --brand-hover: #4f87c1;
  --brand-active: #184e88;
  --on-accent: #fff;
  --success: #1f9d57;
  --success-bg: #e9f6ee;
  --warning: #d98e04;
  --warning-bg: #fdf3e2;
  --error: #d93a2b;
  --error-bg: #fdeceb;
  --processing: #5b4fd1;
  --processing-bg: #eeedfb;
  --area-ship: #27577f;
  --area-ship-bg: #e7eef6;
  --area-ref: #2b7e92;
  --area-ref-bg: #e7f1f4;
  --area-id: #5b4fb3;
  --area-id-bg: #ece9f7;
  --shadow-1: 0 1px 2px 0 rgba(14, 20, 27, 0.04);
  --shadow-2: 0 1px 2px 0 rgba(14, 20, 27, 0.05), 0 1px 6px -1px rgba(14, 20, 27, 0.04);
  --shadow-3: 0 4px 12px -4px rgba(14, 20, 27, 0.1), 0 2px 6px -2px rgba(14, 20, 27, 0.06);
  --overlay: color-mix(in srgb, var(--fg) 45%, transparent);
  --on-error: #fff;
}
[data-theme="dark"] {
  --bg: #0e141b;
  --surface: #161d25;
  --elevated: #1f2730;
  --fg: #eef2f6;
  --fg-2: #d6dee6;
  --muted: #9aa7b4;
  --muted-2: #74828f;
  --border: #2a323c;
  --border-2: #222b35;
  --fill: #1f2730;
  --fill-2: #1a222b;
  --accent: #4f87c1;
  --brand: #4f87c1;
  --brand-1: #1d2c3d;
  --brand-hover: #7ba8d4;
  --brand-active: #7ba8d4;
  --on-accent: #0e141b;
  --success: #3fbd77;
  --success-bg: #143528;
  --warning: #e7a92e;
  --warning-bg: #3a2e12;
  --error: #e85c4e;
  --error-bg: #3a1c1a;
  --processing: #7d72e3;
  --processing-bg: #242048;
  --area-ship: #5e90c0;
  --area-ship-bg: #152e44;
  --area-ref: #4ba6bb;
  --area-ref-bg: #143842;
  --area-id: #897ed6;
  --area-id-bg: #262150;
  --shadow-1: 0 1px 2px 0 rgba(0, 0, 0, 0.35);
  --shadow-2: 0 1px 2px 0 rgba(0, 0, 0, 0.4), 0 1px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-3: 0 4px 14px -4px rgba(0, 0, 0, 0.55), 0 2px 6px -2px rgba(0, 0, 0, 0.4);
  --overlay: rgba(0, 0, 0, 0.55);
  --on-error: #fff;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 13px;
  line-height: 1.5715;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
.num, .mono {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: 48px 1fr;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.sidebar {
  grid-row: 1 / -1;
  background: var(--surface);
  border-right: 1px solid var(--border-2);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.sidebar-brand {
  height: 48px;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-bottom: 1px solid var(--border-2);
}
.sidebar-brand .logo {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.sidebar-brand .sub {
  font-size: 11px;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.nav { flex: 1; overflow: auto; padding: 12px 8px; }
.nav-group { margin-bottom: 12px; }
.nav-group-title {
  padding: 6px 10px;
  font-size: 11px;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--fg-2);
  text-align: left;
  position: relative;
}
.nav-item:hover { background: var(--fill-2); color: var(--fg); }
.nav-item.active {
  background: var(--brand-1);
  color: var(--accent);
  font-weight: 600;
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}
.nav-item .ico { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.75; }
.nav-item.active .ico { opacity: 1; color: var(--accent); }
.sidebar-foot {
  border-top: 1px solid var(--border-2);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand-1);
  color: var(--accent);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}
.user-meta { flex: 1; min-width: 0; }
.user-meta strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-meta span { font-size: 11px; color: var(--muted); }

.header {
  grid-column: 2;
  height: 48px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-2);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  position: relative;
  z-index: 40;
}
.collapse-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border-2);
  display: grid; place-items: center;
  color: var(--muted);
  flex-shrink: 0;
  margin-left: -30px;
  position: relative;
  z-index: 50;
  background: var(--surface);
}
.collapse-btn:hover { border-color: var(--border); color: var(--fg); background: var(--fill-2); }
.app.is-sidebar-collapsed { grid-template-columns: 0 1fr; }
.app.is-sidebar-collapsed .sidebar { display: none; }
.app.is-sidebar-collapsed .collapse-btn { margin-left: 0; }
.header-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.icon-btn {
  height: 32px;
  width: 32px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--fg-2);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.icon-btn:hover { background: var(--fill-2); color: var(--fg); border-color: var(--border); }
.icon-btn:focus-visible, .collapse-btn:focus-visible, .nav-item:focus-visible, .btn:focus-visible, .input:focus-visible, .link:focus-visible, .tag:focus-visible, .map-fs-btn:focus-visible, .kpi-tile:focus-visible, .chip:focus-visible, .fleet-toggle:focus-visible, .check-row input:focus-visible, .group-item:focus-visible, .member-pick input:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 1px;
}
.main {
  grid-column: 2;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--on-accent); }
.btn-primary:active:not(:disabled) { background: var(--brand-active); border-color: var(--brand-active); }
.btn-default { background: var(--surface); color: var(--fg-2); border-color: var(--border); }
.btn-default:hover:not(:disabled) { background: var(--fill-2); color: var(--fg); border-color: var(--border); }
.btn-text { background: transparent; color: var(--accent); border-color: transparent; padding: 0 8px; }
.btn-text:hover:not(:disabled) { background: var(--brand-1); color: var(--accent); }
.btn-danger { background: var(--surface); color: var(--error); border-color: var(--border); }
.btn-danger:hover:not(:disabled) { background: var(--error-bg); border-color: var(--error); color: var(--error); }
.btn-danger-solid { background: var(--error); color: var(--on-error); border-color: var(--error); }
.btn-danger-solid:hover:not(:disabled) { filter: brightness(0.95); color: var(--on-error); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 7px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  background: var(--fill);
  color: var(--muted);
  border: 1px solid transparent;
  white-space: nowrap;
}
.tag.ship { background: var(--area-ship-bg); color: var(--area-ship); }
.tag.warning { background: var(--warning-bg); color: var(--warning); }
.tag.success { background: var(--success-bg); color: var(--success); }
.tag.neutral { background: var(--fill); color: var(--muted); }
.tag.hb-ok { background: var(--success-bg); color: var(--success); }
.tag.hb-stale { background: var(--warning-bg); color: var(--warning); }
.tag.hb-aging {
  background: color-mix(in srgb, oklch(0.79 0.14 98) 22%, var(--surface));
  color: oklch(0.52 0.12 85);
}
.tag.hb-down { background: var(--error-bg); color: var(--error); }
[data-theme="dark"] .tag.hb-aging {
  background: color-mix(in srgb, oklch(0.84 0.13 98) 22%, var(--surface));
  color: oklch(0.84 0.13 98);
}

.link { color: var(--accent); font-weight: 500; }
.link:hover { color: var(--brand-hover); text-decoration: underline; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-2);
  flex-shrink: 0;
}
.toolbar .spacer { flex: 1; min-width: 8px; }
.search { position: relative; min-width: 220px; flex: 1; max-width: 320px; }
.search svg {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search .input { padding-left: 30px; }

.input, select.input, textarea.input {
  width: 100%;
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--fg);
}
select.input { min-width: 180px; width: auto; }
.input:hover { border-color: var(--brand-hover); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent); }
.input:disabled, .input[readonly].locked {
  background: var(--fill);
  color: var(--muted);
  cursor: not-allowed;
  border-color: var(--border-2);
}
.input.is-error { border-color: var(--error); }
.input.is-error:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--error) 22%, transparent); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.hint.error { color: var(--error); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field .req { color: var(--error); }

.table-wrap { flex: 1; min-height: 0; overflow: auto; background: var(--surface); }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  position: sticky; top: 0; z-index: 1;
  background: var(--fill);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: left;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border-2);
  font-size: 13px;
  color: var(--fg);
  vertical-align: middle;
}
.tbl tbody tr:hover { background: var(--fill-2); }
.tbl th.col-actions,
.tbl td.col-actions {
  white-space: nowrap;
  width: 1%;
  text-align: right;
}
.muted { color: var(--muted); }
.dash { color: var(--muted-2); }

.tbl-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border-2);
  flex-shrink: 0;
}
.tbl-foot[hidden] { display: none; }
.page-size {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.pager { display: flex; align-items: center; gap: 4px; }
.pager-btn {
  min-width: 28px; height: 28px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg-2);
  display: grid; place-items: center;
  font-size: 12px;
}
.pager-btn:hover:not(:disabled):not(.active) { background: var(--fill-2); color: var(--fg); }
.pager-btn.active { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.pager-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pager-info { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 64px 24px;
  text-align: center;
  color: var(--muted);
  min-height: 280px;
  background: var(--surface);
}
.empty[hidden] { display: none !important; }
.table-wrap[hidden] { display: none !important; }
.empty strong { color: var(--fg); font-size: 14px; font-weight: 600; }

.overlay {
  position: fixed; inset: 0;
  background: var(--overlay);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-3);
  width: min(560px, 100%);
  max-height: min(86vh, 760px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal.wide { width: min(760px, 100%); }
.modal-hd {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-hd h2, .modal-hd h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
}
.modal-bd { padding: 16px; overflow: auto; flex: 1; }
.modal-ft {
  padding: 12px 16px;
  border-top: 1px solid var(--border-2);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-2);
  margin: 0 -16px 16px;
  padding: 0 8px;
}
.tab {
  height: 40px;
  padding: 0 16px;
  color: var(--fg-2);
  border-bottom: 2px solid transparent;
  font-size: 13px;
}
.tab:hover { color: var(--fg); }
.tab.active { color: var(--accent); font-weight: 600; border-bottom-color: var(--accent); }

.alert {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--fill);
  color: var(--fg-2);
  font-size: 13px;
  margin-bottom: 14px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.alert-error {
  background: var(--error-bg);
  border-color: color-mix(in srgb, var(--error) 28%, var(--border));
  color: var(--error);
}
.alert-warning {
  background: var(--warning-bg);
  border-color: color-mix(in srgb, var(--warning) 28%, var(--border));
  color: var(--fg);
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--fg);
  color: var(--surface);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 200;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.page-hd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-2);
  flex-shrink: 0;
}
.page-hd:has(.page-hd-row) {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}
.page-hd-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.page-hd h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.3;
}
.page-hd-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}
.page-hd-title .hb { font-size: 13px; font-weight: 500; }
.page-hd-meta { font-size: 13px; color: var(--muted); font-weight: 500; }
.page-hd .imo { margin-left: 10px; font-size: 14px; color: var(--muted); font-weight: 500; }
.page-hd-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumb {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.crumb a { color: var(--accent); }
.crumb a:hover { text-decoration: underline; }

.card {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  box-shadow: var(--shadow-1);
}
.card-hd {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-2);
  font-size: 13px;
  font-weight: 600;
}
.card-bd { padding: 16px; }
.content { padding: 16px; overflow: auto; flex: 1; min-height: 0; }
.split-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.dl {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 10px 16px;
  align-items: center;
}
.dl dt { font-size: 12px; color: var(--muted); }
.dl dd { margin: 0; color: var(--fg); }

.card-meta {
  margin: 12px 16px 0;
  flex-shrink: 0;
}
.card-meta .card-bd { padding: 10px 14px 8px; }
.dl-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  align-items: flex-start;
}
.dl-compact > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 112px;
}
.dl-compact dt { font-size: 11px; color: var(--muted); }
.dl-compact dd { margin: 0; color: var(--fg); }
.card-meta .caption { padding: 6px 0 0; }

.company-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.company-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.company-fleet {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  flex: 1;
  background: var(--surface);
}
.company-fleet .table-wrap {
  flex: 1;
  min-height: 0;
}
.company-fleet .empty { min-height: 0; flex: 1; }
.company-fleet .search { min-width: 140px; max-width: none; }
.company-fleet select.input { min-width: 132px; }

.fleet-map {
  margin: 12px 16px 0;
  height: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  box-shadow: var(--shadow-1);
  overflow: hidden;
  position: relative;
  z-index: 0;
}
.company-body .fleet-map {
  margin: 12px 16px;
  height: 320px;
  flex: 0 0 320px;
}
.fleet-map .map-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-2);
  min-height: 34px;
  flex-shrink: 0;
}
.fleet-map .map-hd h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
}
.fleet-map .map-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.fleet-map.is-fs {
  position: fixed;
  inset: 0;
  z-index: 70;
  width: 100vw;
  height: 100vh;
  margin: 0;
  border-radius: 0;
  border: none;
  box-shadow: none;
}
.fleet-map.is-fs .map-hd { display: none; }
body.map-fs-open { overflow: hidden; }
.map-fs-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1100;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg-2);
  box-shadow: var(--shadow-2);
  cursor: pointer;
}
.map-fs-btn:hover {
  background: var(--fill-2);
  border-color: var(--border);
  color: var(--fg);
}
.map-fs-btn svg { width: 16px; height: 16px; display: block; }
.map-fs-btn .ico-exit { display: none; }
.fleet-map.is-fs .map-fs-btn .ico-enter { display: none; }
.fleet-map.is-fs .map-fs-btn .ico-exit { display: block; }
.map-canvas {
  position: absolute;
  inset: 0;
  background: var(--fill);
  overflow: hidden;
}
.leaflet-host {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.leaflet-container {
  width: 100%;
  height: 100%;
  background: var(--fill);
  font: inherit;
}
.marine-custom-icon {
  background: none !important;
  border: none !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
}
.marine-custom-icon svg {
  display: block;
  filter: drop-shadow(0 1px 2px rgba(22, 29, 37, .25));
}
.leaflet-control-attribution { display: none !important; }
.leaflet-tooltip.fleet-tip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-2);
  color: var(--fg);
  font-size: 12px;
  padding: 6px 8px;
}
.leaflet-tooltip.fleet-tip .mono { font-size: 11px; color: var(--muted); }
.map-empty {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface);
  color: var(--muted);
  pointer-events: none;
}
.map-empty[hidden] { display: none; }
.map-empty strong { color: var(--fg); font-size: 14px; font-weight: 600; }
.map-legend {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 500;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 6px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-1);
}
.map-legend .hb { color: var(--muted); }

.caption {
  padding: 10px 16px 16px;
  font-size: 12px;
  color: var(--muted);
}

.tree { padding: 4px 0; }
.tree-node { }
.tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 8px;
  border-radius: 6px;
}
.tree-row:hover { background: var(--fill-2); }
.tree-row.is-base { background: var(--brand-1); }
.tree-row.is-disabled { opacity: 0.65; }
.tree-children { padding-left: 22px; }
.twist {
  width: 18px; height: 18px;
  display: grid; place-items: center;
  color: var(--muted);
  flex-shrink: 0;
  font-size: 10px;
}
.tree-label { flex: 1; min-width: 0; color: var(--fg); }
.tree-actions { display: inline-flex; gap: 2px; opacity: 0; }
.tree-row:hover .tree-actions, .tree-row:focus-within .tree-actions { opacity: 1; }
.tree-actions button {
  width: 24px; height: 24px;
  border-radius: 4px;
  color: var(--muted);
  display: grid; place-items: center;
}
.tree-actions button:hover { background: var(--fill); color: var(--fg); }
.tree-check, .tree-radio { accent-color: var(--accent); width: 15px; height: 15px; }

.summary {
  margin-top: 12px;
  padding: 8px 10px;
  background: var(--fill);
  border-radius: 6px;
  font-size: 12px;
  color: var(--fg-2);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 32px;
  padding: 4px 0;
}
.check-row input { accent-color: var(--accent); width: 15px; height: 15px; margin-top: 3px; }
.check-row:focus-within { outline: none; }
[data-name-alt] .check-row { margin-top: 4px; }
[data-name-alt-field] { margin-top: 0; }

.pop {
  position: absolute;
  z-index: 80;
  min-width: 220px;
  max-width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-3);
  padding: 12px;
}
.pop p { margin: 0 0 10px; font-size: 13px; color: var(--fg); }
.pop-ft { display: flex; justify-content: flex-end; gap: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.list-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border-2);
}
.list-row:last-child { border-bottom: 0; }

.split-master {
  display: grid;
  grid-template-columns: 240px 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.split-master.is-wide { grid-template-columns: 300px 1fr; }
.split-master .left {
  background: var(--surface);
  border-right: 1px solid var(--border-2);
  overflow: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.split-master .right { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.split-master .right .empty { flex: 1; min-height: 0; }
.split-master .left .caption { padding: 12px 10px 8px; margin-top: auto; }
.pane-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px 10px;
  flex-shrink: 0;
}
.pane-toolbar .pane-title {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.group-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--fg-2);
  font: inherit;
  cursor: pointer;
}
.group-item .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.group-item .meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.group-item .count {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.group-item:hover { background: var(--fill-2); color: var(--fg); }
.group-item.active { background: var(--brand-1); color: var(--accent); font-weight: 600; }
.group-item.active:hover { background: var(--brand-1); color: var(--accent); }
.group-item.active .count,
.group-item.active .iso { color: var(--accent); }

.hb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--fg-2);
  white-space: nowrap;
}
.hb-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hb) 18%, transparent);
  background: var(--hb);
}
.hb-ok { --hb: var(--success); }
.hb-stale { --hb: var(--warning); }
.hb-aging { --hb: oklch(0.79 0.14 98); }
.hb-down { --hb: var(--error); }
[data-theme="dark"] .hb-aging { --hb: oklch(0.84 0.13 98); }
.hb-legend {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
}
.hb-legend .hb { color: var(--muted); }

.iso {
  font-size: 11px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

.dash {
  padding: 16px;
  overflow: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.dash-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 16px;
}
.dash-head h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.3;
}
.dash-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.dash-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.dash-totals strong { color: var(--fg); font-weight: 600; }
.dash-section { display: flex; flex-direction: column; gap: 8px; }
.dash-section-hd {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.dash-section-hd h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
}
.dash-section-hd span { font-size: 12px; color: var(--muted); }
.dash-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.kpi-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  box-shadow: var(--shadow-1);
  color: var(--fg);
  min-height: 92px;
}
.kpi-tile:hover {
  background: var(--fill-2);
  border-color: var(--border);
  color: var(--fg);
}
.kpi-tile:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 1px;
}
.kpi-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.kpi-tile .hb { color: var(--fg-2); }
.kpi-value {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
.kpi-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--fill);
  overflow: hidden;
}
.kpi-bar > i {
  display: block;
  height: 100%;
  background: var(--hb);
  border-radius: 2px;
}
.hb-stack {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--fill);
  gap: 1px;
}
.hb-stack > i {
  display: block;
  min-width: 0;
  background: var(--hb);
}
.hb-stack > i[data-n="0"] { display: none; }

@media (max-width: 920px) {
  html, body { overflow: auto; }
  .app { grid-template-columns: 0 1fr; height: auto; min-height: 100dvh; overflow: visible; }
  .sidebar { display: none; }
  .collapse-btn { margin-left: 0; }
  .main { overflow: auto; height: auto; }
  .split-2, .split-master, .split-master.is-wide, .dl { grid-template-columns: 1fr; }
  .search, select.input { max-width: none; min-width: 0; width: 100%; }
  .toolbar .spacer { display: none; }
  .fleet-map { height: 280px; margin: 12px 12px 0; }
  .company-body {
    display: flex;
    flex-direction: column;
  }
  .company-body .fleet-map {
    margin: 12px;
    height: 280px;
    flex: 0 0 280px;
  }
  .card-meta { margin: 12px 12px 0; }
  .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fleet-stats { width: 100%; justify-content: flex-start; }
  .fleet-ship {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    min-height: 0;
    padding: 8px 12px 8px 32px;
  }
  .fleet-co-hd { flex-wrap: wrap; height: auto; min-height: 44px; }
  .fleet-co-dist { margin-left: 0; width: 100%; justify-content: flex-start; }
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.chip:hover { background: var(--fill-2); color: var(--fg); border-color: var(--border); }
.chip.is-on {
  background: var(--brand-1);
  border-color: var(--accent);
  color: var(--accent);
}
.chip.is-on:hover { background: var(--brand-1); color: var(--accent); }
.chip .hb-dot { width: 7px; height: 7px; box-shadow: none; }
.chip-all.is-on { background: var(--fill); border-color: var(--fg-2); color: var(--fg); }

.fleet-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.fleet-page .search { max-width: 360px; }
.fleet-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.fleet-stats button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  padding: 0;
  height: auto;
  border: 0;
  background: none;
}
.fleet-stats button:hover { color: var(--fg); }
.fleet-stats button.is-on { color: var(--fg); font-weight: 600; }
.fleet-stats button:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 2px;
  border-radius: 4px;
}
.fleet-stats .sep { color: var(--border); }
.fleet-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fleet-co {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  box-shadow: var(--shadow-1);
}
.fleet-co-hd {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 12px;
  cursor: pointer;
}
.fleet-co-hd:hover { background: var(--fill-2); }
.fleet-toggle {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--muted-2);
}
.fleet-toggle:hover { background: var(--fill); color: var(--fg); }
.fleet-toggle svg {
  width: 14px;
  height: 14px;
  transition: transform 200ms cubic-bezier(0.23, 1, 0.32, 1);
}
.fleet-co.is-open .fleet-toggle svg { transform: rotate(90deg); }
.fleet-co-name {
  font-weight: 600;
  color: var(--fg);
  min-width: 0;
}
.fleet-co-name:hover { color: var(--accent); }
.fleet-co-meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.fleet-co-dist {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.fleet-n {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color: var(--hb);
  min-width: 10px;
  text-align: right;
}
.fleet-co-dist .hb-stack { width: 72px; height: 8px; }
.fleet-co-dist .hb-stack > i { flex: 1 1 auto; }
.fleet-co-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 200ms cubic-bezier(0.23, 1, 0.32, 1);
}
.fleet-co.is-open .fleet-co-body {
  grid-template-rows: 1fr;
  border-top: 1px solid var(--border-2);
}
.fleet-co-body-inner { overflow: hidden; min-height: 0; }
.fleet-ship {
  display: grid;
  grid-template-columns: 16px minmax(110px, 1.3fr) 88px 92px minmax(110px, 1fr) 92px;
  gap: 12px;
  align-items: center;
  min-height: 36px;
  padding: 0 12px 0 40px;
  border-bottom: 1px solid var(--border-2);
  cursor: pointer;
}
.fleet-ship:last-child { border-bottom: 0; }
.fleet-ship:hover { background: var(--fill-2); }
.fleet-ship .hb-dot { box-shadow: none; }
.fleet-ship .src {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fleet-ship .ago {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.fleet-empty-co {
  padding: 12px 12px 12px 40px;
  color: var(--muted);
  font-size: 12px;
}
.fleet-list[hidden],
.fleet-co[hidden],
.fleet-ship[hidden],
.fleet-empty-co[hidden] { display: none !important; }

.drawer-root {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
}
.drawer-root.open { display: block; }
.drawer-mask {
  position: absolute;
  inset: 0;
  background: var(--overlay);
}
.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(400px, 100%);
  background: var(--surface);
  box-shadow: var(--shadow-3);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.drawer-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px;
  flex-shrink: 0;
}
.drawer-hd h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.3;
}
.drawer-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}
.drawer-sub .mono { color: var(--muted); }
.drawer-bd {
  padding: 0 16px 24px;
  overflow: auto;
  flex: 1;
  min-height: 0;
}
.drawer-status { margin: 0 0 12px; }
.drawer-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
}
.drawer-cell {
  background: var(--fill);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 0;
}
.drawer-cell .k {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.drawer-cell .v {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  word-break: break-word;
}
.drawer-sec-hd {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--fg-2);
}
.drawer-sec-hd strong { font-weight: 500; color: var(--fg); }
.drawer-pct {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--fg);
}
.uptime-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 56px;
  margin-bottom: 4px;
}
.uptime-bar {
  flex: 1;
  min-width: 0;
  border-radius: 2px 2px 0 0;
  background: var(--hb);
}
.uptime-bar.hb-ok { height: 100%; }
.uptime-bar.hb-stale { height: 72%; }
.uptime-bar.hb-aging { height: 52%; }
.uptime-bar.hb-down { height: 34%; }
.uptime-axis {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted-2);
  margin-bottom: 20px;
}
.sig-list { display: flex; flex-direction: column; }
.sig-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border-bottom: 1px solid var(--border-2);
  font-size: 12px;
  color: var(--fg-2);
}
.sig-row:last-child { border-bottom: 0; }
.sig-row .hb-dot { box-shadow: none; }
.sig-row .sig-st {
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--hb);
}
.sig-row .sig-time { color: var(--muted); }

.member-pick-cap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
}
.member-pick-cap label { font-size: 12px; color: var(--muted); }
.member-pick {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.member-pick .tbl { margin: 0; }
.member-pick .tbl th,
.member-pick .tbl td { padding: 6px 10px; }
.member-pick .col-check { width: 36px; text-align: center; }
.member-pick .col-order { width: 88px; }
.member-pick .col-neg { width: 148px; }
.member-pick .input.num { width: 72px; }
.member-pick tr.is-off td { color: var(--muted); }
.member-pick input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}
.member-pick .check-row { min-height: 32px; padding: 0; margin: 0; align-items: center; }
.member-pick .check-row input { margin-top: 0; }
.tbl .chips .tag { text-decoration: none; }
.tbl .chips .tag:hover { background: var(--brand-1); color: var(--accent); }
