/* Custom Design Tokens & Clean Layout System */
:root {
  --bg-app: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-canvas: #ffffff;

  --text-main: #0f172a;
  --text-muted: #64748b;

  --border-light: #e2e8f0;
  --border-focus: #2563eb;

  --color-slate: #1e293b;
  --color-blue: #2563eb;
  --color-green: #16a34a;
  --color-red: #dc2626;
  --color-yellow: #eab308;

  --sidebar-width: 137px;
  --topbar-height: 56px;

  --font-family:
    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* Screen reader styling */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Main Container Layout */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* Sidebar Dashboard (Tufte-inspired, low ink, high clarity, compact) */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 10;
}

.sidebar-header {
  padding: 12px 6px 8px;
  border-bottom: 1px solid var(--border-light);
  text-align: center;
}

.sidebar-header h1 {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-header .subtitle {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Sidebar Content Sections */
.tool-section {
  padding: 8px 6px;
  border-bottom: 1px solid var(--border-light);
}

.tool-section h2 {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 5px;
  font-weight: 600;
}

/* Grid Tool Button Layouts */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}

.tool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.tool-btn svg {
  width: 15px;
  height: 15px;
}

.tool-btn:hover {
  background-color: #f1f5f9;
}

.tool-btn.active {
  border-color: var(--border-focus);
  background-color: #eff6ff;
  color: var(--border-focus);
}

/* Colors and Stroke Selection */
.color-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
}

.color-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.color-btn:hover {
  transform: scale(1.1);
}

.color-btn.active {
  border-color: var(--text-main);
  box-shadow: 0 0 0 2px #ffffff inset;
}

.stroke-selector {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stroke-selector input[type='range'] {
  width: 100%;
  cursor: pointer;
  accent-color: var(--border-focus);
  transition: accent-color 0.15s ease;
}

.stroke-selector span {
  font-size: 0.72rem;
  text-align: right;
  transition: color 0.15s ease;
}

/* Template Selectors */
.template-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.template-btn {
  text-align: left;
  padding: 5px 6px;
  font-size: 0.72rem;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.15s ease;
}

.template-btn:hover {
  background-color: #f1f5f9;
}

.template-btn.active {
  background-color: var(--color-slate);
  color: #ffffff;
  border-color: var(--color-slate);
}

/* Sidebar Swimlanes / Roles Monitor & Typo Manager */
.sidebar-roles-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
}

.sidebar-section-header h2 {
  margin-bottom: 0;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sidebar-section-badge {
  font-size: 0.58rem;
  font-weight: 600;
  background: #f1f5f9;
  color: #475569;
  border-radius: 999px;
  padding: 0 5px;
  line-height: 1.3;
}

.sidebar-roles-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 165px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 1px;
}

.sidebar-roles-empty {
  font-size: 0.64rem;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 6px 2px;
}

.sidebar-role-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  padding: 2px 3px 2px 5px;
  gap: 2px;
  transition: all 0.12s ease;
}

.sidebar-role-item:hover {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.sidebar-role-item.typo-warning {
  border-left: 2.5px solid var(--color-yellow);
  background: #fffbeb;
}

.sidebar-role-item.typo-warning:hover {
  background: #fef3c7;
}

.sidebar-role-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 1px 0;
  text-align: left;
}

.sidebar-role-name {
  font-size: 0.66rem;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-role-count {
  font-size: 0.56rem;
  font-weight: 600;
  color: var(--text-muted);
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 0 3px;
  margin-left: 3px;
  flex-shrink: 0;
}

.sidebar-role-rename-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 2px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0.5;
  transition: all 0.1s ease;
  flex-shrink: 0;
  padding: 0;
}

.sidebar-role-rename-btn:hover {
  opacity: 1;
  color: var(--color-blue);
  background: #eff6ff;
}

/* Note highlight pulsing ring */
@keyframes note-pulse-glow {
  0% {
    box-shadow:
      0 0 0 2px var(--color-blue),
      0 2px 8px rgba(37, 99, 235, 0.3);
  }
  100% {
    box-shadow:
      0 0 0 4px var(--color-blue),
      0 4px 16px rgba(37, 99, 235, 0.6);
  }
}

.sticky-note.note-highlight-active {
  z-index: 1000 !important;
  animation: note-pulse-glow 0.6s infinite alternate ease-in-out;
}

/* Sidebar Workflow Graphic Preview */
.sidebar-workflow-section {
  cursor: pointer;
  transition: background-color 0.15s ease;
  user-select: none;
}

.sidebar-workflow-section:hover {
  background-color: #f8fafc;
}

.sidebar-workflow-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 3px;
  background-color: #ffffff;
  transition: all 0.15s ease;
}

.sidebar-workflow-section:hover .sidebar-workflow-card,
.sidebar-workflow-section:focus-visible .sidebar-workflow-card {
  border-color: var(--border-focus);
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.12);
}

.sidebar-workflow-section:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 1px;
}

.sidebar-workflow-img {
  width: 100%;
  height: auto;
  max-height: 84px;
  object-fit: cover;
  object-position: top center;
  border-radius: 2px;
  display: block;
  border: 1px solid #f1f5f9;
}

.sidebar-workflow-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--color-blue);
  padding: 1px 2px;
  line-height: 1.2;
}

/* Utility / Buttons */
.utility-section {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.text-btn {
  width: 100%;
  padding: 5px 3px;
  font-size: 0.68rem;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.text-btn:hover {
  background-color: #f1f5f9;
}

.text-btn.warning {
  color: var(--color-red);
}

.text-btn.warning:hover {
  background-color: #fef2f2;
  border-color: #fee2e2;
}

/* Canvas Viewport and Layout */
.canvas-area-wrapper {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  height: 100%;
  position: relative;
}

/* Header/Top Bar Control Layer (Tufte Data-Ink Aligned) */
.top-bar {
  height: var(--topbar-height);
  border-bottom: 1px solid var(--border-light);
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  z-index: 9;
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.navigation-info {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.brainstorm-container {
  flex: 0 1 240px;
  min-width: 140px;
  margin: 0;
  display: flex;
  align-items: center;
}

#brainstorm-input {
  width: 100%;
  height: 32px;
  padding: 0 12px;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--font-family);
  border: 1px solid #facc15;
  border-radius: 4px;
  background-color: #fef08a;
  color: #0f172a;
  outline: none;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

#brainstorm-input::placeholder {
  color: #713f12;
  font-weight: 700;
  opacity: 0.85;
}

#brainstorm-input:focus {
  border-color: #ca8a04;
  background-color: #fef9c3;
  box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.25);
}

#current-template-name {
  font-weight: 600;
  color: var(--text-main);
}

.project-save-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 2px 4px 2px 10px;
  background-color: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  flex-shrink: 0;
  box-sizing: border-box;
}

.project-save-controls .primary-btn {
  height: 28px;
  padding: 0 10px;
  background-color: var(--color-blue);
  color: #ffffff;
  border: 1px solid var(--color-blue);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 500;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.project-save-controls .primary-btn:hover {
  background-color: #1d4ed8;
  border-color: #1d4ed8;
}

.project-save-controls .secondary-btn {
  height: 28px;
  padding: 0 10px;
  background-color: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 500;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.project-save-controls .secondary-btn:hover {
  background-color: #f1f5f9;
  border-color: var(--border-focus);
}

.project-name-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

#project-name-input {
  width: 105px;
  min-width: 75px;
  height: 26px;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 0.8rem;
  padding: 0 4px;
  outline: none;
  box-sizing: border-box;
}

.history-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.history-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  box-sizing: border-box;
  color: var(--text-main);
}

.history-controls button:hover {
  background-color: #f1f5f9;
}

.history-controls button.primary-btn {
  width: auto;
  height: 32px;
  padding: 0 11px;
  background-color: var(--color-blue);
  color: #ffffff;
  border-color: var(--color-blue);
  font-weight: 500;
  font-size: 0.78rem;
  gap: 5px;
  border-radius: 4px;
}

.history-controls button.primary-btn:hover {
  background-color: #1d4ed8;
}

.history-controls .guide-btn {
  height: 32px;
  padding: 0 10px;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 4px;
  box-sizing: border-box;
}

/* Canvas Container */
.canvas-viewport {
  flex-grow: 1;
  position: relative;
  overflow: hidden;
  background-color: var(--bg-canvas);
}

#whiteboardCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* Sticky Note Styles (Zero unnecessary shadows, flat design) */
.sticky-note {
  position: absolute;
  width: 160px;
  min-height: 100px;
  background-color: #fef08a; /* Soft warning yellow */
  border-left: 4px solid var(--color-yellow);
  border-top: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  padding: 10px;
  cursor: move;
  touch-action: none;
  display: flex;
  flex-direction: column;
  user-select: none;
  font-size: 0.85rem;
  z-index: 100;
}

.sticky-note.note-blue {
  background-color: #eff6ff;
  border-left-color: var(--color-blue);
}

.sticky-note.note-green {
  background-color: #f0fdf4;
  border-left-color: var(--color-green);
}

.sticky-note.note-red {
  background-color: #fef2f2;
  border-left-color: var(--color-red);
}

.sticky-note textarea {
  width: 100%;
  flex-grow: 1;
  border: none;
  background: transparent;
  resize: none;
  font-family: var(--font-family);
  font-size: 0.85rem;
  color: var(--text-main);
  outline: none;
}

.sticky-note-details {
  flex-shrink: 0;
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--text-muted);
  font-size: 0.68rem;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}

.sticky-note-details strong {
  color: var(--text-main);
  font-weight: 600;
}

.sticky-note .note-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  font-size: 10px;
  background: rgba(0, 0, 0, 0.05);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.sticky-note .note-delete:hover {
  background: rgba(0, 0, 0, 0.15);
  color: var(--color-red);
}

/* Sticky note role badge styling */
.sticky-note-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  padding-bottom: 4px;
  margin-bottom: 6px;
}

/* In-place Canvas Text Box Editor */
.canvas-textbox-editor {
  position: absolute;
  box-sizing: border-box;
  font-family: var(--font-family);
  font-size: 13px;
  line-height: 1.4;
  padding: 8px;
  border-radius: 4px;
  outline: none;
  z-index: 1000;
  resize: both;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.canvas-textbox-editor:focus {
  outline: none;
  box-shadow:
    0 0 0 2px rgba(37, 99, 235, 0.25),
    0 2px 8px rgba(0, 0, 0, 0.12);
}

/* Custom Context Menu */
.custom-context-menu {
  position: absolute;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 4px 0;
  min-width: 160px;
  z-index: 10000;
  font-size: 0.85rem;
}

.menu-item {
  padding: 8px 16px;
  cursor: pointer;
  color: var(--text-main);
  transition: background-color 0.1s ease;
}

.menu-item:hover {
  background-color: #f1f5f9;
}

.menu-item.danger {
  color: var(--color-red);
}

.menu-item.danger:hover {
  background-color: #fef2f2;
}

.menu-item-separator {
  height: 1px;
  background-color: var(--border-light);
  margin: 4px 0;
}

/* Custom Dialog Modal */
.custom-dialog {
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 0;
  margin: auto;
  width: 90%;
  max-width: 560px;
  background: #ffffff;
  outline: none;
}

.custom-dialog.lg {
  max-width: 840px;
}

.custom-dialog::backdrop {
  background-color: rgba(15, 23, 42, 0.15);
  backdrop-filter: blur(2px);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.dialog-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
}

.close-dialog {
  background: none;
  border: none;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text-muted);
}

.close-dialog:hover {
  color: var(--text-main);
}

.dialog-content {
  padding: 20px;
  max-height: 380px;
  overflow-y: auto;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  background-color: #f8fafc;
}

.custom-dialog input:focus {
  border-color: var(--color-blue) !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* Buttons in dialogs */
.btn-primary,
.btn-cancel,
.btn-primary-outline {
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--color-blue);
  color: #ffffff;
  border: 1px solid var(--color-blue);
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-cancel {
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-light);
}

.btn-cancel:hover {
  background: #f1f5f9;
}

.btn-primary-outline {
  background: transparent;
  color: var(--color-blue);
  border: 1px solid var(--color-blue);
}

.btn-primary-outline:hover {
  background: #eff6ff;
}

/* Gantt Metadata Layout */
.gantt-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

/* Data-Ink / Tufte Compliant Table Styling (no vertical lines) */
.clean-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: left;
}

.clean-table th {
  font-weight: 600;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-light);
  padding: 5px 6px;
  white-space: normal;
  line-height: 1.25;
  vertical-align: bottom;
  letter-spacing: 0.02em;
}

.clean-table td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  white-space: nowrap;
  vertical-align: middle;
}

/* Alignment rules based on Tufte principles */
.clean-table th.text-right,
.clean-table td.text-right {
  text-align: right;
}

.clean-table th.text-left,
.clean-table td.text-left {
  text-align: left;
}

.clean-table tbody tr:hover {
  background-color: #f8fafc;
}

#gantt-view-table {
  min-width: 1180px;
  table-layout: fixed;
}

#gantt-view-table th:nth-child(1),
#gantt-view-table td:nth-child(1) {
  width: 66px;
}

#gantt-view-table th:nth-child(2),
#gantt-view-table td:nth-child(2) {
  width: 170px;
}

#gantt-view-table th:nth-child(3),
#gantt-view-table td:nth-child(3) {
  width: 105px;
}

#gantt-view-table th:nth-child(4),
#gantt-view-table td:nth-child(4),
#gantt-view-table th:nth-child(5),
#gantt-view-table td:nth-child(5),
#gantt-view-table th:nth-child(8),
#gantt-view-table td:nth-child(8),
#gantt-view-table th:nth-child(9),
#gantt-view-table td:nth-child(9),
#gantt-view-table th:nth-child(10),
#gantt-view-table td:nth-child(10) {
  width: 92px;
  text-align: right;
}

#gantt-view-table th:nth-child(6),
#gantt-view-table td:nth-child(6) {
  width: 105px;
  text-align: right;
}

#gantt-view-table th:nth-child(7),
#gantt-view-table td:nth-child(7) {
  width: 125px;
}

#gantt-view-table th:nth-child(11),
#gantt-view-table td:nth-child(11),
#gantt-view-table th:nth-child(12),
#gantt-view-table td:nth-child(12) {
  width: 104px;
}

#gantt-view-table th:nth-child(13),
#gantt-view-table td:nth-child(13) {
  width: 76px;
  text-align: center;
}

/* Remove up/down spinner arrows from number inputs */
input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type='number'] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.gantt-cell-input,
.gantt-predecessor-input,
.gantt-actual-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 3px 5px;
  color: var(--text-main);
  background: transparent;
  font: inherit;
  font-size: 0.78rem;
  transition: all 0.15s ease;
}

.gantt-cell-input:hover,
.gantt-predecessor-input:hover,
.gantt-actual-input:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.gantt-cell-input:focus,
.gantt-predecessor-input:focus,
.gantt-actual-input:focus {
  border-color: var(--border-focus);
  background: #ffffff;
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.gantt-cell-input {
  min-height: 30px;
  cursor: text;
}

.gantt-cell-input::placeholder {
  color: #94a3b8;
  opacity: 1;
}

.gantt-cell-input.text-right,
.gantt-actual-input.text-right {
  text-align: right;
}

.gantt-task-code {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.76rem;
  padding: 0 4px;
}

/* Canvas Hover Tooltip */
.canvas-tooltip {
  position: fixed;
  background-color: var(--color-slate);
  color: #ffffff;
  padding: 6px 10px;
  font-size: 0.75rem;
  border-radius: 4px;
  pointer-events: none;
  z-index: 10000;
  white-space: nowrap;
}

/* View Switcher Tabs */
.view-switcher-tabs {
  display: inline-flex;
  align-items: center;
  background-color: #f1f5f9;
  padding: 3px;
  border-radius: 6px;
  gap: 2px;
  margin: 0;
  flex-shrink: 0;
  box-sizing: border-box;
}

.view-tab-btn {
  border: none;
  background: transparent;
  padding: 0 10px;
  height: 28px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  line-height: 1;
}

.view-tab-btn:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.6);
}

.view-tab-btn.active {
  background-color: #ffffff;
  color: var(--color-blue);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.view-tab-btn:focus-visible,
.tool-btn:focus-visible,
.utility-btn:focus-visible,
.template-btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* View Pane Overlays */
.view-pane {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-light);
  background-color: #ffffff;
}

.pane-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
}

.pane-subtitle {
  margin: 2px 0 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pane-content {
  flex-grow: 1;
  padding: 24px;
  overflow-y: auto;
}

/* Split Pane for Gantt Chart */
.gantt-split {
  display: grid;
  grid-template-columns: minmax(max-content, 2.2fr) minmax(280px, 1fr);
  gap: 16px;
  padding: 14px 18px;
  height: 100%;
  overflow: hidden;
}

.gantt-table-section {
  overflow-x: auto;
  overflow-y: auto;
  border-right: 1px solid var(--border-light);
  padding-right: 14px;
}

.gantt-visual-section {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* Gantt Timeline View */
.gantt-timeline-scroll-area {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  position: relative;
}

.gantt-timeline-content {
  min-height: 100%;
  position: relative;
}

.gantt-timeline-header-container {
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 10px;
  position: sticky;
  top: 0;
  background-color: #ffffff;
  z-index: 10;
}

.gantt-timeline-header-row {
  display: grid;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.gantt-timeline-bars-container {
  display: flex;
  flex-direction: column;
  padding-top: 10px;
  position: relative;
}

.gantt-status-date-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 2px dashed #dc2626;
  pointer-events: none;
  z-index: 11;
}

.gantt-status-date-label {
  position: absolute;
  top: 4px;
  left: 6px;
  padding: 3px 5px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
}

.gantt-bar-row {
  position: relative;
  height: 39px; /* Align row height with table row heights */
  border-bottom: 1px solid var(--border-light);
}

.gantt-bar-wrapper {
  position: absolute;
  top: 9px;
  right: 0;
  left: 0;
  height: 20px;
}

.gantt-bar {
  position: absolute;
  height: 100%;
  background-color: #eff6ff;
  border-left: 3px solid var(--color-blue);
  border-radius: 3px;
  color: var(--color-blue);
  font-size: 0.75rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  padding-left: 6px;
  white-space: nowrap;
  overflow: visible;
}

.gantt-bar.critical {
  background-color: #fef2f2;
  border-left: 3px solid var(--color-red);
  color: var(--color-red);
}

.gantt-horizontal-roller {
  flex: 0 0 auto;
  padding: 8px 4px 2px;
  border-top: 1px solid var(--border-light);
  background: #ffffff;
}

.gantt-horizontal-roller label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.gantt-horizontal-roller-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}

#gantt-horizontal-roller-input {
  display: block;
  width: 100%;
  margin: 3px 0 0;
  accent-color: var(--color-blue);
  cursor: ew-resize;
}

.gantt-pane-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.9rem;
}

.gantt-schedule-controls {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-light);
  background-color: #f8fafc;
}

.gantt-schedule-controls label,
.gantt-calculated-date {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.gantt-schedule-controls input {
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  background: #ffffff;
  color: var(--text-main);
  font: inherit;
  text-transform: none;
  letter-spacing: normal;
}

.gantt-schedule-controls input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.2);
  border-color: var(--border-focus);
}

.gantt-calculated-date strong {
  min-height: 32px;
  padding: 7px 0;
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
}

.gantt-date-help {
  align-self: center;
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.gantt-rag-badge {
  display: inline-block;
  min-width: 52px;
  padding: 4px 7px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  white-space: nowrap;
}

.gantt-rag-badge.green,
.gantt-date-green,
.gantt-bar.green {
  background: #ecfdf5;
  border-color: #86efac;
  color: #166534;
}

.gantt-rag-badge.amber,
.gantt-date-amber,
.gantt-bar.amber {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}

.gantt-rag-badge.red,
.gantt-date-red,
.gantt-bar.red {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}

.gantt-date-cell {
  font-weight: 600;
}

/* Risk Matrix View */
.risk-view-content {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Risk Matrix & Risk Register Layout */
.risk-view-content {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(440px, 1.4fr);
  gap: 16px;
  padding: 16px 20px;
  height: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.risk-view-content.mode-matrix {
  grid-template-columns: 1fr;
  max-width: 860px;
  margin: 0 auto;
  overflow-y: auto;
}

.risk-view-content.mode-matrix .risk-register-card {
  display: none;
}

.risk-view-content.mode-register {
  grid-template-columns: 1fr;
  overflow-y: auto;
}

.risk-view-content.mode-register .risk-matrix-card {
  display: none;
}

.risk-matrix-card,
.risk-register-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.risk-card-header {
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.risk-card-header h4 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.risk-card-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.risk-card-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.risk-table-scroll-wrap {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  padding: 0;
}

.risk-matrix-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.risk-matrix-axis-label {
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.risk-matrix-y-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  margin-right: 12px;
  text-align: center;
}

.risk-matrix-board-wrap {
  width: 100%;
  max-width: 480px;
}

.risk-matrix-column-label {
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  margin-bottom: 6px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.risk-matrix-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, minmax(46px, 1fr));
  gap: 4px;
}

.risk-matrix-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 46px;
  padding: 4px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.risk-matrix-cell:hover {
  transform: scale(1.04);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  z-index: 5;
}

.risk-matrix-cell.selected {
  outline: 2px solid var(--color-blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
  z-index: 6;
}

.risk-matrix-cell.low {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.risk-matrix-cell.medium {
  background: #fffbeb;
  border-color: #fde68a;
}

.risk-matrix-cell.high {
  background: #fef2f2;
  border-color: #fecaca;
}

.risk-cell-score {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1;
}

.risk-cell-count {
  font-size: 0.62rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  color: var(--text-main);
}

.risk-cell-count.active {
  background: var(--color-blue);
  color: #ffffff;
}

.risk-matrix-scale-labels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.66rem;
  text-align: center;
  font-weight: 500;
}

.risk-matrix-legend {
  padding: 8px 14px;
  background: #f8fafc;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.risk-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.risk-legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

.risk-legend-color.low {
  background: #dcfce7;
  border: 1px solid #86efac;
}
.risk-legend-color.medium {
  background: #fef3c7;
  border: 1px solid #fde047;
}
.risk-legend-color.high {
  background: #fee2e2;
  border: 1px solid #fca5a5;
}

.btn-clear-risk-filter {
  margin-left: auto;
  padding: 2px 8px;
  font-size: 0.68rem;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  background: #ffffff;
  cursor: pointer;
  color: var(--color-blue);
  font-weight: 600;
  transition: all 0.12s ease;
}

.btn-clear-risk-filter:hover {
  background: var(--color-blue);
  color: #ffffff;
  border-color: var(--color-blue);
}

.risk-summary-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

.risk-score-badge {
  display: inline-block;
  min-width: 24px;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

.risk-score-badge.low {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.risk-score-badge.medium {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.risk-score-badge.high {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.risk-empty-state {
  color: var(--text-muted) !important;
  padding: 24px !important;
  text-align: center;
}

@media (max-width: 760px) {
  .gantt-schedule-controls {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .gantt-date-help {
    flex-basis: 100%;
    margin-left: 0;
  }

  .risk-matrix-layout {
    min-height: 280px;
  }

  .risk-matrix-cell {
    min-height: 46px;
    padding: 4px;
  }

  .risk-marker {
    font-size: 0.6rem;
  }
}

/* EVM & S-Curve View Styling */
.evm-view-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 16px 24px;
}

.evm-status-date-badge {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 4px 10px;
  background: #f1f5f9;
  border-radius: 999px;
  border: 1px solid var(--border-light);
}

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

.evm-kpi-card {
  padding: 10px 12px;
  background: #f8fafc;
  border-bottom: 2px solid var(--border-light);
  border-top: none;
  border-left: none;
  border-right: none;
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.evm-kpi-card .kpi-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.evm-kpi-card .kpi-value {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin: 2px 0;
  white-space: nowrap;
}

.evm-kpi-card .kpi-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.kpi-favorable {
  color: #16a34a !important;
}

.kpi-unfavorable {
  color: #dc2626 !important;
}

.kpi-neutral {
  color: var(--text-main) !important;
}

.evm-chart-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 16px;
  background: #ffffff;
}

.evm-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.evm-chart-header h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
}

.evm-chart-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.evm-canvas-container {
  width: 100%;
  height: 340px;
  position: relative;
}

#evmSCurveCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.evm-table-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.evm-table-section h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
}

.clean-table-responsive {
  width: 100%;
  overflow-x: auto;
}

.evm-variance-tag {
  display: inline-block;
  padding: 2px 5px;
  border-radius: 3px;
  font-weight: 600;
  font-size: 0.72rem;
  text-align: right;
}

.evm-variance-tag.favorable {
  background: #dcfce7;
  color: #166534;
}

.evm-variance-tag.unfavorable {
  background: #fee2e2;
  color: #991b1b;
}

.evm-variance-tag.neutral {
  background: #f1f5f9;
  color: #475569;
}

/* Cost, Scope, Time Driver View */
.triangle-view-content {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  gap: 18px;
  align-items: stretch;
  background: #f8fafc;
}

.triangle-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  overflow: hidden;
}

.triangle-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  background: #f8fafc;
}

.triangle-card-header h4 {
  font-size: 0.88rem;
  color: var(--text-main);
}

.triangle-card-header span {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.triangle-driver-badge {
  padding: 7px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.triangle-driver-badge.green,
.triangle-rag-badge.green {
  background: #ecfdf5;
  border-color: #86efac;
  color: #166534;
}

.triangle-driver-badge.amber,
.triangle-rag-badge.amber {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}

.triangle-driver-badge.red,
.triangle-rag-badge.red {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}

.triangle-input-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px 20px;
}

.triangle-input-row {
  display: grid;
  grid-template-columns: 125px minmax(100px, 1fr) 52px 58px;
  align-items: center;
  gap: 12px;
  color: var(--text-main);
}

.triangle-input-row span {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.82rem;
}

.triangle-input-row small {
  color: var(--text-muted);
  font-size: 0.68rem;
}

.triangle-input-row input[type='range'] {
  width: 100%;
  accent-color: var(--color-blue);
  cursor: pointer;
}

.triangle-number-input {
  width: 52px;
  padding: 6px 5px;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  color: var(--text-main);
  text-align: center;
  font: inherit;
  font-size: 0.8rem;
}

.triangle-number-input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.2);
  border-color: var(--border-focus);
}

.triangle-rag-badge {
  min-width: 58px;
  padding: 4px 3px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.04em;
}

.triangle-visual-card {
  min-height: 420px;
}

.cst-triangle {
  position: relative;
  width: min(100%, 500px);
  aspect-ratio: 1.25;
  margin: 28px auto 36px;
}

.cst-triangle-shape {
  position: absolute;
  inset: 12% 14% 10%;
  background: #eff6ff;
  border: 2px solid #93c5fd;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.cst-triangle-label {
  position: absolute;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--text-main);
  font-size: 0.78rem;
  text-align: center;
}

.cst-triangle-label span {
  color: var(--color-blue);
  font-size: 0.72rem;
  font-weight: 700;
}

.cst-triangle-top {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

.cst-triangle-left {
  bottom: 0;
  left: 0;
}

.cst-triangle-right {
  right: 0;
  bottom: 0;
}

.cst-triangle-center {
  position: absolute;
  top: 48%;
  left: 50%;
  z-index: 1;
  transform: translate(-50%, -50%);
  color: #1e40af;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-transform: uppercase;
}

@media (max-width: 900px) {
  .triangle-view-content {
    grid-template-columns: 1fr;
  }

  .triangle-visual-card {
    min-height: 360px;
  }
}

@media (max-width: 560px) {
  .triangle-input-row {
    grid-template-columns: 1fr 52px 58px;
  }

  .triangle-input-row > span:first-child {
    grid-column: 1 / -1;
  }
}

/* =============================================================
   User Guide & Workflow Modal Styles (Tufte Data-Ink Principles)
   ============================================================= */
.guide-dialog {
  max-width: 980px;
  width: 94vw;
  max-height: 90vh;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 45px -12px rgba(15, 23, 42, 0.25);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.guide-close-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background-color: #f8fafc;
  color: var(--text-main);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.guide-close-btn:hover {
  background-color: #fee2e2;
  border-color: #fca5a5;
  color: var(--color-red);
}

.guide-close-kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 0.68rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background-color: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  color: var(--text-muted);
  font-weight: 600;
}

.guide-dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background-color: #f8fafc;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.guide-footer-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.guide-close-action-btn {
  font-size: 0.85rem;
  padding: 8px 18px;
  font-weight: 600;
}

.guide-dialog-content {
  padding: 24px 32px;
  max-height: calc(90vh - 135px);
  overflow-y: auto;
  scroll-behavior: smooth;
  color: var(--text-main);
  background-color: #ffffff;
}

.guide-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 36px;
  background-color: #f8fafc;
  color: var(--text-main);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.guide-btn:hover {
  background-color: #eff6ff;
  border-color: var(--color-blue);
  color: var(--color-blue);
}

.guide-btn svg {
  flex-shrink: 0;
}

.utility-btn.guide-trigger {
  color: var(--color-blue);
  font-weight: 500;
}

.utility-btn.guide-trigger:hover {
  background-color: #eff6ff;
  border-color: #bfdbfe;
}

.guide-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 24px;
  background-color: #f8fafc;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 10;
}

.guide-nav-link {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 9px;
  border-radius: 4px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.guide-nav-link:hover {
  color: var(--color-blue);
  border-color: var(--color-blue);
  background-color: #eff6ff;
}

.guide-section {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
}

.guide-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.guide-section h4 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

.guide-section h5 {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 16px 0 8px;
}

.guide-section p {
  font-size: 0.86rem;
  line-height: 1.6;
  color: #334155;
  margin-bottom: 12px;
}

.guide-figure {
  margin: 16px 0 20px;
  padding: 16px;
  background-color: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  text-align: center;
}

.guide-workflow-img {
  max-width: 540px;
  width: 100%;
  height: auto;
  border-radius: 4px;
  border: 1px solid var(--border-light);
  background: #ffffff;
  display: block;
  margin: 0 auto 10px;
}

.guide-figure figcaption {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 6px;
}

.guide-step-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin: 16px 0;
}

.guide-step-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 14px 16px;
  border-left: 4px solid var(--color-blue);
  display: flex;
  flex-direction: column;
}

.guide-step-card:nth-child(2) {
  border-left-color: var(--color-slate);
}

.guide-step-card:nth-child(3) {
  border-left-color: var(--color-green);
}

.guide-step-card:nth-child(4) {
  border-left-color: var(--color-red);
}

.guide-step-card h5 {
  font-size: 0.86rem;
  font-weight: 600;
  margin: 0 0 6px 0;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.guide-step-card p {
  font-size: 0.8rem;
  color: #475569;
  line-height: 1.5;
  margin-bottom: 0;
  flex-grow: 1;
}

.guide-kbd {
  display: inline-block;
  padding: 2px 6px;
  font-size: 0.72rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background-color: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-bottom-width: 2px;
  border-radius: 3px;
  color: var(--text-main);
  font-weight: 600;
  line-height: 1.2;
}

.guide-callout {
  padding: 12px 16px;
  border-radius: 6px;
  background-color: #f0fdf4;
  border-left: 4px solid var(--color-green);
  margin: 14px 0;
}

.guide-callout.tip {
  background-color: #eff6ff;
  border-left-color: var(--color-blue);
}

.guide-callout.warning {
  background-color: #fffbeb;
  border-left-color: var(--color-yellow);
}

.guide-callout p {
  font-size: 0.82rem;
  color: #1e293b;
  margin: 0;
  line-height: 1.5;
}

.guide-callout strong {
  color: var(--text-main);
}

.guide-badge {
  display: inline-block;
  padding: 2px 7px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.guide-badge.slate {
  background-color: #f1f5f9;
  color: var(--color-slate);
}

.guide-badge.blue {
  background-color: #eff6ff;
  color: var(--color-blue);
}

.guide-badge.green {
  background-color: #f0fdf4;
  color: var(--color-green);
}

.guide-badge.red {
  background-color: #fef2f2;
  color: var(--color-red);
}

.guide-badge.yellow {
  background-color: #fffbeb;
  color: #b45309;
}

/* =============================================================
   Intuitive Floating Tooltips (Edward Tufte Data-Ink Precision)
   ============================================================= */
.app-tooltip {
  position: fixed;
  z-index: 100000;
  pointer-events: none;
  background-color: #0f172a;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: 5px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-family: var(--font-family);
  line-height: 1.35;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  max-width: 270px;
  min-width: 120px;
  opacity: 0;
  transform: scale(0.96);
  transition:
    opacity 0.14s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.14s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 3px;
  visibility: hidden;
}

.app-tooltip.visible {
  opacity: 1;
  transform: scale(1);
  visibility: visible;
}

.app-tooltip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.app-tooltip-title {
  font-weight: 600;
  color: #ffffff;
  font-size: 0.76rem;
  letter-spacing: -0.01em;
}

.app-tooltip-kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 0.65rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background-color: #1e293b;
  border: 1px solid #475569;
  border-radius: 3px;
  color: #93c5fd;
  font-weight: 600;
  line-height: 1.2;
  flex-shrink: 0;
}

.app-tooltip-desc {
  font-size: 0.7rem;
  color: #cbd5e1;
  line-height: 1.35;
}

.app-tooltip-arrow {
  position: absolute;
  width: 6px;
  height: 6px;
  background-color: #0f172a;
  border: 1px solid #334155;
  transform: rotate(45deg);
}

.app-tooltip[data-placement='top'] .app-tooltip-arrow {
  bottom: -4px;
  left: 50%;
  margin-left: -3px;
  border-top: none;
  border-left: none;
}

.app-tooltip[data-placement='bottom'] .app-tooltip-arrow {
  top: -4px;
  left: 50%;
  margin-left: -3px;
  border-bottom: none;
  border-right: none;
}

.app-tooltip[data-placement='right'] .app-tooltip-arrow {
  left: -4px;
  top: 50%;
  margin-top: -3px;
  border-top: none;
  border-right: none;
}

.app-tooltip[data-placement='left'] .app-tooltip-arrow {
  right: -4px;
  top: 50%;
  margin-top: -3px;
  border-bottom: none;
  border-left: none;
}

/* ============================================================= */
/* Vertical Swimlane Flowchart Template (Google Slides Style)   */
/* ============================================================= */
.swimlane-mode-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.swimlane-summary-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

.swimlane-badge-pill {
  padding: 3px 8px;
  background-color: #f1f5f9;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.swimlane-badge-pill strong {
  color: var(--text-main);
  font-weight: 600;
}

.swimlane-unique-roles-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-light);
  overflow-x: auto;
  flex-shrink: 0;
}

.swimlane-role-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background-color: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.swimlane-role-chip:hover {
  background-color: #f1f5f9;
  border-color: var(--border-focus);
}

.swimlane-role-chip.active {
  background-color: #0f172a;
  border-color: #0f172a;
  color: #ffffff;
  font-weight: 600;
}

.swimlane-role-chip-count {
  font-size: 0.68rem;
  padding: 1px 6px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 999px;
}

.swimlane-role-chip.active .swimlane-role-chip-count {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.swimlane-pane-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.swimlane-diagram-wrapper {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: auto;
  background-color: #f1f5f9;
  padding: 24px;
  display: block;
  text-align: center;
  box-sizing: border-box;
}

.swimlane-diagram-viewport {
  display: inline-block;
  text-align: left;
  position: relative;
  margin: 0 auto;
  box-sizing: border-box;
}

/* The Main Flowchart Poster Frame matching the PowerPoint/Slides template */
.vs-flowchart-frame {
  background-color: #fbf9f6;
  border: 2px solid #0f172a;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  position: relative;
  margin: 0 auto;
}

.vs-flowchart-header {
  padding: 8px 16px;
  text-align: center;
  border-bottom: 2px solid #0f172a;
  background-color: #ffffff;
}

.vs-flowchart-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0f172a;
}

.vs-flowchart-subtitle {
  margin: 2px 0 0;
  font-size: 0.62rem;
  color: #64748b;
  font-weight: 500;
}

.vs-swimlanes-header-row {
  display: flex;
  border-bottom: 2px solid #0f172a;
  background-color: #ffffff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.vs-swimlane-header-col {
  flex: 0 0 148px;
  min-width: 148px;
  padding: 7px 4px;
  text-align: center;
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #0f172a;
  border-right: 1.5px solid #0f172a;
  box-sizing: border-box;
  background-color: #ffffff;
}

.vs-swimlane-header-col:last-child {
  border-right: none;
}

.vs-swimlane-body {
  display: flex;
  position: relative;
  min-height: 320px;
  background-color: #fbf9f6;
}

.vs-swimlane-col-track {
  flex: 0 0 148px;
  min-width: 148px;
  border-right: 1.5px solid #0f172a;
  box-sizing: border-box;
  position: relative;
  min-height: 100%;
}

.vs-swimlane-col-track:last-child {
  border-right: none;
}

/* Flowchart Nodes (Scaled compact) */
.vs-node-wrapper {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.vs-node-wrapper:hover {
  transform: translate(-50%, -50%) scale(1.03);
}

/* 1. Start / Terminal Oval Pill (Magenta, exactly matching the reference image) */
.vs-node-capsule {
  width: 96px;
  min-height: 30px;
  height: 30px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #c026d3;
  color: #ffffff;
  text-align: center;
  font-size: 0.6rem;
  font-weight: 600;
  line-height: 1.2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border: 1px solid #a21caf;
  box-shadow: 0 2px 4px rgba(192, 38, 211, 0.2);
}

/* 2. Process Step Box (Crisp white rectangle with dark border) */
.vs-node-process {
  width: 122px;
  min-height: 40px;
  padding: 4px 6px;
  background: #ffffff;
  border: 1.5px solid #0f172a;
  border-radius: 0px;
  color: #0f172a;
  text-align: center;
  font-size: 0.64rem;
  font-weight: 500;
  line-height: 1.22;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.vs-node-title {
  font-weight: 600;
  font-size: 0.65rem;
  color: #0f172a;
  word-break: break-word;
  line-height: 1.2;
}

.vs-node-meta {
  font-size: 0.54rem;
  color: #64748b;
  margin-top: 1px;
  font-weight: 400;
}

/* 3. Decision Diamond (Teal diamond with white text, matching reference) */
.vs-node-decision-outer {
  width: 96px;
  height: 48px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vs-node-decision-bg {
  position: absolute;
  width: 40px;
  height: 40px;
  background-color: #3b7b8a;
  transform: rotate(45deg);
  border: 1.5px solid #285762;
  z-index: 1;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.vs-node-decision-text {
  position: relative;
  z-index: 2;
  color: #ffffff;
  font-size: 0.54rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.12;
  padding: 0 6px;
  text-transform: uppercase;
  max-width: 80px;
}

/* SVG Orthogonal Connector Layer */
.vs-flowchart-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.vs-flowchart-path {
  fill: none;
  stroke: #0f172a;
  stroke-width: 1.25;
  transition:
    stroke 0.15s ease,
    stroke-width 0.15s ease;
}

.vs-flowchart-path.active {
  stroke: var(--color-blue);
  stroke-width: 2;
}

.vs-branch-label {
  font-size: 0.56rem;
  font-weight: 700;
  fill: #0f172a;
  text-anchor: middle;
  background: #ffffff;
}

.swimlane-table-wrapper {
  flex: 1;
  padding: 16px 20px;
  overflow-y: auto;
  background: #ffffff;
}

/* Swimlane Empty State Action Button */
.btn-load-demo-empty {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 8px 16px;
  background-color: var(--color-blue);
  color: #ffffff;
  border: 1px solid var(--color-blue);
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.2);
}

.btn-load-demo-empty:hover {
  background-color: #1d4ed8;
  border-color: #1d4ed8;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
  transform: translateY(-1px);
}
