:root {
  --sidebar-width: 260px;
  --sidebar-bg: #1e2a3a;
  --sidebar-hover: #2d3f55;
  --sidebar-active: #0d6efd;
  --topbar-height: 60px;
  --topbar-bg: #ffffff;
}

/* ── Layout ── */
body {
  background-color: #f0f2f5;
  font-family: "Segoe UI", system-ui, sans-serif;
}

#wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
#sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background-color: var(--sidebar-bg);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

#sidebar .sidebar-brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

#sidebar .sidebar-brand span {
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

#sidebar .sidebar-brand i {
  color: #0d6efd;
  font-size: 1.4rem;
  margin-right: 0.6rem;
}

#sidebar .nav-section-title {
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 1.25rem 1.25rem 0.4rem;
}

#sidebar .nav-link {
  color: rgba(255, 255, 255, 0.72);
  padding: 0.65rem 1.25rem;
  border-radius: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  transition: background 0.2s, color 0.2s;
}

#sidebar .nav-link i {
  width: 20px;
  text-align: center;
  font-size: 1rem;
}

#sidebar .nav-link:hover {
  background-color: var(--sidebar-hover);
  color: #ffffff;
}

#sidebar .nav-link.active {
  background-color: var(--sidebar-active);
  color: #ffffff;
  font-weight: 600;
}

#sidebar .nav-link .badge {
  margin-left: auto;
}

#sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.75rem 1.25rem;
}

/* ── Main Content ── */
#main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

/* ── Topbar ── */
#topbar {
  height: var(--topbar-height);
  background-color: var(--topbar-bg);
  border-bottom: 1px solid #e3e6f0;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 99;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

#topbar .topbar-divider {
  width: 0;
  border-right: 1px solid #e3e6f0;
  height: 2rem;
  margin: 0 1rem;
}

/* ── Stat Cards ── */
.stat-card {
  border: none;
  border-radius: 0.75rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s, box-shadow 0.2s;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.stat-card .stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-card .stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Content Card ── */
.content-card {
  background: #ffffff;
  border-radius: 0.75rem;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.content-card .card-header {
  background: transparent;
  border-bottom: 1px solid #e9ecef;
  padding: 1rem 1.25rem;
}

/* ── Table ── */
.table-hover tbody tr:hover {
  background-color: rgba(13, 110, 253, 0.04);
}

/* ── Sidebar collapsed ── */
#sidebar.collapsed {
  width: 70px;
}

#sidebar.collapsed .sidebar-brand span,
#sidebar.collapsed .nav-section-title,
#sidebar.collapsed .nav-link span,
#sidebar.collapsed .nav-link .badge,
#sidebar.collapsed #sidebar-user-name {
  display: none;
}

#sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 0.75rem;
}

#sidebar.collapsed .nav-link i {
  margin: 0;
}

#main-content.expanded {
  margin-left: 70px;
}

/* ── Toast ── */
.toast-container {
  z-index: 9999;
}

/* ── Loading spinner overlay ── */
#loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.55);
  z-index: 9998;
  align-items: center;
  justify-content: center;
}

#loading-overlay.show {
  display: flex;
}

/* ── Nav Tabs (vessel update page) ── */
.nav-tabs .nav-link {
  color: #6c757d;
  border-bottom: 2px solid transparent;
}

.nav-tabs .nav-link:hover {
  color: #0d6efd;
  border-color: transparent;
  background: transparent;
}

.nav-tabs .nav-link.active {
  color: #0d6efd;
  font-weight: 600;
  border-bottom-color: #0d6efd;
}

/* ── File upload drag area ── */
.file-upload-area {
  transition: background 0.2s, border-color 0.2s;
}

.file-upload-area:hover {
  background: rgba(13, 110, 253, 0.04);
  border-color: #0d6efd !important;
  color: #0d6efd;
}

/* ── Accordion (hazardous materials) ── */
.accordion-button:not(.collapsed) {
  background-color: rgba(13, 110, 253, 0.06);
  color: #0d6efd;
  box-shadow: none;
}

.accordion-button:focus {
  box-shadow: none;
}

.accordion-item {
  border-radius: 0.5rem !important;
  overflow: hidden;
}

/* ── Vessel header card ── */
.vessel-avatar {
  flex-shrink: 0;
}

/* ── Monospace small for log time ── */
.font-monospace {
  font-family: "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  font-size: 0.82em;
}

/* ── Smaller badge utility ── */
.smaller {
  font-size: 0.7rem;
}

/* ── Dropdown action menus ── */
.dropdown-menu.shadow-sm {
  min-width: 140px;
}

/* Allow dropdown menus to escape the table-responsive overflow boundary */
.table-responsive:has(.dropdown-menu.show) {
  overflow: visible;
}

/* ── Tab content card (remove top border/radius to connect with tabs) ── */
.tab-content > .tab-pane > .content-card {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-top: none;
}

