/* Local / system typography — no external font CDN (CSP-safe) */

/* Custom Color Variables */
:root {
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --success: #10b981;
  --success-dark: #059669;
  --danger: #ef4444;
  --danger-dark: #dc2626;
  --warning: #f59e0b;
  --warning-dark: #d97706;
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.5;
  color: #111827;
  background-color: #f3f4f6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

html.dark {
  color-scheme: dark;
}

html.dark body {
  color: #f9fafb;
  background-color: #0f172a;
}

.dark {
  color: #f9fafb;
  background-color: #0f172a;
}

/* Utility Classes */
.min-h-screen { min-height: 100vh; }
.h-screen { height: 100vh; }
.h-2 { height: 0.5rem; }
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-6 { height: 1.5rem; }
.h-16 { height: 4rem; }
.h-20 { height: 5rem; }
.h-24 { height: 6rem; }
.w-full { width: 100%; }
.w-2 { width: 0.5rem; }
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-6 { width: 1.5rem; }
.w-8 { width: 2rem; }
.h-8 { height: 2rem; }
.w-10 { width: 2.5rem; }
.h-10 { height: 2.5rem; }
.w-12 { width: 3rem; }
.h-12 { height: 3rem; }
/* Bounded icons — prevent SVG default huge intrinsic size */
.mm-icon,
svg.h-4, svg.w-4,
svg.h-5, svg.w-5,
svg.h-6, svg.w-6 {
  width: 1.25rem;
  height: 1.25rem;
  max-width: 1.25rem;
  max-height: 1.25rem;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}
svg.h-4, svg.w-4 { width: 1rem; height: 1rem; max-width: 1rem; max-height: 1rem; }
svg.h-6, svg.w-6 { width: 1.5rem; height: 1.5rem; max-width: 1.5rem; max-height: 1.5rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1 1 0%; }
.space-x-1\.5 > * + * { margin-left: 0.375rem; }
.space-x-2 > * + * { margin-left: 0.5rem; }
.space-x-3 > * + * { margin-left: 0.75rem; }
.space-x-4 > * + * { margin-left: 1rem; }
.space-x-8 > * + * { margin-left: 2rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* Grid */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:col-span-2 { grid-column: span 2 / span 2; }
}

@media (min-width: 1280px) {
  .xl\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* Typography */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.uppercase { text-transform: uppercase; }
.whitespace-nowrap { white-space: nowrap; }
.whitespace-pre-wrap { white-space: pre-wrap; }

/* Colors - Text */
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-900 { color: #111827; }
.text-white { color: #ffffff; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-red-600 { color: #dc2626; }
.text-red-700 { color: #b91c1c; }
.text-red-800 { color: #991b1b; }
.text-orange-600 { color: #ea580c; }
.text-orange-800 { color: #9a3412; }
.text-blue-800 { color: #1e40af; }
.text-purple-800 { color: #6b21a8; }

.dark .text-gray-300 { color: #e5e7eb; }
.dark .text-gray-400 { color: #d1d5db; }
.dark .text-gray-500 { color: #d1d5db; }
.dark .text-gray-600 { color: #e5e7eb; }
.dark .text-gray-700 { color: #f3f4f6; }
.dark .text-gray-900 { color: #ffffff; }
.dark .text-white { color: #ffffff; }
.dark .text-primary { color: #60a5fa; }
.dark .text-success { color: #34d399; }
.dark .text-danger { color: #f87171; }
.dark .text-warning { color: #fbbf24; }
.dark .text-red-600 { color: #f87171; }
.dark .text-red-700 { color: #fca5a5; }
.dark .text-red-800 { color: #fca5a5; }
.dark .text-orange-600 { color: #fbbf24; }
.dark .text-orange-800 { color: #fde68a; }
.dark .text-blue-800 { color: #93c5fd; }
.dark .text-purple-800 { color: #c4b5fd; }
.dark .text-red-400 { color: #f87171; }
.dark .text-red-300 { color: #fca5a5; }
.dark .text-orange-200 { color: #fde68a; }
.dark .text-orange-400 { color: #fbbf24; }

/* Colors - Background */
.bg-white { 
  background-color: #ffffff; 
  transition: background-color 0.2s;
}
.bg-gray-50 { background-color: #f9fafb; }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-gray-200 { background-color: #e5e7eb; }
.bg-gray-500 { background-color: #6b7280; }
.bg-gray-600 { background-color: #4b5563; }
.bg-gray-700 { 
  background-color: #374151;
  transition: background-color 0.2s;
}
.bg-gray-800 { 
  background-color: #1f2937;
  transition: background-color 0.2s;
}
.bg-gray-900 { 
  background-color: #111827;
  transition: background-color 0.2s;
}

.dark .bg-white {
  background-color: #1f2937;
  color: #ffffff;
}

.dark .bg-white * {
  color: #ffffff;
}

/* Ensure hover states on links inside bg-white containers work correctly */
.dark .bg-white a:hover,
html.dark .bg-white a:hover,
html.dark .bg-white.dark\:bg-gray-800 a:hover {
  background-color: inherit;
}

.dark .bg-gray-50 {
  background-color: #0f172a;
}

.dark .bg-gray-100 {
  background-color: #1e293b;
}
.bg-primary { background-color: var(--primary); }
.bg-primary-dark { background-color: var(--primary-dark); }
.bg-success { background-color: var(--success); }
.bg-success-dark { background-color: var(--success-dark); }
.bg-danger { background-color: var(--danger); }
.bg-danger-dark { background-color: var(--danger-dark); }
.bg-warning { background-color: var(--warning); }
.bg-warning-dark { background-color: var(--warning-dark); }
.bg-blue-100 { background-color: #dbeafe; }
.bg-blue-500 { background-color: #3b82f6; }
.bg-purple-100 { background-color: #f3e8ff; }
.bg-red-50 { background-color: #fef2f2; }
.bg-red-100 { background-color: #fee2e2; }
.bg-orange-50 { background-color: #fff7ed; }
.bg-orange-100 { background-color: #ffedd5; }
.bg-green-50 { background-color: #f0fdf4; }

.dark .bg-gray-700 { 
  background-color: #374151;
  color: #ffffff;
}
.dark .bg-gray-700 * {
  color: #ffffff;
}

.dark .bg-gray-800 { 
  background-color: #1f2937;
  color: #ffffff;
}
.dark .bg-gray-800 * {
  color: #ffffff;
}

.dark .bg-gray-900 { 
  background-color: #111827;
  color: #ffffff;
}
.dark .bg-gray-900 * {
  color: #ffffff;
}
.dark .bg-blue-900 { background-color: #1e3a8a; }
.dark .bg-blue-200 { background-color: #bfdbfe; }
.dark .bg-blue-100 { 
  background-color: #1e3a8a;
}
.dark .bg-blue-100.text-blue-800 {
  color: #bfdbfe;
}
.dark .bg-purple-900 { background-color: #581c87; }
.dark .bg-purple-200 { background-color: #e9d5ff; }
.dark .bg-purple-100 { 
  background-color: #581c87;
}
.dark .bg-purple-100.text-purple-800 {
  color: #e9d5ff;
}
.dark .bg-red-900 { background-color: #7f1d1d; }
.dark .bg-red-800 { background-color: #991b1b; }
.dark .bg-orange-900 { background-color: #7c2d12; }
.dark .bg-orange-900\/20 { background-color: rgba(124, 45, 18, 0.4); }
.dark .bg-orange-800 { background-color: #9a3412; }
.dark .bg-orange-200 { background-color: #fed7aa; }
.dark .bg-orange-100 { background-color: #7c2d12; }
.dark .bg-orange-50 { background-color: rgba(124, 45, 18, 0.4); }

/* Opacity */
.bg-danger\/10 { background-color: rgba(239, 68, 68, 0.1); }
.bg-orange-900\/20 { background-color: rgba(124, 45, 18, 0.2); }
.bg-red-900\/20 { background-color: rgba(127, 29, 29, 0.2); }

/* Spacing */
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-1\.5 { padding-left: 0.375rem; padding-right: 0.375rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-0\.5 { margin-top: 0.125rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.ml-2 { margin-left: 0.5rem; }
.mr-4 { margin-right: 1rem; }

/* Borders */
.border { border-width: 1px; }
.border-2 { border-width: 2px; }
.border-b { border-bottom-width: 1px; }
.border-t { border-top-width: 1px; }
.border-gray-200 { border-color: #e5e7eb; }
.border-gray-300 { border-color: #d1d5db; }
.border-gray-600 { border-color: #4b5563; }
.border-gray-700 { 
  border-color: #374151;
  transition: border-color 0.2s;
}
.border-red-200 { border-color: #fecaca; }
.border-red-800 { border-color: #991b1b; }
.border-orange-200 { border-color: #fed7aa; }
.border-orange-800 { border-color: #9a3412; }
.border-primary { border-color: var(--primary); }
.border-danger { border-color: var(--danger); }
.border-dashed { border-style: dashed; }
.rounded { border-radius: 0.25rem; }
.rounded-lg { 
  border-radius: 0.5rem;
  transition: border-radius 0.2s;
}
.rounded-full { border-radius: 9999px; }
.rounded-md { border-radius: 0.375rem; }

.dark .border-gray-200 {
  border-color: #374151;
}

.dark .border-gray-300 {
  border-color: #4b5563;
}

.dark .border-gray-700 {
  border-color: #4b5563;
}

/* Shadows */
.shadow { box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); }
.shadow-sm { box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); }
.shadow-lg { 
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  transition: box-shadow 0.2s;
}
.shadow-xl { box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1); }

.dark .shadow {
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3), 0 1px 2px -1px rgb(0 0 0 / 0.3);
}

.dark .shadow-lg {
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
}

.dark .shadow-xl {
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.5);
}

/* Display */
.block { display: block; }
.inline-block { display: inline-block; }
.inline-flex { display: inline-flex; }
.hidden { display: none; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.inset-y-0 { top: 0; bottom: 0; }
.pl-3 { padding-left: 0.75rem; }
.pointer-events-none { pointer-events: none; }
.fixed { position: fixed; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.top-0 { top: 0; }
.left-0 { left: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

/* Cursor */
.cursor-pointer { cursor: pointer; }

/* Z-index */
.z-50 { z-index: 50; }

/* Transitions */
.transition-colors { transition-property: color, background-color, border-color; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.transition-shadow { transition-property: box-shadow; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }

/* Hover States */
.hover\:bg-gray-50:hover { background-color: #f9fafb; }
.hover\:bg-gray-600:hover { background-color: #4b5563; }
.hover\:bg-gray-700:hover { background-color: #374151; }
.hover\:bg-primary-dark:hover { background-color: var(--primary-dark); }
.hover\:bg-success-dark:hover { background-color: var(--success-dark); }
.hover\:bg-danger-dark:hover { background-color: var(--danger-dark); }
.hover\:text-gray-300:hover { color: #d1d5db; }
.hover\:text-gray-700:hover { color: #374151; }
.hover\:text-primary-dark:hover { color: var(--primary-dark); }
.hover\:text-red-700:hover { color: #b91c1c; }
.hover\:underline:hover { text-decoration: underline; }
.hover\:shadow-lg:hover { box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); }

.dark .hover\:bg-gray-600:hover { background-color: #4b5563 !important; }
.dark .hover\:bg-gray-700:hover { background-color: #374151; }
.dark .hover\:text-gray-300:hover { color: #d1d5db; }
.dark .hover\:text-red-300:hover { color: #fca5a5; }

/* Specific rule for project links in dark mode to ensure hover works */
html.dark a.block.hover\:bg-gray-50.dark\:hover\:bg-gray-600:hover,
html.dark .dark\:hover\:bg-gray-600:hover,
html.dark a.block.rounded-lg.dark\:hover\:bg-gray-600:hover {
  background-color: #4b5563 !important;
}

/* Override any white background rules for hovered project links inside bg-white containers */
html.dark .bg-white a.block.rounded-lg:hover,
html.dark .bg-white.dark\:bg-gray-800 a.block.rounded-lg:hover,
html.dark .dark\:bg-gray-800 a.block.rounded-lg:hover,
html.dark .bg-white a.block.border.rounded-lg:hover,
html.dark .bg-white.dark\:bg-gray-800 a.block.border.rounded-lg:hover,
html.dark .dark\:bg-gray-800 a.block.border.rounded-lg:hover,
html.dark .bg-white a[class*="hover:bg-gray-50"]:hover,
html.dark .bg-white.dark\:bg-gray-800 a[class*="hover:bg-gray-50"]:hover,
html.dark .bg-white a[class*="dark:hover:bg-gray-600"]:hover,
html.dark .bg-white.dark\:bg-gray-800 a[class*="dark:hover:bg-gray-600"]:hover {
  background-color: #4b5563 !important;
}

/* Very specific rule for project history links */
html.dark .bg-white.dark\:bg-gray-800 a.block.p-4.border.rounded-lg:hover,
html.dark .bg-white.dark\:bg-gray-800.rounded-lg.shadow a.block.p-4.border.rounded-lg:hover,
html.dark .bg-white.dark\:bg-gray-800.rounded-lg.shadow.p-6 a.block.p-4.border.rounded-lg:hover {
  background-color: #4b5563 !important;
}

/* Even more specific - target any link with dark:hover:bg-gray-600 inside bg-white containers */
html.dark .bg-white a[class*="dark:hover:bg-gray-600"]:hover,
html.dark .bg-white.dark\:bg-gray-800 a[class*="dark:hover:bg-gray-600"]:hover {
  background-color: #4b5563 !important;
}

/* Universal rule for any link inside bg-white/dark:bg-gray-800 containers on hover in dark mode */
html.dark .bg-white.dark\:bg-gray-800 a:hover,
html.dark .dark\:bg-gray-800 a:hover {
  background-color: #4b5563 !important;
}

/* Focus States */
.focus\:border-primary:focus { border-color: var(--primary); }
.focus\:border-transparent:focus { border-color: transparent; }
.focus\:ring-2:focus { box-shadow: 0 0 0 2px var(--primary); }
.focus\:ring-primary:focus { box-shadow: 0 0 0 2px var(--primary); }

/* Input Styles */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 0.5rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.dark input,
.dark select,
.dark textarea {
  background-color: #374151;
  border-color: #4b5563;
  color: #ffffff;
}

.dark input:focus,
.dark select:focus,
.dark textarea:focus {
  border-color: var(--primary);
}

/* Button Styles */
button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

button:disabled,
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Links */
a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease-in-out;
}

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 0.75rem 1.5rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

th {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  background-color: #f9fafb;
}

.dark th {
  background-color: #374151;
  color: #d1d5db;
}

.dark td {
  border-color: #374151;
  color: #ffffff;
}

tbody tr:hover {
  background-color: #f9fafb;
}

.dark tbody tr:hover {
  background-color: #374151;
}

.dark tbody tr:hover td {
  color: #ffffff;
}

/* Responsive */
@media (min-width: 640px) {
  .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
}

@media (min-width: 1024px) {
  .lg\:px-8 { padding-left: 2rem; padding-right: 2rem; }
}

/* Max Width */
.max-w-md { max-width: 28rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-7xl { max-width: 80rem; }

/* Container */
.mx-auto { margin-left: auto; margin-right: auto; }

/* Aspect Ratio */
.aspect-video { aspect-ratio: 16 / 9; }

/* Object Fit */
.object-cover { object-fit: cover; }
.object-contain { object-fit: contain; }
.max-w-full { max-width: 100%; }
.max-h-48 { max-height: 12rem; }

/* Vessel pictures must always stay inside their container */
.vessel-picture-preview,
.vessel-picture-sidebar {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.vessel-picture-img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 12rem;
  object-fit: contain;
  border-radius: 0.5rem;
}

.vessel-picture-sidebar .vessel-picture-img {
  max-height: 16rem;
}

/* Tracking */
.tracking-wider { letter-spacing: 0.05em; }

/* Gradient */
.bg-gradient-to-br {
  background-image: linear-gradient(to bottom right, var(--tw-gradient-stops));
}

.from-blue-50 {
  --tw-gradient-from: #eff6ff;
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(239, 246, 255, 0));
}

.to-blue-100 {
  --tw-gradient-to: #dbeafe;
}

.dark .from-gray-900 {
  --tw-gradient-from: #111827;
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(17, 24, 39, 0));
}

.dark .to-gray-800 {
  --tw-gradient-to: #1f2937;
}

/* Badge/Pill Styles */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 0.25rem;
}

/* Card/Box Styles - Professional Look */
.bg-white.rounded-lg.shadow,
.bg-white.dark\:bg-gray-800.rounded-lg.shadow,
.rounded-lg.shadow {
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  transition: all 0.3s ease;
}

html.dark .bg-white.rounded-lg.shadow,
html.dark .bg-white.dark\:bg-gray-800.rounded-lg.shadow,
html.dark .bg-gray-800.rounded-lg.shadow,
html.dark .rounded-lg.shadow {
  background-color: #1f2937;
  border: 1px solid #374151;
  color: #ffffff;
}

html.dark .bg-white.rounded-lg.shadow *,
html.dark .bg-white.dark\:bg-gray-800.rounded-lg.shadow *,
html.dark .bg-gray-800.rounded-lg.shadow *,
html.dark .rounded-lg.shadow * {
  color: #ffffff;
}

.bg-white.rounded-lg.shadow:hover,
.bg-white.dark\:bg-gray-800.rounded-lg.shadow:hover,
.rounded-lg.shadow:hover {
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  transform: translateY(-1px);
}

html.dark .bg-white.rounded-lg.shadow:hover,
html.dark .bg-gray-800.rounded-lg.shadow:hover,
html.dark .rounded-lg.shadow:hover {
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
  border-color: #4b5563;
  transform: translateY(-1px);
}

/* Status Colors */
.bg-success.text-white { background-color: var(--success); color: #ffffff; }
/* Amber + white fails contrast — use near-black text on solid amber */
.bg-warning.text-white { background-color: #fbbf24; color: #1c1917 !important; font-weight: 700; }
.bg-danger.text-white { background-color: var(--danger); color: #ffffff; }
.bg-gray-500.text-white { background-color: #6b7280; color: #ffffff; }
.bg-gray-600.text-white { background-color: #4b5563; color: #ffffff; }
.bg-blue-500.text-white { background-color: #3b82f6; color: #ffffff; }

/* Enhanced Navigation */
nav.bg-white.dark\:bg-gray-800 {
  background-color: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

html.dark nav.bg-white.dark\:bg-gray-800 {
  background-color: #1f2937;
  border-bottom: 1px solid #374151;
  color: #ffffff;
}

html.dark nav.bg-white.dark\:bg-gray-800 * {
  color: #ffffff;
}

/* Better spacing for cards */
.p-6 {
  padding: 1.5rem;
}

/* Smooth transitions */
* {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* Make all text white in boxes/cards in dark mode */
html.dark .bg-white,
html.dark .bg-gray-50,
html.dark .bg-gray-100,
html.dark .bg-gray-200,
html.dark .bg-gray-700,
html.dark .bg-gray-800,
html.dark .bg-gray-900 {
  color: #ffffff;
}

/* Ensure labels and secondary text are also visible in dark mode boxes */
html.dark .bg-white label,
html.dark .bg-gray-800 label,
html.dark .bg-white .text-gray-600,
html.dark .bg-gray-800 .text-gray-600,
html.dark .bg-white .text-gray-500,
html.dark .bg-gray-800 .text-gray-500,
html.dark .bg-white .text-gray-400,
html.dark .bg-gray-800 .text-gray-400 {
  color: #d1d5db !important;
}

/* Make all text white/light in orange warning boxes in dark mode */
html.dark .bg-orange-50,
html.dark .bg-orange-50\/20,
html.dark [class*="bg-orange-900/20"],
html.dark [class*="bg-orange-900\/20"] {
  color: #ffffff;
}

html.dark .bg-orange-50 *,
html.dark .bg-orange-50\/20 *,
html.dark [class*="bg-orange-900/20"] *,
html.dark [class*="bg-orange-900\/20"] * {
  color: #ffffff !important;
}

html.dark .bg-orange-50 label,
html.dark .bg-orange-50\/20 label,
html.dark [class*="bg-orange-900/20"] label,
html.dark [class*="bg-orange-900\/20"] label {
  color: #fde68a !important;
}

html.dark .bg-orange-50 .text-orange-800,
html.dark .bg-orange-50\/20 .text-orange-800,
html.dark [class*="bg-orange-900/20"] .text-orange-800,
html.dark [class*="bg-orange-900\/20"] .text-orange-800 {
  color: #fde68a !important;
}

html.dark .bg-orange-50 .text-orange-600,
html.dark .bg-orange-50\/20 .text-orange-600,
html.dark [class*="bg-orange-900/20"] .text-orange-600,
html.dark [class*="bg-orange-900\/20"] .text-orange-600 {
  color: #fbbf24 !important;
}

html.dark .bg-orange-50 .text-orange-400,
html.dark .bg-orange-50\/20 .text-orange-400,
html.dark [class*="bg-orange-900/20"] .text-orange-400,
html.dark [class*="bg-orange-900\/20"] .text-orange-400 {
  color: #fbbf24 !important;
}

html.dark .bg-orange-50 .text-orange-200,
html.dark .bg-orange-50\/20 .text-orange-200,
html.dark [class*="bg-orange-900/20"] .text-orange-200,
html.dark [class*="bg-orange-900\/20"] .text-orange-200 {
  color: #fde68a !important;
}

/* Make all text elements white inside boxes, excluding form elements which have their own styling */
html.dark .bg-white p,
html.dark .bg-white div,
html.dark .bg-white span,
html.dark .bg-white h1,
html.dark .bg-white h2,
html.dark .bg-white h3,
html.dark .bg-white h4,
html.dark .bg-white h5,
html.dark .bg-white h6,
html.dark .bg-white li,
html.dark .bg-white td,
html.dark .bg-white th,
html.dark .bg-white label,
html.dark .bg-gray-50 p,
html.dark .bg-gray-50 div,
html.dark .bg-gray-50 span,
html.dark .bg-gray-50 h1,
html.dark .bg-gray-50 h2,
html.dark .bg-gray-50 h3,
html.dark .bg-gray-50 h4,
html.dark .bg-gray-50 h5,
html.dark .bg-gray-50 h6,
html.dark .bg-gray-50 li,
html.dark .bg-gray-50 td,
html.dark .bg-gray-50 th,
html.dark .bg-gray-50 label,
html.dark .bg-gray-100 p,
html.dark .bg-gray-100 div,
html.dark .bg-gray-100 span,
html.dark .bg-gray-100 h1,
html.dark .bg-gray-100 h2,
html.dark .bg-gray-100 h3,
html.dark .bg-gray-100 h4,
html.dark .bg-gray-100 h5,
html.dark .bg-gray-100 h6,
html.dark .bg-gray-100 li,
html.dark .bg-gray-100 td,
html.dark .bg-gray-100 th,
html.dark .bg-gray-100 label,
html.dark .bg-gray-200 p,
html.dark .bg-gray-200 div,
html.dark .bg-gray-200 span,
html.dark .bg-gray-200 h1,
html.dark .bg-gray-200 h2,
html.dark .bg-gray-200 h3,
html.dark .bg-gray-200 h4,
html.dark .bg-gray-200 h5,
html.dark .bg-gray-200 h6,
html.dark .bg-gray-200 li,
html.dark .bg-gray-200 td,
html.dark .bg-gray-200 th,
html.dark .bg-gray-200 label,
html.dark .bg-gray-700 p,
html.dark .bg-gray-700 div,
html.dark .bg-gray-700 span,
html.dark .bg-gray-700 h1,
html.dark .bg-gray-700 h2,
html.dark .bg-gray-700 h3,
html.dark .bg-gray-700 h4,
html.dark .bg-gray-700 h5,
html.dark .bg-gray-700 h6,
html.dark .bg-gray-700 li,
html.dark .bg-gray-700 td,
html.dark .bg-gray-700 th,
html.dark .bg-gray-700 label,
html.dark .bg-gray-800 p,
html.dark .bg-gray-800 div,
html.dark .bg-gray-800 span,
html.dark .bg-gray-800 h1,
html.dark .bg-gray-800 h2,
html.dark .bg-gray-800 h3,
html.dark .bg-gray-800 h4,
html.dark .bg-gray-800 h5,
html.dark .bg-gray-800 h6,
html.dark .bg-gray-800 li,
html.dark .bg-gray-800 td,
html.dark .bg-gray-800 th,
html.dark .bg-gray-800 label,
html.dark .bg-gray-900 p,
html.dark .bg-gray-900 div,
html.dark .bg-gray-900 span,
html.dark .bg-gray-900 h1,
html.dark .bg-gray-900 h2,
html.dark .bg-gray-900 h3,
html.dark .bg-gray-900 h4,
html.dark .bg-gray-900 h5,
html.dark .bg-gray-900 h6,
html.dark .bg-gray-900 li,
html.dark .bg-gray-900 td,
html.dark .bg-gray-900 th,
html.dark .bg-gray-900 label {
  color: #ffffff !important;
}

.dark .bg-white,
.dark .bg-gray-50,
.dark .bg-gray-100,
.dark .bg-gray-200,
.dark .bg-gray-700,
.dark .bg-gray-800,
.dark .bg-gray-900 {
  color: #ffffff;
}

.dark .bg-white p,
.dark .bg-white div,
.dark .bg-white span,
.dark .bg-white h1,
.dark .bg-white h2,
.dark .bg-white h3,
.dark .bg-white h4,
.dark .bg-white h5,
.dark .bg-white h6,
.dark .bg-white li,
.dark .bg-white td,
.dark .bg-white th,
.dark .bg-white label,
.dark .bg-gray-50 p,
.dark .bg-gray-50 div,
.dark .bg-gray-50 span,
.dark .bg-gray-50 h1,
.dark .bg-gray-50 h2,
.dark .bg-gray-50 h3,
.dark .bg-gray-50 h4,
.dark .bg-gray-50 h5,
.dark .bg-gray-50 h6,
.dark .bg-gray-50 li,
.dark .bg-gray-50 td,
.dark .bg-gray-50 th,
.dark .bg-gray-50 label,
.dark .bg-gray-100 p,
.dark .bg-gray-100 div,
.dark .bg-gray-100 span,
.dark .bg-gray-100 h1,
.dark .bg-gray-100 h2,
.dark .bg-gray-100 h3,
.dark .bg-gray-100 h4,
.dark .bg-gray-100 h5,
.dark .bg-gray-100 h6,
.dark .bg-gray-100 li,
.dark .bg-gray-100 td,
.dark .bg-gray-100 th,
.dark .bg-gray-100 label,
.dark .bg-gray-200 p,
.dark .bg-gray-200 div,
.dark .bg-gray-200 span,
.dark .bg-gray-200 h1,
.dark .bg-gray-200 h2,
.dark .bg-gray-200 h3,
.dark .bg-gray-200 h4,
.dark .bg-gray-200 h5,
.dark .bg-gray-200 h6,
.dark .bg-gray-200 li,
.dark .bg-gray-200 td,
.dark .bg-gray-200 th,
.dark .bg-gray-200 label,
.dark .bg-gray-700 p,
.dark .bg-gray-700 div,
.dark .bg-gray-700 span,
.dark .bg-gray-700 h1,
.dark .bg-gray-700 h2,
.dark .bg-gray-700 h3,
.dark .bg-gray-700 h4,
.dark .bg-gray-700 h5,
.dark .bg-gray-700 h6,
.dark .bg-gray-700 li,
.dark .bg-gray-700 td,
.dark .bg-gray-700 th,
.dark .bg-gray-700 label,
.dark .bg-gray-800 p,
.dark .bg-gray-800 div,
.dark .bg-gray-800 span,
.dark .bg-gray-800 h1,
.dark .bg-gray-800 h2,
.dark .bg-gray-800 h3,
.dark .bg-gray-800 h4,
.dark .bg-gray-800 h5,
.dark .bg-gray-800 h6,
.dark .bg-gray-800 li,
.dark .bg-gray-800 td,
.dark .bg-gray-800 th,
.dark .bg-gray-800 label,
.dark .bg-gray-900 p,
.dark .bg-gray-900 div,
.dark .bg-gray-900 span,
.dark .bg-gray-900 h1,
.dark .bg-gray-900 h2,
.dark .bg-gray-900 h3,
.dark .bg-gray-900 h4,
.dark .bg-gray-900 h5,
.dark .bg-gray-900 h6,
.dark .bg-gray-900 li,
.dark .bg-gray-900 td,
.dark .bg-gray-900 th,
.dark .bg-gray-900 label {
  color: #ffffff !important;
}

/* Make all text white/light in orange warning boxes in dark mode */
html.dark .bg-orange-50,
html.dark [class*="bg-orange-900/20"],
html.dark [class*="bg-orange-900\/20"] {
  color: #ffffff;
}

html.dark .bg-orange-50 *,
html.dark [class*="bg-orange-900/20"] *,
html.dark [class*="bg-orange-900\/20"] * {
  color: #ffffff !important;
}

html.dark .bg-orange-50 label,
html.dark [class*="bg-orange-900/20"] label,
html.dark [class*="bg-orange-900\/20"] label {
  color: #fde68a !important;
}

html.dark .bg-orange-50 .text-orange-800,
html.dark [class*="bg-orange-900/20"] .text-orange-800,
html.dark [class*="bg-orange-900\/20"] .text-orange-800 {
  color: #fde68a !important;
}

html.dark .bg-orange-50 .text-orange-600,
html.dark [class*="bg-orange-900/20"] .text-orange-600,
html.dark [class*="bg-orange-900\/20"] .text-orange-600 {
  color: #fbbf24 !important;
}

html.dark .bg-orange-50 .text-orange-400,
html.dark [class*="bg-orange-900/20"] .text-orange-400,
html.dark [class*="bg-orange-900\/20"] .text-orange-400 {
  color: #fbbf24 !important;
}

html.dark .bg-orange-50 .text-orange-200,
html.dark [class*="bg-orange-900/20"] .text-orange-200,
html.dark [class*="bg-orange-900\/20"] .text-orange-200 {
  color: #fde68a !important;
}

html.dark .bg-orange-50 .text-gray-900,
html.dark [class*="bg-orange-900/20"] .text-gray-900,
html.dark [class*="bg-orange-900\/20"] .text-gray-900 {
  color: #ffffff !important;
}

html.dark .bg-orange-50 a,
html.dark [class*="bg-orange-900/20"] a,
html.dark [class*="bg-orange-900\/20"] a {
  color: #ffffff !important;
}

/* Project activity notes alignment */
.flex-1.pr-4 > div.text-sm.text-gray-700,
.flex-1.pr-4 > div.text-sm.text-gray-700.dark\:text-gray-300 {
  padding-left: 0 !important;
  margin-left: 0 !important;
  text-align: left !important;
}

/* Dashboard expiry row highlighting */
.vessel-row-expired,
.vessel-row-expiring {
  cursor: pointer;
}

.vessel-row-expired {
  border-left: 4px solid #dc2626;
  background-color: #fef2f2;
}

.vessel-row-expiring {
  border-left: 4px solid #ea580c;
  background-color: #fff7ed;
}

.vessel-row-expired:hover {
  background-color: #fee2e2;
}

.vessel-row-expiring:hover {
  background-color: #ffedd5;
}

html.dark .vessel-row-expired {
  background-color: rgba(127, 29, 29, 0.4);
  border-left-color: #f87171;
}

html.dark .vessel-row-expiring {
  background-color: rgba(124, 45, 18, 0.4);
  border-left-color: #fb923c;
}

html.dark .vessel-row-expired:hover {
  background-color: rgba(127, 29, 29, 0.55);
}

html.dark .vessel-row-expiring:hover {
  background-color: rgba(124, 45, 18, 0.55);
}

html.dark .vessel-row-expired .text-gray-900,
html.dark .vessel-row-expiring .text-gray-900 {
  color: #f9fafb !important;
}

html.dark .vessel-row-expired .text-gray-500,
html.dark .vessel-row-expiring .text-gray-500 {
  color: #d1d5db !important;
}

.badge-expired {
  background-color: #fee2e2 !important;
  color: #991b1b !important;
}

.badge-due-soon {
  background-color: #ffedd5 !important;
  color: #9a3412 !important;
}

.badge-warning {
  background-color: #fbbf24 !important;
  color: #1c1917 !important;
  font-weight: 700;
}

/* Dashboard vessel list: fit without horizontal scroll */
.dashboard-vessel-table-wrap {
  width: 100%;
  overflow-x: visible;
}

.dashboard-vessel-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.dashboard-vessel-table th,
.dashboard-vessel-table td {
  vertical-align: top;
  word-break: break-word;
}

/* Vessel Live / Archive status controls */
.vessel-status-toggle {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.vessel-status-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 7.5rem;
  padding: 0.65rem 1.1rem;
  border-radius: 0.5rem;
  border: 2px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  user-select: none;
}

.vessel-status-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.vessel-status-option.vessel-status-live:has(input:checked),
.vessel-status-toggle[data-selected="LIVE"] .vessel-status-live {
  border-color: #15803d;
  background: #16a34a;
  color: #ffffff;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.25);
}

.vessel-status-option.vessel-status-archive:has(input:checked),
.vessel-status-toggle[data-selected="ARCHIVED"] .vessel-status-archive {
  border-color: #475569;
  background: #475569;
  color: #ffffff;
  box-shadow: 0 0 0 3px rgba(71, 85, 105, 0.25);
}

/* Unselected option must never keep the bright selected colours */
.vessel-status-toggle[data-selected="ARCHIVED"] .vessel-status-live,
.vessel-status-toggle[data-selected="LIVE"] .vessel-status-archive,
.vessel-status-option.vessel-status-live:not(:has(input:checked)),
.vessel-status-option.vessel-status-archive:not(:has(input:checked)) {
  border-color: #cbd5e1;
  background: #f8fafc;
  color: #334155;
  box-shadow: none;
}

.vessel-status-option:hover {
  border-color: #64748b;
  background: #e2e8f0;
}

.vessel-status-option:has(input:checked):hover,
.vessel-status-toggle[data-selected="LIVE"] .vessel-status-live:hover {
  border-color: #15803d;
  background: #16a34a;
  color: #ffffff;
}

.vessel-status-toggle[data-selected="ARCHIVED"] .vessel-status-archive:hover {
  border-color: #475569;
  background: #475569;
  color: #ffffff;
}

.vessel-status-badge,
.dark .vessel-status-badge,
html.dark .vessel-status-badge,
h1 .vessel-status-badge,
.dark h1 .vessel-status-badge,
.dark .text-gray-900 .vessel-status-badge,
.dark .text-white .vessel-status-badge {
  display: inline-flex !important;
  align-items: center;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
}

/* Always solid green + white text — readable in light and dark mode */
.vessel-status-badge-live,
.dark .vessel-status-badge-live,
html.dark .vessel-status-badge-live,
h1 .vessel-status-badge-live,
.dark h1 .vessel-status-badge-live,
.dark .text-gray-900 .vessel-status-badge-live {
  background: #15803d !important;
  color: #ffffff !important;
  border: 2px solid #14532d !important;
}

/* Always solid amber + near-black text — never white-on-white */
.vessel-status-badge-archived,
.dark .vessel-status-badge-archived,
html.dark .vessel-status-badge-archived,
h1 .vessel-status-badge-archived,
.dark h1 .vessel-status-badge-archived,
.dark .text-gray-900 .vessel-status-badge-archived,
.dark .text-white .vessel-status-badge-archived {
  background: #f59e0b !important;
  color: #111827 !important;
  border: 2px solid #b45309 !important;
}

.vessel-status-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.9rem;
  border-radius: 0.4rem;
  border: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
}

.vessel-status-action-live {
  background: #16a34a;
}

.vessel-status-action-live:hover {
  background: #15803d;
}

.vessel-status-action-archive {
  background: #475569;
}

.vessel-status-action-archive:hover {
  background: #334155;
}

html.dark .vessel-status-option,
html.dark .vessel-status-toggle[data-selected="ARCHIVED"] .vessel-status-live,
html.dark .vessel-status-toggle[data-selected="LIVE"] .vessel-status-archive,
html.dark .vessel-status-option.vessel-status-live:not(:has(input:checked)),
html.dark .vessel-status-option.vessel-status-archive:not(:has(input:checked)) {
  border-color: #64748b;
  background: #1e293b;
  color: #e2e8f0;
  box-shadow: none;
}

html.dark .vessel-status-option:hover {
  background: #334155;
  border-color: #94a3b8;
}

html.dark .vessel-status-option.vessel-status-live:has(input:checked),
html.dark .vessel-status-toggle[data-selected="LIVE"] .vessel-status-live,
html.dark .vessel-status-toggle[data-selected="LIVE"] .vessel-status-live:hover {
  border-color: #15803d;
  background: #16a34a;
  color: #ffffff;
}

html.dark .vessel-status-option.vessel-status-archive:has(input:checked),
html.dark .vessel-status-toggle[data-selected="ARCHIVED"] .vessel-status-archive,
html.dark .vessel-status-toggle[data-selected="ARCHIVED"] .vessel-status-archive:hover {
  border-color: #94a3b8;
  background: #64748b;
  color: #ffffff;
}

.dashboard-sort-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  cursor: pointer;
}

.dashboard-sort-link:hover,
.dashboard-sort-link.is-sorted {
  color: var(--primary, #1d4f91);
  text-decoration: underline;
}

html.dark .dashboard-sort-link:hover,
html.dark .dashboard-sort-link.is-sorted {
  color: #93c5fd;
}

.dashboard-vessel-table .dashboard-col-vessel { width: 30%; }
.dashboard-vessel-table .dashboard-col-imo { width: 8%; }
.dashboard-vessel-table .dashboard-col-type { width: 13%; }
.dashboard-vessel-table .dashboard-col-dp { width: 6%; }
.dashboard-vessel-table .dashboard-col-ovid { width: 10%; }
.dashboard-vessel-table .dashboard-col-outcome { width: 13%; }
.dashboard-vessel-table .dashboard-col-bvs { width: 10%; }
.dashboard-vessel-table .dashboard-col-marine { width: 10%; }

.dashboard-vessel-cell {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  min-width: 0;
}

.dashboard-vessel-thumb {
  flex-shrink: 0;
}

.dashboard-vessel-meta {
  flex: 1 1 auto;
  min-width: 0;
}

.dashboard-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-status-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  margin-top: 0.35rem;
}

.dashboard-status-badge {
  display: inline-block;
  max-width: 100%;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  font-size: 0.6875rem;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
}

.dashboard-outcome-badge {
  display: inline-block;
  max-width: 100%;
  white-space: normal;
  line-height: 1.25;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.dashboard-outcome-badge.bg-warning,
.dashboard-outcome-badge.bg-warning.text-white {
  background-color: #fbbf24 !important;
  color: #1c1917 !important;
}

@media (max-width: 900px) {
  .dashboard-vessel-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .dashboard-vessel-table {
    min-width: 720px;
    table-layout: auto;
  }
}

html.dark .badge-expired,
html.dark .bg-white .badge-expired,
html.dark .bg-gray-800 .badge-expired {
  background-color: #991b1b !important;
  color: #ffffff !important;
}

html.dark .badge-due-soon,
html.dark .bg-white .badge-due-soon,
html.dark .bg-gray-800 .badge-due-soon {
  background-color: #9a3412 !important;
  color: #ffffff !important;
}

html.dark .badge-warning,
html.dark .bg-white .badge-warning,
html.dark .bg-gray-800 .badge-warning {
  background-color: #fbbf24 !important;
  color: #1c1917 !important;
}

html.dark .bg-warning.text-white,
html.dark .dashboard-outcome-badge.bg-warning,
html.dark .dashboard-outcome-badge.bg-warning.text-white {
  background-color: #fbbf24 !important;
  color: #1c1917 !important;
}

/* Vessel page file download links */
.file-link-box {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  background-color: #f9fafb;
  color: var(--primary) !important;
  text-decoration: none;
  font-size: 0.75rem;
  line-height: 1.25rem;
  transition: background-color 0.2s, border-color 0.2s;
}

.file-link-box:hover {
  background-color: #f3f4f6;
  border-color: var(--primary);
  text-decoration: none;
}

html.dark .file-link-box {
  background-color: #111827;
  border-color: #4b5563;
  color: #60a5fa !important;
}

html.dark .file-link-box:hover {
  background-color: #1f2937;
  border-color: #60a5fa;
}

html.dark .bg-white .file-link-box,
html.dark .bg-gray-800 .file-link-box {
  color: #60a5fa !important;
}

/* Archived-by-category collapsible reveal */
.archived-by-category {
  margin-top: 0.75rem;
  margin-bottom: 1rem;
}

.archived-by-category-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.65rem;
  background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
  color: #374151;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.archived-by-category-toggle:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}

.archived-by-category-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.archived-by-category-toggle-main,
.archived-by-category-toggle-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.archived-by-category-chevron {
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: rotate(-45deg);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  flex-shrink: 0;
  margin-top: -0.1rem;
}

.archived-by-category.is-open .archived-by-category-chevron {
  transform: rotate(45deg);
  margin-top: 0.05rem;
}

.archived-by-category-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

.archived-by-category-total {
  min-width: 1.5rem;
  height: 1.35rem;
  padding: 0 0.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 0.7rem;
  font-weight: 700;
}

.archived-by-category-hint {
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
}

.archived-by-category-panel {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  margin-top: 0;
  transition:
    grid-template-rows 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease,
    margin-top 0.35s ease;
}

.archived-by-category.is-open .archived-by-category-panel {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 0.65rem;
}

.archived-by-category-panel-inner {
  overflow: hidden;
  min-height: 0;
}

.archived-by-category-grid {
  margin-bottom: 0;
}

.archived-by-category-grid .vessel-view-box {
  opacity: 0;
  transform: translateY(0.55rem) scale(0.985);
  transition:
    opacity 0.32s ease,
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease;
  transition-delay: 0s;
}

.archived-by-category.is-open .archived-by-category-grid .vessel-view-box {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition-delay: calc(0.04s * var(--reveal-i, 1));
}

@media (prefers-reduced-motion: reduce) {
  .archived-by-category-chevron,
  .archived-by-category-panel,
  .archived-by-category-grid .vessel-view-box,
  .archived-by-category-toggle {
    transition: none !important;
  }

  .archived-by-category-grid .vessel-view-box {
    opacity: 1;
    transform: none;
  }
}

html.dark .archived-by-category-toggle {
  background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
  border-color: #374151;
  color: #e5e7eb;
}

html.dark .archived-by-category-toggle:hover {
  border-color: #4b5563;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

html.dark .archived-by-category-label,
html.dark .archived-by-category-hint {
  color: #94a3b8;
}

html.dark .archived-by-category-chevron {
  border-color: #94a3b8;
}

html.dark .archived-by-category-total {
  background: #334155;
  color: #f8fafc;
}

/* Dashboard vessel view switcher */
.vessel-view-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 640px) {
  .vessel-view-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .vessel-view-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .vessel-view-grid {
    /* Fixed 6 equal columns so live + archived rows align */
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.vessel-view-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  width: 100%;
  padding: 0.75rem 0.7rem;
  background: #ffffff;
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  text-decoration: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
}

.vessel-view-box > .min-w-0 {
  flex: 1 1 auto;
  min-width: 0;
}

.vessel-view-box:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

.vessel-view-box-active {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(37, 99, 235, 0.03) 100%);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.18);
}

.vessel-view-box-active:hover {
  border-color: var(--primary-dark);
}

.vessel-view-box-icon {
  flex-shrink: 0;
  width: 2.15rem;
  height: 2.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  font-size: 1rem;
  background: #eff6ff;
}

.vessel-view-box-active .vessel-view-box-icon {
  background: var(--primary);
  color: #ffffff;
}

.vessel-view-box-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.vessel-view-box-active .vessel-view-box-title {
  color: var(--primary-dark);
}

.vessel-view-box-meta {
  font-size: 0.65rem;
  color: #6b7280;
  margin-top: 0.1rem;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.vessel-view-box-count {
  margin-left: auto;
  flex-shrink: 0;
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0 0.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: #f3f4f6;
  font-size: 0.75rem;
  font-weight: 700;
  color: #374151;
}

.vessel-view-box-active .vessel-view-box-count {
  background: var(--primary);
  color: #ffffff;
}

html.dark .vessel-view-box {
  background: #1f2937;
  border-color: #374151;
}

html.dark .vessel-view-box:hover {
  border-color: #60a5fa;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

html.dark .vessel-view-box-active {
  border-color: #3b82f6;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(59, 130, 246, 0.08) 100%);
}

html.dark .vessel-view-box-icon {
  background: #1e3a5f;
}

html.dark .vessel-view-box-active .vessel-view-box-icon {
  background: var(--primary);
}

html.dark .vessel-view-box-title {
  color: #f9fafb;
}

html.dark .vessel-view-box-active .vessel-view-box-title {
  color: #93c5fd;
}

html.dark .vessel-view-box-meta {
  color: #9ca3af;
}

html.dark .vessel-view-box-count {
  background: #374151;
  color: #e5e7eb;
}

html.dark .vessel-view-box-active .vessel-view-box-count {
  background: var(--primary);
  color: #ffffff;
}

.dashboard-search-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .dashboard-search-bar {
    flex-direction: row;
    align-items: flex-end;
    flex-wrap: wrap;
  }
}

/* Column flex on mobile: rem flex-basis must NOT inflate height (was 256px/224px gaps). */
.dashboard-search-input-wrap {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 0;
}

@media (min-width: 768px) {
  .dashboard-search-input-wrap {
    flex: 1 1 16rem;
    width: auto;
    align-self: flex-end;
  }
}

.dashboard-search-input-wrap .dashboard-search-input,
.dashboard-search-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 0.625rem 0.75rem 0.625rem 2.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  background: #ffffff;
  color: #111827;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.dashboard-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.dashboard-search-category {
  flex: 0 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 0;
}

@media (min-width: 768px) {
  .dashboard-search-category {
    flex: 0 1 14rem;
    width: auto;
  }
}

.dashboard-search-category-label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #4b5563;
}

.dashboard-search-select {
  display: block;
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  background: #ffffff;
  color: #111827;
  font-size: 0.875rem;
}

.dashboard-search-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.dashboard-search-button {
  flex: 0 0 auto;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: 0.5rem;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.dashboard-search-button:hover {
  background: var(--primary-dark);
}

.dashboard-search-clear {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  color: #6b7280;
  text-decoration: none;
}

.dashboard-search-clear:hover {
  color: #111827;
}

html.dark .dashboard-search-input,
html.dark .dashboard-search-select {
  background: #374151;
  border-color: #4b5563;
  color: #f9fafb;
}

html.dark .dashboard-search-category-label {
  color: #d1d5db;
}

html.dark .dashboard-search-clear {
  color: #9ca3af;
}

html.dark .dashboard-search-clear:hover {
  color: #f9fafb;
}

.assurance-notes-preview-text {
  line-height: 1.4;
}

.assurance-notes-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1rem;
  overflow-y: auto;
  background-color: rgba(17, 24, 39, 0.55);
}

.assurance-notes-modal.hidden {
  display: none !important;
}

.assurance-notes-modal-panel {
  width: 100%;
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.25rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  background-color: #ffffff;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

html.dark .assurance-notes-modal-panel {
  border-color: #374151;
  background-color: #1f2937;
}

.assurance-notes-modal-body {
  max-height: 70vh;
  overflow-y: auto;
  font-size: 0.875rem;
  line-height: 1.5;
  white-space: pre-wrap;
  color: #111827;
}

html.dark .assurance-notes-modal-body {
  color: #f9fafb;
}

.assurance-audits-edit-panel {
  max-width: 42rem;
}

.assurance-modal-btn-secondary {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 0.375rem;
  border: 1px solid #d1d5db;
  background-color: #e5e7eb;
  color: #1f2937 !important;
  cursor: pointer;
}

.assurance-modal-btn-secondary:hover {
  background-color: #d1d5db;
}

html.dark .assurance-modal-btn-secondary {
  background-color: #4b5563;
  border-color: #6b7280;
  color: #f9fafb !important;
}

html.dark .assurance-modal-btn-secondary:hover {
  background-color: #6b7280;
}

.assurance-modal-btn-primary {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 0.375rem;
  border: none;
  background-color: var(--primary);
  color: #ffffff !important;
  cursor: pointer;
}

.assurance-modal-btn-primary:hover {
  background-color: var(--primary-dark);
}

/* ===== Mobile layout / stop horizontal page swipe ===== */
html, body.mm-app {
  max-width: 100%;
  overflow-x: hidden;
}

.mm-app *,
.mm-app *::before,
.mm-app *::after {
  box-sizing: border-box;
}

.mm-app .max-w-7xl {
  width: 100%;
  max-width: 80rem;
  box-sizing: border-box;
}

.mm-nav {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.mm-nav-inner {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

.mm-nav-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.mm-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.25;
  padding-right: 0;
  margin-right: 0;
  border-right: none;
}

.mm-brand-back {
  display: block;
  font-size: 0.7rem;
  color: #6b7280;
  text-decoration: none;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html.dark .mm-brand-back { color: #9ca3af; }
.mm-brand-back:hover { text-decoration: underline; color: #374151; }
html.dark .mm-brand-back:hover { color: #d1d5db; }

.mm-brand-title {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mm-nav-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.mm-nav-user-label {
  max-width: 7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mm-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  min-width: 0;
  padding-bottom: 0.15rem;
}

.mm-nav-links a {
  color: #6b7280;
  font-size: 0.85rem;
  text-decoration: none;
  white-space: nowrap;
}

.mm-nav-links a:hover { color: #111827; }
html.dark .mm-nav-links a { color: #9ca3af; }
html.dark .mm-nav-links a:hover { color: #fff; }

.mm-theme-label {
  font-size: 0.75rem;
  font-weight: 600;
}

/* Tables: scroll inside card, not the whole page */
.mm-app .overflow-x-auto {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.mm-app table.min-w-full {
  width: 100%;
}

@media (max-width: 767px) {
  .mm-nav-user-label {
    display: none;
  }

  .mm-brand-title {
    font-size: 0.95rem;
  }

  .mm-app .text-2xl,
  .mm-app .text-3xl {
    font-size: 1.25rem;
    line-height: 1.4;
  }
}

@media (min-width: 640px) {
  .mm-nav-user-label {
    max-width: 14rem;
  }
}

@media (min-width: 768px) {
  .mm-nav-inner {
    gap: 0.35rem;
  }

  .mm-brand {
    flex: 0 1 auto;
    padding-right: 1rem;
    margin-right: 0.75rem;
    border-right: 1px solid #e5e7eb;
  }

  html.dark .mm-brand {
    border-right-color: #4b5563;
  }

  .mm-brand-title {
    font-size: 1.125rem;
  }
}

/* Mobile comfort: touch targets, search icon slot, reduce excess vertical gaps */
.dashboard-search-input-wrap > .absolute {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  padding-left: 0.75rem;
  pointer-events: none;
}
.dashboard-search-input-wrap svg.mm-icon,
.dashboard-search-input-wrap svg.h-5 {
  width: 20px !important;
  height: 20px !important;
  max-width: 20px !important;
  max-height: 20px !important;
}

@media (max-width: 767px) {
  .mm-app .py-8 { padding-top: 1.25rem; padding-bottom: 1.25rem; }
  .mm-app .py-4 { padding-top: 0.85rem; padding-bottom: 0.85rem; }
  .mm-app .mb-4 { margin-bottom: 0.85rem; }
  .mm-app .gap-3 { gap: 0.65rem; }
  .mm-nav-links a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.15rem;
  }
  .dashboard-search-button,
  .dashboard-search-clear,
  .mm-app a.px-4.py-2,
  .mm-app button.px-4.py-2 {
    min-height: 44px;
  }
  .mm-app .grid.xl\:grid-cols-6,
  .mm-app .grid.lg\:grid-cols-3 {
    gap: 0.65rem;
  }
  .mm-app .rounded-lg.shadow.p-3 {
    padding: 0.75rem;
  }
  .mm-app h1 {
    margin-bottom: 0.5rem;
  }
}
