:root {
  --mw-navy:     #1a2535;
  --mw-accent:   #2a9d8f;
  --mw-accent2:  #e76f51;
  --mw-light:    #f4f6f9;
  --mw-white:    #ffffff;
  --mw-text:     #2d3748;
  --mw-muted:    #6c757d;
  --mw-border:   #dee2e6;
  --priority-low:      #0ea5e9;
  --priority-medium:   #f59e0b;
  --priority-high:     #f97316;
  --priority-critical: #ef4444;
}

/* ── Base ── */
body {
  font-family: 'Inter', sans-serif;
  background: var(--mw-light);
  color: var(--mw-text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ── Navbar extras ── */
.navbar-vessel-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,.85);
  font-size: .875rem;
  font-weight: 500;
}

.dept-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
}

.badge-deck   { background: #1e6bc4; color: #fff; }
.badge-engine { background: #d9381e; color: #fff; }
.badge-hotel  { background: #1a9e5c; color: #fff; }
.badge-admin  { background: #f59e0b; color: #1a2535; }
.badge-supt   { background: #6366f1; color: #fff; }

/* ── Stat cards (dashboard) ── */
.stat-card {
  border: none;
  border-left: 4px solid;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.stat-card .stat-value { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--mw-muted); }

/* ── Task page inline stats row — equal tiles filling full width ── */
.task-stats-row {
  display: flex;
  gap: 5px;
  margin-top: 10px;
}
.stat-item {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 7px 4px 6px;
  background: var(--mw-light);
  border-radius: 7px;
}
.stat-number { font-size: 1.3rem; font-weight: 700; line-height: 1; }
.stat-label  {
  font-size: .55rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--mw-muted); margin-top: 3px; white-space: nowrap;
}
.stat-color-inprogress { color: #2563eb; }
.stat-color-onhold     { color: #d97706; }

/* ── Status + progress bar (desktop task table) ── */
.task-prog-wrap { display: flex; align-items: center; gap: 5px; }
.task-prog-bar  { width: 55px; height: 5px; border-radius: 3px; background: #e9ecef; margin: 0; }
.task-prog-pct  { font-size: .72rem; color: var(--mw-muted); white-space: nowrap; }

/* ── Show-deleted toggle button ── */
.task-show-del-btn { text-decoration: none; }
.task-show-del-btn:hover { text-decoration: none; }

/* ── Fix dropdown clipping inside table-responsive ── */
.task-table-card,
.task-table-card .table-responsive { overflow: visible !important; }

/* ── Priority badges ── */
.badge-priority-low      { background-color: var(--priority-low) !important; color:#fff; }
.badge-priority-medium   { background-color: var(--priority-medium) !important; color:#fff; }
.badge-priority-high     { background-color: var(--priority-high) !important; color:#fff; }
.badge-priority-critical { background-color: var(--priority-critical) !important; color:#fff; }

/* ── Dept badges in table ── */
.badge-dept-dk  { color: #1e6bc4; border: 1.5px solid #1e6bc4; background: transparent; font-size:.7rem; }
.badge-dept-eng { color: #d9381e; border: 1.5px solid #d9381e; background: transparent; font-size:.7rem; }
.badge-dept-htl { color: #1a9e5c; border: 1.5px solid #1a9e5c; background: transparent; font-size:.7rem; }

/* ── Task table ── */
.task-table tbody tr { cursor: pointer; transition: background .12s; }
.task-table tbody tr:hover { background: #e8f5f3 !important; }

/* Desktop striping (replaces Bootstrap table-striped removed from HTML) */
@media (min-width: 768px) {
  .task-table tbody tr:nth-child(even) { background: rgba(0,0,0,.03); }
}
.task-table .task-number { font-family: 'Courier New', monospace; font-size: .85rem; }
.task-row-deleted { background: repeating-linear-gradient(135deg,#f8f9fa,#f8f9fa 10px,#e9ecef 10px,#e9ecef 20px) !important; opacity:.75; }

/* ── Upload zone ── */
.upload-zone {
  border: 2px dashed var(--mw-border);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: #fafbfc;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--mw-accent);
  background: #f0faf9;
}
.upload-zone i { color: var(--mw-accent); }

/* ── File preview ── */
.file-thumb {
  position: relative;
  width: 80px;
  flex-shrink: 0;
}
.file-thumb img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--mw-border);
}
.file-thumb .pdf-icon {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff3f0;
  border-radius: 6px;
  border: 1px solid #ffc9be;
  font-size: 2rem;
  color: var(--mw-accent2);
}
.file-thumb .remove-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  background: #dc3545;
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: .6rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.file-thumb .fname {
  font-size: .65rem;
  text-align: center;
  word-break: break-all;
  margin-top: 3px;
  color: var(--mw-muted);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* New upload thumbs — wider to fit caption input */
.file-thumb.file-thumb-new {
  width: 130px;
}
.file-thumb.file-thumb-new img,
.file-thumb.file-thumb-new .pdf-icon {
  width: 80px;
  margin: 0 auto;
  display: block;
}
.file-thumb.file-thumb-new .fname {
  max-width: 130px;
}
/* Upload progress bar */
.file-thumb-new .upload-progress {
  height: 4px;
  background: #e9ecef;
  border-radius: 2px;
  margin: 4px 0 1px;
  overflow: hidden;
}
.file-thumb-new .upload-progress-bar {
  height: 4px;
  width: 0%;
  background: var(--mw-accent);
  border-radius: 2px;
  transition: width .15s linear, background .3s;
}
.file-thumb-new .upload-label {
  font-size: .62rem;
  text-align: center;
  min-height: 14px;
  color: var(--mw-muted);
  margin-bottom: 2px;
}
.file-comment-input {
  font-size: .7rem !important;
  padding: 2px 6px !important;
  width: 100%;
}
/* Clickable thumbnails in detail modal */
.att-clickable {
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.att-clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.att-clickable img, .att-clickable .pdf-icon {
  border: 2px solid transparent;
  transition: border-color .15s;
}
.att-clickable:hover img,
.att-clickable:hover .pdf-icon {
  border-color: var(--mw-accent);
}

/* ── Task Detail Modal — hero header ── */
.td-hero {
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--mw-border);
  background: #fff;
}
.td-hero-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.td-hero-title {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 4px;
  color: var(--mw-text);
}
.td-hero-desc {
  font-size: .83rem;
  color: var(--mw-muted);
  line-height: 1.4;
}

/* Task Detail Modal — two-column body */
/* Task detail modal scrollable body */
#taskDetailModal .modal-content {
  position: relative;
}
#taskDetailModal .modal-body {
  max-height: calc(100vh - 210px);
  overflow-y: auto;
}
/* Scroll-more indicator */
.scroll-hint {
  position: absolute;
  bottom: 60px; /* above modal-footer */
  left: 0; right: 0;
  height: 64px;
  background: linear-gradient(to bottom, transparent, rgba(255,255,255,.95));
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
  pointer-events: none;
  transition: opacity .3s;
  z-index: 10;
}
.scroll-hint.hidden { opacity: 0; }
.scroll-hint-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  animation: scrollBounce 1.4s ease-in-out infinite;
}
.scroll-hint-icon i { font-size: 1.1rem; color: var(--mw-muted); line-height: 1; }
.scroll-hint-icon span { font-size: .65rem; color: var(--mw-muted); letter-spacing: .05em; text-transform: uppercase; }
@keyframes scrollBounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(4px); }
}
.td-layout {
  display: grid;
  grid-template-columns: 3fr 2fr;
  align-items: start;
}
.td-left {
  padding: 20px 24px;
  border-right: 1px solid var(--mw-border);
}
.td-right {
  padding: 14px 16px;
  background: #f8f9fa;
  position: sticky;
  top: 0;
  max-height: calc(100vh - 210px);
  overflow-y: auto;
}

/* Left: sections */
.td-section {
  margin-bottom: 22px;
}
.td-section:last-child { margin-bottom: 0; }
.td-section-header {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  font-size: .88rem;
  color: var(--mw-text);
  margin-bottom: 10px;
}
.td-section-header > i { color: var(--mw-accent); font-size: .95rem; }

/* Right: info cards */
.td-card {
  background: #fff;
  border: 1px solid var(--mw-border);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
}
.td-card:last-child { margin-bottom: 0; }
.td-card-header {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--mw-muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--mw-border);
  background: #f8f9fa;
}
.td-card-body { padding: 10px 12px; }
.td-ring-wrap { display: flex; justify-content: center; padding: 10px 0 4px; }
.td-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 0;
  font-size: .8rem;
  border-bottom: 1px solid #f0f0f0;
}
.td-row:last-child { border-bottom: none; }
.td-row-label { color: var(--mw-muted); flex-shrink: 0; }
.td-row-value { font-weight: 600; text-align: right; word-break: break-word; max-width: 60%; }

/* Comments */
.td-comment {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.td-comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--mw-accent);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.td-comment-content { flex: 1; min-width: 0; }
.td-comment-meta { font-size: .74rem; margin-bottom: 3px; }
.td-comment-text {
  background: #f0f4f8;
  border-radius: 4px 12px 12px 12px;
  padding: 7px 12px;
  font-size: .85rem;
  word-break: break-word;
  white-space: pre-line;
}

/* Mobile: stack columns — let Bootstrap fullscreen modal handle scrolling */
@media (max-width: 767px) {
  #taskDetailModal .modal-content { position: static; }
  #taskDetailModal .modal-body { max-height: none; overflow-y: auto; }
  .td-layout { grid-template-columns: 1fr; }
  .td-left  { border-right: none; border-bottom: 1px solid var(--mw-border); padding: 16px; }
  .td-right { position: static; max-height: none; overflow-y: visible; padding: 12px 16px; background: #f8f9fa; }
  .td-hero  { padding: 14px 16px 12px; }
}

/* ── Project cards ── */
.project-card { transition: box-shadow .2s; }
.project-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12) !important; }

/* ── Progress slider ── */
#taskProgress {
  accent-color: var(--mw-accent);
  cursor: pointer;
}
#taskProgress::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: #e9ecef;
}
#taskProgress::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -6px;
}

/* ── Print styles ── */
@media print {
  .navbar, .btn, footer, .no-print { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .print-table th, .print-table td { border: 1px solid #888 !important; padding: 4px 6px !important; }
  .badge { border: 1px solid #888 !important; color: #000 !important; background: transparent !important; }
}

/* ── Buttons using accent color ── */
.btn-accent {
  background: var(--mw-accent);
  border-color: var(--mw-accent);
  color: #fff;
}
.btn-accent:hover {
  background: #238f82;
  border-color: #238f82;
  color: #fff;
}

/* ── Extra-small button (not in Bootstrap 5) ── */
.btn-xs { padding: .2rem .45rem; font-size: .78rem; line-height: 1.4; border-radius: .2rem; }

/* ── Filters bar ── */
.filter-bar { background: #fff; border-radius: 8px; padding: 12px 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }

/* ── Responsive table on mobile ── */
@media (max-width: 767px) {
  /* ── Task cards (kafelki) ── */
  .task-table thead { display: none; }

  .task-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    border: 1.5px solid var(--mw-border);
    border-radius: 10px;
    margin-bottom: 8px;
    padding: 10px 12px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
    gap: 2px 6px;
    cursor: pointer;
    transition: background .15s, border-color .15s, box-shadow .15s;
  }
  .task-table tbody tr:hover,
  .task-table tbody tr:active {
    background: #e8f5f3;
    border-color: var(--mw-accent);
    box-shadow: 0 2px 8px rgba(42,157,143,.18);
  }
  .task-table tbody td {
    display: block;
    padding: 2px 0;
    border: none;
    font-size: .875rem;
  }
  /* No data-label prefixes — layout speaks for itself */
  .task-table tbody td::before { display: none; }

  /* Row # — hidden */
  .task-table tbody td:nth-child(1) { display: none; }

  /* Row 1: Task No. (grows) + Dept badge (right) */
  .task-table tbody td:nth-child(2) { order: 1; flex: 1; min-width: 0; font-size: .82rem; }
  .task-table tbody td:nth-child(3) { order: 1; flex: 0 0 auto; }

  /* Row 2: Title (full width) */
  .task-table tbody td:nth-child(4) {
    order: 2; flex: 0 0 100%;
    font-weight: 600; font-size: .92rem;
    padding: 3px 0 2px;
    line-height: 1.3;
  }

  /* Row 1 (right column): Status ring — large, right-aligned */
  .task-table tbody td:nth-child(7) {
    order: 1; flex: 0 0 auto; align-self: center;
  }
  .task-table tbody td:nth-child(7) .task-status-ring svg { width: 42px !important; height: 42px !important; }

  /* Row 3: Status badge + Priority (both from Priority cell) */
  .task-table tbody td:nth-child(5) { order: 3; flex: 0 0 auto; }

  /* CL and Files: hidden on mobile (info in meta footer) */
  .task-table tbody td:nth-child(8),
  .task-table tbody td:nth-child(9) { display: none; }

  /* Row 4: Assigned To (full width, muted — includes meta footer) */
  .task-table tbody td:nth-child(6) {
    order: 4; flex: 0 0 100%;
    font-size: .78rem; color: var(--mw-muted);
    overflow: hidden;
  }

  /* Row 5: Actions */
  .task-table tbody td:nth-child(10) {
    order: 5; flex: 0 0 100%;
    display: flex; justify-content: flex-end; gap: 6px;
    padding-top: 8px; margin-top: 4px;
    border-top: 1px solid #eef0f2;
    cursor: default;
  }
  .task-table tbody td:nth-child(10) .btn { padding: 5px 10px; font-size: .85rem; }

  /* Mobile meta footer (💬 · 📎 · ✓ X/Y) */
  .task-mobile-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: .75rem;
    color: var(--mw-muted);
    margin-top: 4px;
  }
  .task-mobile-meta span { display: flex; align-items: center; gap: 3px; }

  /* Hide comment count icon in title cell (in meta footer instead) */
  .task-table tbody td:nth-child(4) .comment-count-icon,
  .task-table tbody td:nth-child(4) .comment-count-badge { display: none; }

  /* Stats row: equal tiles filling the full row */
  .task-stats-row { gap: 3px; flex-wrap: nowrap; }
  .stat-item { padding: 5px 2px 4px; border-radius: 6px; }
  .stat-number { font-size: 1.05rem; }
  .stat-label { font-size: .5rem; margin-top: 2px; }

  /* Deleted rows */
  .task-row-deleted { background: repeating-linear-gradient(135deg,#f8f9fa,#f8f9fa 10px,#e9ecef 10px,#e9ecef 20px) !important; border-color: #ced4da !important; }
}

/* ── Filter bar on mobile ── */
@media (max-width: 575.98px) {
  .filter-bar { padding: 10px; }

  /* Filter panel on mobile: stack dept full-width, selects 2-per-row */
  #filterPanel > div:first-child { flex: 0 0 100%; }
  #filterPanel > div:first-child .btn-group { width: 100%; }
  #filterPanel > div:first-child .btn-group label { flex: 1; }
  #filterPanel > select.form-select-sm {
    flex: 1 1 calc(50% - 4px) !important;
    min-width: 120px;
    width: auto !important;
  }
}

/* ── Filter badge accent ── */
.bg-accent { background-color: var(--mw-accent) !important; }

/* ── Checklist cell ── */
.task-cl-cell { white-space: nowrap; }
.task-cl-count { font-size: .78rem; display: inline-flex; align-items: center; gap: 3px; }

/* ── Project header meta: stack on mobile ── */
@media (max-width: 575.98px) {
  .project-meta-line > span { margin-left: 0 !important; display: block; }
  .project-meta-line { display: flex; flex-direction: column; gap: 2px; }

  /* Stats badges: a bit smaller */
  .card .d-flex.flex-wrap.gap-2 .badge { font-size: .7rem; padding: .22rem .42rem; }
}

/* ── Task Add/Edit Modal grid ── */
.task-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.task-form-col {
  padding: 20px 24px 24px;
}

.task-form-left {
  border-right: 1px solid var(--mw-border);
}

.task-form-full {
  grid-column: 1 / -1;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--mw-border);
}

.task-form-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: .95rem;
  margin-bottom: 18px;
  color: var(--mw-text);
}

.task-form-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--mw-accent);
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* Checklist empty state */
.task-checklist-empty {
  text-align: center;
  padding: 12px 0 16px;
  color: #c8cfd8;
  font-size: 1.5rem;
  letter-spacing: 6px;
}
.task-checklist-empty > div {
  letter-spacing: 0;
  font-size: .85rem;
  color: var(--mw-muted);
  margin-top: 4px;
}

@media (max-width: 767px) {
  .task-form-grid { grid-template-columns: 1fr; }
  .task-form-left { border-right: none; border-bottom: 1px solid var(--mw-border); }
  .task-form-col  { padding: 16px; }
  .task-form-full { padding: 14px 16px 18px; }
}

/* ── Checklist ── */
.checklist-edit-row input[type="text"] { flex: 1; }
.checklist-view-item .form-check-input:checked { background-color: var(--mw-accent); border-color: var(--mw-accent); }
.checklist-view-item label { cursor: pointer; user-select: none; }

/* ── Floating Help Button (FAB) ── */
.ym-help-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--mw-accent);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.35rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.28);
  z-index: 1039;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s ease, box-shadow .15s ease;
}
.ym-help-fab:hover,
.ym-help-fab:focus {
  transform: scale(1.1);
  box-shadow: 0 6px 22px rgba(0,0,0,.35);
  outline: none;
}
@media (max-width: 575.98px) {
  .ym-help-fab { display: none; }  /* hidden on mobile — offcanvas panel would take full screen */
}

/* ── Help Offcanvas ── */
#helpPanel .offcanvas-body { overflow: hidden; }
#helpPanelContent ul  { padding-left: 1.2rem; }
#helpPanelContent li  { margin-bottom: .35rem; }
#helpPanelContent p   { margin-bottom: .5rem; }
#helpPanelContent code { font-size: .82em; background: #f0f0f0; padding: 0 3px; border-radius: 3px; }
