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

/* ── Color Tokens ─────────────────────────────────────────── */
:root {
  --crew-navy:          #0f2044;
  --crew-blue:          #1a56a0;
  --crew-note-bg:       #e8f0fb;
  --crew-warning-bg:    #fff4ec;
  --crew-warning-bdr:   #c45000;
}

/* ── App Shell ──────────────────────────────────────────────── */
.crew-app-row {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* ── Nav Panel (resizable) ──────────────────────────────────── */
.crew-nav-panel {
  background-color: var(--crew-navy);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  flex-shrink: 0;
  overflow: hidden;
}

.crew-content-panel {
  background-color: #ffffff;
  overflow-y: auto;
  height: 100vh;
}

/* ── Splitter Bar ───────────────────────────────────────────── */
.crew-splitter-bar {
  width: 4px;
  background: #1a2942;
  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::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -4px;
  right: -4px;
}

/* ── Sidebar ────────────────────────────────────────────── */
.crew-sidebar {
  background-color: var(--crew-navy);
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* ── 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;
}

/* ── Table of Contents Panel ─────────────────────────────── */
.crew-toc-panel {
  width: 200px;
  flex-shrink: 0;
  position: sticky;
  top: 24px;
  align-self: flex-start;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  border-left: 2px solid #e8e8e8;
  padding-left: 12px;
  font-size: 13px;
}

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

.crew-toc-item {
  display: block;
  color: #555;
  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;
}

.crew-toc-h3 { padding-left: 12px; }
.crew-toc-h4 { padding-left: 24px; }
.crew-toc-h5 { padding-left: 36px; }
.crew-toc-h6 { padding-left: 48px; }

/* ── Home / Welcome ──────────────────────────────────────── */
.crew-home-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

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

.crew-home-subtitle {
  font-size: 14px;
  color: #666;
}

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

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

.crew-card {
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.crew-card:hover {
  border-color: var(--crew-blue);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.crew-card-number {
  font-size: 11px;
  color: #888;
  font-family: monospace;
  margin-bottom: 4px;
}

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

/* ── Progress Bar ────────────────────────────────────────── */
.crew-progress-wrapper {
  max-width: 400px;
  margin: 80px auto 0;
  text-align: center;
}

.crew-progress-label {
  font-size: 14px;
  color: #666;
  margin-bottom: 12px;
}

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

.crew-progress-bar {
  height: 100%;
  background: var(--crew-blue);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* ── 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: Arial, sans-serif;
  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: 4px;
  font-size: 13px;
  font-weight: 600;
  font-family: Arial, sans-serif;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  line-height: 1.3;
}

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

.crew-btn--ghost {
  background: transparent;
  color: #555;
  border-color: #ccc;
}
.crew-btn--ghost:hover:not(:disabled) { background: #f0f2f5; }
.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; }

/* ── Advance Dropdown ────────────────────────────────────── */
.crew-advance-wrap {
  position: relative;
  display: inline-block;
}
.crew-advance-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  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: #1f2937;
  cursor: pointer;
  white-space: nowrap;
}
.crew-advance-item:hover:not(:disabled) {
  background: #f0f4ff;
  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: 100vh;
  font-family: Arial, sans-serif;
  background: #f4f6fa;
  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;
}

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

.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: 4px;
  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; }

/* ── 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: #fff;
  border: 1px solid #d8e1ec;
  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: 4px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: Arial, sans-serif;
  transition: background 0.1s;
}

.crew-split-btn__option:hover {
  background: #f0f4fa;
}

.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-navy);
}

.crew-split-btn__option-text small {
  font-size: 11px;
  color: #666;
  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: #dce4ee;
  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: #888;
  padding: 2px 4px;
  border-radius: 3px;
  line-height: 1;
  flex-shrink: 0;
}
.crew-edit-collapse-btn:hover { background: #e8ecf0; color: #333; }

.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: #888;
}

.crew-edit-col-subtitle {
  font-size: 10px;
  color: #aaa;
}

/* ── Editor Column ───────────────────────────────────────── */
.crew-edit-col--editor {
  background: #fff;
  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: #555;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  user-select: none;
}
.crew-edit-properties-toggle:hover { background: #f8f9fb; }

.crew-edit-properties-id {
  margin-left: auto;
  font-weight: 400;
  color: #888;
  font-size: 11px;
}

.crew-edit-properties-panel {
  padding: 10px 16px 14px;
  border-bottom: 1px solid #eee;
  background: #fafbfc;
}

.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: #555;
}
.crew-edit-properties-field input,
.crew-edit-properties-field select,
.crew-edit-properties-field textarea {
  border: 1px solid #dce4ee;
  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;
}

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

.crew-edit-section {
  border: 1px solid #dce4ee;
  border-radius: 6px;
  margin-bottom: 10px;
  background: #fff;
}

.crew-edit-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f7f9fc;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  user-select: none;
}
.crew-edit-section-head--open {
  border-bottom: 1px solid #dce4ee;
}

.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: #888;
  width: 14px;
  text-align: center;
}

.crew-edit-section-seq {
  font-size: 11px;
  font-weight: 700;
  color: var(--crew-blue);
  background: #e8f0fb;
  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: var(--crew-navy);
}
.crew-edit-section-title-input:focus {
  border-color: var(--crew-blue);
  background: #fff;
  outline: none;
}

.crew-edit-heading-select {
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 11px;
  padding: 2px 4px;
  background: #fff;
  cursor: pointer;
}

.crew-edit-icon-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 5px;
  border-radius: 3px;
  color: #888;
  line-height: 1;
}
.crew-edit-icon-btn:hover { background: #e8ecf0; color: #333; }
.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: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  margin-top: 4px;
}

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

.crew-edit-agent-popover-section {
  padding: 8px 12px;
  font-size: 12px;
  color: #6b7280;
  background: #f9fafb;
  border-bottom: 1px solid #e8ecf0;
}

.crew-edit-agent-popover-loading,
.crew-edit-agent-popover-error {
  padding: 16px 12px;
  text-align: center;
  font-size: 12px;
  color: #6b7280;
}

.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: 4px;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  margin-bottom: 4px;
}

.crew-edit-agent-option:hover {
  background: #f3f4f6;
}

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

.crew-edit-agent-option-name {
  display: block;
  font-weight: 600;
  color: #111827;
}

.crew-edit-agent-option-desc {
  display: block;
  font-size: 11px;
  color: #6b7280;
  margin-top: 2px;
}

.crew-edit-agent-popover-input {
  padding: 10px 12px;
  border-top: 1px solid #e8ecf0;
}

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

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

.crew-edit-agent-popover-input textarea:focus {
  outline: none;
  border-color: #2563eb;
}

.crew-edit-agent-popover-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e8ecf0;
  background: #f9fafb;
  border-radius: 0 0 8px 8px;
}

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

.crew-edit-paragraph {
  border: 1px solid #e8ecf0;
  border-radius: 4px;
  margin-bottom: 8px;
  background: #fafbfc;
}

.crew-edit-para-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-bottom: 1px solid #e8ecf0;
  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: #888; }

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

/* ── Rich Text Editor ───────────────────────────────────── */
.crew-edit-rte {
  border-top: 1px solid #e8ecf0;
  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 #dce4ee;
  border-radius: 3px;
  background: #fff;
}

/* ── 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: #1e293b;
  border-radius: 6px;
  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: #1e293b;
  border-radius: 8px;
  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 #334155;
  border-radius: 4px;
  background: #0f172a;
  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: #3b82f6;
}
.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: #3b82f6;
}
.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: #3b82f6;
  color: #fff;
}
.crew-link-btn--apply:hover {
  background: #2563eb;
}

/* ── 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: #888;
  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: #e0e0e0; }
.crew-edit-bullet-depth-2 { border-left-color: #d0d0d0; }
.crew-edit-bullet-depth-3 { border-left-color: #c0c0c0; }

.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 #d1d5db;
  border-radius: 3px;
  background: #f9fafb;
  color: #555;
  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: #f3f4f6;
  border: 1px dashed #d1d5db;
  border-radius: 3px;
  color: #999;
  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--note { border-left-color: #2563eb; background: #eff6ff; }
.crew-edit-callout--warning { border-left-color: #d97706; background: #fffbeb; }
.crew-edit-callout--caution { border-left-color: #dc2626; background: #fef2f2; }
.crew-edit-callout--attention { border-left-color: #7c3aed; background: #f5f3ff; }

.crew-edit-callout-head {
  margin-bottom: 4px;
}

.crew-edit-callout-severity {
  border: 1px solid #ccc;
  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--warning .crew-edit-callout-label,
.crew-edit-callout--caution .crew-edit-callout-label {
  font-style: italic;
}

.crew-edit-callout--warning .crew-edit-rte--callout-inline,
.crew-edit-callout--caution .crew-edit-rte--callout-inline {
  font-style: italic;
}

.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 #dce4ee;
  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: #9ca3af;
  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;
}
.crew-edit-span-popover {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 20;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  padding: 6px 8px;
  display: flex;
  gap: 8px;
  white-space: nowrap;
  font-size: 0.7rem;
}
.crew-edit-span-popover label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  color: #374151;
}
.crew-edit-span-popover input[type="number"] {
  width: 44px;
  padding: 2px 4px;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  font-size: 0.7rem;
  text-align: center;
}

.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-cell-type-select {
  font-size: 11px;
  padding: 0 1px;
  border: 1px solid #d1d5db;
  border-radius: 2px;
  background: #f9fafb;
  color: #666;
  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: #999;
  padding: 8px;
  text-align: center;
  background: #f3f4f6;
  border: 1px dashed #d1d5db;
  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 #d1d5db;
  padding: 2px;
  vertical-align: top;
}
.crew-inline-table__grid th {
  background: #f3f4f6;
  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;
}

/* ── 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: #888;
  font-size: 12px;
  flex-shrink: 0;
  min-width: 10px;
  text-align: center;
}
.crew-inline-bullets__input {
  flex: 1;
  min-width: 0;
  border: 1px solid #dce4ee;
  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: #f8f9fb;
  border: 1px solid #dce4ee;
  border-radius: 4px;
  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 #ccd3dd;
  border-radius: 4px;
  color: #888;
  font-size: 13px;
  background: #fafbfc;
}

.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: #555;
  gap: 2px;
}

.crew-edit-image-input {
  width: 100%;
  border: 1px solid #dce4ee;
  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 #aab;
  background: transparent;
  color: var(--crew-blue);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
}
.crew-edit-add-btn:hover { background: #e8f0fb; 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 #ccc;
  border-radius: 3px;
  font-size: 12px;
  padding: 4px 8px;
}

/* ── Preview Column ─────────────────────────────────────── */
.crew-edit-col--preview {
  background: #fff;
  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: #888;
  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: #f8fbff;
}

.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: #516173;
  font-size: 13px;
  padding: 20px 0;
  text-align: center;
}

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

.crew-edit-suggestion-meta {
  color: #44556a;
  font-size: 12px;
  font-weight: 700;
}

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

.crew-edit-original-btn {
  width: 100%;
  border: 1px solid #c8d3e0;
  border-radius: 4px;
  background: #f6f9fc;
  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: #eef4fb; }

.crew-edit-suggestion-change {
  border: 1px solid #d8e1ec;
  border-radius: 4px;
  background: #fff;
  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 #c8d3e0;
  border-radius: 4px;
  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 #e8eef5;
}

.crew-edit-suggestion-date {
  color: #516173;
  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 #c8d3e0;
  border-radius: 50%;
  background: #f0f4f8;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.crew-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: #2c5282;
  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 #d8e1ec;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 -4px 20px rgba(26, 42, 74, 0.12);
  font-size: 0.82rem;
  line-height: 1.4;
  box-sizing: border-box;
}

.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: #44556a;
  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 #e8eef5;
}

.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 #e2e8f0;
  background: #f0f4fa;
}

.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: #888;
  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: #f4f6f9;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.crew-edit-panel-toggle {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #666;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.12s;
}

.crew-edit-panel-toggle:hover {
  background: #eef2f7;
  color: #333;
}

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

.crew-edit-panel-toggle--active:hover {
  background: #1648a0;
  border-color: #1648a0;
  color: #fff;
}

/* ── Original Column ─────────────────────────────────────── */
.crew-edit-col--original {
  background: #fafbfc;
  flex: 1;
}

/* ── JSON Column ─────────────────────────────────────────── */
.crew-edit-col--json {
  background: #fafbfc;
  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: #e8ecf0;
  border-radius: 4px;
  padding: 2px;
}

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

.crew-edit-tab:hover { background: #dde1e6; color: #333; }
.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 #e2e8f0;
  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: #1a1a1a;
  background: #fafbfc;
  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: #6b7280;
  background: #fafbfc;
  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: #9ca3af;
  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: #fff;
  flex-direction: column;
}

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

.crew-diff-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: #f4f6f9;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

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

.crew-diff-subtitle {
  font-size: 11px;
  color: #888;
}

.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 #e2e8f0;
}

.crew-diff-pane-header {
  padding: 4px 12px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #888;
  background: #f9fafb;
  border-bottom: 1px solid #e2e8f0;
  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: #f0f0f0;
  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;
  gap: 12px;
  color: #64748b;
  font-size: 13px;
}

.crew-diff-loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--crew-blue, #3b82f6);
  border-radius: 50%;
  animation: crew-diff-spin 0.7s linear infinite;
}

@keyframes crew-diff-spin {
  to { transform: rotate(360deg); }
}

/* ── 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 #e2e8f0;
  }
  
  .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: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.status-btn {
  flex: 1;
  padding: 4px 6px;
  font-size: 10px;
  font-weight: 600;
  font-family: Arial, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  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: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
}

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

/* ── 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 rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

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

.tree-search-input:focus {
  border-color: rgba(100, 160, 255, 0.6);
  background: rgba(255, 255, 255, 0.12);
}

.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: rgba(255, 255, 255, 0.4);
  transition: color 0.2s, text-shadow 0.3s;
}

.favorites-toggle-star:hover {
  color: #ffd700;
}

.favorites-toggle-star.active {
  color: #ffd700;
  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: Arial, sans-serif;
  color: rgba(255, 255, 255, 0.75);
}

.favorites-toggle-label:hover {
  color: #fff;
}

@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: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: color 0.2s, transform 0.2s;
  line-height: 1;
  flex-shrink: 0;
}

.crew-reload-btn:hover {
  color: rgba(255, 255, 255, 0.9);
}

.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;
}

/* ── Tree Node ──────────────────────────────────────────── */
.tree-node {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 12px;
  font-family: Arial, sans-serif;
  color: rgba(255, 255, 255, 0.78);
  transition: background 0.1s;
  cursor: pointer;
  user-select: none;
}

.tree-node:hover {
  background: rgba(255, 255, 255, 0.06);
}

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

.tree-node-root {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 8px;
}

.tree-node-expander {
  width: 16px;
  text-align: center;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  flex-shrink: 0;
}

.tree-node-expander:hover {
  color: rgba(255, 255, 255, 0.9);
}

.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;
}

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

.tree-node-collapse:hover {
  color: rgba(255, 255, 255, 0.8);
}

.tree-node.selected .tree-node-label {
  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: rgba(255, 255, 255, 0.08);
  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: Arial, sans-serif;
}

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

.crew-dashboard-loading,
.crew-dashboard-empty {
  text-align: center;
  color: #6b7280;
  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 #e5e7eb;
  margin-bottom: 8px;
}

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

.crew-dashboard-group-workflow {
  font-size: 12px;
  color: #6b7280;
  background: #f3f4f6;
  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: #f0f4ff;
}

.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: #6b7280;
  background: #f3f4f6;
  padding: 1px 5px;
  border-radius: 3px;
}

.crew-dashboard-item-title {
  font-size: 13px;
  color: #1f2937;
  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: #374151;
}

.crew-dashboard-item-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: #9ca3af;
  white-space: nowrap;
}

/* ============================================================
   Workflow History Log
   ============================================================ */
.crew-wf-history-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
  font-family: Arial, sans-serif;
}

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

.crew-wf-history-loading,
.crew-wf-history-empty {
  text-align: center;
  color: #6b7280;
  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: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 10px;
  border-bottom: 2px solid #e5e7eb;
}

.crew-wf-history-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: top;
}

.crew-wf-history-table tr:hover td {
  background: #f9fafb;
}

.wfh-date {
  white-space: nowrap;
  color: #6b7280;
  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: #4b5563;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.wfh-action {
  font-weight: 600;
  color: #1f2937;
}

.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: #1f2937;
  white-space: nowrap;
}

.wfh-user-email {
  font-size: 10px;
  color: #6b7280;
  white-space: nowrap;
}

.wfh-comments {
  font-size: 12px;
  color: #4b5563;
  font-style: italic;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crew-wf-history-more {
  text-align: center;
  padding: 16px 0;
}
