:root {
  --navy: #0d1b44;
  --blue: #3f70d0;
  --blue-dark: #254f9c;
  --sky: #eef5ff;
  --line: #d9e4f5;
  --text: #0d1b44;
  --muted: #65748c;
  --panel: #ffffff;
  --yellow: #fff8dc;
  --green: #11a06a;
  --red: #d34c4c;
  --shadow: 0 24px 70px rgba(13, 27, 68, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 20% 10%, rgba(63, 112, 208, 0.18), transparent 30%),
    linear-gradient(135deg, #f8fbff 0%, #edf5ff 100%);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.brand-card {
  width: min(520px, 100%);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 34px;
  box-shadow: var(--shadow);
  padding: 42px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-row.compact {
  margin-bottom: 34px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--navy), var(--blue));
  color: #fff;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.brand-name {
  font-weight: 850;
  line-height: 1.1;
}

.brand-name.small {
  color: #fff;
}

.brand-sub {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.side .brand-sub {
  color: rgba(255, 255, 255, 0.58);
}

.brand-card h1 {
  margin: 42px 0 10px;
  font-size: clamp(38px, 7vw, 64px);
  line-height: 0.95;
  letter-spacing: -0.06em;
}

.brand-card p {
  margin: 0 0 28px;
  color: var(--muted);
  line-height: 1.7;
}

.login-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 750;
}

input,
textarea {
  width: 100%;
  border: 1px solid #cddcf1;
  border-radius: var(--radius-md);
  padding: 15px 16px;
  color: var(--text);
  background: #fff;
  outline: none;
}

textarea {
  min-height: 116px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(63, 112, 208, 0.14);
}

.login-form button,
.primary {
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  font-weight: 850;
  letter-spacing: 0.02em;
  padding: 15px 20px;
}

.primary.small {
  padding: 11px 18px;
  font-size: 14px;
}

.ghost {
  border: 0;
  background: var(--sky);
  color: var(--blue-dark);
  border-radius: 999px;
  padding: 10px 15px;
  font-weight: 800;
}

.full {
  width: 100%;
}

.login-error {
  min-height: 20px;
  color: var(--red);
  font-size: 14px;
}

.demo-box {
  margin-top: 26px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.demo-title {
  font-weight: 850;
  margin-bottom: 12px;
}

.demo-line {
  width: 100%;
  display: flex;
  justify-content: space-between;
  border: 1px solid var(--line);
  background: #f8fbff;
  border-radius: var(--radius-md);
  padding: 11px 13px;
  margin-bottom: 8px;
  color: var(--text);
}

.demo-line span:first-child {
  font-weight: 850;
}

.demo-note {
  color: var(--muted);
  font-size: 13px;
  margin-top: 10px;
}

.portal {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.side {
  min-height: 100vh;
  background: var(--navy);
  padding: 28px;
  position: sticky;
  top: 0;
}

.nav {
  display: grid;
  gap: 10px;
}

.nav-item,
.logout {
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 16px;
  padding: 15px 16px;
  color: rgba(255, 255, 255, 0.76);
  background: transparent;
  font-weight: 800;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
}

.logout {
  margin-top: 28px;
  background: rgba(255, 255, 255, 0.08);
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 26px;
  gap: 18px;
}

.eyebrow {
  color: var(--blue);
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 12px;
}

.topbar h2 {
  margin: 4px 0 0;
  font-size: 34px;
  letter-spacing: -0.04em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-toggle {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
}

.lang-toggle button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 8px 13px;
  color: var(--muted);
  font-weight: 850;
}

.lang-toggle button.active {
  background: var(--navy);
  color: #fff;
}

.user-pill,
.status-chip {
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 10px 16px;
  font-weight: 850;
}

.hero-panel {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 32px;
  background: linear-gradient(135deg, #fff 0%, #f6faff 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.route-label {
  color: var(--muted);
  font-weight: 800;
  margin-bottom: 6px;
}

.hero-panel h1 {
  margin: 0 0 10px;
  font-size: clamp(38px, 5vw, 66px);
  line-height: 0.98;
  letter-spacing: -0.065em;
}

.hero-panel h1 span {
  color: var(--blue);
}

.muted {
  color: var(--muted);
}

.status-chip {
  color: var(--green);
  background: #ecfff6;
  border-color: #bfeeda;
}

.status-chip.compact {
  display: inline-flex;
  align-items: center;
  color: #875e00;
  background: var(--yellow);
  border-color: #efd67c;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.summary-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 38px rgba(13, 27, 68, 0.07);
  padding: 16px;
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1;
  letter-spacing: -0.05em;
}

.summary-card.active {
  border-color: rgba(63, 112, 208, 0.35);
  background: linear-gradient(145deg, #ffffff, #eef5ff);
}

.summary-card.warning {
  border-color: #efd67c;
  background: #fffdf0;
}

.summary-card.danger {
  border-color: rgba(211, 76, 76, 0.3);
}

.arrival-board {
  margin-bottom: 18px;
}

.arrival-list {
  display: grid;
  gap: 10px;
}

.arrival-item {
  width: 100%;
  display: grid;
  grid-template-columns: 1.15fr 1fr auto auto;
  align-items: center;
  gap: 14px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  padding: 16px;
  color: var(--text);
}

.arrival-item.active,
.arrival-item:hover {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(63, 112, 208, 0.11);
}

.arrival-item strong {
  display: block;
  font-size: 16px;
}

.customer-tag {
  display: inline-flex;
  width: fit-content;
  margin: 7px 0 0;
  border-radius: 999px;
  background: #eef5ff;
  color: var(--blue-dark);
  padding: 5px 9px;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.arrival-item span {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.arrival-alert {
  display: inline-flex;
  justify-content: center;
  border-radius: 999px;
  background: var(--yellow);
  color: #875e00;
  font-weight: 900;
  padding: 8px 12px;
  white-space: nowrap;
}

.shipment-detail-panel {
  display: grid;
  gap: 18px;
}

.detail-strip {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--line);
  margin-bottom: 18px;
}

.detail-strip div {
  background: rgba(255, 255, 255, 0.86);
  padding: 17px;
  display: grid;
  gap: 5px;
}

.detail-strip span,
.status-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.detail-strip strong,
.status-summary strong {
  font-size: 15px;
}

.grid.two {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.9fr);
  gap: 18px;
}

.panel {
  min-width: 0;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: 0 16px 50px rgba(13, 27, 68, 0.07);
}

.panel.wide {
  grid-column: 1 / 2;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.panel h3 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.timeline.staff {
  margin-top: 22px;
}

.inline-map-card {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%);
  overflow: hidden;
}

.inline-map-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.inline-map-head strong {
  display: block;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.inline-map-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.inline-map-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.inline-map-actions span {
  min-width: 54px;
  text-align: center;
  margin: 0;
  color: var(--blue-dark);
  font-weight: 900;
}

.inline-map-viewport {
  height: 310px;
  overflow: hidden;
  background: #a9c7e9;
  transition: height 180ms ease;
  position: relative;
}

.inline-map-card.collapsed .inline-map-viewport {
  height: 118px;
}

.live-map {
  width: 100%;
  height: 100%;
  min-height: 310px;
  background: #a9c7e9;
}

.live-map.large {
  min-height: min(54vh, 560px);
}

.map-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(238, 245, 255, 0.78);
  color: var(--blue-dark);
  font-weight: 900;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.map-loading.hidden {
  opacity: 0;
}

.vessel-marker {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 67, 56, 0.18);
  display: grid;
  place-items: center;
}

.vessel-marker::before {
  content: "";
  width: 18px;
  height: 18px;
  background: #ff4338;
  clip-path: polygon(50% 0, 100% 100%, 50% 72%, 0 100%);
  transform: rotate(45deg);
  filter: drop-shadow(0 4px 8px rgba(13, 27, 68, 0.35));
}

.vessel-marker::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 999px;
  border: 2px solid rgba(255, 67, 56, 0.45);
  animation: vesselPulse 1.8s ease-out infinite;
}

@keyframes vesselPulse {
  0% {
    transform: scale(0.78);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.45);
    opacity: 0;
  }
}

.vessel-position-label {
  border: 0;
  border-radius: 14px;
  background: rgba(13, 27, 68, 0.92);
  color: #fff;
  box-shadow: 0 14px 34px rgba(13, 27, 68, 0.28);
  padding: 0;
}

.vessel-position-label::before {
  border-right-color: rgba(13, 27, 68, 0.92);
}

.vessel-label-content {
  display: grid;
  gap: 2px;
  min-width: 150px;
  padding: 9px 11px;
}

.vessel-label-content strong {
  font-size: 13px;
  line-height: 1.15;
}

.vessel-label-content span {
  color: #ffcbc7;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.vessel-label-content em {
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  font-style: normal;
}

.port-marker {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 4px solid #0d1b44;
  background: #fff;
}

.leaflet-container {
  font-family: inherit;
}

.leaflet-popup-content-wrapper {
  border-radius: 14px;
}

.leaflet-control-attribution {
  font-size: 10px;
}

.legacy-map-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.legacy-map-layer {
  transform-origin: center;
  transition: transform 180ms ease;
}

.step {
  position: relative;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--sky);
  min-height: 92px;
}

.step.done {
  background: #edf9f4;
}

.step.active {
  background: linear-gradient(135deg, var(--navy), var(--blue));
  color: #fff;
}

.dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--blue);
  margin-bottom: 13px;
}

.step.active .dot {
  background: #fff;
}

.step-title {
  font-weight: 900;
}

.step-date {
  margin-top: 6px;
  color: inherit;
  opacity: 0.62;
  font-size: 12px;
}

.money-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 13px 0;
  color: var(--muted);
}

.money-row strong {
  color: var(--text);
}

.money-row.balance strong {
  color: var(--red);
  font-size: 22px;
}

.pay-status {
  margin-top: 18px;
  display: inline-flex;
  border-radius: 999px;
  background: var(--yellow);
  border: 1px solid #efd67c;
  color: #875e00;
  padding: 9px 13px;
  font-weight: 850;
}

.doc-list {
  display: grid;
  gap: 10px;
}

.doc-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.doc-item:last-child {
  border-bottom: 0;
}

.download {
  border: 0;
  color: var(--blue-dark);
  background: var(--sky);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
}

.success {
  margin-top: 10px;
  color: var(--green);
  font-weight: 750;
}

.staff-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr) 300px;
  gap: 18px;
}

.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.filter {
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--sky);
  color: var(--muted);
  font-weight: 800;
}

.filter.active {
  background: var(--navy);
  color: #fff;
}

.shipment-list {
  display: grid;
  gap: 10px;
}

.shipment-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 18px;
  padding: 15px;
}

.shipment-card.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(63, 112, 208, 0.12);
}

.shipment-card strong {
  display: block;
  margin-bottom: 6px;
}

.shipment-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.status-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--line);
}

.status-summary div {
  background: #fff;
  padding: 18px;
  display: grid;
  gap: 6px;
}

.right-stack {
  display: grid;
  gap: 18px;
  align-content: start;
}

.compact-panel {
  padding: 20px;
}

.mini-list {
  display: grid;
  gap: 9px;
  color: var(--muted);
  margin: 14px 0;
}

.mini-list span {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.change-board {
  margin-top: 18px;
  grid-column: 1 / -1;
}

.request-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.request-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 13px;
}

.request-item strong {
  display: block;
  margin-bottom: 5px;
}

.request-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 27, 68, 0.45);
  backdrop-filter: blur(10px);
}

.map-dialog {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  max-height: min(92vh, 900px);
  overflow: auto;
  background: #fff;
  border-radius: 32px;
  box-shadow: 0 30px 100px rgba(13, 27, 68, 0.28);
  padding: 26px;
}

.map-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.map-toolbar span {
  min-width: 64px;
  text-align: center;
  font-weight: 900;
  color: var(--blue-dark);
}

.vessel-map {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #f3f8ff;
  height: min(54vh, 560px);
}

.vessel-map .live-map {
  display: block;
  width: 100%;
  height: 100%;
}

.map-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--line);
  margin-top: 16px;
}

.map-meta div {
  display: grid;
  gap: 5px;
  padding: 15px;
  background: #fff;
}

.map-meta span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 1180px) {
  .portal {
    grid-template-columns: 1fr;
  }

  .side {
    position: static;
    min-height: auto;
  }

  .staff-layout,
  .grid.two {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-strip {
    grid-template-columns: repeat(3, 1fr);
  }

  .arrival-item {
    grid-template-columns: 1fr 1fr;
  }

  .summary-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .main,
  .side {
    padding: 18px;
  }

  .topbar,
  .hero-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .detail-strip,
  .timeline,
  .status-summary {
    grid-template-columns: 1fr;
  }

  .arrival-item {
    grid-template-columns: 1fr;
  }

  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .summary-card {
    border-radius: 16px;
    padding: 13px;
  }

  .summary-card span {
    font-size: 11px;
  }

  .inline-map-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .inline-map-actions {
    justify-content: flex-start;
  }

  .inline-map-actions .ghost {
    padding: 9px 12px;
  }

  .inline-map-viewport {
    height: 240px;
  }

  .live-map {
    min-height: 240px;
  }

  .map-dialog {
    width: 100%;
    max-height: 94vh;
    border-radius: 22px;
    padding: 16px;
  }

  .vessel-map {
    height: min(48vh, 420px);
  }

  .vessel-label-content {
    min-width: 128px;
    padding: 8px 9px;
  }

  .map-meta {
    grid-template-columns: 1fr;
  }

  .brand-card {
    padding: 28px;
  }
}
