/* My work — crew self-service (phone-first) */
#nav-section-my-work .nav-item { position: relative; }

.mw-root { display: flex; flex-direction: column; gap: 0.75rem; min-width: 0; }
.mw-links { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.mw-tabs {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--border, rgba(148, 163, 184, 0.25));
  scroll-snap-type: x proximity;
}
.mw-tabs::-webkit-scrollbar { display: none; }
.mw-tab {
  flex: 0 0 auto;
  scroll-snap-align: start;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.9rem;
  min-height: var(--tap-min, 44px);
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-secondary, #94a3b8);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.mw-tab.active { color: var(--text-primary, #f8fafc); border-bottom-color: var(--primary, #38bdf8); }
.mw-tab:focus-visible { outline: 2px solid var(--primary, #38bdf8); outline-offset: -2px; }
.mw-tab-count {
  min-width: 1.25rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: var(--warning, #f59e0b);
  color: #111;
  font-size: 0.7rem;
  text-align: center;
}
.mw-panel { padding: 1rem; min-width: 0; }
.mw-loading { padding: 2rem; }
.mw-empty { color: var(--text-secondary, #94a3b8); padding: 1rem 0; margin: 0; }
.mw-error { display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-start; color: var(--danger, #f87171); }
.mw-error p { margin: 0; }

/* Shared building blocks for tab content */
.mw-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; margin-bottom: 0.75rem; }
.mw-head h2, .mw-head h3 { margin: 0; font-size: 1.05rem; }
.mw-sub { color: var(--text-secondary, #94a3b8); font-size: 0.85rem; margin: 0.25rem 0 0; }
.mw-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.mw-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.mw-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border, rgba(148, 163, 184, 0.25));
  border-radius: 10px;
  background: var(--bg-secondary, rgba(15, 23, 42, 0.4));
}
.mw-item-main { flex: 1 1 12rem; min-width: 0; }
.mw-item-title { font-weight: 600; overflow-wrap: anywhere; }
.mw-item-meta { color: var(--text-secondary, #94a3b8); font-size: 0.82rem; margin-top: 0.15rem; overflow-wrap: anywhere; }
.mw-item-side { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.mw-pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(148, 163, 184, 0.18);
  color: var(--text-primary, #f8fafc);
  white-space: nowrap;
}
.mw-pill-ok { background: rgba(34, 197, 94, 0.18); color: #4ade80; }
.mw-pill-warn { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
.mw-pill-bad { background: rgba(239, 68, 68, 0.18); color: #f87171; }
.mw-pill-info { background: rgba(56, 189, 248, 0.18); color: #7dd3fc; }
.mw-section { margin-top: 1.25rem; }
.mw-section:first-child { margin-top: 0; }
.mw-section-title { font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-secondary, #94a3b8); margin: 0 0 0.5rem; }
.mw-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: 0.5rem; }
.mw-stat { padding: 0.65rem 0.75rem; border-radius: 10px; background: var(--bg-secondary, rgba(15, 23, 42, 0.4)); border: 1px solid var(--border, rgba(148, 163, 184, 0.25)); }
.mw-stat-value { font-size: 1.25rem; font-weight: 700; }
.mw-stat-label { font-size: 0.75rem; color: var(--text-secondary, #94a3b8); }
.mw-form { display: flex; flex-direction: column; gap: 0.75rem; }
.mw-field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.mw-field > span { font-size: 0.82rem; font-weight: 600; }
.mw-field em { color: var(--danger, #f87171); font-style: normal; }
.mw-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.mw-row > .mw-field { flex: 1 1 9rem; }
.mw-form textarea { font-family: inherit; resize: vertical; }
.mw-form-error { color: var(--danger, #f87171); margin: 0; font-size: 0.85rem; }
.mw-notice { padding: 0.65rem 0.75rem; border-radius: 10px; font-size: 0.85rem; background: rgba(56, 189, 248, 0.1); border: 1px solid rgba(56, 189, 248, 0.3); }
.mw-notice-warn { background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.35); }
.mw-notice-bad { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.35); }

/* Hours of rest */
.hor-layout { display: grid; grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.hor-month-head, .hor-datebar { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; }
.hor-date { text-align: center; flex: 1 1 auto; }
.hor-nav { min-width: 2.75rem; font-size: 1.1rem; line-height: 1; }
.hor-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.25rem; }
.hor-cal-dow { text-align: center; font-size: 0.7rem; color: var(--text-secondary, #94a3b8); }
.hor-day {
  position: relative;
  aspect-ratio: 1;
  min-height: 2.4rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-secondary, #94a3b8);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hor-day.hor-s-pending { background: rgba(180, 83, 83, 0.28); color: var(--text-primary, #f8fafc); }
.hor-day.hor-s-done, .hor-day.hor-s-locked_recorded { background: rgba(34, 197, 94, 0.33); color: var(--text-primary, #f8fafc); }
.hor-day.hor-s-locked { opacity: 0.75; }
.hor-day.hor-ring-sea { box-shadow: inset 0 0 0 2px rgba(56, 189, 248, 0.7); }
.hor-day.hor-ring-port { box-shadow: inset 0 0 0 2px rgba(245, 158, 11, 0.75); }
.hor-day.hor-today span { text-decoration: underline; font-weight: 700; }
.hor-day.hor-sel { border-color: var(--primary, #38bdf8); outline: 2px solid var(--primary, #38bdf8); outline-offset: 1px; }
.hor-lock { position: absolute; top: 1px; right: 2px; font-size: 0.55rem; font-style: normal; }
.hor-idl { position: absolute; bottom: 1px; right: 3px; font-size: 0.55rem; font-style: normal; }
.hor-month-foot { font-size: 0.78rem; }
.hor-occ { margin-bottom: 0.5rem; }
.hor-comments { margin: 0.35rem 0 0; padding-left: 1.1rem; }
.hor-day-panel { display: flex; flex-direction: column; gap: 0.6rem; min-width: 0; }
.hor-grid { display: flex; flex-direction: column; gap: 0.5rem; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.hor-hours { display: grid; grid-template-columns: repeat(6, 1fr); font-size: 0.68rem; color: var(--text-secondary, #94a3b8); margin-bottom: 2px; }
.hor-cells { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; }
.hor-cells .hor-cell:nth-child(2n) { margin-right: 2px; }
.hor-cell {
  height: 2.75rem;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--border, rgba(148, 163, 184, 0.25));
  border-radius: 4px;
  background: var(--bg-card, rgba(30, 41, 59, 0.6));
  cursor: pointer;
}
.hor-readonly .hor-cell { cursor: default; opacity: 0.8; }
.hor-c-work { background: var(--primary, #38bdf8) !important; border-color: transparent !important; }
.hor-c-manager-edit { background: #14b8a6 !important; border-color: transparent !important; }
.hor-c-assigned { background: rgba(148, 163, 184, 0.45) !important; }
.hor-c-future { background: rgba(148, 163, 184, 0.2) !important; opacity: 0.35; cursor: not-allowed !important; }
.hor-c-empty { background: var(--bg-card, rgba(30, 41, 59, 0.6)); }
.hor-cell:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.hor-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; font-size: 0.78rem; color: var(--text-secondary, #94a3b8); }
.hor-legend i { display: inline-block; width: 0.9rem; height: 0.9rem; border-radius: 3px; margin-right: 0.3rem; vertical-align: -2px; border: 1px solid var(--border, rgba(148, 163, 184, 0.25)); }
.hor-confirm { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.hor-confirm .btn { flex: 1 1 10rem; }
.hor-confirmed { color: #4ade80 !important; border-color: rgba(34, 197, 94, 0.5) !important; }
@media (max-width: 900px) {
  .hor-layout { grid-template-columns: minmax(0, 1fr); }
}

/* Signature pad */
.mw-sig { display: flex; flex-direction: column; gap: 0.4rem; }
.mw-sig canvas {
  width: 100%;
  height: 160px;
  border-radius: 10px;
  border: 1px dashed var(--border, rgba(148, 163, 184, 0.45));
  background: #fff;
  touch-action: none;
  cursor: crosshair;
}
.mw-sig-actions { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--text-secondary, #94a3b8); }

/* Sheets (dialogs used by tabs) */
.mw-sheet .modal { width: min(560px, 100%); }
.mw-sheet .modal-body { overflow-y: auto; }
.mw-sheet-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border, rgba(148, 163, 184, 0.25));
}

/* Familiarisation */
.fam-video { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #000; margin-bottom: 0.75rem; }
.fam-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.fam-item { border: 1px solid var(--border, rgba(148, 163, 184, 0.25)); border-radius: 10px; padding: 0.65rem 0.75rem; margin: 0; }
.fam-item legend { font-weight: 600; font-size: 0.9rem; padding: 0 0.25rem; }
.fam-check { display: flex; align-items: flex-start; gap: 0.6rem; cursor: pointer; }
.fam-check input, .fam-yesno input { width: 1.2rem; height: 1.2rem; flex: 0 0 auto; margin-top: 0.1rem; accent-color: var(--primary, #3b82f6); }
.fam-yesno { display: flex; gap: 1.25rem; margin-top: 0.4rem; }
.fam-yesno label { display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; }
.fam-ref { font-size: 0.8rem; margin-left: 0.25rem; }
.fam-progress { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-secondary, #94a3b8); }
.fam-bar { width: 100%; height: 6px; margin: 0.35rem 0 0.75rem; accent-color: var(--primary, #3b82f6); }
.fam-page-title { margin: 0 0 0.5rem; font-size: 1rem; }

/* Contracts */
.ct-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; }
.ct-frame { width: 100%; height: min(65vh, 720px); border: 1px solid var(--border, rgba(148, 163, 184, 0.25)); border-radius: 10px; background: #fff; }

/* Leave & HR */
.hr-dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 0.9rem; margin: 0 0 0.75rem; }
.hr-dl dt { color: var(--text-secondary, #94a3b8); font-size: 0.85rem; }
.hr-dl dd { margin: 0; overflow-wrap: anywhere; }
.hr-past > summary, details.mw-section > summary { cursor: pointer; padding: 0.4rem 0; font-weight: 600; }
.hr-thread { display: flex; flex-direction: column; gap: 0.45rem; margin: 0.5rem 0 0.75rem; }
.hr-msg { max-width: 85%; padding: 0.5rem 0.7rem; border-radius: 10px; background: var(--bg-secondary, rgba(15, 23, 42, 0.4)); }
.hr-msg-me { align-self: flex-end; background: rgba(59, 130, 246, 0.18); }
.hr-msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.hr-conduct { border: 1px solid rgba(245, 158, 11, 0.35); background: rgba(245, 158, 11, 0.06); border-radius: 12px; padding: 0.75rem; margin-bottom: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }
.hr-step { border: 1px solid var(--border, rgba(148, 163, 184, 0.25)); border-radius: 10px; padding: 0.6rem 0.7rem; }
.hr-step p { margin: 0.25rem 0 0; }
.hr-step-current { border-color: rgba(245, 158, 11, 0.5); }

/* Calendar */
.cal-nav { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal-wd { text-align: center; font-size: 0.72rem; color: var(--text-secondary, #94a3b8); padding: 0.2rem 0; }
.cal-day {
  position: relative;
  min-height: 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.3rem 0.15rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--bg-secondary, rgba(15, 23, 42, 0.4));
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.cal-day:hover { border-color: var(--border, rgba(148, 163, 184, 0.45)); }
.cal-out { opacity: 0.45; }
.cal-today .cal-num { color: var(--primary, #3b82f6); font-weight: 700; }
.cal-sel { border-color: var(--primary, #3b82f6); box-shadow: 0 0 0 1px var(--primary, #3b82f6) inset; }
.cal-num { font-size: 0.85rem; }
.cal-dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; }
.cal-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; vertical-align: middle; }
.cal-k-assignment { background: #3b82f6; }
.cal-k-leave { background: #f59e0b; }
.cal-k-holiday { background: #a855f7; }
.cal-k-availability { background: #22c55e; }
.cal-k-event { background: #94a3b8; }
.cal-port { position: absolute; top: 2px; right: 4px; font-size: 0.65rem; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; margin-top: 0.5rem; font-size: 0.75rem; color: var(--text-secondary, #94a3b8); }
.cal-legend span { display: inline-flex; align-items: center; gap: 0.3rem; }

/* Internal training */
.itr-text { white-space: normal; overflow-wrap: anywhere; line-height: 1.5; margin-bottom: 0.75rem; }
.itr-media { display: block; width: 100%; max-height: 60vh; object-fit: contain; border-radius: 10px; background: #000; margin-bottom: 0.75rem; }
.itr-q { border: 1px solid var(--border, rgba(148, 163, 184, 0.25)); border-radius: 10px; padding: 0.65rem 0.75rem; margin: 0; }
.itr-q legend { font-weight: 600; font-size: 0.92rem; padding: 0 0.25rem; }
.itr-opt { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.55rem 0.4rem; min-height: var(--tap-min, 44px); border-radius: 8px; cursor: pointer; }
.itr-opt:has(input:checked) { background: rgba(59, 130, 246, 0.14); }
.itr-opt input { width: 1.2rem; height: 1.2rem; flex: 0 0 auto; margin-top: 0.1rem; accent-color: var(--primary, #3b82f6); }
.itr-result { text-align: center; padding: 1.5rem 1rem; border-radius: 12px; }
.itr-result h4 { margin: 0 0 0.35rem; font-size: 1.3rem; }
.itr-pass { background: rgba(34, 197, 94, 0.12); border: 1px solid rgba(34, 197, 94, 0.4); }
.itr-fail { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.35); }

/* Crew shop */
.shop-chips { display: flex; gap: 0.4rem; overflow-x: auto; padding-bottom: 0.25rem; margin-bottom: 0.75rem; scrollbar-width: thin; }
.shop-chip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border, rgba(148, 163, 184, 0.35));
  background: transparent;
  color: var(--text-secondary, #94a3b8);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  text-transform: capitalize;
}
.shop-chip.active { background: var(--primary, #3b82f6); border-color: transparent; color: #fff; }
.shop-views { margin-bottom: 1rem; }
.shop-views .shop-chip { text-transform: none; }
.shop-out { opacity: 0.55; }
.shop-step { display: inline-flex; align-items: center; gap: 0.5rem; }
.shop-step span { min-width: 1.5rem; text-align: center; font-weight: 600; }
.shop-step .btn { flex: 0 0 auto !important; min-width: 2.5rem; }
.shop-basket-bar { position: sticky; bottom: 0; padding: 0.75rem 0 calc(0.25rem + env(safe-area-inset-bottom, 0px)); background: linear-gradient(to top, var(--bg-card, rgba(30, 41, 59, 0.95)) 70%, transparent); }
.shop-basket-bar .btn { width: 100%; }
.shop-total { display: flex; justify-content: space-between; font-size: 1rem; margin: 0.75rem 0; }
.shop-owed { color: var(--danger, #f87171); }
.shop-root .mw-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.shop-root .mw-stats + .mw-actions { margin-top: 0.6rem; }

/* To read / suggestions */
.docs-rich { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; padding: 0.75rem; border-radius: 10px; background: var(--bg-secondary, rgba(15, 23, 42, 0.4)); margin-bottom: 0.75rem; }
.docs-ack { margin-top: 0.75rem; padding: 0.65rem 0.75rem; border-radius: 10px; border: 1px solid var(--border, rgba(148, 163, 184, 0.25)); }
.sg-desc { white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 768px) {
  .mw-panel { padding: 0.75rem; border-radius: 12px; }
  .mw-links .mw-link { flex: 1 1 calc(50% - 0.5rem); }
  .mw-sheet.modal-overlay .modal { height: 100dvh; max-height: 100dvh; display: flex; flex-direction: column; }
  .mw-sheet .modal-body { flex: 1 1 auto; }
  .mw-sheet-footer { padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px)); }
  .mw-sheet-footer .btn { flex: 1 1 0; justify-content: center; text-align: center; }
}

@media (max-width: 480px) {
  .mw-item-side { width: 100%; }
  .mw-item-side .btn { flex: 1 1 auto; justify-content: center; text-align: center; }
}

@media (pointer: coarse) {
  .mw-root .btn, .mw-sheet .btn { min-height: var(--tap-min, 44px); }
}
