/* ============================================================================
 * Global Container Terminal Layer, Carrier-Operator Strategy & Native Drawer
 * ============================================================================ */

/* 5-tab right panel grid */
.drill-tabs {
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
}
.d-tab {
  font-size: 11px !important;
  padding: 8px 3px !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Topbar tri-state layer control highlight */
#terminal-layer-mode .seg-btn[data-tlayer="both"].active {
  background: #0d6e63;
  color: #ffffff;
}
#terminal-layer-mode .seg-btn[data-tlayer="terminals"].active {
  background: #92400e;
  color: #ffffff;
}

/* Inline strategy legend strip below map stage (never overlaps the globe) */
.terminal-map-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding: 6px 14px;
  background: #f6fafb;
  border-top: 1px solid #dde9ed;
  border-bottom: 1px solid #dde9ed;
  font-size: 11px;
  color: #1f3540;
}
.tml-title {
  font-weight: 700;
  color: #0f2f38;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.tml-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #35505c;
  white-space: nowrap;
}
.tml-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
}
.tml-dot.diamond {
  border-radius: 2px;
  transform: rotate(45deg);
  width: 8px;
  height: 8px;
}
.tml-badge-clear {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
  cursor: pointer;
}
.tml-badge-clear:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* SVG Terminal Layer nodes */
.term-hub-node {
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.term-hub-node:hover .term-hub-core {
  filter: brightness(1.08);
}
.term-hub-label {
  font-size: 9.2px;
  font-weight: 700;
  fill: #0f2a33;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 2.6px;
  stroke-linejoin: round;
  pointer-events: none;
}
.term-hub-sub {
  font-size: 7.8px;
  font-weight: 600;
  fill: #475569;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 2.2px;
  pointer-events: none;
}
.term-hub-greenfield-pulse {
  animation: termPulse 2.4s ease-in-out infinite;
}
@keyframes termPulse {
  0%, 100% { opacity: 0.28; }
  50% { opacity: 0.72; }
}

/* Tab 5: Terminals & Competition Cockpit */
.term-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.term-bench-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 8px;
  padding: 8px 10px;
  background: linear-gradient(135deg, #fffbeb 0%, #f8fafc 100%);
  border: 1px solid #fde68a;
  border-radius: 9px;
}
.term-bench-label {
  font-size: 11px;
  font-weight: 700;
  color: #92400e;
}
.term-bench-select {
  font-size: 11.5px;
  font-weight: 600;
  color: #0f2a33;
  background: #ffffff;
  border: 1px solid #d97706;
  border-radius: 6px;
  padding: 3px 8px;
  cursor: pointer;
}

.term-carrier-strip {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 10px;
  background: #f8fbfc;
  border: 1px solid #d7e5ea;
  border-radius: 9px;
}
.term-strip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: #1f3b47;
}
.term-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.term-carrier-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid #cbd9de;
  background: #ffffff;
  color: #26424d;
  cursor: pointer;
  transition: all 0.14s ease;
}
.term-carrier-chip:hover {
  border-color: #0d6e63;
  color: #0d6e63;
}
.term-carrier-chip.active {
  background: #0d6e63;
  border-color: #0d6e63;
  color: #ffffff;
}
.term-carrier-chip.op-active {
  background: #92400e;
  border-color: #92400e;
  color: #ffffff;
}

.term-subtabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: #edf3f5;
  padding: 3px;
  border-radius: 8px;
}
.term-subtab {
  border: none;
  background: transparent;
  color: #46606b;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 4px;
  border-radius: 6px;
  cursor: pointer;
}
.term-subtab.active {
  background: #ffffff;
  color: #0f2f38;
  box-shadow: 0 1px 3px rgba(15, 36, 46, 0.12);
}

.term-cluster-hdr {
  font-size: 11px;
  font-weight: 700;
  color: #46606b;
  letter-spacing: 0.02em;
  margin: 6px 0 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.term-port-card {
  background: #ffffff;
  border: 1px solid #d9e5ea;
  border-radius: 9px;
  padding: 9px 10px;
  cursor: pointer;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
  margin-bottom: 6px;
}
.term-port-card:hover {
  border-color: #0d6e63;
  box-shadow: 0 3px 10px rgba(13, 110, 99, 0.09);
}
.term-port-card.own-hub {
  border-left: 3px solid #d97706;
}
.term-port-card.greenfield-hub {
  border-left: 3px solid #7c3aed;
  background: linear-gradient(135deg, #faf5ff 0%, #ffffff 70%);
}
.term-port-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.term-port-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #102a33;
}
.term-port-en {
  font-size: 10.5px;
  font-weight: 400;
  color: #6b828c;
}
.term-port-kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 5px;
  font-size: 11px;
  color: #36505c;
}
.term-port-kpis b {
  color: #0f2a33;
}
.term-util-bar {
  height: 5px;
  border-radius: 999px;
  background: #e5eff2;
  overflow: hidden;
  margin-top: 6px;
}
.term-util-fill {
  height: 100%;
  border-radius: 999px;
}
.util-low { background: #10b981; }
.util-mid { background: #f59e0b; }
.util-high { background: #ef4444; }

.term-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.term-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 999px;
  background: #eef5f7;
  color: #294954;
  border: 1px solid #d4e3e8;
}
.term-pill.own {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}
.term-pill.greenfield {
  background: #f3e8ff;
  color: #6d28d9;
  border-color: #d8b4fe;
}
.term-pill.exp {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fdba74;
}
.term-pill.strat-owned-called {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}
.term-pill.strat-third-party {
  background: #e0f2fe;
  color: #075985;
  border-color: #7dd3fc;
}
.term-pill.strat-owned-uncalled {
  background: #f3e8ff;
  color: #6b21a8;
  border-color: #d8b4fe;
}

/* League & Radar cards */
.term-league-card {
  background: #ffffff;
  border: 1px solid #d9e5ea;
  border-radius: 9px;
  padding: 8px 10px;
  margin-bottom: 6px;
  cursor: pointer;
}
.term-league-card:hover {
  border-color: #92400e;
}
.term-league-card.active {
  border-color: #92400e;
  background: #fffbeb;
}
.term-radar-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #d97706;
  border-radius: 9px;
  padding: 9px 10px;
  margin-bottom: 8px;
}
.term-radar-section {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #e2e8f0;
  font-size: 11px;
  color: #334155;
}
.term-radar-section h4 {
  margin: 0 0 4px;
  font-size: 11px;
  color: #0f2f38;
}

/* Inline button in Tab 4 port cards */
.port-term-jump-btn {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid #f59e0b;
  background: #fffbeb;
  color: #92400e;
  cursor: pointer;
  margin-left: 6px;
}
.port-term-jump-btn:hover {
  background: #fef3c7;
}

/* ============================================================================
 * Native <dialog> Slide-Over Port Terminal Drawer (Modern Web Guidance)
 * ============================================================================ */
dialog.ptd-dialog {
  margin: 0 0 0 auto;
  padding: 0;
  border: none;
  width: min(620px, 94vw);
  max-width: 94vw;
  height: 100dvh;
  max-height: 100dvh;
  background: #f8fbfc;
  color: #102a33;
  box-shadow: -12px 0 36px rgba(10, 30, 40, 0.24);
}
dialog.ptd-dialog[open] {
  display: flex;
  flex-direction: column;
}
dialog.ptd-dialog:modal {
  overscroll-behavior: contain;
}
dialog.ptd-dialog::backdrop {
  background: rgba(12, 30, 40, 0.42);
  backdrop-filter: blur(2px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.ptd-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.ptd-header {
  padding: 14px 16px 12px;
  background: linear-gradient(135deg, #0d3b46 0%, #11535b 100%);
  color: #ffffff;
  flex: none;
}
.ptd-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.ptd-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  color: #ffffff;
}
.ptd-sub {
  font-size: 11.5px;
  color: #cbe3e8;
  margin-top: 3px;
}
.ptd-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.ptd-btn {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
}
.ptd-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}
.ptd-btn.primary {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #1c1917;
}
.ptd-btn.primary:hover {
  background: #fbbf24;
}

.ptd-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 16px;
  background: #ffffff;
  border-bottom: 1px solid #d9e5ea;
  flex: none;
}
.ptd-kpi {
  background: #f6fafb;
  border: 1px solid #e1ecef;
  border-radius: 8px;
  padding: 7px 8px;
}
.ptd-kpi-lbl {
  font-size: 10.5px;
  color: #5a737d;
}
.ptd-kpi-val {
  font-size: 14px;
  font-weight: 800;
  color: #0e2c36;
  margin-top: 2px;
}
.ptd-kpi-sub {
  font-size: 10px;
  color: #6b828c;
  margin-top: 1px;
}

.ptd-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #ffffff;
  border-bottom: 1px solid #d9e5ea;
  flex: none;
}
.ptd-tab {
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 9px 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: #516a75;
  cursor: pointer;
}
.ptd-tab.active {
  color: #0d6e63;
  border-bottom-color: #0d6e63;
  background: #f4fbfa;
}

.ptd-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px 16px 20px;
}
.ptd-note {
  font-size: 11px;
  color: #475569;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 7px 10px;
  margin-bottom: 10px;
  line-height: 1.45;
}
.ptd-layer-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #0f3a44;
  margin: 10px 0 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ptd-term-card {
  background: #ffffff;
  border: 1px solid #d9e5ea;
  border-radius: 9px;
  padding: 10px 11px;
  margin-bottom: 8px;
}
.ptd-term-card.highlight-own {
  border-left: 3px solid #d97706;
  background: #fffdf7;
}
.ptd-term-card.highlight-carrier {
  border-left: 3px solid #0d6e63;
  background: #f5fcfa;
}
.ptd-term-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.ptd-term-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #102a33;
}
.ptd-term-cn {
  font-size: 11px;
  color: #5b737e;
  margin-top: 1px;
}
.ptd-spec-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  margin-top: 6px;
  font-size: 11px;
  color: #36505c;
}
.ptd-sh-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}
.ptd-sh-chip {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 6px;
  background: #eef5f7;
  color: #1f3b47;
  border: 1px solid #d1e0e5;
}
.ptd-sh-chip.ctrl {
  background: #e6f4f1;
  border-color: #82c4b8;
  color: #0b4f47;
  font-weight: 600;
}
.ptd-sh-chip.own {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
  font-weight: 700;
}
.ptd-cross-note {
  font-size: 10.5px;
  color: #64748b;
  margin-top: 4px;
  padding-left: 8px;
  border-left: 2px solid #cbd5e1;
}
.ptd-comp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  background: #ffffff;
  border: 1px solid #d9e5ea;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 6px;
}
.ptd-comp-table th,
.ptd-comp-table td {
  padding: 6px 7px;
  text-align: left;
  border-bottom: 1px solid #e9f0f3;
}
.ptd-comp-table th {
  background: #f1f7f9;
  color: #334e59;
  font-weight: 700;
}
.ptd-comp-table tr.is-current td {
  background: #fffbeb;
  font-weight: 700;
}
.ptd-comp-table tr:hover td {
  background: #f6fbfc;
}
