/* ==========================================================================
   VIETSUN CORPORATION (vietsunlogistic.com) — Container Barge Ops Theme
   Primary Brand Navy: #002664 | Accent Red: #ED1C24 / #EE2A33
   Clean White Header & Cards (#FFFFFF) | Subtle Surface (#F5F6F8)
   ========================================================================== */
:root {
  --vs-navy-950: #001842;
  --vs-navy: #002664;
  --vs-navy-800: #0a3478;
  --vs-navy-700: #134491;
  --vs-navy-50: #edf3fc;
  --vs-red: #ed1c24;
  --vs-red-hover: #cc141b;
  --vs-red-50: #fef2f2;
  --teal-600: #0d9488;
  --teal-50: #f0fdfa;
  --blue-600: #1d4ed8;
  --blue-50: #eff6ff;
  --amber-600: #d97706;
  --amber-50: #fffbeb;
  --green-600: #15803d;
  --green-50: #f0fdf4;
  --slate-900: #1f2937;
  --slate-700: #333333;
  --slate-500: #667085;
  --slate-400: #98a2b3;
  --slate-200: #e4e4e4;
  --slate-100: #f3f4f6;
  --slate-50: #f6f7f9;
  --white: #ffffff;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0, 38, 100, 0.06);
  --shadow: 0 4px 16px rgba(0, 38, 100, 0.08);
  --shadow-lg: 0 18px 42px rgba(0, 24, 66, 0.2);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  background: var(--slate-50);
  color: var(--slate-700);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea, table, svg text {
  font-family: inherit;
}

h1, h2, h3, h4, .page-title, .card-title, .kpi-value {
  letter-spacing: -0.015em;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

/* ---------------- App Shell ---------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 294px;
  background: var(--vs-navy);
  color: var(--white);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 16px 14px;
  background: var(--white);
  border-bottom: 3px solid var(--vs-red);
}

.brand-logo-img {
  height: 60px;
  width: auto;
  max-width: 205px;
  object-fit: contain;
  display: block;
}

.brand-sub-pill {
  font-size: 12px;
  font-weight: 700;
  color: var(--vs-navy);
  background: var(--vs-navy-50);
  border: 1px solid #d0e0f7;
  padding: 4px 12px;
  border-radius: 99px;
  letter-spacing: 0.01em;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-section-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #9bb5de;
  padding: 8px 14px 6px;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 15px;
  border-radius: 8px;
  color: #e4eefc;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nav-item svg {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
}

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

.nav-item.active {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-weight: 700;
  box-shadow: inset 4px 0 0 var(--vs-red);
}

.nav-badge {
  margin-left: auto;
  background: var(--vs-red);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
}

.sidebar-footer {
  padding: 14px 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--vs-navy-950);
}

.role-label {
  display: block;
  font-size: 12px;
  color: #9fb7dc;
  margin-bottom: 6px;
}

.role-select {
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--vs-navy-800);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 13.5px;
  outline: none;
  cursor: pointer;
}

.role-meta {
  margin-top: 7px;
  font-size: 12px;
  color: #d1e0f7;
}

.brand-contact {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 10.5px;
  color: #8da9d4;
  line-height: 1.45;
}

.main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.brand-ribbon {
  background: var(--white);
  border-bottom: 1px solid var(--slate-200);
  padding: 6px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.brand-tagline {
  color: var(--vs-red);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-ribbon-right {
  color: var(--vs-navy);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.03em;
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--slate-200);
  padding: 13px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}

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

.page-title {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  color: var(--vs-navy);
}

.page-subtitle {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--slate-500);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-root {
  padding: 20px 24px 40px;
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
}

.loading-box {
  padding: 60px;
  text-align: center;
  color: var(--slate-500);
}

/* ---------------- Buttons & Inputs ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--vs-navy);
  color: #fff;
}
.btn-primary:hover { background: var(--vs-navy-800); }

.btn-red {
  background: var(--vs-red);
  color: #fff;
}
.btn-red:hover { background: var(--vs-red-hover); }

.btn-teal {
  background: var(--vs-navy-700);
  color: #fff;
}
.btn-teal:hover { background: var(--vs-navy); }

.btn-danger {
  background: var(--vs-red);
  color: #fff;
}
.btn-danger:hover { background: var(--vs-red-hover); }

.btn-outline {
  background: var(--white);
  border-color: var(--slate-200);
  color: var(--vs-navy);
}
.btn-outline:hover { background: var(--vs-navy-50); border-color: var(--vs-navy); }

.btn-ghost {
  background: transparent;
  color: var(--slate-700);
  padding: 7px 10px;
}
.btn-ghost:hover { background: var(--slate-100); }

.btn-sm {
  padding: 5px 10px;
  font-size: 12.5px;
}

.btn-lg {
  padding: 13px 18px;
  font-size: 15px;
  border-radius: var(--radius);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--slate-200);
  background: var(--white);
  color: var(--vs-navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

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

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

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-field.full {
  grid-column: 1 / -1;
}

.form-field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--vs-navy);
}

.input, .select, .textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  background: var(--white);
  color: var(--slate-900);
  outline: none;
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--vs-navy);
  box-shadow: 0 0 0 3px rgba(0, 38, 100, 0.12);
}

/* ---------------- Cards & Grid ---------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-top: 3px solid var(--vs-navy);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi-card.accent-red {
  border-top-color: var(--vs-red);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--slate-500);
  font-size: 12.5px;
  font-weight: 600;
}

.kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--vs-navy);
  letter-spacing: -0.02em;
}

.kpi-sub {
  font-size: 12px;
  color: var(--slate-500);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
}

.grid-equal {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
}

.card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 18px;
}

.card-header {
  padding: 13px 18px;
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fcfcfd;
}

.card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--vs-navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 16px 18px;
}

/* ---------------- Badges & Container Pills ---------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-green { background: var(--green-50); color: #15803d; border: 1px solid #bbf7d0; }
.badge-teal { background: var(--teal-50); color: #0f766e; border: 1px solid #99f6e4; }
.badge-blue { background: var(--vs-navy-50); color: var(--vs-navy); border: 1px solid #bfd3f5; }
.badge-amber { background: var(--amber-50); color: #b45309; border: 1px solid #fde68a; }
.badge-red { background: var(--vs-red-50); color: var(--vs-red); border: 1px solid #fecaca; }
.badge-slate { background: var(--slate-100); color: var(--slate-700); border: 1px solid var(--slate-200); }

.cont-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}

.cont-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--vs-navy-50);
  color: var(--vs-navy);
  border: 1px solid #c7d9f7;
}
.cont-chip.reefer {
  background: #ecfeff;
  color: #0e7490;
  border-color: #a5f3fc;
}
.cont-chip.empty {
  background: var(--slate-100);
  color: var(--slate-500);
  border-color: var(--slate-200);
}

.load-bar {
  width: 90px;
  height: 7px;
  background: var(--slate-100);
  border-radius: 99px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}
.load-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--vs-navy);
}
.load-bar-fill.high { background: #15803d; }
.load-bar-fill.over { background: var(--vs-red); }

/* ---------------- Tables ---------------- */
.table-wrap {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.data-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--vs-navy);
  color: var(--white);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--vs-red);
  white-space: nowrap;
}

table.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--slate-200);
  vertical-align: middle;
}

table.data-table tbody tr:hover {
  background: var(--vs-navy-50);
}

.text-right { text-align: right; }
.text-muted { color: var(--slate-500); font-size: 12.5px; }
.font-bold { font-weight: 700; }

/* ---------------- Alerts List ---------------- */
.alert-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.1s;
}
.alert-item:hover { transform: translateX(2px); }

.alert-critical { background: var(--vs-red-50); border-color: #fecaca; color: #991b1b; border-left: 4px solid var(--vs-red); }
.alert-warning { background: var(--amber-50); border-color: #fde68a; color: #92400e; border-left: 4px solid var(--amber-600); }
.alert-info { background: var(--vs-navy-50); border-color: #bfd3f5; color: var(--vs-navy); border-left: 4px solid var(--vs-navy); }

.alert-title { font-weight: 700; font-size: 13px; }
.alert-msg { font-size: 12px; opacity: 0.92; margin-top: 2px; }

/* ---------------- Interactive Waterway SVG Map ---------------- */
.river-map-box {
  position: relative;
  background: linear-gradient(180deg, #e8f1fb 0%, #dce9fa 50%, #edf4fc 100%);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid #bfd3f5;
}

.river-map-svg {
  width: 100%;
  height: 360px;
  display: block;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid #bfd3f5;
  font-size: 12px;
  color: var(--slate-700);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
}

/* ---------------- Dispatch Board ---------------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.segmented {
  display: inline-flex;
  background: var(--slate-200);
  padding: 3px;
  border-radius: var(--radius-sm);
}

.segmented button {
  padding: 6px 14px;
  border: none;
  background: transparent;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-700);
  cursor: pointer;
}

.segmented button.active {
  background: var(--vs-navy);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.gantt-wrap {
  overflow-x: auto;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
}

.gantt-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

.gantt-table th {
  padding: 9px 8px;
  font-size: 11.5px;
  background: var(--vs-navy);
  color: #dbe7fa;
  border-bottom: 2px solid var(--vs-red);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.gantt-table th.today-col {
  background: var(--vs-red);
  color: #fff;
  font-weight: 800;
}

.gantt-table td {
  border-bottom: 1px solid var(--slate-200);
  border-right: 1px solid var(--slate-100);
  height: 62px;
  position: relative;
  padding: 0;
}

.gantt-barge-cell {
  width: 230px;
  padding: 8px 12px !important;
  background: #fafbfd;
  border-right: 2px solid var(--slate-200) !important;
}

.gantt-track {
  position: relative;
  height: 62px;
}

.gantt-bar {
  position: absolute;
  top: 10px;
  height: 42px;
  border-radius: 7px;
  padding: 4px 10px;
  color: #fff;
  font-size: 11.5px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 38, 100, 0.22);
  transition: transform 0.12s, filter 0.12s;
  z-index: 2;
}
.gantt-bar:hover { transform: translateY(-1px); filter: brightness(1.08); z-index: 5; }
.gantt-bar-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-bar-sub { font-size: 10.5px; opacity: 0.92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.kanban-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(250px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.kanban-col {
  background: #edf0f5;
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 340px;
}

.kanban-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 13px;
  color: var(--vs-navy);
  padding: 2px 4px;
}

.trip-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-left: 3px solid var(--vs-navy);
  border-radius: var(--radius-sm);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.trip-card:hover {
  border-left-color: var(--vs-red);
  box-shadow: var(--shadow);
}

/* ---------------- Modals & Stepper ---------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 24, 66, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 60;
}

.modal-backdrop.hidden { display: none; }

.modal-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border-top: 4px solid var(--vs-red);
}

.modal-head {
  padding: 15px 20px;
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--vs-navy);
  color: var(--white);
}

.modal-head h2 {
  margin: 0;
  font-size: 16.5px;
  color: var(--white);
}

.modal-head .text-muted { color: #cbd9f2; }
.modal-head .btn-ghost { color: #ffffff; }
.modal-head .btn-ghost:hover { background: rgba(255, 255, 255, 0.15); }
.modal-head .btn-outline { background: rgba(255, 255, 255, 0.12); color: #fff; border-color: rgba(255, 255, 255, 0.3); }
.modal-head .btn-outline:hover { background: #fff; color: var(--vs-navy); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-foot {
  padding: 13px 20px;
  border-top: 1px solid var(--slate-200);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #fafafa;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding: 6px 0 14px;
}

.step-pill {
  padding: 5px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--slate-100);
  color: var(--slate-500);
  white-space: nowrap;
}
.step-pill.done { background: var(--vs-navy-50); color: var(--vs-navy); border: 1px solid #bfd3f5; }
.step-pill.current { background: var(--vs-navy); color: #fff; }
.step-pill.incident { background: var(--vs-red); color: #fff; }

.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-left: 2px solid #cbd9f2;
  margin-left: 8px;
  padding-left: 16px;
}

.timeline-item {
  position: relative;
}

.timeline-dot {
  position: absolute;
  left: -23px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--vs-navy);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #cbd9f2;
}

.thumb-img {
  width: 110px;
  height: 82px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--slate-200);
  cursor: zoom-in;
  margin-top: 6px;
}

/* ---------------- Captain Mobile PWA ---------------- */
.captain-shell {
  max-width: 460px;
  margin: 0 auto;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.captain-header {
  background: linear-gradient(135deg, var(--vs-navy), var(--vs-navy-700));
  color: #fff;
  padding: 18px 18px 16px;
  border-bottom: 3px solid var(--vs-red);
}

.captain-body {
  padding: 16px;
  background: var(--slate-50);
  min-height: 520px;
}

.captain-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--white);
  border-bottom: 1px solid var(--slate-200);
}

.captain-tab {
  padding: 12px 6px;
  border: none;
  background: transparent;
  font-weight: 700;
  font-size: 13px;
  color: var(--slate-500);
  cursor: pointer;
  border-bottom: 3px solid transparent;
}

.captain-tab.active {
  color: var(--vs-navy);
  border-bottom-color: var(--vs-red);
  background: var(--vs-navy-50);
}

.big-action-btn {
  width: 100%;
  padding: 16px 18px;
  border-radius: 12px;
  border: none;
  font-size: 15.5px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--vs-navy), var(--vs-navy-700));
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 38, 100, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.big-action-btn:hover { filter: brightness(1.08); }

.route-banner {
  background: var(--vs-navy);
  color: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  border-left: 4px solid var(--vs-red);
}

/* ---------------- Lightbox & Toast ---------------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.lightbox.hidden { display: none; }
.lightbox img { max-width: 92vw; max-height: 90vh; border-radius: 8px; }
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 22px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 36px;
  cursor: pointer;
}

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 90;
}

.toast {
  background: var(--vs-navy);
  color: #fff;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid #60a5fa;
}
.toast.error { border-left-color: #fff; background: var(--vs-red); }
.toast.success { border-left-color: #34d399; }

/* ---------------- Booking Order & Split-Screen Dispatch Board ---------------- */
.modal-box.wide {
  max-width: 1120px;
}

.split-form-grid {
  display: grid;
  grid-template-columns: 1.5fr 0.9fr;
  gap: 18px;
  align-items: start;
}

.sym-matrix-wrap {
  background: #f8fafc;
  border: 1px solid #cbd9f2;
  border-radius: 10px;
  padding: 12px;
  overflow-x: auto;
}

table.sym-matrix {
  width: 100%;
  border-collapse: separate;
  border-spacing: 6px 6px;
  table-layout: fixed;
}

table.sym-matrix th {
  font-size: 12px;
  font-weight: 800;
  color: var(--vs-navy);
  text-align: center;
  padding: 6px 4px;
  background: #edf3fc;
  border-radius: 6px;
}
table.sym-matrix th.sym-label-col {
  width: 142px;
  text-align: left;
  padding-left: 6px;
  background: transparent;
  color: var(--slate-600);
  font-weight: 700;
}
table.sym-matrix th small {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--slate-500);
}

table.sym-matrix td.sym-row-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--slate-700);
  padding: 4px 5px;
  white-space: nowrap;
}

table.sym-matrix td input.input {
  width: 100%;
  padding: 6px 6px;
  font-size: 12px;
  text-align: right;
  background: #fff;
  -moz-appearance: textfield;
}
table.sym-matrix td input.input::-webkit-outer-spin-button,
table.sym-matrix td input.input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

table.sym-matrix tr.sym-sub-row td {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--vs-navy);
  text-align: right;
  padding: 6px 6px;
  background: #fff;
  border-top: 1px solid #cbd9f2;
  border-radius: 6px;
  white-space: nowrap;
}
table.sym-matrix tr.sym-sub-row td.sym-row-label {
  text-align: left;
  background: transparent;
  border-top: none;
}

.port-code-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 800;
  color: var(--vs-navy);
  letter-spacing: 0.01em;
}

.split-panel {
  background: #f8fafc;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 14px;
}

.split-panel-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--vs-navy);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--vs-navy);
  color: #fff;
  padding: 11px 16px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  border-left: 4px solid var(--vs-red);
  box-shadow: var(--shadow);
}

.dispatch-split {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 16px;
  align-items: start;
}

.dispatch-queue-col {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  overflow: hidden;
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 150px);
  display: flex;
  flex-direction: column;
}

.dispatch-queue-list {
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.bk-queue-card {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-left: 3.5px solid var(--vs-navy);
  border-radius: var(--radius-sm);
  padding: 10px 11px;
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s, box-shadow 0.14s;
}
.bk-queue-card:hover {
  background: var(--vs-navy-50);
  border-color: #93b4e8;
}
.bk-queue-card.selected {
  background: #edf3fc;
  border-color: var(--vs-navy);
  border-left-color: var(--vs-red);
  box-shadow: 0 2px 8px rgba(0, 38, 100, 0.12);
}

.voyage-dispatch-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.voyage-dispatch-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.voyage-dispatch-head {
  padding: 12px 16px;
  background: linear-gradient(90deg, #f4f7fc, #ffffff);
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.meter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 11px 16px;
  background: #fafbfd;
  border-bottom: 1px solid var(--slate-200);
}

.meter-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meter-top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-700);
}

.meter-track {
  height: 8px;
  background: var(--slate-200);
  border-radius: 99px;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  background: var(--vs-navy);
  border-radius: 99px;
  transition: width 0.2s;
}
.meter-fill.warn { background: var(--amber-600); }
.meter-fill.good { background: #15803d; }
.meter-fill.over { background: var(--vs-red); }

.assigned-bk-list {
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.assigned-bk-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 11px;
  background: #f8fafc;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
}

.guard-box {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  margin-top: 8px;
}
.guard-box.error { background: var(--vs-red-50); border: 1px solid #fecaca; color: #991b1b; }
.guard-box.warn { background: var(--amber-50); border: 1px solid #fde68a; color: #92400e; }
.guard-box.ok { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }

.price-box {
  background: #fff;
  border: 1px solid #bfd3f5;
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-top: 10px;
}

.price-line {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 3px 0;
}

.price-total {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 800;
  color: var(--vs-navy);
  border-top: 1px dashed #bfd3f5;
  margin-top: 6px;
  padding-top: 7px;
}

/* ---------------- Per-Barge Color Coding & Clean Airy UI ---------------- */
.barge-color-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}

.barge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.barge-legend-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.barge-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--white);
  border: 1px solid var(--slate-200);
  color: var(--slate-700);
  cursor: pointer;
  transition: all 0.14s;
}
.barge-filter-pill:hover {
  border-color: var(--slate-400);
}
.barge-filter-pill.active {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  font-weight: 700;
}

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

.stat-tile {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.stat-tile.urgent {
  background: #fff5f5;
  border-color: #fecaca;
}
.stat-tile-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.stat-tile-val {
  font-size: 20px;
  font-weight: 800;
  color: var(--vs-navy);
  margin-top: 2px;
}
.stat-tile-sub {
  font-size: 12px;
  color: var(--slate-500);
  margin-top: 2px;
}

/* Clean 2-column Barge Grid on Right of Dispatch Board */
.barge-board-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.barge-vessel-card {
  background: var(--white);
  border: 1.5px solid var(--slate-200);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}
.barge-vessel-card.drag-over {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 38, 100, 0.16);
}

.barge-vessel-head {
  padding: 13px 16px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.barge-voy-box {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.barge-empty-drop {
  border: 1.5px dashed var(--slate-300);
  border-radius: 10px;
  padding: 18px 14px;
  text-align: center;
  background: rgba(255, 255, 255, 0.7);
}

.cap-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.cap-dot {
  width: 14px;
  height: 5px;
  border-radius: 99px;
  background: var(--slate-200);
}
.cap-dot.done {
  background: #15803d;
}
.cap-dot.now {
  background: var(--vs-navy);
}

.clean-bk-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12.5px;
}

.cutoff-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.cutoff-tag.urgent {
  background: #fee2e2;
  color: #b91c1c;
}
.cutoff-tag.soon {
  background: #fef3c7;
  color: #92400e;
}
.cutoff-tag.ok {
  background: #f1f5f9;
  color: #475569;
}

/* Soft clean table override for Booking list */
table.clean-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.clean-table th {
  text-align: left;
  padding: 11px 14px;
  background: #f8fafc;
  color: var(--slate-600);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--slate-200);
  white-space: nowrap;
}
table.clean-table td {
  padding: 13px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
table.clean-table tbody tr:hover {
  background: #f8fafc;
}

details.clean-collapse {
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  background: #fff;
  padding: 9px 12px;
}
details.clean-collapse summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--vs-navy);
  user-select: none;
}

.dir-switch-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.dir-switch-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 2px solid var(--slate-200);
  background: var(--white);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.dir-switch-btn:hover {
  border-color: var(--slate-400);
}
.dir-switch-btn.active-w {
  border-color: #1d4ed8;
  background: linear-gradient(135deg, #eff6ff, #ffffff);
  box-shadow: 0 3px 10px rgba(29, 78, 216, 0.12);
}
.dir-switch-btn.active-e {
  border-color: #0f766e;
  background: linear-gradient(135deg, #f0fdfa, #ffffff);
  box-shadow: 0 3px 10px rgba(15, 118, 110, 0.12);
}

.plan-lock-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
}
.plan-lock-badge.locked {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}
.plan-lock-badge.editable {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.cross-dir-banner {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 11.5px;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ---------------- Responsive & Print ---------------- */
.mobile-only { display: none; }
.print-only { display: none; }

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

@media (max-width: 1080px) {
  .kpi-grid, .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-equal, .dispatch-split, .split-form-grid { grid-template-columns: 1fr; }
  .dispatch-queue-col { position: static; max-height: none; }
  .brand-ribbon-right { display: none; }
}

@media (max-width: 820px) {
  .mobile-only { display: inline-flex; }
  .sidebar {
    position: fixed;
    left: -275px;
    transition: left 0.2s ease;
  }
  .sidebar.open { left: 0; }
  .topbar { padding: 12px 14px; }
  .brand-ribbon { padding: 5px 14px; }
  .view-root { padding: 14px; }
  .form-grid, .form-grid-4 { grid-template-columns: 1fr 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}

@media print {
  .app-shell, .modal-backdrop, .lightbox, .toast-container { display: none !important; }
  .print-only {
    display: block !important;
    padding: 24px;
    color: #000;
    font-family: "Times New Roman", Times, serif;
    font-size: 13.5pt;
  }
  .print-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 2px solid #002664;
    padding-bottom: 10px;
    margin-bottom: 16px;
  }
  .print-title {
    text-align: center;
    font-size: 17pt;
    font-weight: bold;
    color: #002664;
    margin: 14px 0 4px;
  }
  .print-table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
  }
  .print-table td, .print-table th {
    border: 1px solid #333;
    padding: 7px 10px;
  }
  .print-signs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    text-align: center;
    margin-top: 34px;
  }
}
