
.leaflet-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container,.leaflet-pane>svg,.leaflet-pane>canvas,.leaflet-zoom-box,.leaflet-image-layer,.leaflet-layer{position:absolute;top:0;left:0}.leaflet-container{overflow:hidden}.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow{-webkit-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::selection{background:0 0}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{-webkit-transform-origin:0 0;width:1600px;height:1600px}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-overlay-pane svg{max-width:none!important;max-height:none!important}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer,.leaflet-container .leaflet-tile{width:auto;padding:0;max-width:none!important;max-height:none!important}.leaflet-container img.leaflet-tile{mix-blend-mode:plus-lighter}.leaflet-container.leaflet-touch-zoom{-ms-touch-action:pan-x pan-y;touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{-ms-touch-action:pinch-zoom;touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{-ms-touch-action:none;touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:#33b5e566}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{box-sizing:border-box;z-index:800;width:0;height:0}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control{z-index:800;pointer-events:visiblePainted;pointer-events:auto;position:relative}.leaflet-top,.leaflet-bottom{z-index:1000;pointer-events:none;position:absolute}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-popup{opacity:0;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{transform-origin:0 0}svg.leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{-webkit-transition:-webkit-transform .25s cubic-bezier(0,0,.25,1);-moz-transition:-moz-transform .25s cubic-bezier(0,0,.25,1);transition:transform .25s cubic-bezier(0,0,.25,1)}.leaflet-zoom-anim .leaflet-tile,.leaflet-pan-anim .leaflet-tile{transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-popup-pane,.leaflet-control{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-image-layer,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}.leaflet-marker-icon.leaflet-interactive,.leaflet-image-layer.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{outline-offset:1px;background:#070b13;width:100%;height:100%}.leaflet-container a{color:#0078a8}.leaflet-zoom-box{background:#ffffff80;border:2px dotted #38f}.leaflet-popup-content-wrapper,.leaflet-popup-tip{color:#0f172a;background:#fff;box-shadow:0 10px 25px #00000080;border-radius:12px;padding:2px}.leaflet-popup-content{margin:12px 14px}

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --bg-dark: #070b13;
  --panel-bg: rgba(13, 22, 38, 0.85);
  --panel-border: rgba(56, 189, 248, 0.2);
  --accent-cyan: #38bdf8;
  --accent-blue: #2563eb;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --card-bg: rgba(15, 23, 42, 0.75);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body, html {
  height: 100%;
  width: 100%;
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  overflow: hidden;
}

.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  position: relative;
  overflow: hidden;
}

.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--panel-border);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

/* MAP WRAPPER */
.map-wrapper {
  flex: 1;
  height: 100%;
  position: relative;
  z-index: 1;
}

/* TOP FLOATING HUD */
.top-hud-bar {
  position: absolute;
  top: 14px;
  left: 16px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 30px;
}

.hud-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-main);
}

.hud-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(56, 189, 248, 0.18);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: var(--accent-cyan);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

/* MAP LAYER SELECTOR */
.map-layer-selector {
  position: absolute;
  bottom: 20px;
  left: 16px;
  z-index: 1000;
  padding: 10px 12px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.layer-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-cyan);
}

.layer-buttons {
  display: flex;
  gap: 5px;
}

.layer-btn {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.layer-btn.active {
  background: var(--accent-cyan);
  color: #070b13;
  font-weight: 700;
  border-color: var(--accent-cyan);
}

.seamark-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
}

/* SIDEBAR VESSEL FEED */
.live-feed-panel {
  width: 380px;
  height: 100%;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  border-left: 1px solid var(--panel-border);
}

.panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.radar-icon-box {
  width: 34px;
  height: 34px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.radar-sweep {
  position: absolute;
  width: 100%;
  height: 100%;
  background: conic-gradient(from 0deg at 50% 50%, rgba(56, 189, 248, 0.4) 0deg, transparent 60deg);
  animation: radar-spin 2.5s linear infinite;
}

@keyframes radar-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.header-title h2 {
  font-size: 15px;
  font-weight: 700;
}

.header-title .subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
}

/* TABS */
.tabs-container {
  display: flex;
  padding: 8px 14px;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
}

.tab-btn {
  flex: 1;
  padding: 7px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  cursor: pointer;
}

.tab-btn.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: var(--accent-cyan);
}

/* FILTERS */
.filter-row {
  display: flex;
  gap: 8px;
  padding: 8px 14px;
}

.filter-row select {
  flex: 1;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  outline: none;
}

.search-container {
  padding: 6px 14px 10px;
  position: relative;
}

.search-input {
  width: 100%;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  outline: none;
}

.clear-search {
  position: absolute;
  right: 22px;
  top: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

/* SHIP LIST */
.ship-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ship-item {
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.ship-item:hover, .ship-item.selected {
  background: rgba(56, 189, 248, 0.12);
  border-color: var(--accent-cyan);
}

.ship-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ship-name-box {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.ship-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}

.ship-type-tag {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  text-transform: uppercase;
}

.ship-type-tag.cargo { background: rgba(56, 189, 248, 0.2); color: #38bdf8; }
.ship-type-tag.tanker { background: rgba(249, 115, 22, 0.2); color: #fb923c; }
.ship-type-tag.passenger { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.ship-type-tag.tugtow { background: rgba(168, 85, 247, 0.2); color: #c084fc; }
.ship-type-tag.other { background: rgba(148, 163, 184, 0.2); color: #94a3b8; }

.star-btn {
  background: none;
  border: none;
  font-size: 15px;
  color: var(--text-muted);
  cursor: pointer;
}

.ship-telemetry {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.panel-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--panel-border);
  display: flex;
  gap: 8px;
}

.footer-action-btn {
  flex: 1;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

/* ==========================================================================
   ACTIVE VESSEL DETAIL & AI COPILOT DRAWER (UNIVERSAL & MOBILE READY)
   ========================================================================== */
.ship-detail-panel {
  position: absolute;
  top: 14px;
  right: 400px;
  width: 440px;
  max-height: calc(100vh - 28px);
  z-index: 2000;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
}

.detail-panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(13, 22, 38, 0.95);
  flex-shrink: 0;
}

.ship-category-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-cyan);
}

.detail-panel-header h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 1px 0;
}

.mmsi-label {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.drawer-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.save-fleet-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.save-fleet-btn.active {
  background: rgba(245, 158, 11, 0.2);
  border-color: #f59e0b;
  color: #f59e0b;
}

.close-btn {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #ef4444;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.close-btn:hover {
  background: #ef4444;
  color: #fff;
}

/* SUBTABS */
.drawer-subtabs {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(0, 0, 0, 0.3);
  padding: 6px 12px;
  gap: 6px;
  border-bottom: 1px solid var(--panel-border);
  flex-shrink: 0;
}

.drawer-subtabs::-webkit-scrollbar { display: none; }

.drawer-tab {
  white-space: nowrap;
  background: none;
  border: 1px solid transparent;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.drawer-tab.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.3);
  color: var(--accent-cyan);
}

/* TAB CONTENT SCROLLING BODY */
.tab-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.telemetry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.telem-card {
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 12px;
  border-radius: 10px;
}

.telem-card-label {
  font-size: 10px;
  color: var(--text-muted);
  display: block;
}

.telem-card-value {
  font-size: 15px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
}
.telem-card-value.highlight { color: #38bdf8; }
.telem-card-value.live-text { color: #10b981; }

.spec-list {
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 6px 12px;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  font-size: 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.spec-row:last-child { border-bottom: none; }
.spec-row span { color: var(--text-muted); }
.spec-row strong { font-weight: 600; color: var(--text-main); }

.primary-glow-btn {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  border: none;
  color: #fff;
  padding: 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
  width: 100%;
  margin-top: 4px;
}

/* AI INTEL STYLES */
.ai-loading-box, .ai-empty-box {
  text-align: center;
  padding: 30px 14px;
  background: var(--card-bg);
  border-radius: 12px;
}

.ai-pulse-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(56, 189, 248, 0.2);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.ai-intel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  background: var(--card-bg);
  border-radius: 10px;
  overflow: hidden;
}

.ai-intel-table th, .ai-intel-table td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
}
.ai-intel-table th { color: var(--text-muted); width: 40%; }
.ai-intel-table td { font-weight: 600; color: #f1f5f9; }

.ai-narrative-box {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  padding: 12px;
  border-radius: 10px;
  font-size: 11px;
  line-height: 1.5;
}

.reanalyze-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  padding: 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}

/* DISTANCE TABLE */
.distance-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  background: var(--card-bg);
  border-radius: 10px;
  overflow: hidden;
}
.distance-table th, .distance-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.distance-table th { color: var(--text-muted); text-align: left; font-size: 10px; }
.nm-value { color: var(--accent-cyan); font-weight: 700; font-family: 'JetBrains Mono', monospace; }

/* CHAT TAB */
.chat-tab-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 12px;
}

.chat-history {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 380px;
  margin-bottom: 10px;
}

.chat-bubble-wrapper.user { align-self: flex-end; }
.chat-bubble-wrapper.ai { align-self: flex-start; }

.chat-bubble {
  max-width: 290px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.4;
}

.chat-bubble-wrapper.user .chat-bubble {
  background: #2563eb;
  color: #fff;
  border-bottom-right-radius: 2px;
}

.chat-bubble-wrapper.ai .chat-bubble {
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
  border-bottom-left-radius: 2px;
}

.chat-sender-name {
  font-size: 9px;
  color: var(--accent-cyan);
  font-weight: 700;
  margin-bottom: 3px;
}

.chat-timestamp {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.5);
  text-align: right;
  margin-top: 4px;
}

.quick-prompts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.quick-prompts button {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: var(--accent-cyan);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
}

.chat-input-bar {
  display: flex;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--panel-border);
}

.chat-input-bar input {
  flex: 1;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 12px;
  outline: none;
}

.send-chat-btn {
  background: var(--accent-cyan);
  border: none;
  color: #070b13;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

/* POPUP */
.popup-card {
  color: #0f172a;
}
.popup-card h4 { font-size: 14px; margin-bottom: 4px; }
.popup-card p { font-size: 11px; margin: 2px 0; }
.popup-btn {
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* ANALYTICS MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.analytics-modal {
  width: 520px;
  max-width: 95vw;
  border-radius: 16px;
  overflow: hidden;
}

.modal-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.analytics-kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.kpi-card {
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 12px;
  border-radius: 8px;
}
.kpi-label { font-size: 10px; color: var(--text-muted); }
.kpi-value { font-size: 18px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.kpi-value.highlight-green { color: #10b981; }
.kpi-value.highlight-yellow { color: #f59e0b; }

.type-distribution-bar {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  margin: 6px 0;
}
.bar-segment.cargo { background: #38bdf8; }
.bar-segment.tanker { background: #fb923c; }
.bar-segment.passenger { background: #4ade80; }
.bar-segment.other { background: #c084fc; }

.legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; }
.dot.cargo { background: #38bdf8; }
.dot.tanker { background: #fb923c; }
.dot.passenger { background: #4ade80; }
.dot.other { background: #c084fc; }

.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--panel-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.modal-btn {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.modal-btn.primary { background: var(--accent-cyan); border: none; color: #070b13; }
.modal-btn.secondary { background: rgba(15, 23, 42, 0.8); border: 1px solid rgba(255, 255, 255, 0.15); color: #fff; }

/* ==========================================================================
   DEDICATED MOBILE RESPONSIVE DESIGN (SMARTPHONE FIRST)
   ========================================================================== */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    position: relative;
  }

  .map-wrapper {
    height: 60vh;
    height: 60dvh;
    width: 100%;
  }

  .live-feed-panel {
    width: 100%;
    height: 40vh;
    height: 40dvh;
    border-left: none;
    border-top: 1px solid var(--panel-border);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.5);
  }

  .top-hud-bar {
    top: 8px;
    left: 8px;
    right: 8px;
    padding: 6px 10px;
    gap: 6px;
  }
  .hud-badge { font-size: 10px; }
  .hud-action-btn { font-size: 10px; padding: 4px 8px; }

  .map-layer-selector {
    bottom: 8px;
    left: 8px;
    padding: 6px 8px;
  }

  /* FULLSCREEN MODAL DRAWER FOR SHIP DETAIL & AI COPILOT ON SMARTPHONES */
  .ship-detail-panel {
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    z-index: 99999 !important;
    background: #070b13 !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .detail-panel-header {
    padding: 12px 16px;
    background: #0d1626;
    border-bottom: 1px solid var(--panel-border);
  }

  .close-btn {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }

  .drawer-subtabs {
    padding: 8px 12px;
    gap: 8px;
  }

  .drawer-tab {
    padding: 8px 12px;
    font-size: 12px;
  }

  .tab-content {
    flex: 1;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 16px;
    padding-bottom: 90px !important;
  }

  .primary-glow-btn {
    padding: 14px;
    font-size: 14px;
    margin-top: 12px;
  }

  .chat-history {
    max-height: calc(100dvh - 250px);
  }
}


/* TOP RIGHT VERIFICATION BADGE (HIGH VISIBILITY PROOF OF UPDATE) */
.version-proof-badge {
  position: fixed;
  top: 12px;
  right: 14px;
  z-index: 999999;
  background: linear-gradient(135deg, #059669, #0284c7);
  border: 2px solid #38bdf8;
  color: #ffffff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.6), 0 4px 12px rgba(0,0,0,0.5);
  pointer-events: none;
  font-family: 'Outfit', sans-serif;
  animation: badge-glow 2s infinite alternate;
}

.version-proof-badge .glow-dot {
  width: 9px;
  height: 9px;
  background-color: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 10px #4ade80;
  animation: pulse-ring 1.5s infinite;
}

@keyframes badge-glow {
  0% { transform: scale(0.98); box-shadow: 0 0 15px rgba(56, 189, 248, 0.4); }
  100% { transform: scale(1.02); box-shadow: 0 0 25px rgba(56, 189, 248, 0.8); }
}

@media (max-width: 768px) {
  .version-proof-badge {
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    font-size: 9px;
  }
}
