/* ── Crew Manager (Settings → Crew) ──────────────────────────────────────── */

.crew-list-header {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; gap: 8px; flex-wrap: wrap;
}

.crew-list {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 10px; width: 100%;
}

.crew-empty {
  color: #5a6678; font-size: 12px; padding: 14px 4px; text-align: center;
}

.crew-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 8px;
  background: #1a2230; border: 1px solid #232b3a;
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.crew-row:hover { border-color: var(--accent); background: #1d2634; }

.crew-av {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px; font-weight: 800; letter-spacing: 0.5px;
}
.crew-av-photo {
  background-size: cover; background-position: center; background-repeat: no-repeat;
  color: transparent;
}

.crew-row-main { flex: 1; min-width: 0; }
.crew-row-name {
  font-size: 13px; font-weight: 600; color: #dce3ed;
  display: flex; align-items: center; gap: 8px;
}
.crew-row-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 2px; font-size: 11px; color: #7a8a9b;
}
.crew-cat-tag {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
  color: #9aa7b8; background: #232b3a; border-radius: 4px; padding: 1px 6px;
}
.crew-row-contact { color: #7a8a9b; }
.crew-linked {
  font-size: 10px; font-weight: 600; color: #22c55e;
  background: rgba(34,197,94,0.12); border-radius: 4px; padding: 1px 6px;
}
.crew-pending {
  font-size: 10px; font-weight: 600; color: #f59e0b;
  background: rgba(245,158,11,0.12); border-radius: 4px; padding: 1px 6px;
  white-space: nowrap;
}
/* ── Toolbar: sort / group / role-filter chips ───────────────────────────────── */
.crew-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px;
}
.crew-toolbar .st-role-filter { flex: 1; min-width: 0; }
.crew-toolbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.crew-sort-select {
  background: #1f2530; border: 1px solid #2a3040; border-radius: 7px;
  color: #cfd8e3; font-family: 'Barlow', sans-serif; font-size: 12px;
  padding: 6px 10px; cursor: pointer;
}
.crew-sort-select:focus { outline: none; border-color: var(--accent); }
.crew-group-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 36px; border-radius: 7px; cursor: pointer; padding: 0;
  background: #1f2530; border: 1px solid #2a3040; color: #9aa7b8;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.crew-group-btn:hover { border-color: #3a4555; color: #dce3ed; }
.crew-group-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(var(--accent-rgb),0.1); }
.crew-group-btn .material-symbols-outlined { font-size: 18px; }

/* Group headers */
.crew-group-head {
  display: flex; align-items: center; gap: 8px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase;
  color: #7a8a9b; padding: 10px 4px 2px;
}
.crew-group-count {
  font-size: 10px; font-weight: 700; color: #9aa7b8;
  background: #232b3a; border-radius: 10px; padding: 0 7px; line-height: 16px;
}

/* Inline role / category dropdown */
.crew-role-select {
  flex-shrink: 0; max-width: 150px;
  background: #1f2530; border: 1px solid #2a3040; border-radius: 7px;
  color: #cfd8e3; font-family: 'Barlow', sans-serif; font-size: 12px;
  padding: 5px 8px; cursor: pointer;
}
.crew-role-select:hover { border-color: #3a4555; }
.crew-role-select:focus { outline: none; border-color: var(--accent); }

/* Access (team-login) role on linked rows */
.crew-access {
  flex-shrink: 0; font-family: 'Barlow Condensed', sans-serif;
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
  color: #9aa7b8; background: #1a2030; border: 1px solid #2a3040;
  border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
.crew-access-select {
  flex-shrink: 0; max-width: 140px;
  background: rgba(var(--accent-rgb),0.08); border: 1px solid rgba(var(--accent-rgb),0.25);
  border-radius: 7px; color: var(--accent);
  font-family: 'Barlow', sans-serif; font-size: 12px; font-weight: 600;
  padding: 5px 8px; cursor: pointer;
}
.crew-access-select:hover { border-color: var(--accent); }
.crew-access-select:focus { outline: none; border-color: var(--accent); }

/* Manage-roles button — labelled variant of .crew-group-btn */
.crew-cats-btn { width: auto; gap: 5px; padding: 0 10px; }
.crew-cats-btn-label {
  font-family: 'Barlow Condensed', sans-serif; font-size: 13px;
  font-weight: 600; letter-spacing: 0.4px;
}

/* Per-role app-access picker (Manage-roles dialog) */
.crew-cat-access {
  flex-shrink: 0; max-width: 140px;
  background: #1f2530; border: 1px solid #2a3040; border-radius: 7px;
  color: #cfd8e3; font-family: 'Barlow', sans-serif; font-size: 12px;
  padding: 5px 8px; cursor: pointer;
}
.crew-cat-access:hover { border-color: #3a4555; }
.crew-cat-access:focus { outline: none; border-color: var(--accent); }
body.light-mode .crew-cat-access { background: #f0f3f8; border-color: #dde2ec; color: #1a2030; }

.crew-row-edit { font-size: 18px; color: #5a6678; flex-shrink: 0; }
.crew-row:hover .crew-row-edit { color: var(--accent); }
.crew-row-invite {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 7px; cursor: pointer;
  background: rgba(var(--accent-rgb), 0.12); color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb), 0.25); padding: 0;
  transition: background 0.12s, border-color 0.12s;
}
.crew-row-invite:hover { background: rgba(var(--accent-rgb), 0.22); border-color: var(--accent); }
.crew-row-invite .material-symbols-outlined { font-size: 17px; }

/* Revoke action on a pending-invite row — muted red, not the accent. */
.crew-row-revoke {
  background: rgba(229,115,115,0.10); color: #e57373;
  border-color: rgba(229,115,115,0.25);
}
.crew-row-revoke:hover { background: rgba(229,115,115,0.20); border-color: #e57373; }

/* Pending-invite rows aren't clickable (no roster entry to edit yet). */
.crew-row-pending { cursor: default; }
.crew-row-pending:hover { border-color: #232b3a; background: #1a2230; }

/* ── Crew header: Invite + Add buttons ───────────────────────────────────────── */
.crew-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Invite modal (email + scan-to-join QR) ──────────────────────────────────── */
.crew-invite-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.crew-invite-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.crew-invite-sep {
  display: flex; align-items: center; text-align: center;
  color: #5a6678; font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  margin: 18px 0;
}
.crew-invite-sep::before, .crew-invite-sep::after {
  content: ''; flex: 1; height: 1px; background: #2a3340;
}
.crew-invite-sep span { padding: 0 12px; }

/* ── Contact card (hover popover) ───────────────────────────────────────────── */
.crew-contact-card {
  position: fixed; z-index: 1200; width: 260px; max-width: calc(100vw - 16px);
  background: #1d2533; border: 1px solid #2e3849; border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
  padding: 14px; opacity: 0; visibility: hidden; transform: translateY(4px);
  transition: opacity 0.12s, transform 0.12s, visibility 0.12s;
  pointer-events: none;
}
.crew-contact-card.open { opacity: 1; visibility: visible; transform: none; pointer-events: auto; }

.crew-cc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.crew-cc-av {
  width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 17px; font-weight: 800; letter-spacing: 0.5px;
}
.crew-cc-id { min-width: 0; }
.crew-cc-name { font-size: 15px; font-weight: 700; color: #dce3ed; line-height: 1.2; }
.crew-cc-role {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase;
  color: #7a8a9b; margin-top: 2px;
}

.crew-cc-lines { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.crew-cc-empty { color: #7a8a9b; font-size: 12px; margin-bottom: 12px; }
.crew-cc-line {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px; border-radius: 7px; text-decoration: none;
  color: #cfd8e3; font-size: 12px; transition: background 0.12s, color 0.12s;
}
a.crew-cc-line:hover { background: rgba(var(--accent-rgb),0.1); color: var(--accent); }
.crew-cc-line--info { color: #9aa7b8; }
.crew-cc-line .material-symbols-outlined { font-size: 17px; color: #7a8a9b; flex-shrink: 0; }
a.crew-cc-line:hover .material-symbols-outlined { color: var(--accent); }
.crew-cc-val { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.crew-cc-actions { display: flex; gap: 6px; }
.crew-cc-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 7px 6px; border-radius: 7px; cursor: pointer; text-decoration: none;
  background: #232b3a; border: 1px solid #2e3849; color: #cfd8e3;
  font-family: 'Barlow', sans-serif; font-size: 12px; font-weight: 600;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.crew-cc-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(var(--accent-rgb),0.1); }
.crew-cc-btn .material-symbols-outlined { font-size: 16px; }

body.light-mode .crew-contact-card { background: #ffffff; border-color: #e3e8f0; box-shadow: 0 12px 32px rgba(0,0,0,0.15); }
body.light-mode .crew-cc-name { color: #1a2030; }
body.light-mode .crew-cc-line { color: #2a3140; }
body.light-mode .crew-cc-btn { background: #f0f3f8; border-color: #dde2ec; color: #2a3140; }

/* ── Modal: photo ──────────────────────────────────────────────────────────── */
.crew-photo-row {
  display: flex; align-items: center; gap: 14px; margin-bottom: 16px;
}
.crew-photo-avatar {
  position: relative; width: 64px; height: 64px; border-radius: 50%;
  flex-shrink: 0; cursor: pointer; overflow: hidden;
  background: #1f2530 center/cover no-repeat; border: 2px dashed #2a3040;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s;
}
.crew-photo-avatar:hover { border-color: var(--accent); }
.crew-photo-avatar.has-photo { border-style: solid; border-color: #2a3040; }
.crew-photo-overlay {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; color: #5a6678;
}
.crew-photo-avatar.has-photo .crew-photo-overlay {
  opacity: 0; background: rgba(0,0,0,0.45); color: #fff; transition: opacity 0.15s;
}
.crew-photo-avatar.has-photo:hover .crew-photo-overlay { opacity: 1; }
.crew-photo-overlay .material-symbols-outlined { font-size: 22px; }
.crew-photo-avatar.uploading { opacity: 0.5; pointer-events: none; }

/* ── Modal: photo crop / reposition ──────────────────────────────────────────── */
.crew-crop-hint { color: #7a8a9b; font-size: 12px; margin: 0 0 14px; line-height: 1.4; }
.crew-crop-stage {
  position: relative; width: 280px; height: 280px; margin: 0 auto;
  border-radius: 10px; overflow: hidden; background: #14181f;
  cursor: grab; touch-action: none; user-select: none;
}
.crew-crop-stage.dragging { cursor: grabbing; }
#crew-crop-img {
  position: absolute; top: 0; left: 0; transform-origin: top left;
  max-width: none; pointer-events: none; -webkit-user-drag: none;
}
/* Darken everything outside the central circle so the crop area is obvious. */
.crew-crop-mask {
  position: absolute; inset: 0; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(10,12,16,0.62) inset;
  border-radius: 50%;
}
.crew-crop-zoom {
  display: flex; align-items: center; gap: 10px; margin: 16px auto 2px; max-width: 280px;
}
.crew-crop-zoom .material-symbols-outlined { color: #7a8a9b; font-size: 18px; flex-shrink: 0; }
.crew-crop-zoom input[type="range"] { flex: 1; accent-color: var(--accent); cursor: pointer; }

.crew-photo-actions { display: flex; flex-direction: column; gap: 6px; }
.crew-photo-btn {
  background: #1f2530; border: 1px solid #2a3040; border-radius: 6px;
  color: #cfd8e3; font-family: 'Barlow', sans-serif; font-size: 12px;
  padding: 5px 12px; cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.crew-photo-btn:hover { border-color: var(--accent); color: var(--accent); }
.crew-photo-btn.danger:hover { border-color: #ef4444; color: #ef4444; }

/* ── Modal: form ───────────────────────────────────────────────────────────── */
.crew-form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.crew-phone-row { display: flex; gap: 8px; }

/* Account → Personal Details form (collapsible body has no flex gap of its own). */
.acc-profile-form { display: flex; flex-direction: column; gap: 14px; }

/* "Sync from account settings" button on the My Profile modal. */
.myp-sync-btn {
  display: inline-flex; align-items: center; gap: 7px; margin-bottom: 16px;
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
  background: rgba(var(--accent-rgb), 0.1); border: 1px solid rgba(var(--accent-rgb), 0.3);
  color: var(--accent); font-family: 'Barlow', sans-serif; font-size: 12.5px; font-weight: 600;
  transition: background 0.12s, border-color 0.12s;
}
.myp-sync-btn:hover { background: rgba(var(--accent-rgb), 0.2); border-color: var(--accent); }
.myp-sync-btn .material-symbols-outlined { font-size: 17px; }

/* Emergency contact group — visually separated from personal details. */
.crew-emergency-block {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid #1f2530;
}
.crew-section-label {
  font-family: 'Barlow Condensed', sans-serif; font-size: 12px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase; color: #7a8a9b; margin-bottom: 10px;
}

.crew-color-row { display: flex; align-items: center; gap: 12px; }
.crew-color-input {
  width: 44px; height: 36px; padding: 2px; cursor: pointer;
  background: #1f2530; border: 1px solid #2a3040; border-radius: 8px;
}
.crew-color-input::-webkit-color-swatch { border: none; border-radius: 5px; }
.crew-color-input::-webkit-color-swatch-wrapper { padding: 0; }
.crew-color-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.crew-swatch {
  width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; box-shadow: 0 0 0 1px #2a3040;
  transition: transform 0.1s;
}
.crew-swatch:hover { transform: scale(1.12); }
.crew-swatch.active { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }

/* ── Light mode ────────────────────────────────────────────────────────────── */
body.light-mode .crew-row { background: #f5f7fb; border-color: #e3e8f0; }
body.light-mode .crew-row:hover { background: #eef2f8; }
body.light-mode .crew-row-name { color: #1a2030; }
body.light-mode .crew-cat-tag { background: #e3e8f0; color: #4a5568; }
body.light-mode .crew-photo-avatar,
body.light-mode .crew-photo-btn,
body.light-mode .crew-color-input { background: #f0f3f8; border-color: #dde2ec; }
body.light-mode .crew-photo-btn { color: #1a2030; }
body.light-mode .crew-swatch { box-shadow: 0 0 0 1px #dde2ec; }
body.light-mode .crew-sort-select,
body.light-mode .crew-group-btn,
body.light-mode .crew-role-select { background: #f0f3f8; border-color: #dde2ec; color: #1a2030; }
body.light-mode .crew-group-count { background: #e3e8f0; color: #4a5568; }
body.light-mode .crew-access { background: #eef2f8; border-color: #dde2ec; color: #4a5568; }

@media (max-width: 560px) {
  .crew-form-grid { grid-template-columns: 1fr; }
}

/* ── Category manager ───────────────────────────────────────────────────────── */
.crew-cat-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.crew-cat-manage-link {
  background: none; border: none; padding: 0; cursor: pointer;
  font-family: 'Barlow', sans-serif; font-size: 11px; font-weight: 600;
  color: var(--accent); transition: opacity 0.15s;
}
.crew-cat-manage-link:hover { opacity: 0.75; text-decoration: underline; }

.crew-cat-list { display: flex; flex-direction: column; gap: 8px; }
.crew-cat-empty { color: #7a8a9b; font-size: 12px; padding: 4px 0; }
.crew-cat-row { display: flex; align-items: center; gap: 8px; }
.crew-cat-row .crew-cat-color { width: 36px; height: 34px; flex-shrink: 0; }
.crew-cat-name { flex: 1; min-width: 0; }
.crew-cat-del {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 7px; cursor: pointer; padding: 0;
  background: #1f2530; border: 1px solid #2a3040; color: #9aa7b8;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.crew-cat-del:hover { border-color: rgba(239,68,68,0.4); color: #ef4444; background: rgba(239,68,68,0.08); }
.crew-cat-del .material-symbols-outlined { font-size: 18px; }

.crew-cat-add { display: flex; align-items: center; gap: 8px; padding-top: 4px; }
.crew-cat-add .crew-color-input { flex-shrink: 0; }
.crew-cat-add .form-input { flex: 1; min-width: 0; }

body.light-mode .crew-cat-del { background: #f0f3f8; border-color: #dde2ec; color: #4a5568; }
body.light-mode .crew-cat-empty { color: #8a9aab; }
