:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #667085;
  --border: #dce3ed;
  --surface: #ffffff;
  --canvas: #eef3f8;
  --primary: #1769e0;
  --primary-deep: #0c4da6;
  --success: #0f9f6e;
  --warning: #d97706;
  --danger: #c73e4d;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  min-width: 1024px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
}

button, input, select { font: inherit; }

.topbar {
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  color: #fff;
  background: linear-gradient(112deg, #0b1f3a, #114d87 68%, #197b9e);
  box-shadow: 0 2px 12px rgb(11 31 58 / 20%);
}

.eyebrow {
  margin: 0 0 3px;
  color: #9bd9f3;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 24px; letter-spacing: .02em; }
h2 { margin-bottom: 0; font-size: 15px; }

.status {
  max-width: 48%;
  padding: 8px 12px;
  border: 1px solid rgb(255 255 255 / 25%);
  border-radius: 7px;
  color: #e7f6ff;
  font-size: 13px;
  background: rgb(5 23 45 / 26%);
}
.status.error { border-color: #f5a5ae; color: #ffe4e6; }
.status.success { border-color: #91e4c5; color: #d6fae9; }

.app-shell {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  grid-template-rows: minmax(540px, calc(100vh - 224px)) auto;
  gap: 16px;
  padding: 16px;
}

.sidebar {
  overflow: auto;
  padding-right: 3px;
}

.panel, .metric-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(16 24 40 / 3%);
}

.panel { margin-bottom: 12px; padding: 16px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.panel label:not(.file-picker):not(.check-label) { display: block; margin: 11px 0 6px; color: #455268; font-size: 12px; font-weight: 700; }

.badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #0c5e45;
  background: #d9f7eb;
  font-size: 11px;
  font-weight: 700;
}
.badge.neutral { color: #4b5565; background: #edf1f5; }
.badge.warning { color: #995b0a; background: #fff0d1; }

.file-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 39px;
  border: 1px dashed #5285ca;
  border-radius: 7px;
  color: #145bbf;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  background: #f4f8ff;
}
.file-picker:hover { background: #e8f1ff; }
.file-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

.hint { margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.hint code { color: #2d5e9d; }
.text-button { border: 0; padding: 0; color: var(--primary); cursor: pointer; background: transparent; font-size: 12px; font-weight: 700; }
.text-button:hover { color: var(--primary-deep); text-decoration: underline; }

.text-input, select {
  width: 100%;
  height: 35px;
  padding: 6px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  outline: 0;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
}
.text-input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgb(23 105 224 / 12%); }
select:disabled, input:disabled { cursor: not-allowed; color: #98a2b3; background: #f5f7fa; }

.timeline-label { display: flex !important; justify-content: space-between; gap: 8px; }
.timeline-label strong { color: var(--primary-deep); font-weight: 700; }
input[type="range"] { width: 100%; margin: 7px 0 2px; accent-color: var(--primary); }
.range-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 10px; }
.range-meta span:last-child { text-align: right; }
.check-label { display: flex; align-items: center; gap: 8px; margin-top: 15px; color: #3f4a5c; font-size: 12px; cursor: pointer; }
.check-label input { width: 14px; height: 14px; accent-color: var(--primary); }
.muted { color: var(--muted); font-size: 12px; }

.details { margin: 0; }
.details div { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 9px; padding: 7px 0; border-bottom: 1px solid #edf1f5; }
.details div:last-child { border-bottom: 0; }
dt { color: var(--muted); font-size: 12px; }
dd { min-width: 0; margin: 0; color: #283548; font-size: 12px; word-break: break-word; }
.empty-state dd { line-height: 1.5; }

.map-workspace { position: relative; overflow: hidden; min-width: 0; border: 1px solid var(--border); border-radius: 10px; background: #dce7eb; box-shadow: 0 1px 2px rgb(16 24 40 / 3%); }
#map { width: 100%; height: 100%; }
.map-notice { position: absolute; top: 14px; left: 50%; z-index: 6; transform: translateX(-50%); max-width: 70%; padding: 8px 12px; border-radius: 6px; color: #364152; background: rgb(255 255 255 / 94%); box-shadow: 0 2px 10px rgb(16 24 40 / 15%); font-size: 12px; text-align: center; pointer-events: none; }
.map-notice.hidden { display: none; }
.map-legend { position: absolute; right: 14px; bottom: 22px; z-index: 5; display: flex; flex-wrap: wrap; gap: 10px 14px; max-width: 80%; padding: 9px 11px; border-radius: 7px; color: #3f4a5c; background: rgb(255 255 255 / 94%); box-shadow: 0 1px 8px rgb(16 24 40 / 14%); font-size: 11px; pointer-events: none; }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.legend-line { display: inline-block; width: 21px; border-top: 3px solid #1769e0; }
.legend-dot { width: 10px; height: 10px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #9aa4b2; }
.legend-dot.start { background: #0f9f6e; }
.legend-dot.intermediate { width: 8px; height: 8px; background: #f59e0b; }
.legend-dot.current { background: #1769e0; }
.legend-ship { width: 0; height: 0; border-right: 5px solid transparent; border-bottom: 10px solid #667085; border-left: 5px solid transparent; }

.ship-marker { display: grid; width: 24px; height: 24px; place-items: center; filter: drop-shadow(0 1px 2px rgb(15 23 42 / 45%)); }
.ship-marker .ship-arrow { display: block; color: #1769e0; font-size: 22px; line-height: 1; transform: rotate(var(--heading)); transform-origin: center; }
.ship-marker.secondary { width: 18px; height: 18px; }
.ship-marker.secondary .ship-arrow { color: #64748b; font-size: 16px; }
.ship-marker.start .ship-arrow { color: #0f9f6e; }
.route-point-marker { width: 11px; height: 11px; border: 2px solid #fff; border-radius: 50%; background: #f59e0b; box-shadow: 0 1px 3px rgb(15 23 42 / 40%); cursor: pointer; }
.route-point-marker:hover { width: 14px; height: 14px; margin: -1.5px; background: #fbbf24; }

.analytics { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.metric-card { min-height: 112px; padding: 16px; }
.metric-card span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-card strong { display: block; margin-bottom: 8px; color: #172e50; font-size: 22px; line-height: 1; }
.metric-card small { color: #778397; font-size: 11px; }

@media (max-width: 1100px) {
  body { min-width: 860px; }
  .app-shell { grid-template-columns: 300px minmax(0, 1fr); }
  .analytics { gap: 10px; }
  .metric-card { padding: 13px; }
  .metric-card strong { font-size: 19px; }
}

.ship-point-info { width: 292px; padding: 3px 2px 2px; color: #1e293b; font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; }
.ship-point-info__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 4px 3px 11px; border-bottom: 1px solid #e5eaf1; }
.ship-point-info__eyebrow { margin: 0 0 3px; color: #64748b; font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.ship-point-info h3 { max-width: 184px; margin: 0; overflow: hidden; color: #142d53; font-size: 16px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.ship-point-info__identity { margin: 4px 0 0; color: #64748b; font-size: 11px; }
.ship-point-info__status { flex: 0 0 auto; max-width: 96px; padding: 4px 7px; border-radius: 999px; color: #496174; background: #edf2f7; font-size: 10px; font-weight: 700; line-height: 1.25; text-align: center; }
.ship-point-info__status.is-underway { color: #096b4b; background: #d9f7e9; }
.ship-point-info__metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 11px 0; }
.ship-point-info__metrics div { padding: 8px 9px; border-radius: 7px; background: #f3f7fc; }
.ship-point-info__metrics span { display: block; margin-bottom: 3px; color: #64748b; font-size: 10px; font-weight: 700; }
.ship-point-info__metrics strong { color: #1456a0; font-size: 15px; line-height: 1.2; }
.ship-point-info__details { margin: 0; }
.ship-point-info__details div { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 8px; padding: 5px 2px; border-top: 1px solid #f0f3f7; }
.ship-point-info__details dt { color: #718096; font-size: 11px; }
.ship-point-info__details dd { min-width: 0; margin: 0; color: #334155; font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }

.legend-anomaly { display: grid; width: 13px; height: 13px; place-items: center; border: 1px solid #fff; border-radius: 50%; color: #fff; background: #dc2626; box-shadow: 0 0 0 1px #991b1b; font-size: 10px; font-style: normal; font-weight: 800; line-height: 1; }
.anomaly-marker { display: grid; width: 19px; height: 19px; place-items: center; border: 2px solid #fff; border-radius: 50%; color: #fff; background: #dc2626; box-shadow: 0 1px 5px rgb(127 29 29 / 55%); cursor: pointer; font-family: Inter, sans-serif; font-size: 13px; font-weight: 900; line-height: 1; }
.anomaly-marker:hover { width: 23px; height: 23px; margin: -2px; background: #ef4444; }
.ship-point-info__anomaly { margin: 0 0 10px; padding: 8px 9px; border: 1px solid #fecaca; border-radius: 7px; color: #991b1b; background: #fff1f2; }
.ship-point-info__anomaly strong { display: block; margin-bottom: 3px; font-size: 11px; }
.ship-point-info__anomaly ul { margin: 0; padding-left: 16px; }
.ship-point-info__anomaly li { margin: 2px 0; font-size: 11px; line-height: 1.4; }
