:root,
[data-theme="midnight"] {
  color-scheme: dark;
  --bg: #071120;
  --panel: #0d1b2c;
  --panel-soft: #10243a;
  --ink: #eaf6ff;
  --muted: #8aa4b8;
  --line: #1e3c59;
  --line-dark: #2d6385;
  --brand: #00c8ff;
  --brand2: #00e6a8;
  --navy: #081426;
  --blue: #28a7ff;
  --amber: #ffad33;
  --red: #ff4568;
  --green: #00e6a8;
  --purple: #8e6cff;
  --input-bg: #081524;
  --row-hover: rgba(0, 200, 255, .055);
  --shadow: 0 18px 45px rgba(0, 0, 0, .28);
}

[data-theme="ocean"] {
  color-scheme: dark;
  --bg: #071b1f;
  --panel: #0c222b;
  --panel-soft: #11313b;
  --ink: #e9fffb;
  --muted: #8bbab4;
  --line: #1c4a55;
  --line-dark: #2a6b75;
  --brand: #00d1c1;
  --brand2: #26eaa6;
  --navy: #06212b;
  --blue: #25b7ff;
  --amber: #ffb33d;
  --red: #ff5573;
  --green: #00e5a8;
  --purple: #9a7cff;
  --input-bg: #07171e;
  --row-hover: rgba(0, 209, 193, .06);
  --shadow: 0 18px 45px rgba(0, 0, 0, .24);
}

[data-theme="paper"],
[data-theme="frost"],
[data-theme="harbor-light"] {
  color-scheme: light;
  --bg: #edf5f9;
  --panel: #ffffff;
  --panel-soft: #f3f9fc;
  --ink: #092236;
  --muted: #526b7c;
  --line: #c7dce8;
  --line-dark: #8fb7c9;
  --brand: #008db5;
  --brand2: #00b893;
  --navy: #082238;
  --blue: #0f76b7;
  --amber: #c47a00;
  --red: #e43b5a;
  --green: #008c72;
  --purple: #6957d9;
  --input-bg: #f8fcff;
  --row-hover: rgba(0, 141, 181, .06);
  --shadow: 0 14px 34px rgba(17, 54, 74, .12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--brand2) 13%, transparent), transparent 28%),
    linear-gradient(135deg, var(--bg), color-mix(in srgb, var(--panel-soft) 40%, var(--bg)) 52%, var(--bg));
  color: var(--ink);
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 14px;
}

button, input, select, textarea { font-family: inherit; }
h1, h2, h3, .eyebrow, .kpi-card, .tab { font-family: "Rajdhani", "Segoe UI", sans-serif; }

.topbar {
  height: 66px;
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 22px;
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand img {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  object-fit: cover;
}

.brand-name {
  color: var(--brand);
  font-size: 27px;
  font-weight: 800;
  letter-spacing: 4px;
}

.brand-sub {
  color: #6f7e84;
  font-size: 18px;
  letter-spacing: 3px;
  border-left: 1px solid var(--line);
  padding-left: 12px;
}

.topnav, .hero-actions, .button-row, .board-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.navlink {
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  padding: 8px 11px;
  border-radius: 10px;
}

.navlink:hover { background: #e9f7f3; color: var(--brand); }

.app-shell {
  width: min(1880px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 14px 0 28px;
}

body.crew-workstation .app-shell {
  width: 100%;
  max-width: none;
  min-height: calc(100vh - 66px);
  padding: 10px 12px 18px;
}

body.crew-workstation .hero,
body.crew-workstation .tabs,
body.crew-workstation .kpi-grid,
body.crew-workstation .workspace {
  width: 100%;
}

body.crew-workstation .hero {
  border-radius: 14px;
  padding: 11px 14px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(217, 249, 243, .92), rgba(255, 255, 255, .96)),
    var(--panel);
  box-shadow: var(--shadow);
}

.eyebrow {
  display: block;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.9px;
  text-transform: uppercase;
}

h1, h2 { margin: 0; line-height: 1; }

h1 {
  margin-top: 3px;
  font-size: 29px;
  letter-spacing: .3px;
}

h2 { font-size: 22px; }

p { margin: 6px 0 0; color: #53736e; line-height: 1.35; }

.btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 12px;
  padding: 9px 13px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-decoration: none;
  white-space: nowrap;
  min-height: 38px;
}

.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { border-color: transparent; background: linear-gradient(135deg, var(--brand), var(--brand2)); color: #fff; }
.btn.danger { color: var(--red); border-color: #ffc1cb; background: #fff7f9; }
.btn.ghost { background: #f7fbfa; }
.btn.small { padding: 6px 10px; min-height: 32px; font-size: 13px; }
.btn.grow { flex: 1; }
.btn.full { width: 100%; margin-top: 12px; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(100px, 1fr));
  gap: 7px;
  margin: 8px 0;
}

.kpi-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 11px;
  box-shadow: var(--shadow);
}

.kpi-card strong {
  display: block;
  color: var(--brand);
  font-family: "JetBrains Mono", monospace;
  font-size: 23px;
  line-height: 1;
}

.kpi-card span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.kpi-card.green strong { color: var(--green); }
.kpi-card.amber strong { color: var(--amber); }
.kpi-card.red strong { color: var(--red); }

.crew-command-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}

.crew-command-card {
  display: grid;
  gap: 6px;
  min-height: 112px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--panel) 95%, var(--brand)), var(--panel-soft));
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.crew-command-card i {
  color: var(--brand);
  font-size: 20px;
}

.crew-command-card span {
  font-size: 17px;
  font-weight: 900;
}

.crew-command-card small {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.25;
}

.crew-command-card:hover {
  border-color: var(--brand);
  transform: translateY(-1px);
}

.document-watch-panel {
  margin: 0 0 8px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.document-watch-panel.collapsed .document-watch-list {
  display: none;
}

.document-watch-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 8px;
}

.document-watch-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 6px 10px;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-soft);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.document-watch-item:hover {
  border-color: var(--brand);
  box-shadow: 0 8px 20px rgba(11, 130, 155, .12);
}

.document-watch-item strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.document-watch-item small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-weight: 700;
}

.document-watch-empty {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-weight: 800;
}

.doc-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  padding: 7px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.tab {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 8px 14px;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.tab.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.vessel-filter-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 92%, var(--brand));
  box-shadow: var(--shadow);
}

.vessel-filter-panel strong {
  display: block;
  margin-top: 2px;
  font-size: 19px;
  color: var(--ink);
}

.vessel-button-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.vessel-scope-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  background: color-mix(in srgb, var(--panel) 86%, var(--ink));
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.vessel-scope-btn span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 24px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand) 18%, transparent);
  color: var(--brand);
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
}

.vessel-scope-btn strong {
  font-size: 13px;
  white-space: nowrap;
}

.vessel-scope-btn.active {
  border-color: var(--brand);
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 24%, var(--panel)), color-mix(in srgb, var(--brand2) 16%, var(--panel)));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}

.view { display: none; }
.view.active { display: block; }

.workspace {
  display: grid;
  gap: 12px;
}

.planning-layout, .register-layout, .docs-layout {
  grid-template-columns: 390px minmax(0, 1fr);
}

body.crew-workstation .planning-layout,
body.crew-workstation .register-layout,
body.crew-workstation .docs-layout {
  grid-template-columns: minmax(0, 1fr);
}

.side-panel, .main-panel {
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 15px;
  min-width: 0;
}

.entry-panel {
  display: none;
}

.entry-panel.open {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 4100;
  display: block;
  width: min(760px, calc(100vw - 28px));
  max-height: min(86vh, 900px);
  overflow: auto;
  transform: translate(-50%, -50%);
  border-color: var(--brand);
  box-shadow: 0 28px 110px rgba(0, 0, 0, .55);
}

body.crew-entry-open::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 4090;
  background: rgba(2, 10, 18, .68);
  backdrop-filter: blur(5px);
}

body.crew-entry-open {
  overflow: hidden;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.board-head { align-items: center; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: #718984;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.1px;
  text-transform: uppercase;
}

.field.wide { grid-column: 1 / -1; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f8fcfb;
  color: var(--ink);
  padding: 10px 11px;
  font-size: 15px;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 155, 134, .13);
}

textarea { min-height: 78px; resize: vertical; }

.help-text {
  margin-top: 12px;
  padding: 10px 11px;
  background: #f1fbf8;
  border: 1px dashed #a9d3ca;
  border-radius: 12px;
  font-size: 13px;
}

.notice {
  display: none;
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid #90e1d3;
  border-radius: 14px;
  background: #edfffb;
  color: #006b5f;
  font-weight: 800;
}

.notice.show { display: block; }
.notice.err { border-color: #ffc1cb; background: #fff2f5; color: #bd243f; }

.board-filters, .table-filters {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.board-filters { grid-template-columns: 1.6fr .95fr .95fr .75fr .75fr auto auto; }
.table-filters { grid-template-columns: 1.5fr .8fr .8fr .8fr auto auto; }
.table-filters.docs { grid-template-columns: 1.4fr .8fr .8fr .8fr .8fr auto auto; }

.scale-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f1fbf8;
  color: var(--brand);
  padding: 7px 12px;
  min-width: 92px;
  text-align: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  font-weight: 800;
}

.board-help {
  margin-bottom: 10px;
  color: #5d7773;
  background: #f7fbfa;
  border: 1px dashed #b8d6cf;
  border-radius: 13px;
  padding: 9px 11px;
  font-size: 13px;
}

.rotation-board {
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  max-height: 72vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.board-left {
  position: sticky;
  left: 0;
  z-index: 12;
  background: #fff;
  box-shadow: 12px 0 24px rgba(5, 50, 60, .09);
}

.board-time {
  position: relative;
  min-width: 0;
}

.board-top-left, .day-header {
  position: sticky;
  top: 0;
  z-index: 15;
  height: 58px;
  background: linear-gradient(135deg, #e4eeee, #f8fbfa);
  border-bottom: 1px solid var(--line-dark);
}

.board-top-left {
  display: flex;
  align-items: center;
  padding: 0 13px;
  color: #5d7773;
  font-weight: 900;
  letter-spacing: 1.3px;
  text-transform: uppercase;
}

.day-header {
  display: grid;
}

.day-cell {
  border-left: 1px solid #cadbd7;
  padding-top: 6px;
  color: #5d7773;
  text-align: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  line-height: 1.25;
}

.day-cell strong {
  display: block;
  color: #13383d;
  font-size: 12px;
}

.day-cell.today {
  background: linear-gradient(180deg, #fff1f5, #ffdfe8);
  color: var(--red);
  font-weight: 900;
}

.day-cell.weekend { background: #f7ecef; }

.vessel-band-left, .vessel-band-time {
  height: 38px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #a7cbc3;
  background: linear-gradient(135deg, #06262f, #0d5260);
  color: #fff;
  font-weight: 900;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.vessel-band-left { padding: 0 13px; }
.vessel-band-left small {
  margin-left: 8px;
  color: #9ff1e5;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
}
.vessel-band-time { padding: 0 12px; width: 100%; }

.rank-row-left {
  height: var(--rowH);
  border-bottom: 1px solid #d6e5e1;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}

.rank-main {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.rank-main strong { font-size: 17px; }

.rank-count {
  font-family: "JetBrains Mono", monospace;
  color: var(--brand);
  font-weight: 900;
}

.rank-people {
  color: #5d7773;
  font-size: 12px;
  line-height: 1.25;
}

.rank-tags { display: flex; gap: 5px; flex-wrap: wrap; }

.tag {
  border: 1px solid #cfe1dd;
  border-radius: 999px;
  padding: 2px 7px;
  background: #fff;
  color: #58736f;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .7px;
  text-transform: uppercase;
}

.tag.green { border-color: #90e7d6; background: #eafff8; color: var(--green); }
.tag.amber { border-color: #ffd892; background: #fff8e8; color: var(--amber); }

.rank-track {
  height: var(--rowH);
  position: relative;
  border-bottom: 1px solid #d6e5e1;
  background: repeating-linear-gradient(90deg, #fff 0, #fff var(--dayW), #edf3f1 var(--dayW), #edf3f1 calc(var(--dayW) + 1px));
}

.rank-track:nth-child(even) {
  background: repeating-linear-gradient(90deg, #fbfdfc 0, #fbfdfc var(--dayW), #edf3f1 var(--dayW), #edf3f1 calc(var(--dayW) + 1px));
}

.crew-bar {
  position: absolute;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, .42);
  border-radius: 13px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 18px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  box-shadow: 0 9px 22px rgba(0, 0, 0, .18);
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.crew-bar:active { cursor: grabbing; }
.crew-bar.dragging, .crew-bar.resizing { z-index: 20; filter: saturate(1.2); box-shadow: 0 14px 36px rgba(0, 0, 0, .28); }
.crew-bar.vessel { background: linear-gradient(135deg, #008f7c, #00c7a6); }
.crew-bar.stand_by { background: linear-gradient(135deg, #c47a00, #ffc75a); color: #132521; }
.crew-bar.vacation { background: linear-gradient(135deg, #0f76b7, #5bc8ff); }
.crew-bar.training, .crew-bar.medical { background: linear-gradient(135deg, #6957d9, #9c8cff); }
.crew-bar.banned { background: linear-gradient(135deg, #e43b5a, #ff7d95); }
.crew-bar.travel, .crew-bar.office, .crew-bar.no_info { background: linear-gradient(135deg, #728984, #a8bbb6); }

.bar-person {
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-chip {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, .24);
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
}

.bar-handle {
  position: absolute;
  top: 0;
  width: 10px;
  height: 100%;
  background: rgba(255, 255, 255, .25);
  cursor: ew-resize;
}

.bar-handle.left { left: 0; border-radius: 13px 0 0 13px; }
.bar-handle.right { right: 0; border-radius: 0 13px 13px 0; }

.today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 2px dashed var(--red);
  z-index: 10;
  pointer-events: none;
}

.today-line span {
  position: sticky;
  top: 6px;
  display: inline-block;
  transform: translateX(-50%);
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .8px;
  text-transform: uppercase;
}

.empty {
  padding: 34px;
  color: var(--muted);
  text-align: center;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 15px;
}

.data-table {
  width: 100%;
  min-width: 1100px;
  border-collapse: collapse;
  background: #fff;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #d7e1df;
  color: #6a827d;
  padding: 10px;
  text-align: left;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.data-table td {
  border-top: 1px solid #adc2bf;
  padding: 9px 10px;
  vertical-align: middle;
}

.data-table tr:hover td { background: #f3fbf8; }

.data-table tr.row-flash td {
  animation: crewRowFlash 1.8s ease;
}

@keyframes crewRowFlash {
  0%, 100% { background: transparent; }
  18%, 70% { background: rgba(0, 194, 255, .18); }
}

.mono { font-family: "JetBrains Mono", monospace; font-weight: 700; }

.link-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  text-align: left;
  font: inherit;
}

.link-btn:hover {
  color: var(--accent);
  text-decoration: underline;
}

.strong-link {
  font-weight: 900;
}

.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  background: #f8fbfa;
  font-size: 12px;
  font-weight: 900;
}

.pill.green { border-color: #90e7d6; background: #eafff8; color: var(--green); }
.pill.amber { border-color: #ffd892; background: #fff8e8; color: var(--amber); }
.pill.red { border-color: #ffc1cb; background: #fff2f5; color: var(--red); }
.pill.gray { color: #687d79; }
.pill.soft { opacity: .78; }

.actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.fleet-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 10px;
}

.fleet-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px;
}

.fleet-card.active-scope {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent);
}

.fleet-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}

.fleet-card h3 {
  margin: 0 0 2px;
  font-size: 20px;
}

.fleet-rank-row {
  display: grid;
  grid-template-columns: minmax(120px, .9fr) minmax(150px, 1.2fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 7px 8px;
  margin-bottom: 5px;
}

.fleet-rank-row.doc-risk-row {
  border-color: color-mix(in srgb, var(--amber) 55%, var(--line));
  background: color-mix(in srgb, var(--amber) 7%, #fff);
}

.fleet-rank-row small,
.people-table small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.crew-person-card {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 900;
  cursor: pointer;
}

.crew-person-card:hover {
  color: var(--brand);
}

.fleet-person-cell {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.fleet-person-copy {
  min-width: 0;
}

.crew-list-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 36px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--brand) 34%, var(--line));
  border-radius: 9px;
  background: color-mix(in srgb, var(--brand) 10%, var(--panel-soft));
  color: var(--brand);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .4px;
  line-height: 1;
}

.crew-list-avatar img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
}

.people-search {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px 180px auto auto;
  gap: 10px;
  margin-bottom: 12px;
}

.people-table {
  min-width: 980px;
}

body.crew-fullscreen-active {
  overflow: hidden;
}

body.crew-profile-fullpage-active {
  overflow: hidden;
}

.fullscreen-target {
  min-width: 0;
}

.crew-fullscreen {
  position: fixed !important;
  inset: 76px 16px 16px;
  z-index: 3000;
  display: flex !important;
  flex-direction: column;
  overflow: hidden;
  padding: 16px;
  border-color: var(--brand) !important;
  background: var(--panel) !important;
  box-shadow: 0 28px 100px rgba(0, 0, 0, .42);
}

.crew-fullscreen::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(2, 10, 18, .66);
}

.crew-fullscreen .panel-head,
.crew-fullscreen .board-filters,
.crew-fullscreen .table-filters,
.crew-fullscreen .board-help {
  flex: 0 0 auto;
}

.crew-fullscreen .table-wrap,
.crew-fullscreen .rotation-board,
.crew-fullscreen .fleet-cards {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.crew-fullscreen .fleet-cards {
  align-content: start;
}

.crew-fullscreen .data-table {
  font-size: 16px;
}

.crew-fullscreen-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 13px;
  background: var(--navy);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

@media (max-width: 900px) {
  .crew-command-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .vessel-filter-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .vessel-button-strip {
    justify-content: flex-start;
  }

  .people-search,
  .fleet-rank-row {
    grid-template-columns: 1fr;
  }

  .report-mode-tabs {
    align-items: stretch;
    flex-direction: column;
  }

  .report-workflow {
    margin-left: 0;
  }

  .crew-report-header {
    flex-direction: column;
  }

  .crew-report-header strong {
    text-align: left;
  }
}

.crew-list-identity {
  display: grid;
  grid-template-rows: 36px 14px;
  width: 56px;
  min-width: 56px;
  justify-items: center;
  align-items: center;
  gap: 2px;
}

.appraisal-rating {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 24px;
  color: var(--warning);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.appraisal-rating.compact {
  gap: 1px;
  width: 56px;
  min-height: 14px;
  font-size: 9px;
  line-height: 1;
}

.appraisal-rating.compact > span {
  font-size: 9px;
}

.appraisal-rating.compact i {
  flex: 0 0 auto;
  line-height: 1;
}

.appraisal-rating.poor {
  color: var(--danger);
}

.appraisal-rating.poor i {
  font-size: 17px;
}

.appraisal-rating.poor.compact i {
  font-size: 13px;
}

.appraisal-rating.unrated {
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
}

.profile-evaluation-badge {
  display: grid;
  place-items: center;
  min-height: 30px;
  margin: -3px 0 8px;
}

.vessel-org-person .appraisal-rating {
  width: 100%;
  margin-top: 2px;
}

.appraisal-scale-note,
.evaluation-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}

.appraisal-scale-note span,
.evaluation-preview small {
  color: var(--text-secondary);
  font-size: 11px;
}

.evaluation-excel-workflow {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 9px 16px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  background: var(--panel-2);
}

.evaluation-excel-copy {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.evaluation-excel-copy > i {
  color: var(--accent);
  font-size: 22px;
}

.evaluation-excel-copy > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.evaluation-excel-copy small,
.evaluation-excel-status {
  color: var(--text-secondary);
  font-size: 10px;
}

.evaluation-excel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.evaluation-excel-actions .btn {
  min-height: 33px;
  margin: 0;
  white-space: nowrap;
}

.evaluation-excel-picker {
  cursor: pointer;
}

.visually-hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.evaluation-excel-status {
  grid-column: 1 / -1;
  min-height: 14px;
  overflow-wrap: anywhere;
}

.evaluation-excel-status.ready {
  color: var(--success);
  font-weight: 700;
}

.evaluation-excel-status.error {
  color: var(--danger);
  font-weight: 700;
}

.evaluation-excel-results {
  grid-column: 1 / -1;
  display: grid;
  gap: 4px;
  max-height: 220px;
  overflow: auto;
}

.evaluation-excel-results > div {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 5px 0;
  border-top: 1px solid var(--line);
  font-size: 11px;
}

.evaluation-excel-results small { color: var(--text-secondary); }

.evaluation-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0 8px;
}

.evaluation-history-head h3 { margin: 0; font-size: 15px; }

.evaluation-record {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card-hover);
  color: var(--text-primary);
  overflow: hidden;
}

.evaluation-record + .evaluation-record { margin-top: 8px; }

.evaluation-record > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 16px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.evaluation-record > summary::-webkit-details-marker,
.evaluation-entry > summary::-webkit-details-marker { display: none; }

.evaluation-record > summary:focus-visible,
.evaluation-entry > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.evaluation-record-title { display: grid; gap: 2px; min-width: 0; }
.evaluation-record-title strong { font-size: 14px; }
.evaluation-record-title > span { font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }
.evaluation-record-title small { color: var(--text-secondary); font-size: 11px; }
.evaluation-record-score { display: grid; justify-items: end; gap: 2px; }
.evaluation-record-score b { color: var(--text-primary); font-size: 12px; }
.evaluation-record-chevron { color: var(--text-secondary); font-size: 12px; transition: transform .2s; }
.evaluation-record[open] .evaluation-record-chevron { transform: rotate(180deg); }

.evaluation-record-body { padding: 14px; border-top: 1px solid var(--border); }
.evaluation-record-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.evaluation-record-meta > div { display: grid; gap: 3px; min-width: 0; }
.evaluation-record-meta span { color: var(--text-secondary); font-size: 11px; }
.evaluation-record-meta strong { font-size: 12px; overflow-wrap: anywhere; }
.evaluation-saved-group { margin-top: 18px; }
.evaluation-saved-group h4,
.evaluation-record-remarks h4 { margin: 0 0 8px; font-size: 13px; }
.evaluation-saved-group h4 span { margin-left: 6px; color: var(--text-secondary); font-size: 11px; font-weight: 500; }
.evaluation-saved-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px 14px; }
.evaluation-saved-criterion {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.evaluation-saved-code { color: var(--accent); font-weight: 800; }
.evaluation-saved-label { min-width: 0; overflow-wrap: anywhere; }
.evaluation-saved-criterion strong { font-size: 11px; white-space: nowrap; }
.evaluation-no-criteria { color: var(--text-secondary); font-size: 12px; }
.evaluation-record-remarks { margin-top: 18px; }
.evaluation-record-remarks p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.55; }
.evaluation-record-source {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.evaluation-record-source > div { display: grid; gap: 3px; min-width: 0; }
.evaluation-record-source strong { font-size: 12px; }
.evaluation-record-source span,
.evaluation-record-source small { color: var(--text-secondary); font-size: 11px; overflow-wrap: anywhere; }
.evaluation-entry { margin-top: 16px; border-top: 1px solid var(--border); }
.evaluation-entry > summary { padding: 14px 0; cursor: pointer; list-style: none; color: var(--text-primary); font-size: 13px; font-weight: 800; }
.evaluation-entry > summary i { color: var(--accent); margin-right: 7px; }
.evaluation-entry-body { padding-bottom: 10px; }

@media (max-width: 760px) {
  .evaluation-record > summary { grid-template-columns: minmax(0, 1fr) 16px; }
  .evaluation-record-score { grid-column: 1; grid-row: 2; justify-items: start; }
  .evaluation-record-chevron { grid-column: 2; grid-row: 1; }
  .evaluation-record-meta, .evaluation-saved-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .evaluation-saved-grid { grid-template-columns: minmax(0, 1fr); }
  .evaluation-record-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .evaluation-record-source { align-items: flex-start; flex-direction: column; }
}

.evaluation-criteria {
  display: grid;
  gap: 12px;
  margin: 12px 0;
}

.evaluation-criterion-group {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.evaluation-criterion-group > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}

.evaluation-criterion-group h3 {
  margin: 1px 0 0;
  font-size: 14px;
}

.evaluation-criterion-group header small {
  color: var(--text-secondary);
  text-align: right;
}

.evaluation-criterion-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.evaluation-criterion {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  align-items: center;
  gap: 10px;
  min-height: 47px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
}

.evaluation-criterion:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.evaluation-criterion > span {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.evaluation-criterion > span b {
  color: var(--accent);
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
}

.evaluation-criterion > span span {
  overflow-wrap: anywhere;
  font-size: 11px;
  line-height: 1.15;
}

.evaluation-criterion select {
  width: 100%;
  min-height: 32px;
  font-size: 11px;
}

.evaluation-preview > div {
  display: grid;
  gap: 2px;
}

.evaluation-preview > div > span {
  color: var(--text-secondary);
  font-size: 10px;
  text-transform: uppercase;
}

@media (max-width: 760px) {
  .evaluation-criterion-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .evaluation-criterion:nth-child(odd) {
    border-right: 0;
  }

  .evaluation-criterion {
    grid-template-columns: minmax(0, 1fr) 118px;
  }

  .appraisal-scale-note,
  .evaluation-preview,
  .evaluation-criterion-group > header {
    align-items: flex-start;
    flex-direction: column;
  }

  .evaluation-criterion-group header small {
    text-align: left;
  }

  .evaluation-excel-workflow {
    grid-template-columns: minmax(0, 1fr);
  }

  .evaluation-excel-actions {
    justify-content: flex-start;
  }

  .evaluation-excel-actions .btn {
    flex: 1 1 130px;
  }
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(4, 18, 24, .52);
}

.modal.show { display: flex; }

.modal-card {
  width: min(560px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .28);
}

.right { justify-content: flex-end; margin-top: 12px; }

.profile-quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 8px;
  margin: 10px 0 12px;
}

.profile-mini-row,
.profile-doc-row {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.profile-mini-row + .profile-mini-row,
.profile-doc-row + .profile-doc-row {
  margin-top: 8px;
}

.profile-doc-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
}

.profile-doc-row.has-preview {
  cursor: zoom-in;
}

.profile-doc-row small,
.profile-mini-row small {
  display: block;
  color: var(--muted);
  font-weight: 700;
}

.profile-doc-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-preview-hint {
  color: var(--brand) !important;
  font-size: 10px;
  white-space: nowrap;
}

.small-empty {
  font-size: 13px;
}

.profile-modal {
  align-items: stretch;
}

.profile-modal.profile-full-page {
  padding: 0;
  background: rgba(4, 18, 24, .72);
}

.profile-modal .profile-card {
  width: min(1680px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 14px;
}

.profile-modal.profile-full-page .profile-card {
  width: 100vw;
  height: 100vh;
  max-height: none;
  border-radius: 0;
  padding: 16px;
}

.profile-modal .profile-head {
  position: sticky;
  top: 0;
  z-index: 4;
  margin: -14px -14px 0;
  border-radius: 20px 20px 0 0;
  padding: 13px 16px;
  background: linear-gradient(115deg, color-mix(in srgb, var(--brand) 14%, var(--panel)), var(--panel-soft));
  border-bottom: 1px solid var(--line);
}

.profile-modal.profile-full-page .profile-head {
  margin: -16px -16px 0;
  border-radius: 0;
}

.profile-head h2 {
  margin: 2px 0 0;
  font-size: clamp(22px, 2vw, 31px);
  line-height: 1.05;
}

.profile-head p {
  margin: 4px 0 0;
  font-size: 12px;
}

.profile-section-nav {
  position: sticky;
  top: 68px;
  z-index: 3;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: 0 -14px 12px;
  padding: 8px 14px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.profile-modal.profile-full-page .profile-section-nav {
  margin-inline: -16px;
  padding-inline: 16px;
}

.profile-section-nav button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--ink);
  font: 800 12px/1 "Inter", "Segoe UI", sans-serif;
  cursor: pointer;
}

.profile-section-nav button:hover,
.profile-section-nav button:focus-visible {
  border-color: var(--brand);
  color: var(--brand);
  outline: none;
}

.profile-grid {
  display: grid;
  grid-template-columns: 240px minmax(420px, 1.25fr) minmax(340px, .9fr);
  grid-template-areas:
    "summary summary summary"
    "photo personal personal"
    "rotation personal personal"
    "control control control"
    "contract wage wage"
    "docentry docentry docentry"
    "docs docs docs"
    "evaluation evaluation evaluation";
  gap: 12px;
  align-items: start;
}

.profile-modal.profile-full-page .profile-grid {
  grid-template-columns: 260px minmax(480px, 1.3fr) minmax(380px, 1fr);
}

.profile-wide {
  grid-column: 1 / -1;
}

.profile-box {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--navy) 7%, transparent);
}

.profile-summary-box { grid-area: summary; }
.profile-photo-box { grid-area: photo; }
.profile-personal-box { grid-area: personal; }
.profile-rotation-box { grid-area: rotation; }
.profile-document-control-box { grid-area: control; }
.profile-contract-box { grid-area: contract; }
.profile-wage-box { grid-area: wage; }
.profile-document-entry-box { grid-area: docentry; }
.profile-docs-box { grid-area: docs; }
.profile-evaluation-box { grid-area: evaluation; }

.profile-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: -2px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.profile-section-heading h3 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.05;
}

.profile-personal-heading {
  align-items: center;
}

.profile-personal-heading .profile-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-personal-heading .profile-meta > span {
  min-width: 124px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
}

.profile-personal-heading .profile-meta small,
.profile-personal-heading .profile-meta strong {
  display: block;
}

.profile-personal-heading .profile-meta small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .8px;
  text-transform: uppercase;
}

.profile-personal-heading .profile-meta strong {
  margin-top: 2px;
  color: var(--ink);
  font-size: 11px;
}

.profile-photo-box {
  align-self: start;
}

.profile-photo {
  width: 100%;
  aspect-ratio: 4 / 5;
  min-height: 0;
  max-height: 245px;
  border: 1px solid var(--line);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: color-mix(in srgb, var(--brand) 7%, var(--panel-soft));
  color: var(--brand);
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 2px;
}

.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-summary-grid,
.profile-control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.profile-summary-tile,
.profile-control-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 9px 10px;
  background: color-mix(in srgb, var(--panel-soft) 78%, var(--panel));
}

.profile-summary-tile span,
.profile-control-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.profile-summary-tile strong,
.profile-control-card strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 17px;
}

.profile-personal-box .form-grid,
.profile-document-entry-box .form-grid,
.profile-evaluation-box .form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.profile-personal-box textarea,
.profile-document-entry-box textarea,
.profile-evaluation-box textarea {
  min-height: 60px;
}

.profile-photo-box input[type="file"] {
  margin-top: 8px;
  padding: 7px;
  font-size: 11px;
}

.profile-photo-box .field {
  margin-top: 9px;
}

.profile-photo-box .btn.full {
  margin-top: 6px;
}

.profile-summary-tile small,
.profile-control-card small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 700;
}

.profile-box.profile-section-flash {
  animation: profileSectionFlash 1.8s ease;
}

@keyframes profileSectionFlash {
  0%, 100% { box-shadow: none; }
  18%, 70% { box-shadow: 0 0 0 3px rgba(0, 194, 255, .24), 0 12px 28px rgba(0, 138, 168, .16); }
}

.profile-drop-zone {
  min-height: 96px;
  border: 1.5px dashed var(--brand);
  border-radius: 15px;
  padding: 16px;
  display: grid;
  place-items: center;
  text-align: center;
  background: color-mix(in srgb, var(--brand) 8%, var(--panel-soft));
  cursor: pointer;
}

.profile-drop-zone strong {
  color: var(--brand);
  font-size: 17px;
}

.profile-drop-zone span,
.profile-drop-zone small {
  color: var(--muted);
  font-weight: 700;
}

.profile-drop-zone.drag-over {
  background: color-mix(in srgb, var(--brand2) 18%, var(--panel-soft));
  border-color: var(--brand2);
  transform: translateY(-1px);
}

.profile-doc-preview {
  position: fixed;
  z-index: 150;
  display: none;
  width: min(420px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 32px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .32);
  pointer-events: none;
}

.profile-doc-preview.show {
  display: block;
}

.profile-doc-preview-head {
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--brand) 9%, var(--panel));
}

.profile-doc-preview-head strong,
.profile-doc-preview-head small {
  display: block;
}

.profile-doc-preview-head small {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 800;
}

.profile-doc-preview-body {
  height: 360px;
  background: var(--panel-soft);
}

.profile-doc-preview-body img,
.profile-doc-preview-body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: contain;
  display: block;
}

.profile-doc-preview-file {
  height: 100%;
  display: grid;
  place-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 900;
  text-align: center;
}

.profile-doc-preview > a {
  display: block;
  padding: 10px 13px;
  border-top: 1px solid var(--line);
  color: var(--brand);
  font-weight: 900;
  pointer-events: auto;
}

.compact-head {
  padding: 9px 10px;
  margin: -4px -4px 10px;
  border-radius: 14px;
}

.evaluation-grid {
  margin-bottom: 10px;
}

@media (max-width: 1150px) {
  .profile-grid,
  .profile-modal.profile-full-page .profile-grid {
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-areas:
      "summary summary"
      "photo personal"
      "rotation personal"
      "control control"
      "contract wage"
      "docentry docentry"
      "docs docs"
      "evaluation evaluation";
  }

  .profile-personal-box .form-grid,
  .profile-document-entry-box .form-grid,
  .profile-evaluation-box .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .profile-grid,
  .profile-modal.profile-full-page .profile-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "summary"
      "photo"
      "personal"
      "rotation"
      "control"
      "contract"
      "wage"
      "docentry"
      "docs"
      "evaluation";
  }

  .profile-quick-actions,
  .profile-doc-row {
    grid-template-columns: 1fr;
  }

  .profile-personal-box .form-grid,
  .profile-document-entry-box .form-grid,
  .profile-evaluation-box .form-grid {
    grid-template-columns: 1fr;
  }

  .profile-personal-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-personal-heading .profile-meta {
    width: 100%;
  }

  .profile-personal-heading .profile-meta > span {
    flex: 1 1 0;
    min-width: 0;
  }

  .profile-section-nav {
    top: 94px;
  }

  .profile-photo {
    width: min(100%, 220px);
    max-height: none;
    margin-inline: auto;
  }
}

.report-layout {
  grid-template-columns: 1fr;
}

.report-mode-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: -4px 0 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-soft);
}

.report-jump {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 15px;
  color: var(--muted);
  background: var(--panel-soft);
  font-weight: 800;
  cursor: pointer;
}

.report-jump.active,
.report-jump:hover {
  color: #00131a;
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
}

.report-workflow {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.crew-report-preview {
  display: grid;
  gap: 16px;
}

.crew-report {
  display: grid;
  gap: 16px;
}

.crew-report-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 17px 18px;
  border-radius: 18px;
  color: #fff;
  background:
    radial-gradient(circle at 88% 18%, rgba(0, 230, 168, .18), transparent 32%),
    linear-gradient(135deg, color-mix(in srgb, var(--brand) 50%, #072234), #06263b);
  box-shadow: var(--shadow);
}

.crew-report-header span {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 2.5px;
}

.crew-report-header h1 {
  margin: 0 0 7px;
  font-size: clamp(24px, 2.4vw, 36px);
  line-height: 1;
}

.crew-report-header p {
  margin: 0;
  color: rgba(234, 246, 255, .78);
}

.crew-report-header strong {
  min-width: 100px;
  text-align: right;
  font-size: 38px;
  line-height: .9;
}

.crew-report-header strong small {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: rgba(234, 246, 255, .78);
}

.crew-report-section {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: none;
  scroll-margin-top: 90px;
}

.report-section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
}

.report-section-head h3 {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 22px;
}

.report-section-head p {
  margin: 0;
  color: var(--muted);
}

.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
  gap: 10px;
}

.report-kpi {
  min-height: 78px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
}

.report-kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.4px;
}

.report-kpi strong {
  display: block;
  margin-top: 6px;
  font-size: 23px;
  line-height: 1;
}

.report-kpi small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
}

.report-kpi.ok {
  border-color: color-mix(in srgb, var(--green) 55%, var(--line));
}

.report-kpi.bad {
  border-color: color-mix(in srgb, var(--red) 65%, var(--line));
}

.report-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.report-vessel-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
}

.report-vessel-card strong {
  display: block;
  color: var(--ink);
  font-size: 18px;
}

.report-vessel-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.report-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 45%, var(--panel));
}

.report-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand2));
}

.report-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.report-two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr);
  gap: 12px;
}

.report-table-wrap {
  max-height: min(56vh, 620px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.report-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  font-size: 13px;
}

.report-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 12px;
  text-align: left;
  color: var(--muted);
  background: var(--panel-soft);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.report-table td {
  padding: 10px 12px;
  vertical-align: top;
  border-top: 1px solid color-mix(in srgb, var(--line) 62%, transparent);
}

.report-table small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.report-vessel-sheet {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel-soft) 72%, transparent);
}

.report-vessel-sheet h4 {
  margin: 0 0 8px;
  color: var(--brand2);
  font-size: 19px;
}

/* SMC standard theme bridge. Keeps the existing crew workflow but lets the
   global Theme button drive the same dark/light language as the rest of SMC. */
.hero,
.kpi-card,
.tabs,
.workspace,
.main-panel,
.side-panel,
.profile-box,
.panel-head,
.fleet-card,
.crew-person-card,
.profile-shell,
.modal-card {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}

.hero {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--brand) 13%, var(--panel)), var(--panel));
}

.panel-head,
.table-filters,
.board-filters,
.profile-head,
.fleet-rank-row,
.vessel-band-left,
.vessel-band-time,
.document-card,
.doc-row {
  background: var(--panel-soft);
  color: var(--ink);
  border-color: var(--line);
}

p,
.help-text,
.profile-sub,
.profile-meta,
.profile-id.muted,
.scale-pill,
.empty,
.data-table th,
.fleet-card small,
.board-help,
.muted {
  color: var(--muted);
}

.btn,
.tab,
.navlink,
.pill,
.tag,
.scale-pill {
  background: color-mix(in srgb, var(--panel) 88%, var(--ink));
  color: var(--ink);
  border-color: var(--line);
}

.btn:hover,
.tab:hover,
.navlink:hover {
  background: color-mix(in srgb, var(--brand) 12%, var(--panel));
  border-color: var(--brand);
  color: var(--brand);
}

.tab.active,
.btn.primary {
  color: #00131a;
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
}

.btn.ghost {
  background: color-mix(in srgb, var(--panel-soft) 86%, var(--panel));
}

.btn.danger {
  background: color-mix(in srgb, var(--red) 11%, var(--panel));
  border-color: color-mix(in srgb, var(--red) 48%, var(--line));
  color: var(--red);
}

input,
select,
textarea {
  background: var(--input-bg);
  color: var(--ink);
  border-color: var(--line);
}

input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 72%, transparent);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}

.notice {
  background: color-mix(in srgb, var(--green) 10%, var(--panel));
  border-color: color-mix(in srgb, var(--green) 46%, var(--line));
  color: var(--green);
}

.notice.err {
  background: color-mix(in srgb, var(--red) 10%, var(--panel));
  border-color: color-mix(in srgb, var(--red) 46%, var(--line));
  color: var(--red);
}

.data-table {
  background: var(--panel);
}

.data-table th {
  background: var(--panel-soft);
  color: var(--muted);
}

.data-table td {
  border-top-color: color-mix(in srgb, var(--line) 66%, transparent);
}

.data-table tr:hover td {
  background: var(--row-hover);
}

.pill.green,
.tag.green {
  background: color-mix(in srgb, var(--green) 12%, var(--panel));
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
  color: var(--green);
}

.pill.amber,
.tag.amber {
  background: color-mix(in srgb, var(--amber) 12%, var(--panel));
  border-color: color-mix(in srgb, var(--amber) 45%, var(--line));
  color: var(--amber);
}

.pill.red,
.tag.red {
  background: color-mix(in srgb, var(--red) 12%, var(--panel));
  border-color: color-mix(in srgb, var(--red) 45%, var(--line));
  color: var(--red);
}

.pill.gray {
  color: var(--muted);
}

.rotation-board {
  background: var(--panel);
  border-color: var(--line);
}

.board-left,
.board-time {
  background: var(--panel);
}

.board-time {
  background:
    repeating-linear-gradient(
      90deg,
      color-mix(in srgb, var(--panel) 94%, var(--ink)) 0,
      color-mix(in srgb, var(--panel) 94%, var(--ink)) var(--dayW),
      color-mix(in srgb, var(--line) 44%, var(--panel)) var(--dayW),
      color-mix(in srgb, var(--line) 44%, var(--panel)) calc(var(--dayW) + 1px)
    );
}

.board-row-time {
  background:
    repeating-linear-gradient(
      90deg,
      color-mix(in srgb, var(--panel) 88%, var(--ink)) 0,
      color-mix(in srgb, var(--panel) 88%, var(--ink)) var(--dayW),
      color-mix(in srgb, var(--line) 46%, var(--panel)) var(--dayW),
      color-mix(in srgb, var(--line) 46%, var(--panel)) calc(var(--dayW) + 1px)
    );
}

.day-cell,
.board-row-left {
  border-color: color-mix(in srgb, var(--line) 70%, transparent);
}

.day-cell.weekend {
  background: color-mix(in srgb, var(--red) 7%, transparent);
}

.modal {
  background: rgba(0, 10, 18, .65);
}

@media (max-width: 1250px) {
  .planning-layout, .register-layout, .docs-layout { grid-template-columns: 1fr; }
  .side-panel { order: 2; }
  .main-panel { order: 1; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .board-filters, .table-filters, .table-filters.docs { grid-template-columns: 1fr 1fr; }
  .report-kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .report-two-col { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .topbar, .hero { align-items: flex-start; flex-direction: column; height: auto; padding: 12px; }
  .brand-sub { display: none; }
  .app-shell { width: calc(100vw - 14px); padding-top: 8px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .report-kpi-grid { grid-template-columns: 1fr 1fr; }
  .form-grid, .board-filters, .table-filters, .table-filters.docs { grid-template-columns: 1fr; }
  .rotation-board { grid-template-columns: 255px 1fr; }
  .crew-report-header { flex-direction: column; }
  .crew-report-header strong { text-align: left; }
}

/* Crew workspace cleanup: use the same canonical palette as every SMC theme. */
html[data-theme] {
  --bg: var(--bg-primary);
  --panel: var(--bg-card);
  --panel-soft: var(--bg-card-hover);
  --input-bg: var(--bg-input);
  --ink: var(--text-primary);
  --muted: var(--text-secondary);
  --line: var(--border);
  --line-dark: var(--border-active);
  --brand: var(--accent);
  --brand2: var(--success);
  --navy: var(--bg-primary);
  --blue: var(--info);
  --amber: var(--warning);
  --red: var(--danger);
  --green: var(--success);
  --row-hover: color-mix(in srgb, var(--accent) 8%, transparent);
}

html[data-theme="midnight"],
html[data-theme="ocean"],
html[data-theme="charcoal"],
html[data-theme="slate"],
html[data-theme="nord"],
html[data-theme="dracula"],
html[data-theme="solarized"] {
  color-scheme: dark;
  --shadow: 0 10px 28px rgba(0, 0, 0, .22);
}

html[data-theme="paper"],
html[data-theme="frost"],
html[data-theme="harbor-light"] {
  color-scheme: light;
  --shadow: 0 8px 22px rgba(28, 60, 78, .08);
}

body {
  background:
    radial-gradient(circle at 18% -10%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 34%),
    var(--bg-primary);
}

.hero,
.kpi-card,
.tabs,
.vessel-filter-panel,
.document-watch-panel,
.main-panel,
.side-panel,
.fleet-card,
.profile-box,
.profile-shell,
.modal-card,
.crew-report-section,
.report-mode-tabs {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text-primary);
}

.hero {
  background: linear-gradient(110deg, color-mix(in srgb, var(--accent) 12%, var(--bg-card)), var(--bg-card) 62%);
}

.document-watch-panel.collapsed .panel-head {
  margin-bottom: 0;
}

.fleet-layout {
  grid-template-columns: minmax(0, 1fr);
}

.fleet-rank-row,
.profile-mini-row,
.profile-doc-row,
.profile-summary-tile,
.profile-control-card,
.document-card,
.doc-row,
.board-help {
  background: var(--bg-card-hover);
  border-color: var(--border);
  color: var(--text-primary);
}

.fleet-rank-row.doc-risk-row {
  background: var(--bg-card-hover);
  border-color: var(--border);
  box-shadow: inset 3px 0 color-mix(in srgb, var(--warning) 72%, transparent);
}

.crew-person-card,
.link-btn,
.day-cell strong {
  color: var(--text-primary);
}

.btn,
.tab,
.vessel-scope-btn,
.pill,
.tag,
.scale-pill {
  background: var(--bg-input);
  border-color: var(--border);
  color: var(--text-primary);
}

.btn.ghost {
  background: var(--bg-card-hover);
}

.tab.active,
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-primary);
}

.rotation-board,
.board-left,
.board-top-left,
.day-header,
.data-table,
.data-table th,
.rank-track {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border);
}

.data-table th,
.board-top-left,
.day-header {
  background: var(--bg-card-hover);
  color: var(--text-secondary);
}

.data-table td,
.rank-row-left,
.rank-track,
.day-cell {
  border-color: var(--border);
}

.data-table tr:hover td {
  background: var(--row-hover);
}

.rank-people,
.board-help,
.day-cell,
.profile-doc-row small,
.profile-mini-row small {
  color: var(--text-secondary);
}

input,
select,
textarea {
  background: var(--bg-input);
  border-color: var(--border);
  color: var(--text-primary);
}

@media (max-width: 1250px) and (min-width: 761px) {
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Gemiler Durumu — three wide vessel organization boards. */
.vessel-status-view-active .vessel-filter-panel,
.vessel-status-view-active .document-watch-panel {
  display: none;
}

.vessel-status-layout {
  grid-template-columns: minmax(0, 1fr);
}

.vessel-status-panel {
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 0, color-mix(in srgb, var(--accent) 10%, transparent), transparent 38%),
    var(--bg-card);
}

.vessel-status-head p {
  margin: 4px 0 0;
  color: var(--text-secondary);
}

.vessel-status-legend {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.status-orb {
  display: inline-block;
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border: 2px solid color-mix(in srgb, currentColor 34%, transparent);
  border-radius: 50%;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 13%, transparent), 0 0 14px currentColor;
}

.status-orb.ok { color: var(--success); background: var(--success); }
.status-orb.alarm { color: var(--danger); background: var(--danger); animation: vessel-alarm-pulse 1.8s ease-in-out infinite; }

@keyframes vessel-alarm-pulse {
  50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--danger) 4%, transparent), 0 0 20px var(--danger); }
}

.vessel-status-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}

.vessel-status-summary > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card-hover);
  color: var(--text-secondary);
}

.vessel-status-summary b { color: var(--text-primary); font-size: 17px; }
.vessel-status-summary small { margin-left: auto; color: var(--text-secondary); }
.ok-copy, .ok-copy b { color: var(--success) !important; }
.alarm-copy, .alarm-copy b { color: var(--danger) !important; }

.vessel-status-scroll {
  width: 100%;
  overflow-x: auto;
  padding: 2px 2px 12px;
}

.vessel-status-boards {
  display: grid;
  gap: 22px;
  min-width: 1320px;
}

.vessel-status-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 260px;
  color: var(--text-secondary);
}

.status-loader {
  width: 26px;
  height: 26px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: vessel-status-spin .8s linear infinite;
}

@keyframes vessel-status-spin { to { transform: rotate(360deg); } }

.vessel-org-board {
  --ship-accent: var(--accent);
  --ship-deep: var(--info);
  position: relative;
  isolation: isolate;
  min-height: 426px;
  overflow: hidden;
  padding: 17px 20px 22px;
  border: 1px solid color-mix(in srgb, var(--ship-accent) 55%, var(--border));
  border-radius: 24px 70px 70px 24px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--ship-deep) 15%, var(--bg-card)), var(--bg-card) 30%, color-mix(in srgb, var(--ship-accent) 7%, var(--bg-card)));
  box-shadow: 0 15px 35px color-mix(in srgb, var(--ship-deep) 18%, transparent), inset 0 0 0 1px color-mix(in srgb, #fff 4%, transparent);
}

.vessel-org-hull {
  position: absolute;
  z-index: -1;
  inset: 66px 18px 14px;
  overflow: hidden;
  clip-path: polygon(0 10%, 82% 2%, 95% 12%, 100% 50%, 95% 88%, 82% 98%, 0 90%, 2.2% 50%);
  border: 1px solid var(--ship-accent);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--ship-deep) 38%, transparent), color-mix(in srgb, var(--ship-accent) 18%, transparent) 62%, color-mix(in srgb, var(--ship-accent) 30%, transparent)),
    repeating-linear-gradient(90deg, transparent 0 68px, color-mix(in srgb, var(--ship-accent) 12%, transparent) 69px 70px);
  opacity: .42;
}

.hull-deck-line {
  position: absolute;
  inset: 18px 46px;
  border: 1px dashed color-mix(in srgb, var(--ship-accent) 72%, transparent);
  border-radius: 32px 110px 110px 32px;
}

.hull-bridge {
  position: absolute;
  left: 8%;
  top: 24%;
  width: 80px;
  height: 52%;
  border: 2px solid color-mix(in srgb, var(--ship-accent) 64%, transparent);
  border-radius: 9px;
  background: color-mix(in srgb, var(--bg-card) 56%, transparent);
}

.hull-mark {
  position: absolute;
  right: 8%;
  top: 45%;
  color: color-mix(in srgb, var(--ship-accent) 75%, transparent);
  font: 800 21px/1 "Rajdhani", sans-serif;
  letter-spacing: 7px;
}

.vessel-org-heading {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 42px;
  margin-bottom: 8px;
}

.vessel-org-heading > div:first-child { display: flex; align-items: baseline; gap: 10px; }
.vessel-org-heading h3 { margin: 0; font-size: 24px; letter-spacing: .3px; }
.vessel-code {
  display: grid;
  place-items: center;
  min-width: 44px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--ship-accent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--ship-accent) 13%, var(--bg-card));
  color: var(--ship-accent);
  font: 800 16px/1 "Rajdhani", sans-serif;
}

.vessel-org-counts { display: flex; gap: 8px; }
.vessel-org-counts span {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-card) 88%, transparent);
  color: var(--text-secondary);
  font-size: 12px;
}
.vessel-org-counts b { color: var(--text-primary); font-size: 15px; }

.vessel-org-tree { position: relative; z-index: 2; }
.vessel-org-command { position: relative; display: grid; justify-items: center; min-height: 116px; }
.command-label {
  margin-bottom: 5px;
  color: var(--ship-accent);
  font: 800 11px/1 "Rajdhani", sans-serif;
  letter-spacing: 1.5px;
}

.vessel-org-command::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 2px;
  height: 21px;
  background: var(--ship-accent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--ship-accent) 64%, transparent);
}

.vessel-org-trunk {
  height: 2px;
  margin: 0 9.5%;
  background: linear-gradient(90deg, transparent, var(--ship-accent) 10% 90%, transparent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--ship-accent) 42%, transparent);
}

.vessel-org-groups {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
  padding-top: 13px;
}

.vessel-org-group {
  position: relative;
  min-height: 210px;
  padding: 10px 8px 9px;
  border: 1px solid color-mix(in srgb, var(--ship-accent) 28%, var(--border));
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-card) 83%, transparent);
  backdrop-filter: blur(9px);
}

.vessel-org-group::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -14px;
  width: 2px;
  height: 13px;
  background: var(--ship-accent);
}

.vessel-org-group > header {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--ship-accent);
}

.vessel-org-group > header > i { width: 18px; text-align: center; }
.vessel-org-group > header span { min-width: 0; flex: 1; }
.vessel-org-group > header strong,
.vessel-org-group > header small { display: block; }
.vessel-org-group > header strong { color: var(--text-primary); font: 800 12px/1.1 "Rajdhani", sans-serif; letter-spacing: .45px; }
.vessel-org-group > header small { margin-top: 3px; overflow: hidden; color: var(--text-secondary); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.vessel-org-group > header b { color: var(--ship-accent); font-size: 15px; }

.vessel-org-people {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 7px;
  flex-wrap: wrap;
  padding-top: 9px;
}

.vessel-org-person {
  position: relative;
  display: grid;
  justify-items: center;
  width: 100px;
  min-height: 148px;
  padding: 6px 4px 5px;
  border: 1px solid color-mix(in srgb, var(--success) 45%, var(--border));
  border-radius: 13px;
  background: color-mix(in srgb, var(--bg-input) 92%, transparent);
  color: var(--text-primary);
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.vessel-org-person:hover,
.vessel-org-person:focus-visible {
  z-index: 4;
  outline: none;
  transform: translateY(-4px) scale(1.03);
  border-color: var(--ship-accent);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--ship-deep) 28%, transparent), 0 0 0 2px color-mix(in srgb, var(--ship-accent) 18%, transparent);
}

.vessel-org-person.has-alarm { border-color: color-mix(in srgb, var(--danger) 66%, var(--border)); }
.vessel-org-person > .status-orb { position: absolute; z-index: 3; top: 7px; right: 7px; width: 11px; height: 11px; }
.vessel-org-photo {
  position: relative;
  display: grid;
  place-items: center;
  width: 74px;
  height: 82px;
  overflow: hidden;
  border: 2px solid color-mix(in srgb, var(--ship-accent) 58%, var(--border));
  border-radius: 12px 12px 18px 18px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--ship-accent) 20%, var(--bg-card)), var(--bg-input));
  color: var(--ship-accent);
  font: 800 20px/1 "Rajdhani", sans-serif;
}
.vessel-org-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.vessel-org-person > strong { display: -webkit-box; width: 100%; min-height: 24px; margin-top: 5px; overflow: hidden; font: 800 11.5px/1.05 "Rajdhani", sans-serif; text-align: center; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.vessel-org-person > small { display: -webkit-box; width: 100%; min-height: 18px; margin-top: 2px; overflow: hidden; color: var(--text-secondary); font-size: 9px; line-height: 1.05; text-align: center; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }

.vessel-org-person.primary-person { width: 116px; min-height: 119px; padding-top: 5px; }
.vessel-org-person.primary-person .vessel-org-photo { width: 80px; height: 80px; border-radius: 50%; }
.vessel-org-person.primary-person > strong { font-size: 12px; }
.vessel-org-master-missing { display: flex; align-items: center; gap: 8px; min-height: 70px; color: var(--danger); font-weight: 700; }
.vessel-org-empty { display: grid; place-items: center; min-height: 92px; color: var(--text-secondary); font-size: 10px; text-align: center; }

@media (max-width: 760px) {
  .vessel-status-head { align-items: flex-start; }
  .vessel-status-summary small { width: 100%; margin-left: 0; }
  .vessel-status-boards { min-width: 1240px; }
}

@media (prefers-reduced-motion: reduce) {
  .status-orb.alarm,
  .status-loader { animation: none; }
}

/* Crew 360 workspace: compact, tab-driven profile editing. */
.profile-modal .profile-card {
  width: min(1440px, calc(100vw - 20px));
  max-height: calc(100vh - 20px);
  padding: 12px;
  border-radius: 8px;
}

.profile-modal .profile-head {
  gap: 16px;
  margin: -12px -12px 0;
  padding: 12px 18px;
  border-radius: 8px 8px 0 0;
}

.profile-modal .profile-head .board-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.profile-modal.profile-full-page .profile-head {
  margin: -16px -16px 0;
}

.profile-section-nav {
  top: 72px;
  gap: 4px;
  margin: 0 -12px 12px;
  padding: 7px 12px;
}

.profile-section-nav button {
  min-height: 32px;
  padding: 7px 10px;
  border-radius: 6px;
}

.profile-section-nav button.active,
.profile-section-nav button[aria-selected="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg-primary);
  box-shadow: none;
}

.profile-card[data-profile-view] .profile-grid {
  grid-template-columns: 258px minmax(0, 1fr);
  gap: 12px;
}

.profile-card[data-profile-view="overview"] .profile-grid {
  grid-template-areas:
    "summary summary"
    "photo control"
    "rotation control";
}

.profile-card[data-profile-view="personnel"] .profile-grid {
  grid-template-areas:
    "summary summary"
    "photo personal"
    "rotation personal";
}

.profile-card[data-profile-view="rotation"] .profile-grid {
  grid-template-areas:
    "summary summary"
    "photo rotation";
}

.profile-card[data-profile-view="documents"] .profile-grid {
  grid-template-areas:
    "summary summary"
    "photo control"
    "photo docentry"
    "photo docs";
}

.profile-card[data-profile-view="contract"] .profile-grid {
  grid-template-areas:
    "summary summary"
    "photo contract"
    "photo wage";
}

.profile-card[data-profile-view="evaluation"] .profile-grid {
  grid-template-areas:
    "summary summary"
    "photo evaluation";
}

.profile-card[data-profile-view] .profile-summary-box {
  grid-area: summary;
}

.profile-card[data-profile-view] .profile-docs-box {
  grid-area: docs;
}

.profile-card[data-profile-view] .profile-evaluation-box {
  grid-area: evaluation;
}

.profile-grid > .profile-box[hidden],
#profileHeaderSaveBtn[hidden] {
  display: none !important;
}

.profile-box {
  padding: 12px;
  border-radius: 8px;
  box-shadow: none;
}

.profile-summary-grid,
.profile-control-grid {
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
}

.profile-summary-tile,
.profile-control-card,
.profile-personal-heading .profile-meta > span,
.profile-photo {
  border-radius: 8px;
}

.profile-photo-box {
  position: sticky;
  top: 126px;
  align-self: start;
}

.profile-personal-box .form-grid {
  gap: 9px;
}

.profile-personal-box input,
.profile-personal-box select,
.profile-personal-box textarea {
  min-height: 38px;
  font-size: 13px;
}

.profile-personal-box > .button-row:last-child {
  position: sticky;
  bottom: -12px;
  z-index: 2;
  margin: 12px -12px -12px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  backdrop-filter: blur(12px);
}

@media (max-width: 900px) {
  .profile-modal .profile-card {
    width: calc(100vw - 10px);
    max-height: calc(100vh - 10px);
    padding: 9px;
  }

  .profile-modal .profile-head {
    position: static;
    align-items: flex-start;
    margin: -9px -9px 0;
    padding: 12px;
  }

  .profile-section-nav {
    position: static;
    margin: 0 -9px 10px;
    padding: 7px 9px;
  }

  .profile-card[data-profile-view] .profile-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "summary"
      "photo"
      "personal"
      "rotation"
      "control"
      "contract"
      "wage"
      "docentry"
      "docs"
      "evaluation";
  }

  .profile-photo-box {
    position: static;
  }

  .profile-head .board-actions {
    width: 100%;
    justify-content: flex-start !important;
  }
}
