/* ============================================================
   CREW Operating Procedures — Blazor Wiki Stylesheet
   Ported from crew-wiki-main/assets/crew.css.
   ============================================================ */

/* ── Color Tokens ─────────────────────────────────────────── */
:root {
  --crew-navy:          #0f2044;
  --crew-section-bg:    #1a56a0;
  --crew-blue:          #1a56a0;
  --crew-note-bg:       #e8f0fb;
  --crew-exception-bg:  #f1f8e9;
  --crew-exception-bdr: #388e3c;
  --crew-warning-bg:    #fff4ec;
  --crew-warning-bdr:   #c45000;
  --crew-example-bg:    #f5f5f5;
  --crew-example-bdr:   #555555;
}

/* ── App Shell ──────────────────────────────────────────────── */
.crew-wiki-shell {
  height: 100vh;
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
}

.crew-app-row {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────── */
.crew-sidebar {
  background-color: var(--crew-navy);
  width: 220px;
  min-width: 180px;
  max-width: 220px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: sticky;
  top: 0;
  flex-shrink: 0;
}

.crew-sidebar-header {
  display: flex;
  align-items: center;
  padding: 14px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.crew-sidebar-logo {
  height: 34px;
  margin-right: 8px;
  flex-shrink: 0;
}

.crew-sidebar-brand {
  color: white;
  font-weight: 700;
  font-size: 14px;
  font-family: Arial, sans-serif;
  line-height: 1.2;
}

.crew-sidebar-brand small {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.3px;
}

/* ── Filter Input ───────────────────────────────────────── */
.crew-sidebar-filter {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.crew-filter-input {
  width: 100%;
  padding: 5px 8px;
  font-size: 12px;
  font-family: Arial, sans-serif;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  outline: none;
  box-sizing: border-box;
}

.crew-filter-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.crew-filter-input:focus {
  border-color: var(--crew-blue);
  background: rgba(255, 255, 255, 0.12);
}

/* ── Sidebar Navigation ─────────────────────────────────── */
.crew-sidebar-nav {
  padding: 6px 0;
  flex: 1;
  overflow-y: auto;
}

.crew-nav-group {
  color: rgba(255, 255, 255, 0.45);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 14px 14px 4px 14px;
  font-family: Arial, sans-serif;
}

.crew-nav-link {
  display: block;
  color: rgba(255, 255, 255, 0.78);
  font-family: Arial, sans-serif;
  font-size: 13px;
  padding: 5px 14px;
  border-radius: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  cursor: pointer;
}

.crew-nav-link:hover {
  color: white;
  background-color: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

.crew-nav-link.active {
  color: white;
  background-color: var(--crew-blue);
  font-weight: 600;
}

.crew-nav-loading,
.crew-nav-error {
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  padding: 14px;
  font-family: Arial, sans-serif;
}

.crew-nav-error {
  color: var(--crew-warning-bdr);
}

/* ── Content Area ───────────────────────────────────────── */
.crew-content {
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  background-color: #ffffff;
  padding: 24px 32px;
}

.crew-content:has(.crew-procedure-layout--editor) {
  background-color: #f0f4fa;
}

.crew-content-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.crew-button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.crew-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.crew-button--primary {
  background: var(--crew-blue);
  color: #ffffff;
}

.crew-button--primary:hover:not(:disabled) {
  background: var(--crew-navy);
}

.crew-button--submit {
  background: #27ae60;
  color: #ffffff;
  border-color: #27ae60;
}

.crew-button--submit:hover:not(:disabled) {
  background: #1e8449;
  border-color: #1e8449;
}

.crew-button--submit:disabled {
  background: #a8d5ba;
  border-color: #a8d5ba;
  cursor: not-allowed;
}

.crew-button--ghost {
  background: #ffffff;
  color: var(--crew-navy);
  border-color: #c8d3e0;
}

.crew-button--ghost:hover:not(:disabled) {
  background: #f7fafc;
}

/* ── Icon Buttons ───────────────────────────────────────── */
.crew-button--icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  color: #5a6b80;
  border-color: transparent;
  font-size: 0.92rem;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.crew-button--icon:hover:not(:disabled) {
  background: #eef3f9;
  color: var(--crew-navy);
}

.crew-button--icon:disabled {
  opacity: 0.35;
  cursor: default;
}

.crew-button--icon.crew-button--danger:hover:not(:disabled) {
  background: #fdf0f0;
  color: #c0392b;
}

/* Tooltip on hover via data-tooltip */
.crew-button--icon[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(15, 32, 68, 0.92);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease-out, transform 0.1s ease-out;
  z-index: 50;
}

.crew-button--icon[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.crew-loading-indicator {
  color: var(--crew-blue);
  font-family: Arial, sans-serif;
  font-size: 14px;
  padding: 24px 0;
}

/* ── Document Loading Progress Bar ──────────────────────── */
.crew-progress-wrapper {
  max-width: 480px;
  margin: 80px auto 0;
  font-family: Arial, sans-serif;
}

.crew-progress-label {
  font-size: 13px;
  color: var(--crew-blue);
  font-weight: 600;
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crew-progress-track {
  height: 6px;
  background: #e0e8f0;
  border-radius: 3px;
  overflow: hidden;
}

.crew-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--crew-blue), var(--crew-navy));
  border-radius: 3px;
  transition: width 0.35s ease-out;
}

.crew-content-error {
  color: var(--crew-warning-bdr);
  font-family: Arial, sans-serif;
  font-size: 14px;
  padding: 24px 0;
}

/* ── Procedure/Guide content wrapper ────────────────────── */
.crew-procedure-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 36px;
  overflow-x: auto;
}

/* ── Home Page ───────────────────────────────────────────── */
.crew-home-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 0 12px 0;
  border-bottom: 2px solid var(--crew-blue);
  margin-bottom: 24px;
  font-family: Arial, sans-serif;
}

.crew-home-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--crew-navy);
}

.crew-home-subtitle {
  font-size: 14px;
  color: var(--crew-blue);
  font-style: italic;
  margin-top: 2px;
}

.crew-home-section-heading {
  color: var(--crew-navy);
  margin-top: 28px;
  margin-bottom: 16px;
  font-family: Arial, sans-serif;
}

/* ── Home Page Cards ──────────────────────────────────────── */
.crew-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.crew-card {
  border: 1px solid #c8d3e0;
  border-radius: 4px;
  padding: 16px;
  background: white;
  font-family: Arial, sans-serif;
  transition: box-shadow 0.2s;
  cursor: pointer;
}

.crew-card:hover {
  box-shadow: 0 2px 8px rgba(26, 86, 160, 0.15);
}

.crew-card-number {
  font-size: 11px;
  color: var(--crew-blue);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.crew-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--crew-navy);
  margin: 4px 0 8px 0;
}

.crew-procedure-layout--editor {
  display: flex;
  min-height: 0;
  align-items: stretch;
  background: #f0f4fa;
}

.crew-editor-workspace {
  background: #f0f4fa;
}

.crew-editor-shell {
  max-width: none;
  min-width: 0;
  width: 100%;
  height: auto;
  min-height: 0;
  padding: 0;
  overflow: visible;
}

.crew-editor-dialog {
  width: min(1400px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(15, 32, 68, 0.08);
  border: 1px solid #d8e1ec;
}

.crew-editor-dialog--inline {
  width: 100%;
  height: auto;
  max-height: none;
  padding: 16px 20px 24px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  overflow: visible;
  gap: 20px;
}

/* ── Content Edit Workspace (aligned with crew-wiki-main /new, new_procedure.py) ── */
.crew-editor-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 20px 0 12px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--crew-blue);
  font-family: Arial, sans-serif;
}

.crew-editor-page-header-text {
  min-width: min(100%, 320px);
  flex: 1;
}

.crew-editor-page-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--crew-navy);
  line-height: 1.2;
}

.crew-editor-page-lead {
  margin: 8px 0 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--crew-navy);
  line-height: 1.3;
}

.crew-editor-page-subtitle {
  margin: 6px 0 0;
  font-size: 14px;
  color: #555;
  line-height: 1.45;
  max-width: 56ch;
}

.crew-editor-workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 5fr) minmax(220px, 3fr);
  gap: 20px;
  align-items: start;
  font-family: Arial, sans-serif;
}

.crew-editor-workspace-col--form {
  min-width: 0;
}

.crew-editor-form-scroll {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  padding-right: 8px;
}

.crew-editor-section-heading {
  margin: 18px 0 10px;
  font-family: Arial, sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--crew-blue);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--crew-blue);
}

.crew-editor-section-heading:first-child {
  margin-top: 0;
}

.crew-editor-section-hint {
  margin: 0 0 14px;
  font-size: 13px;
  color: #555;
  line-height: 1.45;
}

.crew-editor-workspace-col--preview {
  min-width: 0;
  position: sticky;
  top: 12px;
  align-self: start;
}

.crew-editor-workspace-col--suggestions {
  min-width: 0;
  position: sticky;
  top: 12px;
  align-self: start;
}

.crew-editor-workspace-col--suggestions .crew-editor-section-heading {
  margin-top: 0;
}

.crew-editor-suggestions-panel--workspace {
  border: 1px solid #e0e8f0;
  border-radius: 4px;
  max-height: calc(100vh - 220px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.crew-editor-suggestions-panel--workspace .crew-editor-suggestions-body {
  max-height: calc(100vh - 280px);
}

.crew-editor-preview-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  font-family: Arial, sans-serif;
  font-size: 13px;
  border-bottom: 1px solid #c8d3e0;
  padding-bottom: 2px;
}

.crew-editor-preview-tab {
  margin: 0;
  padding: 6px 14px;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  color: #59708e;
  font-family: inherit;
  font-size: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  line-height: 1.3;
}

.crew-editor-preview-tab:hover:not(.crew-editor-preview-tab--active) {
  color: var(--crew-navy);
  background: rgba(26, 86, 160, 0.06);
}

.crew-editor-preview-tab:focus-visible {
  outline: 2px solid var(--crew-blue);
  outline-offset: 2px;
}

.crew-editor-preview-tab--active {
  font-weight: 600;
  cursor: default;
  color: var(--crew-navy);
  background: #fff;
  border: 1px solid #c8d3e0;
  border-bottom-color: #fff;
  margin-bottom: -1px;
}

.crew-editor-preview-frame {
  border: 1px solid #e0e8f0;
  border-radius: 4px;
  padding: 20px;
  background: #fff;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  box-sizing: border-box;
}

.crew-editor-preview-frame--raw {
  padding: 0;
  background: #fafbfc;
}

.crew-editor-preview-markdown {
  min-height: 120px;
}

.crew-editor-raw-markdown {
  display: block;
  margin: 0;
  padding: 16px 18px;
  max-height: calc(100vh - 220px);
  overflow: auto;
  box-sizing: border-box;
  font-family: Consolas, "SF Mono", Monaco, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.55;
  color: #1e293b;
  white-space: pre-wrap;
  word-break: break-word;
  tab-size: 2;
  border: none;
  background: #fafbfc;
}

.crew-editor-preview-empty {
  margin: 0;
  padding: 40px 16px;
  text-align: center;
  color: #aaa;
  font-size: 14px;
}

.crew-editor-workspace-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #c8d3e0;
  font-family: Arial, sans-serif;
}

.crew-editor-workspace .crew-editor-field span {
  color: var(--crew-navy);
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
}

.crew-editor-canvas--embedded {
  position: relative;
  padding-bottom: 52px;
}

.crew-editor-fab--embedded {
  position: absolute;
  right: 0;
  bottom: 0;
  width: auto;
  height: auto;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 4px;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(15, 32, 68, 0.12);
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.crew-editor-fab--embedded .crew-editor-fab-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.crew-editor-fab-label {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.crew-editor-fab--embedded::after,
.crew-editor-fab--embedded::before {
  display: none;
}

/* Block-style cards (new_procedure.py _block_card) */
/* crew-wiki-main /new & new_procedure.html panel layout (Document Header, Infobox, etc.) */
.crew-np-panel {
  margin-bottom: 18px;
  border: 1px solid #c8d3e0;
  border-radius: 4px;
  background: #fff;
  overflow: hidden;
  font-family: Arial, sans-serif;
}

.crew-np-panel-title {
  background: var(--crew-navy);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 12px;
  margin: 0;
}

.crew-np-panel-body {
  padding: 20px;
}

.crew-np-field {
  margin-bottom: 14px;
}

.crew-np-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--crew-navy);
  margin-bottom: 4px;
}

.crew-np-input,
.crew-np-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
  font-family: Arial, sans-serif;
  color: #222;
  background: #fff;
}

.crew-np-input:focus,
.crew-np-textarea:focus {
  outline: none;
  border-color: var(--crew-blue);
  box-shadow: 0 0 0 2px rgba(26, 86, 160, 0.15);
}

.crew-np-textarea {
  resize: vertical;
  min-height: 60px;
  line-height: 1.45;
}

.crew-np-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 640px) {
  .crew-np-two-col {
    grid-template-columns: 1fr;
  }
}

.crew-np-note {
  margin: 12px 0 0;
  font-size: 12px;
  color: #777;
  line-height: 1.4;
}

.crew-np-note code {
  font-size: 11px;
  background: #f0f4fa;
  padding: 1px 5px;
  border-radius: 2px;
}

.crew-np-hint {
  margin: 0 0 12px;
  font-size: 12px;
  color: #777;
  line-height: 1.4;
}

.crew-np-panel-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #e8edf4;
}

/* Wiki content blocks (crew-wiki-main /new _block_card stack) */
.crew-editor-section-heading--content-blocks {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 3px solid var(--crew-blue);
}

.crew-np-wiki-block {
  position: relative;
  margin-bottom: 14px;
  padding: 12px 14px 14px 16px;
  border: 1px solid #c8d3e0;
  border-radius: 6px;
  background: #fff;
  font-family: Arial, sans-serif;
  box-shadow: 0 1px 2px rgba(15, 32, 68, 0.04);
}

.crew-np-wiki-block::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 6px 0 0 6px;
  background: #555;
}

.crew-np-wiki-block--section::before {
  background: var(--crew-navy);
}

.crew-np-wiki-block--subsection::before,
.crew-np-wiki-block--step_group::before,
.crew-np-wiki-block--note::before,
.crew-np-wiki-block--role::before,
.crew-np-wiki-block--example::before {
  background: var(--crew-blue);
}

.crew-np-wiki-block--steps::before {
  background: #7a8699;
}

.crew-np-wiki-block--warning::before {
  background: #c45000;
}

.crew-np-wiki-block--exception::before {
  background: #8b5a9e;
}

.crew-np-wiki-block--paragraph::before {
  background: #555;
}

.crew-np-wiki-block-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  min-height: 28px;
}

.crew-np-wiki-block-type {
  flex: 1;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--crew-blue);
}

.crew-np-wiki-block--section .crew-np-wiki-block-type {
  color: var(--crew-navy);
}

.crew-np-wiki-block--steps .crew-np-wiki-block-type {
  color: #4a5568;
}

.crew-np-wiki-block--warning .crew-np-wiki-block-type {
  color: #c45000;
}

.crew-np-wiki-block--paragraph .crew-np-wiki-block-type {
  color: #333;
}

.crew-np-wiki-block-delete {
  margin-left: auto;
  border: none;
  background: transparent;
  color: #6b7280;
  font-size: 18px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 4px;
}

.crew-np-wiki-block-delete:hover:not(:disabled) {
  color: #c45000;
  background: #fef2f2;
}

.crew-np-wiki-block-delete:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.crew-np-wiki-block-textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 88px;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
  font-family: Arial, sans-serif;
  line-height: 1.45;
  color: #222;
  background: #fff;
  resize: vertical;
}

.crew-np-wiki-block-textarea:focus {
  outline: none;
  border-color: var(--crew-blue);
  box-shadow: 0 0 0 2px rgba(26, 86, 160, 0.15);
}

.crew-np-wiki-block-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  color: #333;
  cursor: pointer;
}

.crew-np-wiki-block-check input {
  width: auto;
  margin: 0;
}

.crew-np-add-block-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 18px 0 8px;
  padding-top: 4px;
}

.crew-np-add-block-select {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
  padding: 8px 10px;
  border: 1px solid #c8d3e0;
  border-radius: 4px;
  font-size: 13px;
  font-family: Arial, sans-serif;
  color: #222;
  background: #fff;
}

.crew-np-add-block-select:focus {
  outline: none;
  border-color: var(--crew-blue);
  box-shadow: 0 0 0 2px rgba(26, 86, 160, 0.12);
}

.crew-np-add-block-btn {
  font-weight: 600;
}

/* Content blocks: new_procedure _block_card + macro accent colors */
.crew-np-content-block.crew-structured-section {
  border: 1px solid #d0d8e8;
  border-radius: 4px;
  background: #fafcff;
  box-shadow: none;
  padding: 12px 14px;
  gap: 14px;
}

.crew-np-content-block.crew-np-block--section {
  border-left: 4px solid var(--crew-navy);
}

.crew-np-content-block.crew-np-block--subsection,
.crew-np-content-block.crew-np-block--step_group {
  border-left: 4px solid var(--crew-blue);
}

.crew-np-content-block.crew-np-block--note {
  border-left: 4px solid var(--crew-blue);
}

.crew-np-content-block.crew-np-block--warning {
  border-left: 4px solid #c45000;
}

.crew-np-content-block.crew-np-block--paragraph {
  border-left: 4px solid #555;
}

.crew-np-block-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.crew-np-block-type {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--crew-navy);
}

.crew-np-block--note .crew-np-block-type {
  color: var(--crew-blue);
}

.crew-np-block--warning .crew-np-block-type {
  color: #c45000;
}

.crew-np-block--paragraph .crew-np-block-type {
  color: #333;
}

.crew-editor-workspace .crew-np-content-block .crew-structured-entry,
.crew-editor-workspace .crew-np-entry-card {
  border: 1px solid #d0d8e8;
  border-radius: 4px;
  background: #fff;
  box-shadow: none;
  padding: 12px 14px;
}

.crew-editor-workspace .crew-np-content-block .crew-structured-value-row {
  border-radius: 4px;
  background: #f8f9ff;
}

.crew-editor-header,
.crew-editor-footer,
.crew-editor-meta-grid,
.crew-editor-panels {
  font-family: Arial, sans-serif;
}

.crew-editor-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 0;
}

.crew-editor-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.crew-editor-eyebrow {
  color: var(--crew-blue);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.crew-editor-title {
  margin: 4px 0 0;
  color: var(--crew-navy);
  font-size: clamp(1.55rem, 1.3rem + 0.9vw, 2.05rem);
  line-height: 1.1;
}

.crew-editor-subtitle {
  margin: 6px 0 0;
  max-width: 72ch;
  color: #55657d;
  font-size: 0.95rem;
  line-height: 1.4;
}

.crew-editor-close {
  border: 0;
  background: transparent;
  color: #5b6b80;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

.crew-editor-field--grow {
  flex: 1;
}

.crew-editor-meta-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 12px;
}

.crew-editor-meta-grid--wide {
  grid-template-columns: minmax(320px, 1.4fr) minmax(260px, 420px);
}

.crew-editor-field {
  display: grid;
  gap: 6px;
}

.crew-editor-field span {
  color: #44556a;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.crew-editor-field input,
.crew-editor-field select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #c8d3e0;
  border-radius: 4px;
  padding: 0.65rem 0.75rem;
  font-size: 0.95rem;
  color: #1a1a1a;
  background: #ffffff;
  box-sizing: border-box;
}

.crew-editor-toggle {
  display: inline-flex;
  padding: 4px;
  border: 1px solid #c8d3e0;
  border-radius: 999px;
  background: #f7fafe;
  gap: 4px;
}

.crew-editor-toggle-button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #59708e;
  min-width: 96px;
  min-height: 38px;
  padding: 0 16px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.crew-editor-toggle-button--active {
  background: var(--crew-blue);
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(26, 86, 160, 0.22);
}

.crew-editor-toggle-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.crew-editor-alert {
  padding: 12px 14px;
  border-radius: 4px;
  font-family: Arial, sans-serif;
  font-size: 0.95rem;
}

.crew-editor-alert--error {
  background: #fff4ec;
  color: #8a3e00;
  border: 1px solid #f0c7a7;
}

.crew-editor-alert--success {
  background: #edf8f0;
  color: #1f6b34;
  border: 1px solid #b8ddc2;
}

.crew-editor-alert--info {
  background: #edf4fb;
  color: #184a84;
  border: 1px solid #bfd5f0;
}

.crew-editor-toolbar {
  display: flex;
  align-items: stretch;
  gap: 12px;
  flex-wrap: wrap;
}

.crew-editor-toolbar-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.crew-editor-toolbar-group--grow {
  flex: 1;
  justify-content: flex-end;
}

.crew-editor-source-toggle {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.crew-editor-toolbar-spacer {
  flex: 1;
}

.crew-editor-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.crew-editor-stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  border: 1px solid #d9e4f1;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.crew-editor-stat-label {
  color: #61728a;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.crew-editor-stat-value {
  color: var(--crew-navy);
  font-size: 1rem;
}

.crew-editor-inline-input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #c8d3e0;
  border-radius: 4px;
  padding: 0.65rem 0.75rem;
  font-size: 0.95rem;
  color: #1a1a1a;
  background: #ffffff;
  box-sizing: border-box;
}

.crew-editor-inline-input--title {
  font-size: 1rem;
  font-weight: 600;
}

.crew-editor-inline-input--subkey {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.crew-editor-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: #fff4ec;
  color: #8a3e00;
  font-size: 0.8rem;
  font-weight: 700;
}

.crew-structured-editor {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 0 0 auto;
  min-height: auto;
  overflow: visible;
  padding: 4px 0 12px;
}

.crew-editor-canvas {
  flex: 0 0 auto;
  min-height: auto;
  display: flex;
  flex-direction: column;
  padding: 2px 0 0;
  position: relative;
}

.crew-editor-fab {
  position: fixed;
  right: 28px;
  bottom: 28px;
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--crew-blue) 0%, var(--crew-navy) 100%);
  color: #ffffff;
  box-shadow: 0 20px 34px rgba(15, 32, 68, 0.28);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 40;
}

.crew-editor-fab:hover:not(:disabled) {
  transform: translateY(-1px);
}

.crew-editor-fab::after {
  content: attr(data-tooltip);
  position: absolute;
  right: calc(100% + 14px);
  bottom: calc(100% - 4px);
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(15, 32, 68, 0.96);
  color: #ffffff;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 14px 30px rgba(15, 32, 68, 0.24);
  opacity: 0;
  transform: translate3d(6px, 6px, 0) scale(0.98);
  pointer-events: none;
  transition: opacity 0.08s ease-out, transform 0.12s ease-out;
}

.crew-editor-fab::before {
  content: "";
  position: absolute;
  right: calc(100% + 8px);
  bottom: calc(100% + 10px);
  width: 10px;
  height: 10px;
  background: rgba(15, 32, 68, 0.96);
  transform: rotate(45deg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.08s ease-out, transform 0.12s ease-out;
}

.crew-editor-fab:hover::after,
.crew-editor-fab:hover::before,
.crew-editor-fab:focus-visible::after,
.crew-editor-fab:focus-visible::before {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.crew-editor-fab:disabled {
  cursor: wait;
  opacity: 0.75;
}

.crew-editor-fab-icon {
  font-size: 2rem;
  line-height: 1;
  font-weight: 400;
}

.crew-structured-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  border: 1px solid #dbe5f1;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 10px 24px rgba(15, 32, 68, 0.05);
}

.crew-structured-section-header {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(220px, 280px) auto;
  gap: 16px;
  align-items: end;
}

/* ── Section Navigator ──────────────────────────────────── */
.crew-section-nav {
  position: relative;
}

.crew-section-nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
}

.crew-section-nav-toggle:hover .crew-structured-label,
.crew-section-nav-toggle:hover .crew-section-nav-icon {
  color: var(--crew-blue);
}

.crew-section-nav-icon {
  font-size: 0.72rem;
  color: #8a99ab;
  transition: color 0.12s ease;
}

.crew-section-nav-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  min-width: 280px;
  max-width: 420px;
  max-height: 360px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #d8e1ec;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 32, 68, 0.16);
  padding: 6px 0;
}

.crew-section-nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 16px;
  border: none;
  background: none;
  font-size: 0.88rem;
  color: var(--crew-navy);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background-color 0.1s ease;
}

.crew-section-nav-item:hover {
  background: #f0f5fb;
}

.crew-section-nav-item--active {
  font-weight: 700;
  color: var(--crew-blue);
  background: #eef4fb;
}

.crew-structured-section-title-group,
.crew-structured-section-category-group,
.crew-structured-entry-key-group {
  display: grid;
  gap: 6px;
}

.crew-structured-section-actions,
.crew-structured-entry-actions,
.crew-structured-section-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.crew-structured-entry-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.crew-structured-entry {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border: 1px solid #e3ebf4;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
}

.crew-structured-entry-header {
  display: grid;
  grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
  gap: 16px;
  align-items: end;
}

.crew-structured-values {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.crew-structured-value-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 12px;
  background: #f8fbfe;
  border: 1px solid #e6eef7;
}

.crew-structured-value-row--labeled {
  grid-template-columns: auto minmax(160px, 240px) minmax(0, 1fr) auto;
}

.crew-structured-value-actions-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.crew-structured-textarea {
  width: 100%;
  min-height: 96px;
  border: 1px solid #c8d3e0;
  border-radius: 10px;
  padding: 12px;
  resize: vertical;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #1a1a1a;
  background: #ffffff;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.crew-structured-textarea:focus {
  outline: none;
  border-color: var(--crew-blue);
  box-shadow: 0 0 0 3px rgba(26, 86, 160, 0.12);
}

.crew-button--sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  gap: 6px;
  display: inline-flex;
  align-items: center;
}

.crew-button--sm i {
  font-size: 0.8rem;
}

.crew-structured-label {
  color: #44556a;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.crew-procedure-layout--editor .crew-procedure-content {
  max-width: none;
  width: 100%;
  padding: 0;
}

.crew-editor-shell .crew-button {
  white-space: nowrap;
}

.crew-editor-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(280px, 360px);
  gap: 16px;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.crew-editor-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid #d8e1ec;
  border-radius: 6px;
  overflow: hidden;
  background: #ffffff;
}

.crew-editor-panel-title {
  padding: 12px 14px;
  border-bottom: 1px solid #d8e1ec;
  color: var(--crew-navy);
  font-size: 0.92rem;
  font-weight: 700;
}

.crew-editor-textarea {
  flex: 1;
  min-height: 0;
  border: 0;
  padding: 16px;
  resize: none;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #1a1a1a;
  background: #ffffff;
  overflow: auto;
}

.crew-editor-textarea:focus {
  outline: none;
}

.crew-editor-preview {
  flex: 1;
  min-height: 0;
  padding: 16px 20px;
  overflow: auto;
  background: #ffffff;
}

.crew-editor-preview .crew-suggestion-highlight {
  background: #fff1a8;
  color: #1a1a1a;
  padding: 0 2px;
  border-radius: 2px;
}

.crew-editor-suggestions-panel {
  background: #f8fbff;
}

.crew-editor-suggestions-body {
  flex: 1;
  padding: 12px;
  overflow: auto;
  display: grid;
  gap: 12px;
  align-content: start;
}

.crew-editor-suggestions-empty {
  color: #516173;
  font-size: 0.92rem;
}

.crew-editor-suggestion-card {
  border: 1px solid #d8e1ec;
  border-radius: 6px;
  background: #ffffff;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.crew-editor-suggestion-meta {
  color: #44556a;
  font-size: 0.82rem;
  font-weight: 700;
}

.crew-editor-suggestion-submitted-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.crew-editor-suggestion-submitted-row--above-actions {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid #e8eef5;
}

.crew-editor-suggestion-date {
  color: #516173;
  font-size: 0.8rem;
  font-weight: 500;
}

.crew-editor-suggestion-author-wrap {
  position: relative;
  flex-shrink: 0;
}

.crew-editor-suggestion-avatar-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 2px solid #c8d3e0;
  border-radius: 50%;
  background: #f0f4f8;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.crew-editor-suggestion-avatar-btn:hover {
  border-color: #6b8caf;
  box-shadow: 0 0 0 2px rgba(107, 140, 175, 0.25);
}

.crew-editor-suggestion-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.crew-editor-suggestion-avatar-initials {
  font-size: 0.75rem;
  font-weight: 700;
  color: #2c5282;
  letter-spacing: -0.02em;
}

.crew-editor-suggestion-author-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 40;
  width: max-content;
  max-width: min(640px, calc(100vw - 24px));
  padding: 10px 12px;
  border: 1px solid #d8e1ec;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 -4px 20px rgba(26, 42, 74, 0.12);
  font-size: 0.82rem;
  line-height: 1.4;
  box-sizing: border-box;
}

/* Email: single line; scroll horizontally only if longer than popover max-width */
.crew-editor-suggestion-author-popover-line {
  color: #1a1a1a;
  white-space: nowrap;
  overflow-x: auto;
  max-width: 100%;
  scrollbar-width: thin;
}

.crew-editor-suggestion-author-popover-line + .crew-editor-suggestion-author-popover-line {
  margin-top: 6px;
  color: #44556a;
  white-space: normal;
  word-break: break-word;
  overflow-x: visible;
  max-width: none;
}

.crew-editor-suggestion-author-popover-teams {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e8eef5;
}

.crew-editor-suggestion-teams-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #5b5fc7;
  text-decoration: none;
}

.crew-editor-suggestion-teams-link:hover {
  text-decoration: underline;
  color: #444791;
}

.crew-editor-suggestion-label {
  color: #44556a;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.crew-editor-original-button {
  width: 100%;
  border: 1px solid #c8d3e0;
  border-radius: 4px;
  background: #f6f9fc;
  color: #1a1a1a;
  text-align: left;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 8px;
  cursor: pointer;
}

.crew-editor-original-button:hover {
  background: #eef4fb;
}

.crew-editor-suggestion-change {
  border: 1px solid #d8e1ec;
  border-radius: 4px;
  background: #ffffff;
  padding: 8px;
  font-size: 0.85rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.crew-editor-comments {
  width: 100%;
  min-height: 88px;
  border: 1px solid #c8d3e0;
  border-radius: 4px;
  box-sizing: border-box;
  padding: 8px;
  resize: vertical;
  font-family: Arial, sans-serif;
  font-size: 0.88rem;
}

.crew-editor-suggestion-actions {
  display: flex;
  gap: 8px;
}

.crew-editor-suggestion-actions .crew-button {
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
}

.crew-editor-footer {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
  padding: 20px 24px 4px;
  margin-top: 6px;
  border-top: 1px solid #dce6f2;
  background: transparent;
  position: static;
}

.crew-editor-document-id-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.crew-editor-document-id-label {
  color: #61728a;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.crew-editor-document-id-value {
  color: var(--crew-navy);
  font-size: 0.95rem;
  font-weight: 700;
  word-break: break-all;
}

@media (max-width: 1080px) {
  .crew-editor-shell {
    height: auto;
  }

  .crew-editor-dialog {
    width: 100%;
    max-height: none;
  }

  .crew-editor-dialog--inline {
    padding: 12px 0 20px;
  }

  .crew-editor-workspace-grid {
    grid-template-columns: 1fr;
  }

  .crew-editor-workspace-col--preview {
    position: static;
    max-width: 100%;
  }

  .crew-editor-form-scroll {
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
  }

  .crew-editor-preview-frame {
    max-height: 480px;
  }

  .crew-editor-page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .crew-editor-page-header .crew-editor-header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .crew-editor-meta-grid,
  .crew-editor-meta-grid--wide,
  .crew-structured-section-header,
  .crew-structured-entry-header {
    grid-template-columns: 1fr;
  }

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

  .crew-editor-header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .crew-editor-footer {
    flex-wrap: wrap;
  }

  .crew-editor-toolbar,
  .crew-structured-value-row {
    flex-direction: column;
    align-items: stretch;
  }

  .crew-editor-toolbar-group,
  .crew-editor-toolbar-group--grow {
    width: 100%;
    justify-content: flex-start;
  }

  .crew-editor-stats {
    grid-template-columns: 1fr;
  }

  .crew-structured-value-row {
    display: flex;
  }

  .crew-editor-fab {
    right: 18px;
    bottom: 18px;
    width: 54px;
    height: 54px;
  }

  .crew-editor-source-toggle {
    width: 100%;
  }

  .crew-structured-value-actions-inline {
    flex-direction: row;
  }

  .crew-editor-inline-input--subkey {
    width: 100%;
    flex-basis: auto;
  }

  .crew-editor-textarea,
  .crew-editor-preview {
    min-height: 320px;
  }
}

.crew-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

/* ── Tags ───────────────────────────────────────────────── */
.crew-tag {
  background-color: var(--crew-note-bg);
  color: var(--crew-blue);
  border: 1px solid var(--crew-blue);
  font-size: 11px;
  font-weight: 600;
  border-radius: 2px;
  padding: 2px 7px;
  display: inline-block;
  margin: 2px 2px 2px 0;
  font-family: Arial, sans-serif;
}

/* ── Markdown rendered content ──────────────────────────── */
.crew-markdown {
  font-family: Arial, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: #1a1a1a;
  max-width: 960px;
}

.crew-markdown p {
  margin: 0.6em 0;
}

.crew-markdown a {
  color: var(--crew-blue);
  font-weight: 500;
  text-decoration: none;
}

.crew-markdown a:hover {
  text-decoration: underline;
}

.crew-markdown h1 {
  color: var(--crew-navy);
  font-size: 22px;
  font-weight: 700;
  margin: 28px 0 12px 0;
  border-bottom: 2px solid var(--crew-blue);
  padding-bottom: 6px;
}

.crew-markdown h2 {
  background-color: var(--crew-section-bg);
  color: white;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 14px;
  margin: 24px 0 10px 0;
  border-radius: 2px;
}

.crew-markdown h3 {
  color: var(--crew-blue);
  font-weight: 700;
  font-size: 13px;
  padding: 4px 0;
  margin: 18px 0 6px 0;
  border-bottom: 1px solid var(--crew-blue);
}

.crew-markdown h4 {
  color: var(--crew-blue);
  font-weight: 700;
  font-size: 13px;
  padding: 4px 0;
  margin: 14px 0 4px 0;
}

/* ── Tables ─────────────────────────────────────────────── */
.crew-markdown table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid #d0d8e3;
  border-radius: 3px;
  overflow: hidden;
  table-layout: fixed;
}

.crew-markdown th {
  background-color: var(--crew-navy);
  color: white;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  border-bottom: 2px solid var(--crew-blue);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.crew-markdown td {
  padding: 6px 10px;
  border-bottom: 1px solid #e0e8f0;
  vertical-align: top;
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.crew-markdown tr:nth-child(even) td {
  background-color: #f8fafc;
}

.crew-markdown tr:hover td {
  background-color: #edf2f9;
}

/* ── Blockquotes (used as callouts) ─────────────────────── */
.crew-markdown blockquote {
  background: var(--crew-note-bg);
  border-left: 4px solid var(--crew-blue);
  padding: 10px 14px;
  margin: 12px 0;
  border-radius: 0 4px 4px 0;
  font-size: 13px;
  font-family: Arial, sans-serif;
  color: #333;
}

.crew-markdown blockquote p {
  margin: 0.3em 0;
}

/* ── Code ───────────────────────────────────────────────── */
.crew-markdown code {
  background: var(--crew-example-bg);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 13px;
}

.crew-markdown pre {
  background: var(--crew-example-bg);
  border-left: 4px solid var(--crew-example-bdr);
  padding: 12px 16px;
  margin: 12px 0;
  border-radius: 0 4px 4px 0;
  overflow-x: auto;
  font-size: 13px;
}

.crew-markdown pre code {
  background: none;
  padding: 0;
}

/* ── Lists ──────────────────────────────────────────────── */
.crew-markdown ul,
.crew-markdown ol {
  padding-left: 24px;
  margin: 8px 0;
}

.crew-markdown li {
  margin: 4px 0;
  line-height: 1.55;
}

.crew-markdown li > ul,
.crew-markdown li > ol {
  margin: 4px 0;
}

/* ── Images ─────────────────────────────────────────────── */
.crew-markdown img {
  max-width: 100%;
  height: auto;
  border-radius: 3px;
}

/* ── Horizontal Rules ───────────────────────────────────── */
.crew-markdown hr {
  border: none;
  border-top: 2px solid #c8d3e0;
  margin: 28px 0;
}

/* ── Strong / Emphasis ──────────────────────────────────── */
.crew-markdown strong {
  font-weight: 700;
  color: var(--crew-navy);
}

/* ── Line breaks within table cells (from <br>) ─────────── */
.crew-markdown td br {
  display: block;
  content: "";
  margin-top: 4px;
}

/* ── CREW Infobox (Wikipedia-style metadata card) ─────────── */
.crew-infobox {
  float: right;
  clear: right;
  margin: 0 0 16px 24px;
  width: 280px;
  border: 1px solid #c8d3e0;
  border-radius: 4px;
  font-family: Arial, sans-serif;
  font-size: 13px;
  background: #fafcff;
  overflow: hidden;
}

.crew-infobox-title {
  background-color: var(--crew-navy);
  color: white;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 12px;
  text-align: center;
}

.crew-infobox table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  display: table;
}

.crew-infobox td {
  padding: 5px 10px;
  border-bottom: 1px solid #e0e8f0;
  vertical-align: top;
}

.crew-infobox td:first-child {
  color: var(--crew-blue);
  font-weight: 600;
  width: 40%;
  white-space: nowrap;
}

.crew-infobox a {
  color: var(--crew-blue);
}

/* ── CREW Hatnote ─────────────────────────────────────────── */
.crew-hatnote {
  border-left: 3px solid var(--crew-blue);
  background: var(--crew-note-bg);
  padding: 6px 12px;
  margin: 8px 0 16px 0;
  font-size: 13px;
  font-style: italic;
  color: #333;
  border-radius: 0 2px 2px 0;
  font-family: Arial, sans-serif;
}

.crew-hatnote a {
  color: var(--crew-blue);
  font-weight: 600;
  font-style: normal;
}

/* ── CREW Section Headers ─────────────────────────────────── */
.crew-section {
  background-color: var(--crew-section-bg);
  color: white;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 14px;
  margin: 20px 0 8px 0;
  border-radius: 2px;
  font-family: Arial, sans-serif;
}

.crew-section-major {
  background-color: var(--crew-section-bg);
  color: white;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 15px;
  margin: 28px 0 10px 0;
  border-radius: 2px;
  font-family: Arial, sans-serif;
}

.crew-subsection {
  color: var(--crew-blue);
  font-weight: 700;
  font-size: 13px;
  padding: 4px 0;
  margin: 16px 0 4px 0;
  border-bottom: 1px solid var(--crew-blue);
  font-family: Arial, sans-serif;
}

.crew-step-group {
  color: var(--crew-blue);
  font-weight: 700;
  font-size: 13px;
  padding: 4px 0;
  margin: 14px 0 4px 0;
  font-family: Arial, sans-serif;
}

/* ── CREW Role Labels ─────────────────────────────────────── */
.crew-role {
  color: var(--crew-blue);
  font-weight: 700;
  text-decoration: underline;
  font-family: Arial, sans-serif;
  display: inline-block;
  margin: 6px 0 2px 0;
}

/* ── CREW Callout Blocks ──────────────────────────────────── */
.crew-note {
  background: var(--crew-note-bg);
  border-left: 4px solid var(--crew-blue);
  padding: 8px 12px;
  margin: 8px 0;
  border-radius: 0 4px 4px 0;
  font-size: 13px;
  font-family: Arial, sans-serif;
}

.crew-exception {
  background: var(--crew-exception-bg);
  border-left: 4px solid var(--crew-exception-bdr);
  padding: 8px 12px;
  margin: 8px 0;
  border-radius: 0 4px 4px 0;
  font-size: 13px;
  font-family: Arial, sans-serif;
}

.crew-warning {
  background: var(--crew-warning-bg);
  border-left: 4px solid var(--crew-warning-bdr);
  padding: 8px 12px;
  margin: 8px 0;
  border-radius: 0 4px 4px 0;
  font-size: 13px;
  font-family: Arial, sans-serif;
}

.crew-example {
  background: var(--crew-example-bg);
  border-left: 4px solid var(--crew-example-bdr);
  padding: 8px 12px;
  margin: 8px 0;
  border-radius: 0 4px 4px 0;
  font-size: 13px;
  font-family: Arial, sans-serif;
}

/* Suppress extra margins inside callout blocks */
.crew-note p,
.crew-exception p,
.crew-warning p,
.crew-example p {
  margin: 0;
  display: inline;
}

/* ── CREW Procedure Header Card ───────────────────────────── */
.crew-header-card {
  border: 1px solid #c8d3e0;
  border-radius: 4px;
  overflow: hidden;
  font-family: Arial, sans-serif;
  margin-bottom: 20px;
  clear: both;
}

.crew-header-card .crew-header-top {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  background: white;
  border-bottom: 2px solid var(--crew-blue);
}

.crew-header-card .crew-header-logo {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-right: 20px;
}

.crew-header-card .crew-header-logo img {
  height: 48px;
}

.crew-header-card .crew-header-logo span {
  color: var(--crew-blue);
  font-style: italic;
  font-size: 11px;
  margin-top: 2px;
}

.crew-header-card .crew-header-title {
  flex: 1;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: #111;
}

.crew-header-card .crew-header-meta {
  display: flex;
  justify-content: space-around;
  padding: 6px 20px;
  background: white;
  font-size: 13px;
  color: var(--crew-blue);
  font-weight: 500;
}

/* ── See Also Section ─────────────────────────────────────── */
.crew-see-also {
  border-top: 1px solid #c8d3e0;
  margin-top: 32px;
  padding-top: 12px;
}

.crew-see-also h2 {
  color: var(--crew-navy);
  font-size: 16px;
  margin-bottom: 8px;
  background: none;
  padding: 0;
}

.crew-see-also ul {
  list-style: none;
  padding: 0;
}

.crew-see-also li {
  padding: 3px 0;
}

.crew-see-also li::before {
  content: "→ ";
  color: var(--crew-blue);
  font-weight: 700;
}

.crew-see-also a {
  color: var(--crew-blue);
  font-weight: 500;
}

/* ── Regulation Link ──────────────────────────────────────── */
.crew-reg-link {
  font-family: Arial, sans-serif;
  font-size: 13px;
}

/* ── Procedure Link ───────────────────────────────────────── */
.crew-proc-link {
  font-family: Arial, sans-serif;
  font-size: 13px;
  color: var(--crew-blue);
  font-weight: 500;
}

/* ── Clearfix for infobox float ───────────────────────────── */
.crew-clearfix::after {
  content: "";
  display: table;
  clear: both;
}

/* ── Procedure page layout (content + TOC side panel) ─────── */
.crew-procedure-layout {
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

.crew-procedure-layout .crew-procedure-content {
  flex: 1;
  min-width: 0;
  max-width: 900px;
  padding: 24px 36px;
}

.crew-procedure-layout--editor .crew-procedure-content {
  max-width: none;
  padding: 0;
}

/* ── In-page TOC panel ────────────────────────────────────── */
.crew-toc-panel {
  width: 190px;
  flex-shrink: 0;
  position: sticky;
  top: 24px;
  padding: 12px 0;
  border-left: 2px solid #e0e8f0;
  margin-top: 24px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.crew-toc-title {
  font-family: Arial, sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(15, 32, 68, 0.5);
  padding: 0 12px 8px 12px;
}

.crew-toc-item {
  display: block;
  font-family: Arial, sans-serif;
  font-size: 12px;
  color: var(--crew-blue);
  text-decoration: none;
  padding: 3px 12px;
  line-height: 1.4;
  border-left: 2px solid transparent;
  margin-left: -2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color 0.15s, color 0.15s;
}

.crew-toc-item:hover {
  color: var(--crew-navy);
  border-left-color: var(--crew-blue);
  background: rgba(26, 86, 160, 0.05);
  text-decoration: none;
}

.crew-toc-major {
  font-weight: 700;
  font-size: 12px;
  color: var(--crew-navy);
}

.crew-toc-section {
  font-weight: 600;
}

.crew-toc-subsection {
  padding-left: 22px;
  font-size: 11px;
  color: #555;
}

.crew-toc-subsection:hover {
  color: var(--crew-navy);
}

/* Hide TOC on narrow viewports */
@media (max-width: 900px) {
  .crew-procedure-layout {
    flex-direction: column;
  }
  .crew-toc-panel {
    display: none;
  }
  .crew-procedure-layout .crew-procedure-content {
    max-width: 100%;
  }
}


/* ============================================================
   CREW Profile Menu — floating FAB top-right
   ============================================================ */

/* ── FAB Container ──────────────────────────────────────────── */
.crew-profile-fab {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 900;
}

/* ── Avatar Button ──────────────────────────────────────────── */
.crew-profile-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.7);
  background: var(--crew-navy);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.20);
  transition: box-shadow 0.2s, transform 0.15s;
}

.crew-profile-avatar:hover {
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.30);
  transform: scale(1.05);
}

.crew-profile-fab.open .crew-profile-avatar {
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.30);
}

.crew-profile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.crew-profile-initials {
  font-size: 13px;
  font-weight: 700;
  font-family: Arial, sans-serif;
  letter-spacing: 0.5px;
  line-height: 1;
}

/* ── Backdrop ───────────────────────────────────────────────── */
.crew-profile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(2px);
  z-index: 899;
  animation: crew-fade-in 0.15s ease;
}

@keyframes crew-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Flyout Panel ───────────────────────────────────────────── */
.crew-profile-panel {
  position: fixed;
  top: 56px;
  right: 16px;
  width: 240px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18),
              0 2px 8px  rgba(0, 0, 0, 0.10);
  z-index: 901;
  font-family: Arial, sans-serif;
  overflow: hidden;
  animation: crew-panel-in 0.18s ease;
}

@keyframes crew-panel-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ── Profile Header ─────────────────────────────────────────── */
.crew-profile-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 10px;
}

.crew-profile-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--crew-navy);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
}

.crew-profile-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.crew-profile-header-info {
  min-width: 0;
}

.crew-profile-name {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a2e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crew-profile-email {
  font-size: 11px;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Divider ────────────────────────────────────────────────── */
.crew-profile-divider {
  height: 1px;
  background: #e8e8e8;
  margin: 4px 0;
}

/* ── Navigation ─────────────────────────────────────────────── */
.crew-profile-nav {
  padding: 4px 0;
  max-height: 260px;
  overflow-y: auto;
}

.crew-profile-nav-group {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #999;
  padding: 8px 16px 3px;
}

.crew-profile-nav-link {
  display: block;
  padding: 6px 16px;
  font-size: 12.5px;
  color: #333;
  text-decoration: none;
  transition: background 0.12s;
}

.crew-profile-nav-link:hover {
  background: #f0f4fa;
  color: var(--crew-blue, #1a56a0);
}

/* ── Logout ─────────────────────────────────────────────────── */
.crew-profile-logout {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 16px;
  font-size: 12px;
  font-family: Arial, sans-serif;
  color: #c0392b;
  border: none;
  background: none;
  cursor: pointer;
  transition: background 0.12s;
}

.crew-profile-logout:hover {
  background: #fdf0ef;
}

.crew-profile-logout i {
  margin-right: 6px;
}

/* ── Environment Chip (corner label on avatar) ────────────── */
.crew-env-chip {
  position: static;
  margin-top: 4px;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.4px;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1;
}

.crew-env-chip--dev {
  background: #fff3cd;
  color: #664d03;
  border: 1px solid #ffda6a;
}

.crew-env-chip--qa {
  background: #cff4fc;
  color: #055160;
  border: 1px solid #6edff6;
}

.crew-env-chip--uat {
  background: #e2d9f3;
  color: #432874;
  border: 1px solid #c4a8e8;
}

/* ── Environment Detail (inside profile flyout) ───────────── */
.crew-env-detail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 11px;
  line-height: 1.3;
}

.crew-env-detail-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.crew-env-detail-meta {
  font-weight: 400;
  opacity: 0.75;
}

.crew-env-detail--dev {
  background: #fff8e1;
  color: #664d03;
}

.crew-env-detail--qa {
  background: #e8fbff;
  color: #055160;
}

.crew-env-detail--uat {
  background: #f3eefa;
  color: #432874;
}
