/* ============================================================
   CREW Content Viewer — Blazor View Stylesheet
   ============================================================ */

/* ── Color Tokens ─────────────────────────────────────────── */
/* `.crew-theme-light` re-declares the same tokens on an inner subtree, so a
   surface can opt out of dark mode even while `.crew-theme-dark` sits on the
   shell wrapper above it. Used by document surfaces, which always render
   light so authored content looks the same as it will in print/export. */
:root,
.crew-theme-light {
  /* Brand */
  --crew-navy:            #0f2044;
  --crew-blue:            #1B7AC3;
  --crew-figma-blue:      #1B7AC3;
  --crew-figma-blue-dark: #156082;
  --crew-blue-light:      #97D6FC; /* CREW-3 — home page search box */
  --crew-blue-mid:        #2BABFB; /* CREW-2 — reserved for future pages */
  --crew-dark:            #163E64; /* CREW-DARK — reserved for future pages */

  /* Surfaces */
  --crew-figma-gray:      #F3F3F3;
  --crew-bg-surface:      #ffffff;
  --crew-bg-hover:        #f0f4fa;
  --crew-home-bg:         #FFFFFF;
  --crew-sidebar-bg:      #0f2044;
  --crew-table-bg:        #ffffff;
  --crew-table-header-bg: #f5f7fa;
  --crew-table-hover:     #fafcfe;
  --crew-input-bg:        #ffffff;
  --crew-selected-bg:     #e3f0ff;

  /* Text */
  --crew-text:            #333333;
  --crew-text-muted:      #666666;
  --crew-text-faint:      #999999;
  --crew-text-on-brand:   #ffffff;
  --crew-accent:          #1f6feb;
  --crew-star:            #f0ad4e;
  --crew-star-empty:      #cccccc;

  /* Borders */
  --crew-border:          #e0e0e0;
  --crew-border-light:    #f0f0f0;

  /* Semantic callouts */
  --crew-note-bg:         #e8f0fb;
  --crew-warning-bg:      #fff4ec;
  --crew-warning-bdr:     #c45000;
  --crew-success-bg:      #dcfce7;
  --crew-success-text:    #166534;
  --crew-danger-bg:       #fee2e2;
  --crew-danger-text:     #991b1b;

  /* Elevation */
  --crew-shadow:          0 2px 8px rgba(0, 0, 0, 0.20);
  --crew-figma-shadow:    0 4px 4px rgba(0, 0, 0, 0.25);
  --crew-radius:          6px;

  /* Typography */
  --crew-font-body:       'Work Sans', Arial, sans-serif;
  --crew-font-work:       'Work Sans', sans-serif;
  --crew-font-droid:      'Droid Sans', sans-serif;
}

/* ── Dark Theme Tokens ────────────────────────────────────────
   Applied by CrewLayout as a class on the shell wrapper when
   IThemeViewModel.IsDarkMode is true. MudThemeProvider handles
   MudBlazor components; these tokens cover CREW's own chrome.
────────────────────────────────────────────────────────────── */
.crew-theme-dark {
  /* Brand — lifted for contrast against dark surfaces */
  --crew-navy:            #0b1729;
  --crew-blue:            #4FA9E8;
  --crew-figma-blue:      #4FA9E8;
  --crew-figma-blue-dark: #7CC3F3;
  --crew-blue-light:      #1d4e6d;
  --crew-blue-mid:        #2BABFB;
  --crew-dark:            #CFE6F7;

  /* Surfaces */
  --crew-figma-gray:      #1c2430;
  --crew-bg-surface:      #141a23;
  --crew-bg-hover:        #232d3b;
  --crew-home-bg:         #141a23;
  --crew-sidebar-bg:      #0b1729;
  --crew-table-bg:        #141a23;
  --crew-table-header-bg: #1c2430;
  --crew-table-hover:     #232d3b;
  --crew-input-bg:        #10161f;
  --crew-selected-bg:     #173653;

  /* Text */
  --crew-text:            #e6ebf2;
  --crew-text-muted:      #a8b3c2;
  --crew-text-faint:      #7d8899;
  --crew-text-on-brand:   #ffffff;
  --crew-accent:          var(--crew-blue);
  --crew-star:            #f0ad4e;
  --crew-star-empty:      var(--crew-text-faint);

  /* Borders */
  --crew-border:          #2f3a49;
  --crew-border-light:    #262f3c;

  /* Semantic callouts */
  --crew-note-bg:         #16293d;
  --crew-warning-bg:      #3a2415;
  --crew-warning-bdr:     #e2803c;
  --crew-success-bg:      #153b2a;
  --crew-success-text:    #86efac;
  --crew-danger-bg:       #451f24;
  --crew-danger-text:     #fca5a5;

  /* Elevation */
  --crew-shadow:          0 2px 8px rgba(0, 0, 0, 0.55);
  --crew-figma-shadow:    0 4px 4px rgba(0, 0, 0, 0.60);

  color-scheme: dark;
  background-color: var(--crew-bg-surface);
  color: var(--crew-text);
}

/* Native form controls and scrollbars follow the inherited color-scheme, so a
   light subtree has to restate it or selects/inputs keep rendering dark. */
.crew-theme-light {
  color-scheme: light;
  background-color: var(--crew-bg-surface);
  color: var(--crew-text);
}

/* ── App Shell ──────────────────────────────────────────────── */
.crew-app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.crew-app-row {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.crew-content-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  min-width: 0;
}

.crew-content-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-height: 0;
}

/* ── Persistent application title bar ───────────────────────── */
.crew-appbar {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 56px;
  flex-shrink: 0;
  padding: 6px 16px;
  background-color: var(--crew-figma-gray, #F3F3F3);
  border-bottom: 1px solid var(--crew-border, #e0e0e0);
  z-index: 50;
}

/* The CREW mark carries its own brand color and reads on both themes, so it
   is never inverted. */
.crew-appbar-logo {
  width: auto;
  height: 30px;
  max-width: 160px;
  object-fit: contain;
  object-position: left center;
  flex-shrink: 0;
  margin-right: 10px;
}

.crew-appbar-action {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--crew-text, #333333);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  text-decoration: none;
  font-size: 20px;
}

.crew-appbar-action:hover:not(:disabled):not(.crew-appbar-action--disabled) {
  background: rgba(27, 122, 195, 0.1);
  color: var(--crew-blue, #1B7AC3);
}

.crew-appbar-action:disabled,
.crew-appbar-action--disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.crew-appbar-profile {
  flex-shrink: 0;
  margin-left: 2px;
}

.crew-appbar-profile .crew-sidebar-profile {
  padding: 0;
  border-bottom: 0;
}

.crew-appbar-profile .crew-sidebar-profile-info {
  display: none;
}

.crew-appbar-profile .crew-sidebar-profile-avatar {
  box-shadow: none;
}

.crew-appbar-title {
  min-width: 120px;
  flex: 1 1 auto;
  font-family: var(--crew-font-body);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--crew-text, #333333);
  white-space: nowrap;
}

.crew-appbar-search {
  width: clamp(160px, 24vw, 360px);
  height: 36px;
  display: flex;
  align-items: center;
  border: 1px solid var(--crew-border, #d0d0d0);
  border-radius: 18px;
  background: var(--crew-bg-surface, #fff);
  overflow: hidden;
}

.crew-appbar-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  padding: 0 4px 0 14px;
  background: transparent;
  color: var(--crew-text, #333333);
}

.crew-appbar-search button {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--crew-blue, #1B7AC3);
  cursor: pointer;
  font-size: 20px;
}

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

.crew-appbar-notifications {
  display: flex;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .crew-appbar {
    gap: 2px;
    padding-inline: 6px;
  }

  .crew-appbar-logo {
    height: 24px;
    max-width: 110px;
    margin-right: 4px;
  }

  .crew-appbar-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .crew-appbar-search {
    width: 150px;
  }
}

/* ── Nav Panel (resizable) ──────────────────────────────────── */
.crew-nav-panel {
  background-color: var(--crew-figma-gray, #F3F3F3);
  display: flex;
  flex-direction: column;
  height: 100%;
  flex-shrink: 0;
  overflow: hidden;
  transition: width 0.2s ease;
  position: relative;
}

.crew-nav-panel--collapsed {
  width: 0 !important;
  min-width: 0;
  border: 0;
}

.crew-content-panel {
  background-color: var(--crew-bg-surface);
  overflow-y: auto;
  height: 100%;
}

/* ── Splitter Bar ───────────────────────────────────────────── */
.crew-splitter-bar {
  width: 4px;
  background: var(--crew-border);
  cursor: col-resize;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  transition: background 0.15s;
}

.crew-splitter-bar:hover,
.crew-splitter-bar.dragging {
  background: var(--crew-blue);
}

.crew-splitter-bar--collapsed {
  width: 0;
  cursor: default;
  background: transparent;
}

.crew-splitter-bar--collapsed:hover {
  background: transparent;
}

.crew-splitter-bar::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -4px;
  right: -4px;
}

/* ── Collapse Tab (full-height toggle between sidebar and content) ─── */
.crew-collapse-tab {
  width: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--crew-figma-gray, #F3F3F3);
  border: none;
  border-left: 1px solid var(--crew-border);
  border-right: 1px solid var(--crew-border);
  cursor: pointer;
  color: #9ab;
  transition: background 0.15s, color 0.15s;
  padding: 0;
  outline: none;
}

.crew-collapse-tab:hover {
  background: rgba(27, 122, 195, 0.50);
  color: #fff;
}

.crew-collapse-tab:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(27, 122, 195, 0.30);
}

.crew-collapse-tab--collapsed {
  border-left: none;
}

.crew-collapse-tab-icon {
  display: block;
  font-size: 12px;
}

/* ── Sidebar ────────────────────────────────────────────── */
.crew-sidebar {
  background-color: var(--crew-figma-gray, #F3F3F3);
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Collapsed hides the sidebar entirely; the collapse tab is the only affordance. */
.crew-nav-panel--collapsed .crew-sidebar {
  display: none;
}

/* ── Sidebar Collapse Toggle ────────────────────────────────── */
.crew-sidebar-collapse-toggle {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--crew-figma-gray, #F3F3F3);
  border: none;
  border-top: 1px solid var(--crew-border-light);
  color: var(--crew-text-faint);
  cursor: pointer;
  padding: 8px 14px;
  transition: background 0.15s ease, color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  z-index: 5;
  height: 32px;
  outline: none;
}

.crew-sidebar-collapse-toggle:hover {
  background: var(--crew-bg-hover);
  color: var(--crew-blue);
}

.crew-sidebar-collapse-toggle:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(27, 122, 195, 0.30);
}

.crew-sidebar-collapse-toggle--collapsed {
  justify-content: center;
}

.crew-sidebar-collapse-icon {
  display: block;
  transition: transform 0.2s ease;
}

.crew-sidebar-collapse-toggle--collapsed .crew-sidebar-collapse-icon {
  transform: rotate(180deg);
}

/* ── Filter Input ───────────────────────────────────────── */
.crew-sidebar-toc-error {
  padding: 8px 12px;
  font-size: 12px;
  color: #fbbf24;
  display: flex;
  align-items: center;
  gap: 8px;
}

.crew-sidebar-retry-btn {
  background: transparent;
  border: 1px solid #fbbf24;
  color: #fbbf24;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}

.crew-sidebar-retry-btn:hover {
  background: rgba(251, 191, 36, 0.15);
}

.crew-sidebar-filter {
  padding: 8px 12px;
  border-bottom: 1px solid var(--crew-border-light);
  flex-shrink: 0;
}

.crew-filter-input {
  width: 100%;
  padding: 5px 8px;
  font-size: 12px;
  font-family: var(--crew-font-body);
  border: 1px solid var(--crew-border);
  border-radius: 3px;
  background: var(--crew-bg-surface);
  color: var(--crew-blue);
  outline: none;
  box-sizing: border-box;
}

.crew-filter-input::placeholder {
  color: var(--crew-text-faint);
}

.crew-filter-input:focus {
  border-color: var(--crew-blue);
  background: var(--crew-bg-surface);
}

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

.crew-nav-link {
  display: block;
  color: var(--crew-blue);
  font-family: var(--crew-font-body);
  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: var(--crew-figma-blue-dark, #156082);
  background-color: rgba(0, 0, 0, 0.05);
  text-decoration: none;
}

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

.crew-nav-docid {
  display: block;
  font-size: 10px;
  opacity: 0.5;
  font-family: monospace;
}

.crew-nav-loading,
.crew-nav-error {
  color: var(--crew-text-faint);
  font-size: 12px;
  padding: 14px;
  font-family: var(--crew-font-body);
}

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

/* ── Content Area ───────────────────────────────────────── */
/* The right-panel shell is a non-scrolling 100vh flex column. Vertical scroll
   lives in its descendant regions (the document body scroll region and the
   right-rail scroll region) so the pinned header + tab bar stay put while the
   body and rail scroll independently. Non-document states (home / loading /
   error) get their own scroll via .crew-content-fallback-scroll below. */
.crew-content {
  position: relative;
  flex: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  scroll-behavior: smooth;
  padding: 0;
}

/* ── Semantic Search (non-routed, fills content-body) ──────── */
.crew-semantic-search-page {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 24px 32px;
  align-items: center;
  overflow: hidden;
}

.crew-semantic-search-header {
  flex-shrink: 0;
  max-width: 960px;
  width: 100%;
}

.crew-semantic-search-scroll {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-width: 960px;
  width: 100%;
}

.crew-semantic-search-scroll .crew-search-pager {
  position: sticky;
  bottom: 0;
  background: var(--crew-bg-surface, #fff);
  padding: 12px 0;
  z-index: 2;
}

/* ── Fixed-layout search results (header / scroll body / footer pager) ── */
.crew-semantic-search-results {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.crew-search-results--fixed-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.crew-search-results-header {
  flex-shrink: 0;
}

.crew-search-results-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.crew-search-results-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--crew-border, #e0e0e0);
  background: var(--crew-bg-surface, #fff);
  padding: 8px 0;
}

/* Home / loading / error states render here (no document shell) and keep the
   original scroll + page padding the shell used to provide. */
.crew-content-fallback-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding: 12px 32px 24px;
}

.crew-search-results-scroll {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 12px 32px 0;
}

.crew-search-results-scroll .crew-procedure-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.crew-procedure-content {
  max-width: 960px;
  margin: 0 auto;
}

/* ── Document View shell (pinned header + independent body/rail scroll) ─────
   New layout for the document-loaded states (tabbed and linear). Replaces the
   .crew-procedure-layout shape for those states; .crew-procedure-layout is
   left defined below for any non-document caller. */
.crew-doc-shell-header {
  position: relative;
  flex-shrink: 0;
  padding: 6px 24px 10px;
  background-color: var(--crew-bg-surface);
}

/* WorkflowStatusTracker ("pizza tracker") ships as an absolute overlay pinned
   to the top-left of the right pane, which covered the document title. Inside
   the Document View shell header we force it into normal flow and pin it as a
   strip above the DocumentViewHeader band so it no longer blocks the header. */
.crew-doc-shell-tracker {
  margin-bottom: 12px;
}

.crew-doc-shell-tracker--collapsed {
  margin-bottom: 8px;
}

.crew-doc-shell-tracker-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--crew-text-muted);
  background: transparent;
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  cursor: pointer;
}

.crew-doc-shell-tracker-toggle:hover {
  color: var(--crew-text);
  background: var(--crew-bg-hover);
}

.crew-doc-shell-tracker--collapsed .crew-doc-shell-tracker-toggle {
  margin-bottom: 0;
}

.crew-doc-shell-tracker-toggle-icon {
  font-size: 10px;
  line-height: 1;
}

.crew-doc-shell-tracker .workflow-tracker-container {
  position: static !important;
  top: auto !important;
  left: auto !important;
  pointer-events: auto !important;
}

/* Compact the tracker panels for the header strip (the stock sizes are tuned
   for a full overlay). Collapsed and expanded panels are both shrunk. */
.crew-doc-shell-tracker .tracker-panel {
  min-width: 40px !important;
  max-width: 50px !important;
  min-height: 26px !important;
  padding: 3px 7px !important;
}

.crew-doc-shell-tracker .tracker-panel.current,
.crew-doc-shell-tracker .tracker-panel:hover {
  min-width: 124px !important;
  max-width: 168px !important;
  min-height: 58px !important;
  padding: 5px 9px !important;
}

.crew-doc-shell-tracker .tracker-panel.current .panel-user,
.crew-doc-shell-tracker .tracker-panel.current .panel-datetime,
.crew-doc-shell-tracker .tracker-panel:hover .panel-user,
.crew-doc-shell-tracker .tracker-panel:hover .panel-datetime {
  max-height: 44px !important;
}

.crew-doc-shell-tracker .user-avatar,
.crew-doc-shell-tracker .user-initials {
  width: 20px !important;
  height: 20px !important;
}

.crew-doc-shell-tracker .tracker-panel.current .panel-status,
.crew-doc-shell-tracker .tracker-panel:hover .panel-status {
  font-size: 11px !important;
}

.crew-doc-shell-body {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.crew-doc-shell-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.crew-doc-shell-body-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding: 24px 32px;
}

.crew-doc-shell-rail {
  flex: 0 0 260px;
  align-self: flex-start;
  height: calc(100% - 43px);
  margin-top: 43px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid var(--crew-border);
}

.crew-doc-shell-rail-title {
  flex-shrink: 0;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  color: #fff;
  background-color: var(--crew-blue);
  border-bottom: 3px solid var(--crew-blue);
  border-top-left-radius: var(--crew-radius);
  border-top-right-radius: var(--crew-radius);
}

.crew-doc-shell-rail-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  font-size: 13px;
}

/* The formatter still emits its header card (.crew-header-card) inside the
   rendered HTML for export / legacy consumers; the View now sources its
   header from DocumentViewHeader, so suppress the duplicate inside the body
   scroll region to avoid showing two header bands. */
.crew-doc-shell-body-scroll .crew-header-card,
.crew-doc-shell-body-scroll .crew-doc-header {
  display: none;
}

/* ── DocumentViewHeader band ─────────────────────────────── */
.crew-doc-header-band {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  /* Reserve space on the right so the title never runs under the
     top-right action cluster (search + Edit/Reload), which is pinned to the
     top-right corner of the shell header. */
  padding-right: 260px;
}

.crew-doc-header-brand {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.crew-doc-header-logo {
  height: 44px;
  width: auto;
}

.crew-doc-header-eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--crew-text-muted);
}

.crew-doc-header-identity {
  flex: 1;
  min-width: 0;
}

.crew-doc-header-number {
  font-size: 12px;
  font-weight: 600;
  color: var(--crew-text-muted);
}

.crew-doc-header-title {
  font-size: 30px;
  font-weight: 700;
  color: var(--crew-blue);
  line-height: 1.25;
}

.crew-doc-header-effective {
  margin-top: 2px;
  font-size: 12px;
  color: var(--crew-text-muted);
}

.crew-doc-header-badges {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
}

.crew-doc-header-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--crew-border);
  color: var(--crew-text-muted);
  background: var(--crew-bg-surface);
}

.crew-doc-header-badge--status {
  color: var(--crew-text);
  border-color: var(--crew-blue);
}

.crew-doc-header-aside {
  position: absolute;
  top: 6px;
  right: 24px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.crew-doc-header-searchbar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.crew-doc-header-search {
  width: 220px;
  max-width: 100%;
  padding: 6px 12px;
  font-size: 13px;
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  background: var(--crew-bg-surface);
  color: var(--crew-text);
}

.crew-doc-search-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--crew-text-muted);
  white-space: nowrap;
}

.crew-doc-search-count--none {
  color: var(--crew-text-muted);
  font-style: italic;
  font-weight: 400;
}

.crew-doc-search-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 11px;
  line-height: 1;
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  background: var(--crew-bg-surface);
  color: var(--crew-text-muted);
  cursor: pointer;
}

.crew-doc-search-nav:hover {
  background: var(--crew-bg-hover);
  color: var(--crew-text);
}

/* In-document search highlight marks (injected by crew-doc-search.js). */
.crew-doc-shell-body-scroll mark.crew-search-hit {
  background: #ffe08a;
  color: inherit;
  padding: 0;
  border-radius: 2px;
}

.crew-doc-shell-body-scroll mark.crew-search-hit--active {
  background: #ff9f1c;
  box-shadow: 0 0 0 2px rgba(255, 159, 28, 0.45);
}

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

.crew-doc-header-action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* Print menu — single trigger button + dropdown panel */
.crew-print-menu {
  position: relative;
  display: inline-flex;
}

.crew-print-menu-trigger[aria-expanded="true"] {
  background: var(--crew-figma-blue-dark);
}

.crew-print-menu-chevron {
  font-size: 0.65rem;
  margin-left: 0.1rem;
  opacity: 0.92;
}

.crew-print-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1199;
  background: transparent;
}

.crew-print-menu-panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 1200;
  min-width: 17rem;
  background: var(--crew-surface, #fff);
  border: 1px solid var(--crew-border, #ccc);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 0.35rem 0;
}

.crew-print-menu-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.crew-print-menu-item:hover:not(:disabled) {
  background: rgba(0, 51, 102, 0.06);
}

.crew-print-menu-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.crew-print-menu-item-title {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.3;
}

.crew-print-menu-item-desc {
  font-size: 0.78rem;
  color: var(--crew-text-muted, #666);
  line-height: 1.25;
}

/* ── Procedure Layout (content + TOC) ────────────────────── */
.crew-procedure-layout {
  display: flex;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.crew-procedure-layout .crew-procedure-content {
  flex: 1;
  min-width: 0;
}

/* ── Right rail (Table of Contents + optional metadata) ──────
   Legacy container retained for any non-document caller. The Document View
   now composes its rail from .crew-doc-shell-rail / .crew-doc-shell-rail-scroll
   (the sticky/own-scroll behavior moved there); this rule no longer drives the
   document view's rail. */
.crew-toc-panel {
  width: 200px;
  flex-shrink: 0;
  overflow-y: auto;
  border-left: 2px solid var(--crew-border);
  padding-left: 12px;
  font-size: 13px;
}

/* Tabbed viewer stacks a metadata card under the TOC items inside the
   same rail; give it breathing room so it reads as a distinct block. */
.crew-toc-panel .crew-metadata-card {
  margin-top: 16px;
}

.crew-toc-title {
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--crew-text-faint);
  margin-bottom: 8px;
}

/* Empty-state: when the pane has only the "Contents" title and no items,
   drop the trailing margin so the wrapper looks intentional rather than
   like a layout glitch. */
.crew-toc-title:last-child {
  margin-bottom: 0;
}

.crew-toc-item {
  display: block;
  color: var(--crew-text-muted);
  text-decoration: none;
  padding: 3px 0;
  font-size: 12px;
  line-height: 1.3;
}

.crew-toc-item:hover {
  color: var(--crew-blue);
}

.crew-toc-item.active {
  color: var(--crew-blue);
  font-weight: 600;
  border-left: 2px solid var(--crew-blue);
  padding-left: 6px;
  margin-left: -8px;
}

/* Two-level Contents pane: h1 sits flush, h2 indents one tier.
   Heading levels deeper than h2 are not surfaced to the TOC. */
.crew-toc-h1 {
  padding-left: 0;
  font-weight: 600;
}

.crew-toc-h2 {
  padding-left: 12px;
  font-weight: 400;
}

.crew-attachments-panel {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--crew-border);
}

.crew-attachment-link {
  display: block;
  color: var(--crew-blue);
  text-decoration: underline;
  padding: 4px 0;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.crew-attachment-link:hover {
  color: var(--crew-figma-blue-dark, #156082);
}

.crew-related-procedures-panel {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--crew-border);
}

.crew-related-procedure-link {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--crew-blue);
  text-decoration: underline;
  padding: 4px 0;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.crew-related-procedure-link__icon {
  flex: 0 0 auto;
  color: var(--crew-blue);
  font-size: 11px;
}

.crew-related-procedure-link:hover {
  color: var(--crew-figma-blue-dark, #156082);
}

.crew-related-procedure-link:hover .crew-related-procedure-link__icon {
  color: var(--crew-figma-blue-dark, #156082);
}

.crew-related-procedures-panel__empty {
  font-size: 12px;
  color: #94a3b8;
  padding: 4px 0;
}

/* ── Home / Welcome ──────────────────────────────────────── */
.crew-home-header-sticky {
  flex-shrink: 0;
  background: var(--crew-bg-surface, #fff);
  border-bottom: 1px solid var(--crew-border, #e0e0e0);
  padding: 0;
}

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

.crew-home-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.crew-home-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--crew-dark, #163E64);
}

.crew-home-subtitle {
  font-size: 14px;
  color: var(--crew-text-muted);
}

.crew-home-contact-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--crew-blue, #1B7AC3);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}

.crew-home-contact-btn:hover {
  background: var(--crew-figma-blue-dark, #156082);
  color: #fff;
  text-decoration: none;
}

.crew-home-contact-btn:active {
  transform: scale(0.97);
}

.crew-home-section-heading {
  font-size: 18px;
  font-weight: 700;
  color: var(--crew-dark, #163E64);
  margin-top: 24px;
  margin-bottom: 12px;
}

/* ── Ask CREW Banner ─────────────────────────────────────── */
.crew-ask-banner {
  background: linear-gradient(135deg, rgba(151, 214, 252, 0.35) 0%, rgba(151, 214, 252, 0.65) 40%, var(--crew-blue-light, #97D6FC) 100%);
  border-radius: var(--crew-radius, 6px);
  padding: 20px 24px 16px;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(27, 122, 195, 0.18), 0 1px 4px rgba(27, 122, 195, 0.10);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.crew-ask-banner:hover {
  box-shadow: 0 8px 28px rgba(27, 122, 195, 0.22), 0 2px 6px rgba(27, 122, 195, 0.12);
  transform: translateY(-2px);
}

.crew-ask-banner::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
  pointer-events: none;
}

.crew-ask-banner-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.crew-ask-banner-icon {
  width: 40px;
  height: 40px;
  background: var(--crew-blue, #1B7AC3);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.crew-ask-banner-title-group {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.crew-ask-banner-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--crew-dark, #163E64);
}

.crew-ask-banner-subtitle {
  font-size: 13px;
  color: var(--crew-text-muted, #666666);
}

.crew-ask-banner-search {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.crew-ask-banner-input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid var(--crew-border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--crew-text);
  background: var(--crew-input-bg);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.crew-ask-banner-input::placeholder {
  color: var(--crew-text-muted);
}

.crew-ask-banner-input:focus {
  border-color: var(--crew-blue, #1B7AC3);
  box-shadow: 0 0 0 3px rgba(27, 122, 195, 0.15);
  background: var(--crew-input-bg);
}

.crew-ask-banner-input:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.crew-ask-banner-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--crew-blue, #1B7AC3);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}

.crew-ask-banner-btn:hover {
  background: var(--crew-figma-blue-dark, #156082);
}

.crew-ask-banner-btn:active {
  transform: scale(0.97);
}

.crew-ask-banner-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.crew-ask-banner-hint {
  font-size: 13px;
  color: var(--crew-text-muted, #666666);
  margin-top: 8px;
  padding-left: 2px;
  font-style: italic;
}

.crew-ask-banner-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.crew-ask-banner-chip {
  padding: 5px 14px;
  background: var(--crew-bg-surface);
  border: 1px solid rgba(27, 122, 195, 0.3);
  border-radius: 16px;
  font-size: 12px;
  color: var(--crew-text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.crew-ask-banner-chip:hover {
  background: var(--crew-bg-hover);
  border-color: var(--crew-blue, #1B7AC3);
}

.crew-ask-banner-chip:active {
  background: rgba(151, 214, 252, 0.45);
}

.crew-ask-banner-chip:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.crew-ask-banner-more {
  font-size: 12px;
  font-weight: 600;
  color: var(--crew-blue, #1B7AC3);
  cursor: pointer;
  margin-left: 4px;
}

.crew-ask-banner-more:hover {
  text-decoration: underline;
}

/* ── Home Dashboard Row (Favorites / Need to Know / Suggestions) ── */
.crew-home-dashboard-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
  align-items: start;
}

.crew-home-task-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  grid-column: 1 / -1;
}

/* ── Home page responsive breakpoints ─────────────────────── */
@media (max-width: 900px) {
  .crew-home-dashboard-row {
    grid-template-columns: 1fr;
  }

  .crew-home-task-pair {
    grid-template-columns: 1fr 1fr;
  }

  .crew-card-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

@media (max-width: 700px) {
  .crew-content-fallback-scroll,
  .crew-doc-shell-body-scroll {
    padding: 16px 18px;
  }

  .crew-doc-shell-main .crew-tabbar {
    padding: 0 18px;
  }

  .crew-home-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .crew-home-header-left {
    flex-wrap: wrap;
  }

  .crew-home-contact-btn {
    align-self: flex-start;
  }

  .crew-ask-banner {
    padding: 16px 16px 12px;
  }

  .crew-ask-banner-search {
    flex-direction: column;
  }

  .crew-ask-banner-btn {
    width: 100%;
    justify-content: center;
  }

  .crew-ask-banner-chips {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .crew-ask-banner-chips::-webkit-scrollbar {
    display: none;
  }
}

.crew-home-card {
  background: var(--crew-figma-gray, #F3F3F3);
  border-radius: var(--crew-radius);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.34), 0 1px 3px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 220px;
  transition: height 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.crew-home-card:hover {
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.40), 0 2px 5px rgba(0, 0, 0, 0.26);
  transform: translateY(-2px);
}

.crew-home-card--collapsed {
  height: auto;
}

.crew-home-card--collapsed .crew-home-card-body {
  display: none;
}

.crew-home-card--collapsed .crew-home-card-footer {
  display: none;
}

.crew-home-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.crew-home-card-header:hover {
  background: rgba(0, 0, 0, 0.03);
}

.crew-home-card-chevron {
  font-size: 16px;
  font-weight: 700;
  color: var(--crew-text-faint);
  transition: transform 0.2s ease;
}

.crew-home-card-chevron--open {
  transform: rotate(90deg);
}

.crew-home-card-title {
  font-family: var(--crew-font-work, 'Work Sans', sans-serif);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.28px;
  text-transform: uppercase;
  color: var(--crew-dark, #163E64);
  margin: 0;
}

.crew-home-card-body {
  padding: 0 18px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(27, 122, 195, 0.3) transparent;
}

.crew-home-card-body::-webkit-scrollbar {
  width: 6px;
}

.crew-home-card-body::-webkit-scrollbar-track {
  background: transparent;
}

.crew-home-card-body::-webkit-scrollbar-thumb {
  background: rgba(27, 122, 195, 0.25);
  border-radius: 3px;
}

.crew-home-card-body::-webkit-scrollbar-thumb:hover {
  background: rgba(27, 122, 195, 0.45);
}

/* Skeleton placeholder rows for loading state */
.crew-home-card-skeleton-list {
  pointer-events: none;
}

.crew-home-card-row--skeleton {
  align-items: center;
  gap: 8px;
}

.crew-home-card-skeleton-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.crew-home-card-skeleton-line {
  flex: 1;
  height: 10px;
  border-radius: 3px;
}

.crew-home-card-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.crew-home-card-count-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.crew-home-card-count-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
}

.crew-home-card-count-label {
  font-family: var(--crew-font-work, 'Work Sans', sans-serif);
  font-size: 11px;
  color: var(--crew-text-muted, #374151);
}

.crew-home-card-count-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--crew-text, #1a1a1a);
  text-decoration: none;
}

a.crew-home-card-count-value:hover {
  text-decoration: underline;
}

a.crew-home-card-count-value:hover {
  text-decoration: underline;
}
  font-family: var(--crew-font-work, 'Work Sans', sans-serif);
  font-size: 11px;
  font-weight: 600;
  color: var(--crew-text, #111827);
  min-width: 1.25em;
  text-align: right;
}

.crew-home-card-skeleton-line--wide {
  flex: 1;
  height: 10px;
}

.crew-home-card-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 4px 0;
}

.crew-home-card-star {
  color: #fbbf24;
  font-size: 12px;
  flex-shrink: 0;
  margin-top: 2px;
}

.crew-home-card-link {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--crew-font-work, 'Work Sans', sans-serif);
  font-size: 11px;
  color: var(--crew-blue, #1B7AC3);
  cursor: pointer;
  text-align: left;
}

.crew-home-card-link:hover {
  text-decoration: underline;
}

.crew-home-card-link--static {
  font-size: 12px;
  color: var(--crew-text-muted);
}

.crew-home-card-empty {
  font-size: 12px;
  color: var(--crew-text-faint);
  margin: 0;
}

.crew-home-card-error {
  font-size: 12px;
  color: #c00;
  margin: 0;
}

.crew-home-card-meta {
  font-size: 10px;
  color: var(--crew-text-faint);
  margin-top: 2px;
}

.crew-home-card-suggestion {
  display: flex;
  flex-direction: column;
}

.crew-suggestion-status {
  font-size: 10px;
  flex-shrink: 0;
  margin-top: 3px;
}

.crew-suggestion-status--submitted { color: #f59e0b; }
.crew-suggestion-status--accepted  { color: #10b981; }
.crew-suggestion-status--rejected  { color: #ef4444; }
.crew-suggestion-status--unknown   { color: #9ca3af; }

.crew-home-card-footer {
  padding: 8px 18px 12px;
  text-align: left;
  flex-shrink: 0;
  background: var(--crew-figma-gray, #F3F3F3);
}

.crew-home-card-see-all {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--crew-blue, #1B7AC3);
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.crew-home-card-see-all:hover {
  text-decoration: underline;
  opacity: 0.8;
}

.crew-home-card-see-all:active {
  transform: scale(0.95);
  opacity: 0.6;
}

/* Home widget — suggestion detail modal */
.crew-home-suggestion-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.crew-home-suggestion-detail-panel {
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--crew-bg-surface);
  color: var(--crew-text);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
}

/* ── Sidebar Profile ───────────────────────────────────── */
.crew-sidebar-profile {
  padding: 12px 12px 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.crew-sidebar-profile-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.crew-sidebar-profile-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--crew-blue, #1B7AC3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

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

.crew-sidebar-profile-initials {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.crew-sidebar-profile-info {
  flex: 1;
  min-width: 0;
}

.crew-sidebar-profile-name {
  color: var(--crew-blue);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crew-sidebar-profile-title {
  color: rgba(0, 0, 0, 0.5);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crew-sidebar-profile-actions {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.crew-home-icon {
  color: var(--crew-blue);
  opacity: 0.6;
  cursor: pointer;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.crew-home-icon:hover {
  opacity: 1;
}

.crew-sidebar-profile--collapsed {
  padding: 10px 0;
  display: flex;
  justify-content: center;
}

.crew-sidebar-profile--collapsed .crew-sidebar-profile-row {
  flex-direction: column;
  gap: 4px;
}

.crew-sidebar-profile--collapsed .crew-sidebar-profile-info,
.crew-sidebar-profile--collapsed .crew-sidebar-profile-actions {
  display: none;
}

.crew-sidebar-profile--collapsed .crew-sidebar-profile-avatar {
  width: 28px;
  height: 28px;
}

/* ── Sidebar Home Button ───────────────────────────────── */
.crew-sidebar-home-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  color: var(--crew-blue);
  font-size: 12px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.crew-sidebar-home-btn:hover {
  color: var(--crew-figma-blue-dark, #156082);
  background: rgba(0, 0, 0, 0.05);
}

.crew-sidebar-home-btn-icon {
  font-size: 16px;
}

/* ── Card Grid ──────────────────────────────────────────── */
.crew-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.crew-card {
  background: var(--crew-bg-surface);
  border: 1px solid var(--crew-border-light);
  border-radius: var(--crew-radius);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.crew-card:hover {
  border-color: var(--crew-blue);
  box-shadow: 0 4px 12px rgba(27, 122, 195, 0.12);
  transform: translateY(-1px);
}

.crew-card:focus-visible {
  outline: none;
  border-color: var(--crew-blue);
  box-shadow: 0 0 0 3px rgba(27, 122, 195, 0.25);
}

.crew-card:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* ── Empty State ────────────────────────────────────────── */
.crew-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 40px 20px;
  margin: 16px 0;
  border: 1px dashed var(--crew-border);
  border-radius: var(--crew-radius);
  background: var(--crew-bg-surface);
  color: var(--crew-text-muted);
  text-align: center;
}

.crew-empty-state-icon {
  color: var(--crew-text-faint);
  margin-bottom: 4px;
}

.crew-empty-state-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--crew-text);
}

.crew-empty-state-desc {
  font-size: 12px;
  color: var(--crew-text-muted);
}

.crew-card-number {
  font-size: 11px;
  color: var(--crew-text-faint);
  font-family: monospace;
  margin-bottom: 4px;
}

.crew-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--crew-dark, #163E64);
}

/* ── Error ───────────────────────────────────────────────── */
.crew-content-error {
  color: #c0392b;
  font-size: 14px;
  padding: 24px 0;
}

/* ── Content Actions (Edit button) ─────────────────────── */
.crew-content-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 1rem;
}

/* ── Edit Dropdown ────────────────────────────────────────── */
.crew-edit-dropdown {
  position: relative;
  display: inline-block;
}

.crew-edit-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  min-width: 180px;
  margin-top: 4px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.crew-edit-dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-family: var(--crew-font-body);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.crew-edit-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ── Shared Buttons ───────────────────────────────────────── */
.crew-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: 1px solid transparent;
  border-radius: var(--crew-radius);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--crew-font-body);
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease, border-color 0.15s ease;
  line-height: 1.3;
  outline: none;
}

.crew-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(27, 122, 195, 0.30);
}

.crew-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.crew-btn--primary {
  background: var(--crew-blue);
  color: #fff;
  border-color: var(--crew-blue);
}
.crew-btn--primary:hover { background: var(--crew-figma-blue-dark); }
.crew-btn--primary:disabled { opacity: 0.55; cursor: default; }

.crew-btn--ghost {
  background: transparent;
  color: var(--crew-text-muted);
  border-color: var(--crew-border);
}
.crew-btn--ghost:hover:not(:disabled) { background: var(--crew-bg-hover); }
.crew-btn--ghost:disabled { opacity: 0.55; cursor: default; }

.crew-btn--accent {
  background: #059669;
  color: #fff;
  border-color: #059669;
}
.crew-btn--accent:hover { background: #047857; }
.crew-btn--accent:disabled { opacity: 0.55; cursor: default; }

/* ── Workflow action buttons (ContentEditPage) ───────────── */
.crew-workflow-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}
.crew-workflow-action-btn {
  /* Uniform primary blue — grooming G1; modifiers group return vs forward only */
}
.crew-workflow-action-btn--return { /* reserved for future emphasis */ }
.crew-workflow-action-btn--forward { /* reserved for future emphasis */ }

/* ── Advance Dropdown (legacy — remove when confirmed unused) ── */
.crew-advance-wrap {
  position: relative;
  display: inline-block;
}
.crew-advance-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--crew-bg-surface);
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 200px;
  z-index: 1000;
  padding: 4px 0;
}
.crew-advance-item {
  display: block;
  width: 100%;
  padding: 8px 16px;
  font-size: 13px;
  text-align: left;
  background: none;
  border: none;
  color: var(--crew-text);
  cursor: pointer;
  white-space: nowrap;
}
.crew-advance-item:hover:not(:disabled) {
  background: var(--crew-bg-hover);
  color: #059669;
}
.crew-advance-item:disabled {
  opacity: 0.55;
  cursor: default;
}

/* ============================================================
   Content Edit Page — Three-Pane Editor
   ============================================================ */

.crew-edit-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  font-family: var(--crew-font-body);
  position: relative;
}

/* ── Header ──────────────────────────────────────────────── */
.crew-edit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--crew-navy);
  color: #fff;
  flex-shrink: 0;
  position: relative;
  z-index: 500;
}

.crew-edit-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

/* Edit-mode workflow tracker (ADO #476303 AW.1) — in-flow strip below header */
.crew-edit-tracker {
  flex-shrink: 0;
  padding: 8px 20px 0;
  background: var(--crew-table-header-bg);
}

/* Tracker + draft-revision notice share one row: tracker grows rightward as the workflow
   executes; the notice is pinned to the FAR right as a narrow, wrapping block (out of the way). */
.crew-edit-tracker-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: nowrap;
}

.crew-edit-tracker-revision {
  flex: 0 1 auto;
  width: 300px;
  max-width: 42%;
  margin-left: auto;
  margin-top: 0;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--crew-blue);
  background: var(--crew-note-bg);
  border: 1px solid var(--crew-blue);
  border-radius: var(--crew-radius, 6px);
}

.crew-edit-tracker-revision .crew-edit-discard-revision {
  display: inline;
  margin: 0;
  margin-left: 0.25em;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--crew-danger-text);
  font: inherit;
  font-weight: 600;
  line-height: inherit;
  text-decoration: underline;
  vertical-align: baseline;
  cursor: pointer;
}

.crew-edit-tracker-revision .crew-edit-discard-revision:hover:not(:disabled),
.crew-edit-tracker-revision .crew-edit-discard-revision:focus-visible {
  color: var(--crew-danger-text);
  background: transparent;
}

.crew-edit-tracker-revision .crew-edit-discard-revision:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Unpublished-document notice — net-new first-publish draft (no published baseline).
   Amber, to distinguish from the blue "editing a revision" note. */
.crew-edit-tracker-unpublished {
  flex: 0 1 auto;
  width: 240px;
  max-width: 38%;
  margin-left: auto;
  margin-top: 0;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.3;
  color: var(--crew-warning-bdr);
  background: var(--crew-warning-bg);
  border: 1px solid var(--crew-warning-bdr);
  border-radius: var(--crew-radius, 6px);
}

.crew-edit-tracker .workflow-tracker-container {
  position: static !important;
  top: auto !important;
  left: auto !important;
  pointer-events: auto !important;
}

.crew-edit-tracker .tracker-panel {
  min-width: 40px !important;
  max-width: 50px !important;
  min-height: 26px !important;
  padding: 3px 7px !important;
}

.crew-edit-tracker .tracker-panel.current,
.crew-edit-tracker .tracker-panel:hover {
  min-width: 124px !important;
  max-width: 168px !important;
  min-height: 58px !important;
  padding: 5px 9px !important;
}

.crew-edit-tracker .tracker-panel.current .panel-user,
.crew-edit-tracker .tracker-panel.current .panel-datetime,
.crew-edit-tracker .tracker-panel:hover .panel-user,
.crew-edit-tracker .tracker-panel:hover .panel-datetime {
  max-height: 44px !important;
}

.crew-edit-tracker .user-avatar,
.crew-edit-tracker .user-initials {
  width: 20px !important;
  height: 20px !important;
}

.crew-edit-tracker .tracker-panel.current .panel-status,
.crew-edit-tracker .tracker-panel:hover .panel-status {
  font-size: 11px !important;
}

@media (max-width: 768px) {
  .crew-edit-tracker {
    display: none;
  }
}

.crew-edit-back {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
}
.crew-edit-back:hover { color: #fff; }

.crew-edit-doc-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crew-edit-doc-title--editable {
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--crew-radius);
  padding: 0.125rem 0.25rem;
  background: transparent;
  outline: none;
  min-width: 0;
  flex: 1;
}
.crew-edit-doc-title--editable:focus {
  border-color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.1);
}

.crew-edit-header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  padding-right: 52px;
}

.crew-edit-header-actions .crew-btn--ghost {
  color: rgba(255,255,255,0.8);
  border-color: rgba(255,255,255,0.3);
}
.crew-edit-header-actions .crew-btn--ghost:hover:not(:disabled) {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

/* ── Loading / Error ─────────────────────────────────────── */
.crew-edit-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  padding: 40px;
}

/* ── Alerts ──────────────────────────────────────────────── */
.crew-edit-alert {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
}
.crew-edit-alert--error { background: #fef2f2; color: #991b1b; border-bottom: 1px solid #fecaca; }
.crew-edit-alert--success { background: #f0fdf4; color: #166534; border-bottom: 1px solid #bbf7d0; }

/* ── Published-Edit draft overlay (I2) ─────────────────────── */
.crew-edit-revision-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #eff6ff;
  color: #1e40af;
  border-bottom: 1px solid #bfdbfe;
}
.crew-edit-revision-banner-text { flex: 1; }
.crew-btn--danger {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.crew-btn--danger:hover:not(:disabled) { background: #fee2e2; }
.crew-btn--danger:disabled { opacity: 0.6; cursor: default; }
.crew-edit-starting {
  font-size: 13px;
  color: #6b7280;
  font-style: italic;
  align-self: center;
}

/* ── Starting-draft overlay (progress while cloning a Published doc) ── */
.crew-edit-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(17, 24, 39, 0.45);
  backdrop-filter: blur(2px);
}
.crew-edit-overlay-card {
  width: min(440px, calc(100vw - 48px));
  padding: 24px 28px;
  background: var(--crew-bg-surface);
  color: var(--crew-text);
  border: 1px solid var(--crew-border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}
.crew-edit-overlay-hint {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--crew-text-muted);
}
.crew-workflow-publish-btn {
  background: #7c3aed;
  border-color: #7c3aed;
}
.crew-workflow-publish-btn:hover:not(:disabled) { background: #6d28d9; border-color: #6d28d9; }

/* ── Split Button (Publish / Submit for Review) ────────── */
.crew-split-btn {
  position: relative;
  display: inline-flex;
  align-items: stretch;
}

.crew-split-btn__action {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.25);
}

.crew-split-btn__chevron {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  padding: 8px 8px;
  min-width: 0;
}

.crew-split-btn__arrow {
  font-size: 11px;
  line-height: 1;
}

.crew-split-btn__menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 50;
  min-width: 260px;
  background: var(--crew-bg-surface);
  border: 1px solid var(--crew-border);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(15, 32, 68, 0.14);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.crew-split-btn__option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--crew-radius);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: var(--crew-font-body);
  transition: background 0.1s;
}

.crew-split-btn__option:hover {
  background: var(--crew-bg-hover);
}

.crew-split-btn__option--active {
  background: #e8f0fb;
}

.crew-split-btn__radio {
  color: var(--crew-blue);
  font-size: 14px;
  line-height: 1.2;
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}

.crew-split-btn__option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.crew-split-btn__option-text strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--crew-text);
}

.crew-split-btn__option-text small {
  font-size: 11px;
  color: var(--crew-text-muted);
  font-weight: 400;
}

/* ── Dynamic Panel Workspace ─────────────────────────────── */
.crew-edit-workspace {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Resize Handles ────────────────────────────────────── */
.crew-edit-resize-handle {
  width: 4px;
  cursor: col-resize;
  background: var(--crew-border);
  transition: background 0.12s;
  flex-shrink: 0;
  z-index: 5;
}
.crew-edit-resize-handle:hover,
.crew-edit-resize-handle.crew-edit-resize-handle--active {
  background: var(--crew-blue);
}

/* ── Collapse / Expand Toggle ──────────────────────────── */
.crew-edit-collapse-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  color: var(--crew-text-faint);
  padding: 2px 4px;
  border-radius: 3px;
  line-height: 1;
  flex-shrink: 0;
}
.crew-edit-collapse-btn:hover { background: var(--crew-bg-hover); color: var(--crew-text); }

.crew-edit-col-header--suggestions {
  gap: 4px;
}

.crew-edit-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  flex: 1;
  min-width: 160px;
  transition: flex 0.2s ease, min-width 0.2s ease;
}

/* ── Collapsed Panel ─────────────────────────────────────── */
.crew-edit-col--collapsed {
  flex: 0 0 36px !important;
  min-width: 36px !important;
  max-width: 36px;
  overflow: hidden;
  cursor: pointer;
}

.crew-edit-col--collapsed .crew-edit-col-header {
  writing-mode: vertical-lr;
  transform: rotate(180deg);
  padding: 12px 8px;
  gap: 8px;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.crew-edit-col--collapsed .crew-edit-col-header .crew-edit-col-subtitle,
.crew-edit-col--collapsed .crew-edit-col-header .crew-edit-copy-btn {
  display: none;
}

.crew-edit-col--collapsed .crew-edit-preview-body,
.crew-edit-col--collapsed .crew-edit-json-body,
.crew-edit-col--collapsed .crew-edit-suggestions-body,
.crew-edit-col--collapsed .crew-edit-properties-toggle,
.crew-edit-col--collapsed .crew-edit-properties-panel,
.crew-edit-col--collapsed .crew-edit-sections,
.crew-edit-col--collapsed .crew-edit-add-btn {
  display: none;
}

.crew-edit-col--collapsed .crew-edit-col-header .crew-edit-collapse-btn {
  writing-mode: horizontal-tb;
  transform: rotate(180deg);
}

/* ── Column Headers ──────────────────────────────────────── */
.crew-edit-col-header {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 16px;
  background: transparent;
  flex-shrink: 0;
}

.crew-edit-col-title {
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--crew-text-faint);
}

.crew-edit-col-subtitle {
  font-size: 10px;
  color: var(--crew-text-faint);
}

/* ── Editor Column ───────────────────────────────────────── */
.crew-edit-col--editor {
  background: var(--crew-bg-surface);
  overflow-y: auto;
  flex: 2;
}

/* ── Content Properties Panel ───────────────────────────── */
.crew-edit-properties-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--crew-text-muted);
  cursor: pointer;
  border-bottom: 1px solid var(--crew-border-light);
  user-select: none;
}
.crew-edit-properties-toggle:hover { background: var(--crew-bg-hover); }

.crew-edit-properties-id {
  margin-left: auto;
  font-weight: 400;
  color: var(--crew-text-faint);
  font-size: 11px;
}

.crew-edit-properties-panel {
  padding: 10px 16px 14px;
  border-bottom: 1px solid var(--crew-border-light);
  background: var(--crew-figma-gray);
}

.crew-edit-properties-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.crew-edit-properties-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--crew-text-muted);
}
.crew-edit-properties-field input,
.crew-edit-properties-field select,
.crew-edit-properties-field textarea {
  border: 1px solid var(--crew-border);
  border-radius: 3px;
  padding: 4px 8px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 400;
}
.crew-edit-properties-field input:focus,
.crew-edit-properties-field select:focus,
.crew-edit-properties-field textarea:focus {
  outline: 1px solid var(--crew-blue);
}
.crew-edit-properties-field textarea {
  resize: vertical;
}
.crew-edit-properties-field--full {
  margin-top: 8px;
}

/* ADO 477047 — locked title-block fields (document #, effective date, status) */
.crew-edit-properties-readonly {
  background: var(--crew-bg-hover);
  color: var(--crew-text-muted, #6b7280);
  cursor: default;
}
.crew-edit-properties-readonly:focus {
  outline: none !important;
}

.crew-attachments-editor {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--crew-border);
}

.crew-attachments-editor__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--crew-text);
}

.crew-attachments-editor__hint,
.crew-attachments-editor__empty,
.crew-attachments-editor__warning {
  font-size: 11px;
  font-weight: 400;
  color: var(--crew-text-muted);
}

.crew-attachments-editor__warning {
  margin: -4px 0 8px 24px;
  color: #b45309;
}

.crew-attachments-editor__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.crew-attachments-editor__row {
  display: grid;
  grid-template-columns: auto minmax(140px, 1fr) minmax(220px, 2fr) minmax(110px, 0.7fr) auto;
  gap: 8px;
  align-items: end;
  padding: 8px;
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  background: var(--crew-bg-surface);
}

.crew-attachments-editor__drag {
  align-self: center;
  color: var(--crew-text-faint);
  cursor: grab;
  font-size: 14px;
  line-height: 1;
}

.crew-attachments-editor__link {
  min-width: 0;
}

.crew-related-procedures-editor {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--crew-border);
}

.crew-related-procedures-editor__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--crew-text);
}

.crew-related-procedures-editor__hint,
.crew-related-procedures-editor__empty,
.crew-related-procedures-editor__warning {
  font-size: 11px;
  font-weight: 400;
  color: var(--crew-text-muted);
}

.crew-related-procedures-editor__warning {
  margin: -4px 0 8px 24px;
  color: #b45309;
}

.crew-related-procedures-editor__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.crew-related-procedures-editor__row {
  display: grid;
  grid-template-columns: auto minmax(140px, 1fr) minmax(220px, 2fr) auto;
  gap: 8px;
  align-items: end;
  padding: 8px;
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  background: var(--crew-bg-surface);
}

.crew-related-procedures-editor__drag {
  align-self: center;
  color: var(--crew-text-faint);
  cursor: grab;
  font-size: 14px;
  line-height: 1;
}

.crew-related-procedures-editor__link {
  min-width: 0;
}

.crew-edit-mini-btn {
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  background: var(--crew-bg-surface);
  color: var(--crew-text);
  font: inherit;
  font-size: 12px;
  padding: 4px 8px;
  cursor: pointer;
}

.crew-edit-mini-btn:hover:not(:disabled) {
  background: var(--crew-bg-hover);
}

.crew-edit-mini-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.crew-edit-mini-btn--danger {
  color: #991b1b;
}

.crew-edit-sections {
  padding: 12px 16px 24px;
}

.crew-edit-section {
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  margin-bottom: 10px;
  background: var(--crew-bg-surface);
}

/* Section gated read-only by Tab.Visibility = 'role-gated' (4c). The head
   stays interactive so users can still expand/collapse; the body is dimmed
   to signal that edit affordances are intentionally suppressed. */
.crew-edit-section--readonly .crew-edit-paragraphs,
.crew-edit-section--readonly .crew-edit-add-para-row {
  opacity: 0.6;
  pointer-events: none;
}

.crew-edit-section-lock-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 0.85rem;
  color: #92400e;
  background: #fef3c7;
  border-bottom: 1px solid var(--crew-border);
}
.crew-edit-section-lock-icon {
  font-size: 1rem;
}

.crew-edit-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  user-select: none;
}
.crew-edit-section-head--banner {
  background: #64748b;
  color: #fff;
}
.crew-edit-section-head--sub {
  background: var(--crew-figma-gray);
  color: var(--crew-text);
}
.crew-edit-section-head .crew-edit-section-title-input {
  color: inherit;
}
.crew-edit-section-head--open {
  border-bottom: 1px solid var(--crew-border);
}

.crew-edit-agent-thinking-banner {
  position: relative;
  overflow: hidden;
  margin: 8px 12px 10px;
  padding: 6px 10px 6px 28px;
  border: 1px solid #c7d2fe;
  border-radius: 6px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 600;
  animation: crew-agent-thinking-border 1.6s ease-in-out infinite;
}

.crew-edit-agent-thinking-banner::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #4f46e5;
  transform: translateY(-50%);
  animation: crew-agent-thinking-dot 1s ease-in-out infinite;
}

.crew-edit-agent-thinking-banner::after {
  content: "";
  position: absolute;
  top: 0;
  left: -40%;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  animation: crew-agent-thinking-shimmer 1.8s linear infinite;
  pointer-events: none;
}

@keyframes crew-agent-thinking-dot {
  0%,
  100% { opacity: 0.45; transform: translateY(-50%) scale(0.9); }
  50% { opacity: 1; transform: translateY(-50%) scale(1.1); }
}

@keyframes crew-agent-thinking-shimmer {
  from { left: -40%; }
  to { left: 100%; }
}

@keyframes crew-agent-thinking-border {
  0%,
  100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.12); border-color: #c7d2fe; }
  50% { box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2); border-color: #a5b4fc; }
}

@media (prefers-reduced-motion: reduce) {
  .crew-edit-agent-thinking-banner,
  .crew-edit-agent-thinking-banner::before,
  .crew-edit-agent-thinking-banner::after {
    animation: none;
  }
}

.crew-edit-section-chevron {
  font-size: 11px;
  color: #fff;
  opacity: 0.7;
  width: 14px;
  text-align: center;
}

.crew-edit-section-seq {
  font-size: 11px;
  font-weight: 700;
  color: var(--crew-text-muted);
  background: #fff;
  opacity: 0.9;
  padding: 2px 6px;
  border-radius: 3px;
  min-width: 22px;
  text-align: center;
}

.crew-edit-section-title-input {
  flex: 1;
  border: 1px solid transparent;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  padding: 2px 6px;
  border-radius: 3px;
  color: inherit;
}
.crew-edit-section-title-input:focus {
  border-color: currentColor;
  border-opacity: 0.4;
  background: rgba(128,128,128,0.15);
  outline: none;
}

.crew-edit-heading-select {
  border: 1px solid var(--crew-border);
  border-radius: 3px;
  font-size: 11px;
  padding: 2px 4px;
  background: var(--crew-bg-surface);
  cursor: pointer;
}

.crew-edit-section-head .crew-edit-icon-btn {
  color: currentColor;
  opacity: 0.7;
}
.crew-edit-section-head .crew-edit-icon-btn:hover {
  background: rgba(128,128,128,0.2);
  color: currentColor;
  opacity: 1;
}

.crew-edit-icon-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 5px;
  border-radius: 3px;
  color: var(--crew-text-faint);
  line-height: 1;
}
.crew-edit-icon-btn:hover { background: var(--crew-bg-hover); color: var(--crew-text); }
.crew-edit-icon-btn--danger:hover { background: #fef2f2; color: #c00; }
.crew-edit-icon-btn--agent { color: #2563eb; }
.crew-edit-icon-btn--agent:hover { background: #eff6ff; color: #1d4ed8; }
.crew-edit-icon-btn--small { font-size: 11px; padding: 1px 4px; }
.crew-edit-icon-btn:disabled { opacity: 0.3; cursor: default; }

/* ── Agent Popover ──────────────────────────────────────── */
.crew-edit-agent-popover {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 1000;
  width: 320px;
  background: var(--crew-bg-surface);
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  box-shadow: var(--crew-shadow);
  margin-top: 4px;
}

.crew-edit-agent-popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--crew-border-light);
  font-size: 13px;
}

.crew-edit-agent-popover-section {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--crew-text-muted);
  background: var(--crew-figma-gray);
  border-bottom: 1px solid var(--crew-border-light);
}

.crew-edit-agent-popover-loading,
.crew-edit-agent-popover-error {
  padding: 16px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--crew-text-muted);
}

.crew-edit-agent-popover-error {
  color: #c00;
}

.crew-edit-agent-popover-list {
  max-height: 200px;
  overflow-y: auto;
  padding: 8px;
}

.crew-edit-agent-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--crew-radius);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  margin-bottom: 4px;
}

.crew-edit-agent-option:hover {
  background: var(--crew-bg-hover);
}

.crew-edit-agent-option--selected {
  background: #eff6ff;
  border-color: #2563eb;
}

.crew-edit-agent-option-name {
  display: block;
  font-weight: 600;
  color: var(--crew-text);
}

.crew-edit-agent-option-desc {
  display: block;
  font-size: 11px;
  color: var(--crew-text-muted);
  margin-top: 2px;
}

.crew-edit-agent-popover-input {
  padding: 10px 12px;
  border-top: 1px solid var(--crew-border-light);
}

.crew-edit-agent-popover-input label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--crew-text);
  margin-bottom: 4px;
}

.crew-edit-agent-popover-input textarea {
  width: 100%;
  min-height: 60px;
  padding: 8px;
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  font-size: 12px;
  resize: vertical;
}

.crew-edit-agent-popover-input textarea:focus {
  outline: none;
  border-color: var(--crew-blue);
}

.crew-edit-agent-popover-input-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.crew-edit-agent-popover-input-label label {
  margin-bottom: 0;
}

.crew-edit-mic-btn {
  background: transparent;
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  padding: 2px 6px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.crew-edit-mic-btn:hover {
  background: var(--crew-bg-hover);
  border-color: var(--crew-text-faint);
}

.crew-edit-mic-btn--active {
  background: #fee2e2;
  border-color: #dc2626;
  color: #b91c1c;
  animation: crew-mic-pulse 1.2s ease-in-out infinite;
}

@keyframes crew-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  50%      { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0); }
}

.crew-edit-agent-voice-error {
  margin-top: 4px;
  font-size: 11px;
  color: #b91c1c;
}

/* ── Voice dictation overlay (VoiceMicButton) ──────────── */
.crew-voice-wrap {
  position: relative;
  display: block;
}

.crew-voice-wrap__ta {
  padding-right: 40px !important;
  padding-bottom: 32px !important;
}

.crew-voice-wrap__mic {
  position: absolute;
  bottom: 6px;
  right: 6px;
  z-index: 2;
}

.crew-edit-agent-popover-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--crew-border-light);
  background: var(--crew-figma-gray);
  border-radius: 0 0 8px 8px;
}

/* ── Paragraphs ─────────────────────────────────────────── */
.crew-edit-paragraphs {
  padding: 8px 12px 12px;
}

.crew-edit-paragraph {
  border: 1px solid var(--crew-border-light);
  border-radius: var(--crew-radius);
  margin-bottom: 8px;
  background: var(--crew-figma-gray);
}

.crew-edit-para-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--crew-border-light);
  font-size: 11px;
}

.crew-edit-para-badge {
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #fff;
}
.crew-edit-para-badge--text { background: #2563eb; }
.crew-edit-para-badge--bullets { background: #059669; }
.crew-edit-para-badge--callout { background: #d97706; }
.crew-edit-para-badge--table { background: #7c3aed; }
.crew-edit-para-badge--image { background: #db2777; }

.crew-edit-para-seq { color: var(--crew-text-faint); }

.crew-edit-para-actions {
  margin-left: auto;
  display: flex;
  gap: 2px;
}

/* ── Rich Text Editor ───────────────────────────────────── */
.crew-edit-rte {
  border-top: 1px solid var(--crew-border-light);
  padding: 8px 10px;
  min-height: 60px;
  font-size: 13px;
  line-height: 1.5;
  outline: none;
  overflow-y: auto;
  max-height: 200px;
  word-wrap: break-word;
}
.crew-edit-rte:focus {
  box-shadow: inset 0 0 0 1px var(--crew-blue);
}
.crew-edit-rte a {
  color: var(--crew-blue);
  text-decoration: underline;
  cursor: text;
}
.crew-edit-rte a:hover {
  text-decoration: underline wavy;
}
.crew-edit-rte--inline {
  min-height: 24px;
  padding: 4px 8px;
  max-height: 80px;
  flex: 1;
  border: 1px solid var(--crew-border);
  border-radius: 3px;
  background: var(--crew-bg-surface);
}

/* ── Scroll Sync Highlight ──────────────────────────────── */
.crew-sync-highlight {
  animation: crew-sync-flash 800ms ease-out;
}
@keyframes crew-sync-flash {
  0%   { outline: 2px solid rgba(59,130,246,.6); outline-offset: 2px; background: rgba(59,130,246,.08); }
  100% { outline: 2px solid transparent; outline-offset: 2px; background: transparent; }
}

/* ── Preview "You Are Here" Indicator (left side, pointing right) ── */
.crew-preview-indicator {
  position: absolute;
  left: -2px;
  width: 28px;
  height: 28px;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 10;
  transition: top 0.3s cubic-bezier(.4,0,.2,1), opacity 0.25s, left 0.25s;
  opacity: 1;
  filter: drop-shadow(0 2px 6px rgba(59,130,246,.45));
}
.crew-preview-indicator::before {
  content: '▶';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 18px;
  color: var(--crew-blue);
  animation: crew-preview-pulse 2s ease-in-out infinite;
}
@keyframes crew-preview-pulse {
  0%, 100% { transform: translateX(0); opacity: 1; }
  50%      { transform: translateX(3px); opacity: 0.7; }
}
.crew-preview-indicator--hidden {
  opacity: 0;
  left: -14px;
}

/* ── Editor "You Are Here" Indicator (right side, pointing left) ── */
.crew-editor-indicator {
  position: absolute;
  right: -2px;
  width: 28px;
  height: 28px;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 10;
  transition: top 0.3s cubic-bezier(.4,0,.2,1), opacity 0.25s, right 0.25s;
  opacity: 1;
  filter: drop-shadow(0 2px 6px rgba(59,130,246,.45));
}
.crew-editor-indicator::before {
  content: '◀';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 18px;
  color: var(--crew-blue);
  animation: crew-editor-pulse 2s ease-in-out infinite;
}
@keyframes crew-editor-pulse {
  0%, 100% { transform: translateX(0); opacity: 1; }
  50%      { transform: translateX(-3px); opacity: 0.7; }
}
.crew-editor-indicator--hidden {
  opacity: 0;
  right: -14px;
}

/* ── Original "You Are Here" Indicator (left side, pointing right) ── */
.crew-original-indicator {
  position: absolute;
  left: -2px;
  width: 28px;
  height: 28px;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 10;
  transition: top 0.3s cubic-bezier(.4,0,.2,1), opacity 0.25s, left 0.25s;
  opacity: 1;
  filter: drop-shadow(0 2px 6px rgba(59,130,246,.45));
}
.crew-original-indicator::before {
  content: '▶';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 18px;
  color: var(--crew-blue);
  animation: crew-preview-pulse 2s ease-in-out infinite;
}
.crew-original-indicator--hidden {
  opacity: 0;
  left: -14px;
}

/* ── Typing Indicator (live edit feedback) ──────────────── */
.crew-typing-indicator {
  display: none;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  vertical-align: middle;
}

.crew-typing-indicator--active {
  display: inline-flex;
}

.crew-typing-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--crew-blue, #3b82f6);
  animation: crew-typing-bounce 1.2s infinite ease-in-out;
}

.crew-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.crew-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes crew-typing-bounce {
  0%, 60%, 100% { opacity: 0.2; transform: scale(0.8); }
  30%           { opacity: 1;   transform: scale(1.1); }
}

/* ── Floating Toolbar ──────────────────────────────────── */
.crew-floating-toolbar {
  position: fixed;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  background: var(--crew-navy);
  border-radius: var(--crew-radius);
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  top: -9999px;
  left: -9999px;
}
.crew-floating-toolbar.visible {
  opacity: 1;
  pointer-events: auto;
}
.crew-floating-toolbar button {
  border: none;
  background: transparent;
  color: #cbd5e1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1;
}
.crew-floating-toolbar button:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
}
.crew-floating-toolbar button.active {
  background: rgba(255,255,255,.2);
  color: #fff;
}
.crew-floating-toolbar-sep {
  display: inline-block;
  width: 1px;
  height: 18px;
  background: rgba(255,255,255,.25);
  margin: 0 2px;
  vertical-align: middle;
}

/* ── Link Editor Dialog ─────────────────────────────────── */
.crew-link-editor {
  position: fixed;
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  background: var(--crew-navy);
  border-radius: var(--crew-radius);
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
  z-index: 1101;
  min-width: 300px;
  max-width: 400px;
  top: -9999px;
  left: -9999px;
}
.crew-link-editor.visible {
  display: flex;
}
.crew-link-editor-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.crew-link-editor-field label {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.crew-link-url-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.crew-link-url-wrap input {
  padding-right: 28px;
}
.crew-link-url-clear {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  display: none;
}
.crew-link-url-wrap input:not(:placeholder-shown) ~ .crew-link-url-clear,
.crew-link-url-clear.visible {
  display: block;
}
.crew-link-url-clear:hover {
  color: #f87171;
  background: rgba(248,113,113,.12);
}
.crew-link-editor-field input {
  padding: 6px 8px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  background: rgba(0,0,0,0.3);
  color: #e2e8f0;
  font-size: 13px;
  outline: none;
  transition: border-color 120ms ease;
  width: 100%;
  box-sizing: border-box;
}
.crew-link-editor-field input:focus {
  border-color: var(--crew-blue);
}
.crew-link-editor-option {
  display: flex;
  align-items: center;
}
.crew-link-editor-option label {
  color: #cbd5e1;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.crew-link-editor-option input[type="checkbox"] {
  accent-color: var(--crew-blue);
}
.crew-link-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 2px;
}
.crew-link-btn {
  border: none;
  border-radius: 4px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease;
}
.crew-link-btn--cancel {
  background: transparent;
  color: #94a3b8;
}
.crew-link-btn--cancel:hover {
  background: rgba(255,255,255,.08);
  color: #cbd5e1;
}
.crew-link-btn--apply {
  background: var(--crew-blue);
  color: #fff;
}
.crew-link-btn--apply:hover {
  background: var(--crew-figma-blue-dark);
}

/* ── Bullets ────────────────────────────────────────────── */
.crew-edit-bullets {
  padding: 8px 10px;
}

.crew-edit-bullet-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 4px;
}

.crew-edit-bullet-marker {
  color: var(--crew-text-faint);
  padding-top: 4px;
  flex-shrink: 0;
  font-size: 14px;
  line-height: 1;
  min-width: 12px;
  text-align: center;
}

.crew-edit-bullet-row[class*="crew-edit-bullet-depth-"] {
  border-left: 2px solid transparent;
  transition: border-color 0.15s;
}
.crew-edit-bullet-depth-1 { border-left-color: var(--crew-border); }
.crew-edit-bullet-depth-2 { border-left-color: var(--crew-border); }
.crew-edit-bullet-depth-3 { border-left-color: var(--crew-border); }

.crew-edit-bullet-content {
  flex: 1;
  min-width: 0;
}

.crew-edit-bullet-actions {
  display: flex;
  align-items: flex-start;
  gap: 2px;
  flex-shrink: 0;
}

.crew-edit-bullet-type-select {
  font-size: 12px;
  padding: 1px 2px;
  border: 1px solid var(--crew-border);
  border-radius: 3px;
  background: var(--crew-figma-gray);
  color: var(--crew-text-muted);
  cursor: pointer;
  height: 22px;
  min-width: 40px;
}
.crew-edit-bullet-type-select:focus { outline: 1px solid var(--crew-blue); }

.crew-edit-image-block--inline {
  padding: 4px 0;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.crew-edit-image-block--inline .crew-edit-image-preview--compact {
  flex-shrink: 0;
  width: 120px;
  margin-bottom: 0;
}
.crew-edit-image-block--inline .crew-edit-image-preview--compact img {
  max-width: 120px;
  max-height: 80px;
  object-fit: contain;
  border-radius: 3px;
}
.crew-edit-image-placeholder--compact {
  width: 120px;
  height: 60px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--crew-figma-gray);
  border: 1px dashed var(--crew-border);
  border-radius: 3px;
  color: var(--crew-text-faint);
  flex-shrink: 0;
}
.crew-edit-image-fields--compact {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}
.crew-edit-image-fields--compact .crew-edit-image-label {
  font-size: 10px;
  gap: 2px;
}
.crew-edit-image-fields--compact .crew-edit-image-input {
  padding: 2px 4px;
  font-size: 11px;
}
.crew-edit-image-fields--compact .crew-edit-image-dims {
  display: flex;
  gap: 6px;
}

/* ── Callout ────────────────────────────────────────────── */
.crew-edit-callout {
  padding: 8px 10px;
  border-left: 4px solid #2563eb;
  background: #eff6ff;
}
.crew-edit-callout-head {
  margin-bottom: 4px;
}

.crew-edit-callout-severity {
  border: 1px solid var(--crew-border);
  border-radius: 3px;
  font-size: 12px;
  padding: 2px 4px;
}

.crew-edit-callout-body {
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.crew-edit-callout-label {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  line-height: 1.5;
}

.crew-edit-callout--inline,
.crew-edit-callout--cell {
  padding: 4px 6px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.crew-edit-callout--inline .crew-edit-callout-severity,
.crew-edit-callout--cell .crew-edit-callout-severity {
  font-size: 10px;
  padding: 1px 2px;
  flex-shrink: 0;
}
.crew-edit-callout-text-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--crew-border);
  border-radius: 3px;
  padding: 2px 4px;
  font-size: 12px;
  background: transparent;
}
.crew-edit-callout-text-input:focus {
  outline: 1px solid var(--crew-blue);
}

.crew-edit-rte--callout-inline {
  flex: 1;
  min-height: 22px;
  padding: 0 4px;
  font-size: 13px;
  line-height: 1.5;
  outline: none;
  border: none;
  border-top: none;
  font-family: inherit;
}

/* ── Table ──────────────────────────────────────────────── */
.crew-edit-rte--table {
  min-height: 22px;
  padding: 2px 4px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
}
.crew-edit-rte--table:focus {
  outline: 1px solid var(--crew-blue);
  border-radius: 2px;
}

.crew-edit-cell-link-badge {
  position: absolute;
  bottom: 1px;
  right: 1px;
  font-size: 10px;
  line-height: 1;
  opacity: 0.5;
  cursor: default;
}
th:hover > .crew-edit-cell-link-badge,
td:hover > .crew-edit-cell-link-badge {
  opacity: 1;
}

/* ── Table span popover ────────────────────────────────── */
.crew-edit-span-btn {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  background: none;
  color: var(--crew-text-faint);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
th:hover > .crew-edit-span-btn,
td:hover > .crew-edit-span-btn {
  opacity: 1;
}
/* ── Portal Popover (fixed position, outside scroll containers) ── */
.crew-portal-popover {
  position: fixed;
  z-index: 200;
  background: var(--crew-bg-surface);
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  padding: 12px;
  white-space: nowrap;
  font-size: 0.8rem;
  max-height: 80vh;
  overflow-y: auto;
}
.crew-portal-popover label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-weight: 600;
  font-size: 0.7rem;
  color: var(--crew-text-muted);
}
.crew-portal-popover select,
.crew-portal-popover input[type="number"],
.crew-portal-popover input[type="text"],
.crew-portal-popover input[type="url"] {
  padding: 2px 4px;
  border: 1px solid var(--crew-border);
  border-radius: 4px;
  font-size: 0.75rem;
}

.crew-edit-span-popover {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 100;
  background: var(--crew-bg-surface);
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  box-shadow: var(--crew-shadow);
  padding: 12px;
  white-space: nowrap;
  font-size: 0.8rem;
}
.crew-edit-span-popover label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-weight: 600;
  font-size: 0.7rem;
  color: var(--crew-text-muted);
  text-transform: uppercase;
}
.crew-edit-span-popover input[type="number"] {
  width: 56px;
  padding: 4px 6px;
  border: 1px solid var(--crew-border);
  border-radius: 4px;
  font-size: 0.8rem;
  text-align: center;
}
.crew-edit-span-popover select {
  padding: 4px 6px;
  border: 1px solid var(--crew-border);
  border-radius: 4px;
  font-size: 0.8rem;
  background: var(--crew-bg-surface);
}
.crew-edit-span-popover--wide {
  flex-direction: column;
  gap: 0;
  min-width: 240px;
}
.crew-edit-span-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--crew-text-muted);
  padding-bottom: 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--crew-border);
}
.crew-edit-span-close {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--crew-text-faint);
  padding: 2px 4px;
  border-radius: 3px;
  line-height: 1;
}
.crew-edit-span-close:hover {
  background: var(--crew-bg-hover);
  color: var(--crew-text);
}
.crew-edit-span-section {
  padding: 8px 0;
  border-bottom: 1px solid var(--crew-border);
}
.crew-edit-span-section:first-child { padding-top: 0; }
.crew-edit-span-section:last-child { border-bottom: none; padding-bottom: 0; }
.crew-edit-span-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--crew-text-faint);
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.crew-edit-span-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.crew-edit-cell-toolbar {
  position: absolute;
  top: 1px;
  right: 1px;
  display: flex;
  align-items: center;
  gap: 1px;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 2;
}
th:hover > .crew-edit-cell-toolbar,
td:hover > .crew-edit-cell-toolbar { opacity: 1; }
.crew-edit-cell-toolbar .crew-edit-span-btn {
  position: static;
  opacity: 1;
}
.crew-edit-span-btn--styled {
  color: #2563eb !important;
  opacity: 1 !important;
  font-weight: bold;
}

.crew-edit-cell-type-select {
  font-size: 11px;
  padding: 0 1px;
  border: 1px solid var(--crew-border);
  border-radius: 2px;
  background: var(--crew-figma-gray);
  color: var(--crew-text-muted);
  cursor: pointer;
  height: 18px;
  min-width: 32px;
}

.crew-edit-cell-image {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px 0;
}
.crew-edit-cell-image-thumb {
  max-width: 100%;
  max-height: 80px;
  object-fit: contain;
  border-radius: 2px;
}
.crew-edit-cell-image-empty {
  display: block;
  font-size: 10px;
  color: var(--crew-text-faint);
  padding: 8px;
  text-align: center;
  background: var(--crew-figma-gray);
  border: 1px dashed var(--crew-border);
  border-radius: 2px;
}
.crew-edit-cell-image-fields {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.crew-edit-cell-image-fields .crew-edit-image-input {
  font-size: 10px;
  padding: 1px 3px;
}
.crew-edit-cell-image-fields .crew-edit-image-file {
  font-size: 10px;
}

/* ── Inline Table Editor (nested) ──────────────────────── */
.crew-inline-table {
  padding: 2px 0;
  width: 100%;
}
.crew-inline-table__grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.crew-inline-table__grid th,
.crew-inline-table__grid td {
  border: 1px solid var(--crew-border);
  padding: 2px;
  vertical-align: top;
}
.crew-inline-table__grid th {
  background: var(--crew-figma-gray);
  font-weight: 600;
}
.crew-inline-table__input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 11px;
  padding: 1px 2px;
  outline: none;
}
.crew-inline-table__input:focus {
  background: #eff6ff;
}
.crew-inline-table__input--header {
  font-weight: 600;
}
.crew-inline-table__action-cell {
  width: 20px;
  border: none !important;
  background: none !important;
  padding: 0 2px !important;
  vertical-align: middle;
}
.crew-inline-table__actions {
  display: flex;
  gap: 4px;
  margin-top: 3px;
}
.crew-inline-table__colgroup {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 3px;
  flex-wrap: wrap;
}
.crew-inline-table__colgroup-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--crew-text-muted);
  text-transform: uppercase;
  white-space: nowrap;
}
.crew-inline-table__col-width {
  width: 52px;
  font-size: 10px;
  padding: 1px 3px;
  border: 1px solid var(--crew-border);
  border-radius: 2px;
  text-align: center;
  background: var(--crew-figma-gray);
  color: var(--crew-text);
}

/* ── Inline Bullet Editor (nested) ─────────────────────── */
.crew-inline-bullets {
  padding: 2px 0;
  width: 100%;
}
.crew-inline-bullets__row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
}
.crew-inline-bullets__marker {
  color: var(--crew-text-faint);
  font-size: 12px;
  flex-shrink: 0;
  min-width: 10px;
  text-align: center;
}
.crew-inline-bullets__input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--crew-border);
  border-radius: 3px;
  padding: 2px 4px;
  font-size: 11px;
  background: transparent;
}
.crew-inline-bullets__input:focus {
  outline: 1px solid var(--crew-blue);
  background: #eff6ff;
}

.crew-edit-table-head-actions {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}

.crew-edit-add-btn--compact {
  font-size: 11px;
  padding: 1px 8px;
}

/* ── Image ──────────────────────────────────────────────── */
.crew-edit-image-block {
  padding: 8px 10px;
}

.crew-edit-image-preview {
  text-align: center;
  margin-bottom: 8px;
  background: var(--crew-figma-gray);
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  padding: 8px;
}
.crew-edit-image-preview img {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
}

.crew-edit-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
  margin-bottom: 8px;
  border: 2px dashed var(--crew-border);
  border-radius: var(--crew-radius);
  color: var(--crew-text-faint);
  font-size: 13px;
  background: var(--crew-figma-gray);
}

/* Stored image whose bytes are missing on the server: render a labelled placeholder
   instead of the browser's broken-image glyph (empty src never resolves). */
.crew-image-unavailable {
  position: relative;
  display: block;
  width: 100% !important;
  height: auto !important;
  min-height: 140px;
  box-sizing: border-box;
  overflow: hidden;
  border: 2px dashed var(--crew-border);
  border-radius: var(--crew-radius);
  /* Hide the browser's broken-image glyph and the alt text underneath the label. */
  font-size: 0;
  color: transparent;
}
.crew-image-unavailable::after {
  content: "Image not available";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--crew-figma-gray);
  color: var(--crew-text-faint);
  font-size: 13px;
  font-style: italic;
}

.crew-edit-image-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.crew-edit-image-label {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  font-weight: 600;
  color: var(--crew-text-muted);
  gap: 2px;
}

.crew-edit-image-input {
  width: 100%;
  border: 1px solid var(--crew-border);
  border-radius: 3px;
  padding: 4px 8px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 400;
}
.crew-edit-image-input:focus { outline: 1px solid var(--crew-blue); }

.crew-edit-image-file {
  font-size: 12px;
  font-weight: 400;
}

.crew-edit-image-dims {
  display: flex;
  gap: 8px;
}
.crew-edit-image-dims .crew-edit-image-label { flex: 1; }

.crew-edit-image-input--dim {
  width: 100%;
}

/* ── Add buttons ────────────────────────────────────────── */
.crew-edit-add-btn {
  border: 1px dashed var(--crew-border);
  background: transparent;
  color: var(--crew-blue);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--crew-radius);
  cursor: pointer;
}
.crew-edit-add-btn:hover { background: var(--crew-note-bg); border-color: var(--crew-blue); }

.crew-edit-add-section-btn {
  width: 100%;
  margin-top: 4px;
}

.crew-edit-add-para-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}

.crew-edit-add-para-select {
  border: 1px solid var(--crew-border);
  border-radius: 3px;
  font-size: 12px;
  padding: 4px 8px;
}

/* ── Preview Column ─────────────────────────────────────── */
.crew-edit-col--preview {
  background: var(--crew-bg-surface);
  flex: 1.5;
}

.crew-edit-preview-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.crew-edit-preview-body .crew-markdown {
  max-width: 100%;
}

.crew-edit-preview-body .crew-document {
  max-width: 100% !important;
  margin: 0 !important;
}

.crew-edit-preview-empty {
  color: var(--crew-text-faint);
  font-size: 13px;
  text-align: center;
  padding: 40px 20px;
}

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

.crew-suggestion-block-hl {
  outline: 2px solid rgba(234, 179, 8, .7);
  outline-offset: 2px;
  background: rgba(234, 179, 8, .08);
  border-radius: 3px;
  transition: outline-color 0.3s, background 0.3s;
}

/* ── Suggestions Column ─────────────────────────────────── */
.crew-edit-col--suggestions {
  background: var(--crew-figma-gray);
}

.crew-edit-suggestions-body {
  padding: 12px;
  overflow-y: auto;
  flex: 3;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.crew-edit-suggestions-empty {
  color: var(--crew-text-muted);
  font-size: 13px;
  padding: 20px 0;
  text-align: center;
}

.crew-edit-suggestion-card {
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  background: var(--crew-bg-surface);
  padding: 10px;
  display: grid;
  gap: 8px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}

.crew-edit-suggestion-card--focused {
  border-color: var(--crew-blue);
  box-shadow: 0 0 0 3px rgba(27, 122, 195, 0.18);
  animation: crew-suggestion-focus-pulse 1.8s ease-out 1;
}

@keyframes crew-suggestion-focus-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(27, 122, 195, 0.55);
  }
  60% {
    box-shadow: 0 0 0 10px rgba(27, 122, 195, 0);
  }
  100% {
    box-shadow: 0 0 0 3px rgba(27, 122, 195, 0.18);
  }
}

.crew-edit-suggestion-meta {
  color: var(--crew-text-muted);
  font-size: 12px;
  font-weight: 700;
}

.crew-edit-suggestion-label {
  color: var(--crew-text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.crew-edit-original-btn {
  width: 100%;
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  background: var(--crew-figma-gray);
  color: #1a1a1a;
  text-align: left;
  font-family: Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 8px;
  cursor: pointer;
}
.crew-edit-original-btn:hover { background: var(--crew-bg-hover); }

.crew-edit-suggestion-change {
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  background: var(--crew-bg-surface);
  padding: 8px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.crew-edit-reject-comments {
  width: 100%;
  min-height: 60px;
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  padding: 8px;
  resize: vertical;
  font-family: inherit;
  font-size: 12px;
  box-sizing: border-box;
}

.crew-edit-suggestion-actions {
  display: flex;
  gap: 8px;
}
.crew-edit-suggestion-actions .crew-btn {
  padding: 5px 12px;
  font-size: 12px;
}

/* ── Suggestion author (submitter) — matches wiki editor pattern ── */
.crew-edit-suggestion-submitted-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.crew-edit-suggestion-submitted-row--above-actions {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--crew-border-light);
}

.crew-edit-suggestion-date {
  color: var(--crew-text-muted);
  font-size: 0.8rem;
  font-weight: 500;
}

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

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

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

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

.crew-edit-suggestion-avatar-initials {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--crew-text);
  letter-spacing: -0.02em;
}

.crew-edit-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 var(--crew-border);
  border-radius: var(--crew-radius);
  background: var(--crew-bg-surface);
  box-shadow: var(--crew-shadow);
  font-size: 0.82rem;
  line-height: 1.4;
  box-sizing: border-box;
}

.crew-edit-suggestion-author-popover-line {
  color: #1a1a1a;
  white-space: nowrap;
  overflow-x: auto;
  max-width: 100%;
  scrollbar-width: thin;
}

.crew-edit-suggestion-author-popover-line + .crew-edit-suggestion-author-popover-line {
  margin-top: 6px;
  color: var(--crew-text-muted);
  white-space: normal;
  word-break: break-word;
  overflow-x: visible;
  max-width: none;
}

.crew-edit-suggestion-author-popover-teams {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--crew-border-light);
}

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

.crew-edit-suggestion-teams-link:hover {
  text-decoration: underline;
}

/* ── AI Agent Placeholder ───────────────────────────────── */
.crew-edit-ai-pane {
  flex: 2;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--crew-border-light);
  background: var(--crew-bg-hover);
}

.crew-edit-ai-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.crew-edit-ai-body p {
  font-size: 12px;
  color: var(--crew-text-faint);
  margin: 0;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1080px) {
  .crew-edit-workspace {
    flex-direction: column;
    overflow-y: auto;
  }
  .crew-edit-col {
    max-height: 50vh;
    min-width: 0;
  }
  .crew-edit-resize-handle {
    width: 100%;
    height: 4px;
    cursor: row-resize;
  }
}

/* ── Panel Toggle Toolbar ───────────────────────────────── */
.crew-edit-panel-toolbar {
  display: flex;
  gap: 4px;
  padding: 4px 16px;
  background: var(--crew-figma-gray);
  border-bottom: 1px solid var(--crew-border-light);
  flex-shrink: 0;
}

.crew-edit-panel-toggle {
  border: 1px solid var(--crew-border);
  background: var(--crew-bg-surface);
  color: var(--crew-text-muted);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--crew-radius);
  cursor: pointer;
  transition: all 0.12s;
}

.crew-edit-panel-toggle:hover {
  background: var(--crew-bg-hover);
  color: var(--crew-text);
}

.crew-edit-panel-toggle--active {
  background: var(--crew-blue);
  border-color: var(--crew-blue);
  color: #fff;
}

.crew-edit-panel-toggle--active:hover {
  background: var(--crew-figma-blue-dark);
  border-color: var(--crew-figma-blue-dark);
  color: #fff;
}

/* ── Original Column ─────────────────────────────────────── */
.crew-edit-col--original {
  background: var(--crew-figma-gray);
  flex: 1;
}

/* ── JSON Column ─────────────────────────────────────────── */
.crew-edit-col--json {
  background: var(--crew-figma-gray);
  flex: 1;
}

.crew-edit-json-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px 12px;
}

.crew-edit-json-pre {
  margin: 0;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: #1a1a1a;
}

.crew-edit-copy-btn {
  margin-left: auto;
  padding: 2px 8px !important;
  font-size: 10px !important;
}

/* ── Editor Tab Toggle (Visual | JSON) ────────────────── */
.crew-edit-tab-toggle {
  display: flex;
  gap: 2px;
  margin-left: auto;
  background: var(--crew-border-light);
  border-radius: var(--crew-radius);
  padding: 2px;
}

.crew-edit-tab {
  border: none;
  background: transparent;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--crew-text-muted);
  cursor: pointer;
  border-radius: 3px;
  line-height: 1.4;
  transition: background 0.15s, color 0.15s;
}

.crew-edit-tab:hover { background: var(--crew-border); color: var(--crew-text); }
.crew-edit-tab--active { background: var(--crew-blue); color: #fff; }
.crew-edit-tab--active:hover { background: var(--crew-blue); color: #fff; }

/* ── JSON Editor (inside Editor panel) ─────────────────── */
.crew-edit-json-editor {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.crew-edit-json-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-bottom: 1px solid var(--crew-border-light);
  flex-shrink: 0;
}

.crew-edit-json-error {
  color: #c00;
  font-size: 10px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.crew-edit-json-textarea {
  flex: 1;
  min-height: 0;
  resize: none;
  border: none;
  outline: none;
  padding: 8px 12px;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 11px;
  line-height: 1.5;
  color: var(--crew-text);
  background: var(--crew-figma-gray);
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}

/* ── JSON Editor Syntax Highlighting ────────────────────── */
.crew-edit-json-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.crew-edit-json-backdrop {
  position: absolute;
  inset: 0;
  padding: 8px 12px;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.5;
  font-weight: 600;
  color: var(--crew-text-muted);
  background: var(--crew-figma-gray);
  white-space: pre;
  tab-size: 2;
  overflow: auto;
  pointer-events: none;
  border: none;
  margin: 0;
}

.crew-edit-json-wrap .crew-edit-json-textarea {
  position: absolute;
  inset: 0;
  background: transparent;
  color: transparent;
  caret-color: #1a1a1a;
  font-size: 12px;
  font-weight: 600;
  width: 100%;
  height: 100%;
}

/* Syntax tokens */
.jh-key    { color: #881391; font-weight: 800; }
.jh-string { color: #0b7c3e; font-weight: 600; }
.jh-number { color: #1a58b5; font-weight: 700; }
.jh-bool   { color: #d35400; font-weight: 800; }
.jh-null   { color: #9ca3af; font-style: italic; font-weight: 600; }

/* ── JSON Validation Errors ─────────────────────────────── */
.crew-edit-json-errors {
  max-height: 180px;
  overflow-y: auto;
  border-bottom: 1px solid #fecaca;
  background: #fef2f2;
  padding: 6px 12px;
  font-size: 11px;
  flex-shrink: 0;
}

.crew-edit-json-error-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 0;
  border-bottom: 1px solid #fee2e2;
  line-height: 1.4;
  flex-wrap: wrap;
}

.crew-edit-json-error-item:last-child {
  border-bottom: none;
}

.crew-edit-json-error-kind {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.crew-edit-json-error-kind--schema {
  background: #dbeafe;
  color: #1e40af;
}

.crew-edit-json-error-kind--model {
  background: #fef3c7;
  color: #92400e;
}

.crew-edit-json-error-kind--parse {
  background: #fecaca;
  color: #991b1b;
}

.crew-edit-json-error-path {
  font-family: Consolas, 'Courier New', monospace;
  font-size: 10px;
  color: #6b21a8;
  background: #f5f3ff;
  padding: 1px 4px;
  border-radius: 3px;
  flex-shrink: 0;
}

.crew-edit-json-error-msg {
  color: #374151;
  flex: 1;
  min-width: 0;
}

.crew-edit-json-error-loc {
  color: var(--crew-text-faint);
  font-size: 10px;
  font-family: Consolas, 'Courier New', monospace;
  flex-shrink: 0;
}

/* ── Diff Compare Overlay ───────────────────────────────── */
.crew-diff-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--crew-bg-surface);
  flex-direction: column;
}

.crew-diff-overlay--visible {
  display: flex;
}

.crew-diff-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--crew-figma-gray);
  border-bottom: 1px solid var(--crew-border-light);
  flex-shrink: 0;
}

.crew-diff-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--crew-text);
}

.crew-diff-subtitle {
  font-size: 11px;
  color: var(--crew-text-faint);
}

.crew-diff-version-picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--crew-text-muted);
  margin-left: 8px;
}

.crew-diff-version-picker-label {
  font-weight: 500;
}

.crew-diff-version-picker select {
  font-size: 12px;
  padding: 2px 6px;
  border: 1px solid var(--crew-border);
  border-radius: 4px;
  background: var(--crew-input-bg);
  color: var(--crew-text);
  cursor: pointer;
}

.crew-diff-version-picker select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.crew-diff-header .crew-btn {
  margin-left: auto;
}

.crew-diff-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.crew-diff-nav-btn {
  font-size: 11px !important;
  padding: 2px 8px !important;
}

.crew-diff-header .crew-btn:last-child {
  margin-left: 0;
}

.crew-diff-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.crew-diff-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.crew-diff-pane--old {
  border-right: 1px solid var(--crew-border-light);
}

.crew-diff-pane-header {
  padding: 4px 12px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--crew-text-faint);
  background: var(--crew-figma-gray);
  border-bottom: 1px solid var(--crew-border-light);
  flex-shrink: 0;
}

.crew-diff-pane-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  min-width: 0;
}

.crew-diff-pane-content.crew-markdown {
  max-width: none;
}

.crew-diff-pane-content .crew-procedure-content {
  max-width: none;
}

.crew-diff-pane-content .crew-document {
  max-width: none !important;
}

.crew-diff-del {
  background: #fecaca;
  color: #991b1b;
  text-decoration: line-through;
  padding: 1px 2px;
  border-radius: 2px;
}

.crew-diff-ins {
  background: #bbf7d0;
  color: #166534;
  text-decoration: none;
  padding: 1px 2px;
  border-radius: 2px;
}

.crew-diff-active {
  outline: 2px solid var(--crew-blue, #3b82f6);
  outline-offset: 1px;
  border-radius: 2px;
}

/* ── Diff Minimap (VS Code-style change strip) ──────────── */
.crew-diff-pane-wrapper {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.crew-diff-minimap {
  position: relative;
  flex-shrink: 0;
  width: 34px;
  background: var(--crew-border-light);
  cursor: pointer;
}

.crew-diff-minimap-viewport {
  position: absolute;
  left: 0;
  right: 0;
  background: rgba(100, 100, 100, 0.12);
  border-top: 1px solid rgba(100, 100, 100, 0.2);
  border-bottom: 1px solid rgba(100, 100, 100, 0.2);
  pointer-events: none;
  transition: top 0.08s linear, height 0.08s linear;
}

.crew-diff-minimap-mark {
  position: absolute;
  left: 0;
  right: 0;
  min-height: 2px;
  cursor: pointer;
}
.crew-diff-minimap-mark:hover {
  filter: brightness(1.2);
}

.crew-diff-pane--old .crew-diff-minimap-mark {
  background: rgba(239, 68, 68, 0.6);
}
.crew-diff-pane--new .crew-diff-minimap-mark {
  background: rgba(34, 197, 94, 0.6);
}

/* ── Diff Loading Indicator ─────────────────────────────── */
.crew-diff-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--crew-text-muted);
  font-size: 13px;
}

/* ── Diff Change-Count Stats ────────────────────────────── */
.crew-diff-stats {
  display: flex;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.crew-diff-stat--add {
  color: #166534;
  background: #dcfce7;
  padding: 1px 6px;
  border-radius: 3px;
}

.crew-diff-stat--del {
  color: #991b1b;
  background: #fee2e2;
  padding: 1px 6px;
  border-radius: 3px;
}

/* ── Diff Mobile Responsive ─────────────────────────────── */
@media (max-width: 768px) {
  .crew-diff-body {
    flex-direction: column;
  }
  
  .crew-diff-pane {
    flex: 1;
    min-height: 50%;
  }
  
  .crew-diff-pane--old {
    border-right: none;
    border-bottom: 1px solid var(--crew-border-light);
  }
  
  .crew-diff-header {
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 12px;
  }
  
  .crew-diff-title {
    font-size: 12px;
  }
  
  .crew-diff-subtitle {
    font-size: 10px;
  }
  
  .crew-diff-nav {
    order: 10;
    width: 100%;
    justify-content: center;
  }
  
  .crew-diff-header .crew-btn:last-child {
    margin-left: auto;
  }
}

/* ============================================================
   Content Filter Tree & Status Toggle Components
   ============================================================ */

/* ── Status Toggle ──────────────────────────────────────── */
.status-toggle {
  display: flex;
  gap: 0;
  padding: 4px 6px;
  border-bottom: 1px solid var(--crew-border-light);
  flex-shrink: 0;
}

.status-btn {
  flex: 1;
  min-width: 0;       /* allow flex item to shrink below content width */
  overflow: hidden;
  padding: 4px 3px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--crew-font-body);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border: 1px solid var(--crew-border);
  background: transparent;
  color: var(--crew-blue);
  cursor: pointer;
  transition: all 0.15s;
}

.status-btn:first-child {
  border-radius: 4px 0 0 4px;
}

.status-btn:last-child {
  border-radius: 0 4px 4px 0;
}

.status-btn:not(:first-child) {
  border-left: none;
}

.status-btn:hover {
  background: var(--crew-bg-hover);
  color: var(--crew-figma-blue-dark, #156082);
}

.status-btn.active {
  background: var(--crew-blue);
  border-color: var(--crew-blue);
  color: #fff;
}

/* Collapsed status toggle - vertical icon stack */
.status-toggle--collapsed {
  flex-direction: column;
  padding: 8px 0;
  gap: 6px;
  align-items: center;
}

.status-toggle--collapsed .status-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  font-size: 16px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--crew-text-muted);
  transition: background 0.15s, color 0.15s;
}

.status-toggle--collapsed .status-btn:hover {
  background: var(--crew-bg-hover);
}

.status-toggle--collapsed .status-btn.active {
  background: var(--crew-blue);
  color: #fff;
}

.status-toggle--collapsed .status-btn:not(:last-child) {
  border-bottom: none;
}

.status-toggle--collapsed .status-text {
  display: none;
}

.status-toggle--collapsed .status-icon {
  display: inline-block;
}

/* Expanded status toggle - show both icon and text */
.status-toggle:not(.status-toggle--collapsed) .status-btn {
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-toggle:not(.status-toggle--collapsed) .status-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.status-toggle:not(.status-toggle--collapsed) .status-icon {
  font-size: 14px;
  flex-shrink: 0;
}

/* ── Content Filter Tree ────────────────────────────────── */
.content-filter-tree {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.filter-tree-header {
  padding: 8px 12px;
  border-bottom: 1px solid var(--crew-border-light);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tree-search-wrap {
  position: relative;
  width: 100%;
}

.tree-search-wrap::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  z-index: 1;
  pointer-events: none;
}

.tree-search-wrap .tree-search-input {
  padding-right: 28px;
}

.tree-search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  line-height: 1;
  user-select: none;
}

.tree-search-clear:hover {
  color: #fff;
}

.tree-search-input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--crew-font-body);
  border: none;
  border-radius: 20px;
  background: var(--crew-blue);
  color: #fff;
  outline: none;
  box-sizing: border-box;
}

.tree-search-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.tree-search-input:focus {
  background: var(--crew-figma-blue-dark, #156082);
}

.favorites-toggle-row {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.favorites-toggle-star {
  font-size: 18px;
  line-height: 1;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  color: var(--crew-star-empty);
  transition: color 0.2s, text-shadow 0.3s;
}

.favorites-toggle-star:hover {
  color: var(--crew-star);
}

.favorites-toggle-star.active {
  color: var(--crew-star);
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.6), 0 0 16px rgba(255, 215, 0, 0.3);
  animation: star-glow 2s ease-in-out infinite alternate;
}

.favorites-toggle-label {
  font-size: 12px;
  font-family: var(--crew-font-body);
  color: var(--crew-blue);
}

.favorites-toggle-label:hover {
  color: var(--crew-figma-blue-dark, #156082);
}

@keyframes star-glow {
  from { text-shadow: 0 0 6px rgba(255, 215, 0, 0.4), 0 0 12px rgba(255, 215, 0, 0.2); }
  to   { text-shadow: 0 0 12px rgba(255, 215, 0, 0.8), 0 0 24px rgba(255, 215, 0, 0.4); }
}

/* ── Reload Button ──────────────────────────────────────── */
.crew-reload-btn {
  margin-left: auto;
  font-size: 18px;
  color: var(--crew-blue);
  opacity: 0.6;
  cursor: pointer;
  transition: color 0.2s, transform 0.2s, opacity 0.2s;
  line-height: 1;
  flex-shrink: 0;
}

.crew-reload-btn:hover {
  opacity: 1;
}

.crew-reload-btn.spinning {
  animation: spin 0.8s linear infinite;
  color: var(--crew-blue, #4a90d9);
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.filter-tree-content {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 40px 0;
}

/* ── Tree Node ──────────────────────────────────────────── */
.tree-node {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 12px;
  font-family: var(--crew-font-body);
  color: var(--crew-blue);
  transition: background 0.1s;
  cursor: pointer;
  user-select: none;
}

.tree-node:hover {
  background: var(--crew-bg-hover);
}

.tree-node.selected {
  background: var(--crew-blue);
  color: #fff;
  font-weight: 600;
}

.tree-node-root {
  font-weight: 600;
  color: var(--crew-figma-blue-dark, #156082);
  border-bottom: 1px solid var(--crew-border-light);
  padding: 6px 8px;
}

.tree-node-expander {
  width: 16px;
  text-align: center;
  font-size: 10px;
  color: var(--crew-text-faint);
  cursor: pointer;
  flex-shrink: 0;
}

.tree-node-expander:hover {
  color: var(--crew-blue);
}

.tree-node-favorite {
  width: 18px;
  text-align: center;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  color: #fbbf24;
  transition: transform 0.1s;
}

.tree-node-favorite:hover {
  transform: scale(1.2);
}

.tree-node-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  font-weight: 600;
  color: var(--crew-blue);
}

/* Document leaves: bold dark blue — distinct from folder blue but not black */
.tree-node-label-document {
  font-weight: 600;
  color: var(--crew-figma-blue-dark, #156082);
}

.tree-node-collapse {
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  font-size: 12px;
  cursor: pointer;
  color: var(--crew-text-faint);
  margin-left: auto;
  line-height: 1;
}

.tree-node-collapse:hover {
  color: var(--crew-blue);
}

.tree-node.selected .tree-node-label,
.tree-node.selected .tree-node-label-document {
  color: #fff;
}

.tree-node-empty .tree-node-label {
  font-weight: 300;
  opacity: 0.7;
}

/* ── Skeleton loading for tree ── */
.filter-tree-skeleton {
  padding: 8px 12px;
}

.skeleton-row {
  display: flex;
  align-items: center;
  padding: 6px 0;
}

.skeleton-block {
  display: block;
  height: 12px;
  background: var(--crew-border);
  border-radius: 4px;
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}

/* ============================================================
   Workflow Dashboard — My Action Items
   ============================================================ */
.crew-dashboard {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px;
  font-family: var(--crew-font-body);
}

.crew-dashboard-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--crew-text);
  margin: 0 0 24px;
}

.crew-dashboard-loading,
.crew-dashboard-empty {
  text-align: center;
  color: var(--crew-text-muted);
  padding: 40px 0;
  font-size: 14px;
}

.crew-dashboard-group {
  margin-bottom: 24px;
}

.crew-dashboard-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 2px solid var(--crew-border);
  margin-bottom: 8px;
}

.crew-dashboard-group-status {
  font-size: 15px;
  font-weight: 700;
  color: var(--crew-text);
}

.crew-dashboard-group-workflow {
  font-size: 12px;
  color: var(--crew-text-muted);
  background: var(--crew-figma-gray);
  padding: 2px 8px;
  border-radius: 4px;
}

.crew-dashboard-group-count {
  background: var(--crew-blue);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: auto;
}

.crew-dashboard-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.crew-dashboard-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}

.crew-dashboard-item:hover {
  background: var(--crew-bg-hover);
}

.crew-dashboard-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.crew-dashboard-item-id {
  font-size: 12px;
  font-weight: 700;
  color: var(--crew-blue);
  white-space: nowrap;
}

.crew-dashboard-item-version {
  font-size: 10px;
  font-weight: 600;
  color: var(--crew-text-muted);
  background: var(--crew-figma-gray);
  padding: 1px 5px;
  border-radius: 3px;
}

.crew-dashboard-item-title {
  font-size: 13px;
  color: var(--crew-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crew-dashboard-item-author {
  display: flex;
  align-items: center;
  gap: 6px;
}

.crew-dashboard-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.crew-dashboard-avatar-initials {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--crew-navy, #0f2044);
  color: white;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.crew-dashboard-author-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--crew-text);
}

.crew-dashboard-item-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--crew-text-faint);
  white-space: nowrap;
}

/* ============================================================
   Workflow History Log
   ============================================================ */
.crew-wf-history-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  font-family: var(--crew-font-body);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.crew-wf-history-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--crew-text);
  margin: 0 0 20px;
}

/* ── Filter Bar ───────────────────────────────────────── */
.crew-wf-history-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--crew-figma-gray);
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  margin: 16px 0 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.crew-wf-history-filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.crew-wf-history-filter-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--crew-text);
}

.crew-wf-history-filter-group input[type="text"] {
  font-size: 13px;
  padding: 5px 10px;
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  width: 220px;
}

.crew-wf-history-filter-badge {
  font-size: 11px;
  font-weight: 600;
  color: #1e40af;
  background: #dbeafe;
  padding: 2px 8px;
  border-radius: 10px;
}

.crew-wf-history-filter-meta {
  font-size: 12px;
  color: var(--crew-text-muted);
}

/* ── Document Group ───────────────────────────────────── */
.crew-wf-history-group {
  margin-bottom: 20px;
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  overflow: hidden;
}

.crew-wf-history-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--crew-bg-hover);
  border-bottom: 1px solid var(--crew-border);
}

.wfh-group-content-id {
  font-weight: 700;
  font-size: 13px;
  color: var(--crew-blue, #2563eb);
}

.wfh-group-title {
  font-size: 12px;
  color: var(--crew-text-muted);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wfh-group-count {
  font-size: 11px;
  color: var(--crew-text-muted);
  white-space: nowrap;
}

.crew-wf-history-group .crew-wf-history-table {
  margin: 0;
}

.crew-wf-history-results {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.crew-wf-history-loading,
.crew-wf-history-empty {
  text-align: center;
  color: var(--crew-text-muted);
  padding: 40px 0;
  font-size: 14px;
}

.crew-wf-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.crew-wf-history-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--crew-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 10px;
  border-bottom: 2px solid var(--crew-border);
}

.crew-wf-history-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--crew-border-light);
  vertical-align: top;
}

.crew-wf-history-table tr:hover td {
  background: var(--crew-bg-hover);
}

.wfh-date {
  white-space: nowrap;
  color: var(--crew-text-muted);
  font-size: 12px;
}

.wfh-document {
  min-width: 140px;
}

.wfh-content-id {
  font-weight: 600;
  color: var(--crew-blue);
  white-space: nowrap;
  font-size: 12px;
}

.wfh-title {
  font-size: 11px;
  color: var(--crew-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.wfh-action {
  font-weight: 600;
  color: var(--crew-text);
}

.wfh-status {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 600;
  font-size: 11px;
}

.wfh-from {
  background: #fee2e2;
  color: #991b1b;
}

.wfh-to {
  background: #d1fae5;
  color: #065f46;
}

.wfh-user {
  font-size: 12px;
}

.wfh-user-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wfh-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.wfh-avatar-initials {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--crew-navy, #0f2044);
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wfh-user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--crew-text);
  white-space: nowrap;
}

.wfh-user-email {
  font-size: 10px;
  color: var(--crew-text-muted);
  white-space: nowrap;
}

.wfh-comments {
  font-size: 12px;
  color: var(--crew-text-muted);
  font-style: italic;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Pager ─────────────────────────────────────────────── */
.crew-wf-history-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.crew-wf-history-pager-size {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--crew-text-muted);
}

.crew-wf-history-pager-size label {
  font-weight: 600;
}

.crew-wf-history-pager-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.crew-wf-history-pager-info {
  font-size: 12px;
  color: var(--crew-text);
  font-weight: 600;
  padding: 0 8px;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════
   Style Palette — per-paragraph formatting popover
   ═══════════════════════════════════════════════════════════════ */

/* Style button indicator states */
.crew-edit-icon-btn--default-style {
  opacity: 0.35;
  transition: opacity 0.15s;
}
.crew-edit-icon-btn--default-style:hover {
  opacity: 0.7;
}
.crew-edit-icon-btn--styled {
  color: var(--crew-blue);
  position: relative;
}
.crew-edit-icon-btn--styled::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--crew-blue);
}

/* Popover container */
.crew-edit-style-popover {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 100;
  background: var(--crew-bg-surface);
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  box-shadow: var(--crew-shadow);
  padding: 12px;
  font-size: 0.8rem;
  min-width: 280px;
  white-space: normal;
}
.crew-edit-style-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--crew-text-muted);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--crew-border);
}
.crew-edit-style-header .crew-edit-icon-btn {
  font-size: 16px;
  color: var(--crew-text-faint) !important;
  padding: 0 2px;
  line-height: 1;
  opacity: 1 !important;
}
.crew-edit-style-header .crew-edit-icon-btn:hover {
  color: var(--crew-text) !important;
}
.crew-edit-style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.crew-edit-style-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.crew-edit-style-field > span {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--crew-text-muted);
  text-transform: uppercase;
}
.crew-edit-style-field select,
.crew-edit-style-field input[type="text"],
.crew-edit-style-field input[type="number"] {
  padding: 4px 6px;
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  font-size: 0.8rem;
  background: var(--crew-bg-surface);
}
.crew-edit-style-color {
  display: flex;
  gap: 4px;
  align-items: center;
}
.crew-edit-style-color input[type="color"] {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  cursor: pointer;
}
.crew-edit-style-color input[type="text"] {
  flex: 1;
  min-width: 0;
}
.crew-edit-style-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--crew-border);
}
.crew-edit-style-section-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--crew-text-muted);
  text-transform: uppercase;
  display: block;
  margin-bottom: 4px;
}
.crew-edit-style-section select {
  padding: 4px 6px;
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  font-size: 0.8rem;
  background: var(--crew-bg-surface);
  width: 100%;
  max-width: 250px;
}
.crew-edit-style-footer {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--crew-border);
  text-align: right;
}

/* ============================================================
   Tabbed Content Viewer (ContentType-driven, e.g. GAS SSOP)
   ============================================================ */

.crew-tabbed-view {
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* Document header — wraps the lowest-Sequence section (rendered by the normal
   Content.ToHtml pipeline) and lifts it above the tab bar. We deliberately add
   no visual treatment of our own so the section keeps the exact look it had
   when it rendered as the first block of the linear viewer. */
.crew-doc-header {
  margin-bottom: 16px;
}

/* Tab strip */
.crew-tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 2px solid var(--crew-border);
  margin-bottom: 16px;
}

/* Inside the Document View shell the tab bar is pinned at the top of the main
   column (flush, no bottom margin); the body scroll region owns the padding. */
.crew-doc-shell-main .crew-tabbar {
  flex-shrink: 0;
  margin-bottom: 0;
  padding: 0 32px;
}

/* Status / revision pills, pinned just above the tab bar (or above the body for
   linear docs) so they don't compete with the header band layout. */
.crew-doc-pills {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 32px 16px;
}

.crew-version-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.crew-version-chip {
  appearance: none;
  background: var(--crew-bg-surface);
  border: 1px solid var(--crew-border);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(15, 32, 68, 0.12);
  color: var(--crew-text);
  cursor: pointer;
  font-family: var(--crew-font-body);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  padding: 7px 14px;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s, color 0.15s;
}

.crew-version-chip:hover:not(:disabled) {
  background: var(--crew-bg-hover);
  border-color: var(--crew-blue);
  box-shadow: 0 2px 6px rgba(27, 122, 195, 0.16);
}

.crew-version-chip:focus-visible {
  outline: 2px solid var(--crew-blue);
  outline-offset: 2px;
}

.crew-version-chip--active {
  background: var(--crew-blue);
  border-color: var(--crew-blue);
  box-shadow: 0 2px 6px rgba(27, 122, 195, 0.28);
  color: #fff;
}

.crew-version-chip--active:hover:not(:disabled) {
  background: var(--crew-figma-blue-dark);
  border-color: var(--crew-figma-blue-dark);
  box-shadow: 0 2px 8px rgba(21, 96, 130, 0.3);
  color: #fff;
}

.crew-version-chip:disabled {
  cursor: default;
  opacity: 1;
}

.crew-tabbar-tab {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--crew-text-muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
  white-space: nowrap;
}

.crew-tabbar-tab:hover {
  color: var(--crew-blue);
  background-color: var(--crew-bg-hover);
}

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

.crew-tabbar-tab--active {
  color: #fff;
  background-color: var(--crew-blue);
  border-bottom-color: var(--crew-blue);
  border-top-left-radius: var(--crew-radius);
  border-top-right-radius: var(--crew-radius);
}

.crew-tabbar-tab--active:hover {
  color: #fff;
  background-color: var(--crew-blue);
}

/* Tabbed viewer reuses the .crew-procedure-layout / .crew-procedure-content
   / .crew-toc-panel shape from the linear viewer. The only tabbed-specific
   bits below are the tabpanel container (focus outline) and its header. */
.crew-tabbed-panel {
  outline: none;
}

/* Tab panel visibility — all panels hidden, JS/Blazor toggles .active on the matching panel */
.crew-tabbed-panel .crew-tab-panel {
  display: none;
}

.crew-tabbed-panel .crew-tab-panel.active {
  display: block;
}

.crew-tabbed-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.crew-tabbed-panel-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--crew-text);
}

/* Empty-tab watermark */
.crew-tab-watermark {
  color: var(--crew-text-faint);
  font-size: 14px;
  font-style: italic;
  padding: 64px 24px;
  text-align: center;
  border: 1px dashed var(--crew-border);
  border-radius: var(--crew-radius);
  background-color: var(--crew-figma-gray);
}

/* Procedure metadata card */
.crew-metadata-card {
  background-color: var(--crew-figma-gray);
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  padding: 14px 16px;
  font-size: 13px;
}

.crew-metadata-list {
  display: block;
  margin: 0;
  padding: 0;
}

.crew-metadata-list dt {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--crew-text-muted);
  letter-spacing: 0.3px;
  margin-top: 10px;
  margin-bottom: 2px;
}

.crew-metadata-list dt:first-child {
  margin-top: 0;
}

.crew-metadata-list dd {
  margin: 0 0 0 10px;
  color: var(--crew-text);
  word-break: break-word;
  font-size: 13px;
}

.crew-metadata-empty {
  color: var(--crew-text-faint);
}

.crew-metadata-bullet-list {
  margin: 0;
  padding-left: 14px;
  list-style: disc;
}

.crew-metadata-bullet-list li {
  font-size: 13px;
  color: var(--crew-text);
  padding: 1px 0;
}

/* Status badge */
.crew-status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 8px;
  border-radius: 999px;
  background-color: #e2e8f0;
  color: #1f2937;
}

.crew-status-badge--published,
.crew-status-badge--effective {
  background-color: #d1fae5;
  color: #065f46;
}

.crew-status-badge--draft {
  background-color: #fef3c7;
  color: #92400e;
}

.crew-status-badge--in.review,
.crew-status-badge--inreview,
.crew-status-badge--review {
  background-color: #dbeafe;
  color: #1e40af;
}

.crew-status-badge--archived,
.crew-status-badge--superseded {
  background-color: #e2e8f0;
  color: #4b5568;
}

/* Editor: ContentCategory tab picker on the section header */
.crew-edit-tab-select {
  margin-left: 6px;
  padding: 4px 6px;
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  font-size: 0.8rem;
  background: var(--crew-bg-surface);
  color: var(--crew-text);
  max-width: 180px;
}

/* ── Content Location Editor ──────────────────────────────── */
.crew-location-editor {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--crew-border);
}

.crew-location-editor__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--crew-text);
}

.crew-location-editor__add-btn {
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  background: var(--crew-bg-surface);
  color: var(--crew-blue);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  cursor: pointer;
}

.crew-location-editor__add-btn:hover {
  background: var(--crew-bg-hover);
}

.crew-location-editor__empty {
  font-size: 11px;
  color: var(--crew-text-faint);
}

.crew-location-editor__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.crew-location-editor__chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--crew-bg-surface);
  border: 1px solid var(--crew-border);
  border-radius: 12px;
  font-size: 11px;
  color: var(--crew-text);
}

.crew-location-editor__chip-delete {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0 2px;
  color: var(--crew-text-faint);
  transition: color 0.15s;
}

.crew-location-editor__chip-delete:hover {
  color: #c00;
}

.crew-location-editor__add-wrap {
  position: relative;
}

.crew-location-editor__dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 100;
  width: 440px;
  max-height: 400px;
  display: flex;
  flex-direction: column;
  background: var(--crew-bg-surface);
  border: 1px solid var(--crew-border);
  border-radius: var(--crew-radius);
  box-shadow: var(--crew-shadow);
  margin-top: 4px;
}

.crew-location-editor__dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--crew-border);
  font-size: 12px;
  font-weight: 600;
  color: var(--crew-text-muted);
  flex-shrink: 0;
}

.crew-location-editor__dropdown-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--crew-text-faint);
  cursor: pointer;
  border-radius: var(--crew-radius);
}

.crew-location-editor__dropdown-close:hover {
  background: var(--crew-bg-hover);
  color: var(--crew-text);
}

.crew-location-editor__dropdown-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 0;
}

/* ── Application control theme integration ──────────────────
   Native controls do not inherit foreground/background reliably. Keep editor
   and workflow chrome on the shared input palette; authored document content
   remains isolated under .crew-document. */
.crew-edit-properties-field input,
.crew-edit-properties-field select,
.crew-edit-properties-field textarea,
.crew-edit-heading-select,
.crew-edit-agent-popover-input textarea,
.crew-edit-callout-severity,
.crew-edit-callout-text-input,
.crew-portal-popover select,
.crew-portal-popover input,
.crew-edit-span-popover input,
.crew-edit-span-popover select,
.crew-edit-image-input,
.crew-edit-add-para-select,
.crew-edit-reject-comments,
.crew-wf-history-filter-group input,
.crew-edit-style-field select,
.crew-edit-style-field input,
.crew-edit-style-section select {
  background: var(--crew-input-bg);
  color: var(--crew-text);
  border-color: var(--crew-border);
}

.crew-edit-original-btn,
.crew-edit-suggestion-author-popover-line {
  color: var(--crew-text);
}

.crew-edit-section-seq {
  background: var(--crew-bg-surface);
  color: var(--crew-text-muted);
}

