:root {
  --ink: #18212b;
  --muted: #66717f;
  --line: #d9e0e7;
  --panel: #ffffff;
  --surface: #f2f5f7;
  --nav: #101923;
  --blue: #2364aa;
  --teal: #168176;
  --gold: #b87912;
  --red: #b83232;
  --green: #23724b;
  --slate: #343f4c;
  --shadow: 0 18px 45px rgba(21, 31, 43, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--surface);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button,
select,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px;
  color: #eef5f8;
  background:
    linear-gradient(180deg, rgba(16, 25, 35, 0.96), rgba(16, 25, 35, 0.99)),
    linear-gradient(135deg, #17475a, #21342e 56%, #342617);
}

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

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 8px;
  background: #f0c15b;
  color: #101923;
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.pilot-card p {
  color: #afbcc7;
  font-size: 0.88rem;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-section {
  margin: 10px 0 2px;
  color: #f0c15b;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.client-section {
  margin-top: 18px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 43px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #dbe5eb;
  background: transparent;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
}

.icon,
.small-icon {
  position: relative;
  display: inline-block;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.small-icon {
  width: 16px;
  height: 16px;
  flex-basis: 16px;
}

.tower-icon,
.vessel-icon,
.cargo-icon,
.document-icon,
.revenue-icon,
.route-icon,
.booking-icon,
.request-icon {
  color: currentColor;
}

.tower-icon::before,
.tower-icon::after,
.vessel-icon::before,
.vessel-icon::after,
.cargo-icon::before,
.cargo-icon::after,
.document-icon::before,
.document-icon::after,
.revenue-icon::before,
.revenue-icon::after,
.route-icon::before,
.route-icon::after,
.booking-icon::before,
.booking-icon::after,
.request-icon::before,
.request-icon::after,
.refresh-icon::before,
.refresh-icon::after {
  position: absolute;
  content: "";
}

.tower-icon::before {
  inset: 2px 5px;
  border: 2px solid currentColor;
  border-radius: 2px;
}

.tower-icon::after {
  left: 2px;
  bottom: 2px;
  width: 16px;
  height: 2px;
  background: currentColor;
  box-shadow: 4px -6px 0 -1px currentColor;
}

.vessel-icon::before {
  left: 2px;
  top: 10px;
  width: 16px;
  height: 7px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 8px 8px;
}

.vessel-icon::after {
  left: 8px;
  top: 3px;
  width: 7px;
  height: 8px;
  border: 2px solid currentColor;
  border-bottom: 0;
}

.cargo-icon::before {
  inset: 4px 3px 3px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.cargo-icon::after {
  left: 3px;
  top: 8px;
  width: 14px;
  height: 2px;
  background: currentColor;
}

.document-icon::before {
  inset: 2px 5px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.document-icon::after {
  left: 8px;
  top: 7px;
  width: 7px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 5px 0 currentColor;
}

.revenue-icon::before {
  inset: 2px 4px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.revenue-icon::after {
  left: 9px;
  top: 5px;
  width: 2px;
  height: 10px;
  background: currentColor;
}

.route-icon::before {
  left: 3px;
  top: 3px;
  width: 14px;
  height: 14px;
  border: 2px dashed currentColor;
  border-radius: 50%;
}

.route-icon::after {
  left: 4px;
  bottom: 3px;
  width: 12px;
  height: 2px;
  background: currentColor;
  transform: rotate(-28deg);
}

.booking-icon::before {
  inset: 3px 2px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.booking-icon::after {
  left: 6px;
  top: 8px;
  width: 8px;
  height: 2px;
  background: currentColor;
}

.request-icon::before {
  inset: 3px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.request-icon::after {
  left: 9px;
  top: 6px;
  width: 2px;
  height: 8px;
  background: currentColor;
}

.pilot-card {
  margin-top: auto;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.label,
.eyebrow {
  display: block;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pilot-card .label {
  color: #f0c15b;
}

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

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 22px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.75rem, 2.1vw, 2.35rem);
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

h3 {
  margin-bottom: 6px;
  font-size: 1rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

select,
input,
textarea {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

select,
input {
  padding: 0 12px;
}

textarea {
  padding: 12px;
  resize: vertical;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 124px;
  padding: 16px;
}

.metric-card strong {
  display: block;
  margin: 8px 0;
  font-size: 1.75rem;
}

.metric-trend,
.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.empty-state,
.empty-state-card {
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.empty-state {
  padding: 28px 14px;
  white-space: normal;
}

.empty-state-card {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.page-dashboard {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-metric,
.dashboard-chart {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.dashboard-metric {
  min-height: 96px;
  padding: 14px;
}

.dashboard-metric span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-metric strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1.45rem;
}

.dashboard-metric p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

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

.dashboard-chart {
  padding: 14px;
}

.dashboard-chart h3 {
  margin-bottom: 12px;
}

.chart-bars {
  display: grid;
  gap: 9px;
}

.chart-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(140px, 1.5fr) 64px;
  align-items: center;
  gap: 10px;
  font-size: 0.86rem;
}

.chart-row span {
  overflow: hidden;
  color: var(--muted);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-row strong {
  text-align: right;
}

.chart-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf2;
}

.chart-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--blue));
}

.workbench-dashboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.action-list,
.sharing-recommendation-list,
.timeline-board,
.risk-grid {
  display: grid;
  gap: 10px;
}

.action-card,
.sharing-card,
.timeline-card,
.risk-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.action-card strong,
.sharing-card strong,
.timeline-card strong,
.risk-card strong {
  display: block;
  margin-bottom: 6px;
}

.action-card p,
.sharing-card p,
.timeline-card p,
.risk-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.milestone-track {
  display: grid;
  grid-template-columns: repeat(11, minmax(90px, 1fr));
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.milestone {
  min-width: 90px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.milestone span {
  display: block;
  width: 13px;
  height: 13px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.milestone strong,
.milestone em {
  display: block;
  font-style: normal;
}

.milestone strong {
  font-size: 0.78rem;
}

.milestone em {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.milestone.completed span {
  background: var(--green);
}

.milestone.current span {
  background: var(--blue);
}

.milestone.delayed span,
.milestone.blocked span {
  background: var(--red);
}

.milestone.pending span {
  background: var(--gold);
}

.panel {
  padding: 18px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.control-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(310px, 0.62fr);
  gap: 14px;
}

.control-bottom-grid,
.section-grid,
.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.8fr);
  gap: 14px;
  margin-top: 14px;
}

.split-layout {
  margin-top: 0;
}

.wide-panel {
  min-width: 0;
}

.map-panel {
  min-width: 0;
}

.marine-map {
  position: relative;
  min-height: 430px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 28% 44%, rgba(24, 129, 118, 0.18), transparent 24%),
    linear-gradient(135deg, #dce9ec 0 42%, #c8dce1 42% 100%);
}

.traffic-map {
  background: #f7f7f7;
  aspect-ratio: 1832 / 869;
  min-height: 0;
}

.marine-map::before {
  position: absolute;
  inset: 10% auto 8% 9%;
  width: 29%;
  content: "";
  border-radius: 48% 36% 42% 50%;
  background: #d8c99a;
  box-shadow: 18px 24px 0 #c7b887, 36px 64px 0 #b9a978;
  transform: rotate(-9deg);
}

.traffic-map::before {
  display: none;
}

.traffic-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.exact-traffic-image {
  object-fit: contain;
}

.map-route {
  position: absolute;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal), var(--blue));
  transform-origin: left center;
  opacity: 0.82;
}

.map-route.delayed {
  background: linear-gradient(90deg, var(--gold), var(--red));
}

.map-port,
.map-vessel {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  min-width: 86px;
  min-height: 34px;
  padding: 6px 8px;
  border: 2px solid #fff;
  border-radius: 8px;
  color: #fff;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.16);
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
}

.map-port {
  background: var(--blue);
}

.map-vessel {
  background: var(--slate);
}

.map-vessel.Inbound {
  background: var(--teal);
}

.map-vessel.Outbound {
  background: var(--blue);
}

.map-vessel.Offshore {
  background: var(--green);
}

.map-vessel.Delayed,
.map-vessel.Under-review {
  background: var(--red);
}

.icon-button,
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 8px;
  font-weight: 900;
}

.icon-button {
  width: 40px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

.primary-button {
  padding: 0 14px;
  border: 1px solid var(--blue);
  color: #fff;
  background: var(--blue);
}

.secondary-button {
  padding: 0 12px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

.refresh-icon {
  position: relative;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-left-color: transparent;
  border-radius: 50%;
}

.refresh-icon::after {
  right: -2px;
  top: 0;
  width: 6px;
  height: 2px;
  background: currentColor;
  transform: rotate(45deg);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
}

tr[data-vessel-id] {
  cursor: pointer;
}

tr[data-vessel-id]:hover {
  background: #f7fafc;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
}

.status.Inbound,
.status.Verified,
.status.Reconciled,
.status.Confirmed,
.status.Available,
.status.Completed,
.status.Paid,
.status.Low,
.status.Accepted,
.status.Resolved,
.status.Recovery-ready,
.status.Recovered {
  color: #1e6240;
  background: #dff1e8;
}

.status.Outbound,
.status.Offshore,
.status.Booking,
.status.Requested,
.status.Under-review,
.status.Generated,
.status.In-review,
.status.Medium,
.status.Open {
  color: #1e4f79;
  background: #e0eef8;
}

.status.Pending,
.status.Loading,
.status.In-transit,
.status.Planned,
.status.High,
.status.Recommended {
  color: #744b0f;
  background: #f7ebd4;
}

.status.Delayed,
.status.Missing,
.status.Mismatch,
.status.At-risk,
.status.Rejected,
.status.Critical {
  color: #7d1f1f;
  background: #fae8e8;
}

.alert-list,
.event-list,
.compliance-list,
.revenue-exception-list,
.route-list,
.slot-list,
.booking-grid,
.pivot-grid,
.detail-stack {
  display: grid;
  gap: 10px;
}

.alert-item,
.event-item,
.detail-card,
.route-card,
.slot-card,
.booking-card,
.pivot-card,
.compliance-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.alert-item,
.event-item,
.detail-card,
.route-card,
.slot-card,
.booking-card,
.pivot-card,
.compliance-item {
  padding: 14px;
}

.alert-item strong,
.event-item strong,
.detail-card strong,
.route-card strong,
.slot-card strong,
.booking-card strong,
.pivot-card strong,
.compliance-item strong {
  display: block;
  margin-bottom: 6px;
}

.alert-item p,
.event-item p,
.detail-card p,
.route-card p,
.slot-card p,
.booking-card p,
.pivot-card p,
.compliance-item p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.vessel-detail {
  align-self: start;
}

.detail-hero {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.detail-grid,
.route-metrics,
.booking-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-metric,
.route-metric {
  min-height: 72px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.detail-metric span,
.route-metric span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.capacity-meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf2;
}

.capacity-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--blue));
}

.route-card,
.booking-card,
.pivot-card {
  display: grid;
  gap: 12px;
}

.route-card-header,
.booking-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10;
  max-width: 360px;
  padding: 13px 16px;
  border-radius: 8px;
  color: #fff;
  background: #17222d;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: 180ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

  .sidebar {
    position: static;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-section {
    grid-column: 1 / -1;
  }

  .pilot-card {
    display: none;
  }

  .topbar,
  .control-layout,
  .control-bottom-grid,
  .section-grid,
  .split-layout {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

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

@media (max-width: 720px) {
  .main,
  .sidebar {
    padding: 16px;
  }

  .filters,
  .nav-list,
  .kpi-grid,
  .detail-grid,
  .route-metrics,
  .booking-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .marine-map {
    min-height: 360px;
  }
}
