/* ============================================================
   ITIL v5 Designer - Styles
   Design tokens: Primary #1B3A5C | Accent #2563EB | Bg #F8FAFC | Text #111827
   Provenance: BS-DESIGNER-7a9f3d21 — Better Skills (better-skills.com)
   Proprietary — unauthorised redistribution prohibited.
   ============================================================ */

/* ---------- CSS Custom Properties (Light theme) ---------- */
:root {
  --color-primary: #1B3A5C;
  --color-accent: #2563EB;
  --color-accent-hover: #1D4ED8;
  --color-bg: #F8FAFC;
  --color-bg-2: #EEF2F7;
  --color-surface: #FFFFFF;
  --color-surface-2: #F1F5F9;
  --color-border: #E2E8F0;
  --color-border-2: #CBD5E1;
  --color-text: #111827;
  --color-text-2: #374151;
  --color-text-muted: #6B7280;
  --color-text-inverse: #FFFFFF;
  --color-danger: #DC2626;
  --color-danger-hover: #B91C1C;
  --color-success: #059669;

  /* Category colors */
  --cat-lifecycle: #2563EB;
  --cat-dimensions: #059669;
  --cat-product-rules: #D97706;
  --cat-stakeholders: #7C3AED;
  --cat-outputs: #DB2777;

  /* Layout */
  --header-height: 56px;
  --footer-height: 32px;
  --palette-width: 280px;
  --detail-width: 320px;
  --toolbar-height: 44px;

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.14), 0 4px 10px rgba(0,0,0,0.08);

  /* Fonts */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Transitions */
  --transition-fast: 120ms ease;
  --transition-med: 200ms ease;
}

/* ---------- Dark theme ---------- */
[data-theme="dark"] {
  --color-bg: #0F172A;
  --color-bg-2: #1E293B;
  --color-surface: #1E293B;
  --color-surface-2: #273549;
  --color-border: #334155;
  --color-border-2: #475569;
  --color-text: #F1F5F9;
  --color-text-2: #CBD5E1;
  --color-text-muted: #94A3B8;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.30), 0 1px 2px rgba(0,0,0,0.20);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.40), 0 2px 4px rgba(0,0,0,0.20);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.50), 0 4px 10px rgba(0,0,0,0.30);
}

/* ---------- Reset ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Utility ---------- */
.hidden { display: none !important; }

/* ---------- App Header ---------- */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--color-primary);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 0 var(--sp-4);
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.header-brand {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  flex-shrink: 0;
}

.header-brand strong {
  font-size: 15px;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.01em;
}

.header-brand .subtitle {
  font-size: 11px;
  color: rgba(255,255,255,0.65);
  font-weight: 400;
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.canvas-name-input {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.20);
  border-radius: var(--radius-sm);
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 4px 10px;
  width: 220px;
  text-align: center;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.canvas-name-input:focus {
  outline: none;
  background: rgba(255,255,255,0.20);
  border-color: rgba(255,255,255,0.40);
}

.canvas-name-input::placeholder {
  color: rgba(255,255,255,0.45);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}

.btn-header {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-sm);
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  white-space: nowrap;
}

.btn-header:hover {
  background: rgba(255,255,255,0.20);
  border-color: rgba(255,255,255,0.30);
}

.btn-header--danger:hover {
  background: rgba(220,38,38,0.5);
  border-color: rgba(220,38,38,0.7);
}

.btn-header--accent {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.btn-header--accent:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

.btn-icon {
  font-size: 13px;
  line-height: 1;
}

.theme-select {
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-sm);
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 12px;
  padding: 5px 8px;
  cursor: pointer;
}

.theme-select option {
  background: var(--color-primary);
  color: #FFFFFF;
}

.header-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.85);
  font-size: 12px;
  padding: 5px 10px;
  text-decoration: none;
  transition: background var(--transition-fast);
  white-space: nowrap;
}

.header-link:hover {
  background: rgba(255,255,255,0.20);
  color: #FFFFFF;
}

/* ---------- Workspace ---------- */
.workspace {
  display: flex;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: var(--footer-height);
  overflow: hidden;
}

/* ---------- Palette ---------- */
.palette {
  width: var(--palette-width);
  min-width: var(--palette-width);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--transition-med), min-width var(--transition-med);
  z-index: 10;
}

.palette.collapsed {
  width: 0;
  min-width: 0;
}

.palette-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  flex-shrink: 0;
}

.palette-search {
  position: relative;
  flex: 1;
}

.search-icon {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--color-text-muted);
  pointer-events: none;
}

#palette-search {
  width: 100%;
  padding: 6px 8px 6px 28px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 12px;
  background: var(--color-bg);
  color: var(--color-text);
  transition: border-color var(--transition-fast);
}

#palette-search:focus {
  outline: none;
  border-color: var(--color-accent);
}

.palette-collapse-btn,
.palette-expand-btn {
  background: var(--color-bg-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 16px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.palette-collapse-btn:hover,
.palette-expand-btn:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.palette-expand-btn {
  position: absolute;
  left: var(--sp-2);
  top: calc(var(--header-height) + var(--sp-3));
  z-index: 20;
  box-shadow: var(--shadow-md);
}

.palette-categories {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--sp-2) 0;
}

.palette-category {
  border-bottom: 1px solid var(--color-border);
}

.palette-category:last-child {
  border-bottom: none;
}

.palette-category-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  cursor: pointer;
  user-select: none;
  background: var(--color-surface);
  transition: background var(--transition-fast);
}

.palette-category-header:hover {
  background: var(--color-surface-2);
}

.palette-category-icon {
  font-size: 13px;
}

.palette-category-label {
  flex: 1;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.palette-category-count {
  font-size: 10px;
  font-weight: 600;
  background: var(--color-bg-2);
  color: var(--color-text-muted);
  border-radius: 10px;
  padding: 1px 6px;
}

.palette-category-toggle {
  font-size: 10px;
  color: var(--color-text-muted);
  transition: transform var(--transition-fast);
}

.palette-category.open .palette-category-toggle {
  transform: rotate(90deg);
}

.palette-block-list {
  list-style: none;
  padding: var(--sp-1) var(--sp-2) var(--sp-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.palette-block {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  cursor: grab;
  transition: box-shadow var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
  border-left-width: 3px;
  user-select: none;
}

.palette-block:hover {
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  transform: translateX(2px);
}

.palette-block.dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.palette-block-icon {
  font-size: 15px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.palette-block-info {
  flex: 1;
  min-width: 0;
}

.palette-block-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.palette-block-desc {
  font-size: 10px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* ---------- Canvas Container ---------- */
.canvas-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: var(--color-bg);
}

/* ---------- Toolbar ---------- */
.canvas-toolbar {
  height: var(--toolbar-height);
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-3);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  z-index: 5;
  white-space: nowrap;
  overflow: hidden;
}

.toolbar-group {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--sp-1);
  flex-shrink: 0;
  white-space: nowrap;
}

.toolbar-group--right {
  margin-left: auto;
}

.toolbar-separator {
  width: 1px;
  height: 20px;
  background: var(--color-border);
  margin: 0 var(--sp-1);
}

.btn-toolbar {
  background: var(--color-bg-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-2);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  min-width: 32px;
  text-align: center;
}

.btn-toolbar:hover {
  background: var(--color-border);
  border-color: var(--color-border-2);
  color: var(--color-text);
}

.zoom-level {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-text-muted);
  min-width: 42px;
  text-align: center;
}

.status-chip {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-bg-2);
  border-radius: 10px;
  padding: 2px 8px;
  border: 1px solid var(--color-border);
}

.save-status {
  font-size: 11px;
  color: var(--color-success);
  font-weight: 500;
}

.save-status.unsaved {
  color: var(--color-text-muted);
}

/* ---------- Canvas Viewport ---------- */
.canvas-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  cursor: default;
}

.canvas-viewport.panning {
  cursor: grabbing;
}

.canvas-viewport.space-held,
.canvas-viewport.pan-tool {
  cursor: grab;
}

.canvas-viewport.pan-tool .canvas-block {
  cursor: grab;
}

.canvas-viewport.pan-tool.panning,
.canvas-viewport.pan-tool.panning .canvas-block {
  cursor: grabbing;
}

.canvas-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 3000px;
  height: 3000px;
  transform-origin: 0 0;
}

/* Dot grid — visibility controlled by .grid-on on the viewport */
.canvas-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, var(--color-border) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: 12px 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.canvas-viewport.grid-on .canvas-grid {
  opacity: 1;
  background-image: radial-gradient(circle, #94A3B8 1.5px, transparent 1.5px);
}

[data-theme="dark"] .canvas-viewport.grid-on .canvas-grid {
  background-image: radial-gradient(circle, #64748B 1.5px, transparent 1.5px);
}

/* ---------- Canvas Blocks ---------- */
.canvas-block {
  position: absolute;
  min-width: 180px;
  max-width: 260px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  cursor: grab;
  transition: box-shadow var(--transition-fast), transform var(--transition-fast), border-color var(--transition-fast);
  border-left-width: 4px;
  user-select: none;
  will-change: transform;
}

.canvas-block:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.canvas-block.selected {
  border-color: var(--color-accent) !important;
  border-left-color: var(--color-accent) !important;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.25), var(--shadow-md);
}

.canvas-block.dragging-block {
  cursor: grabbing;
  box-shadow: var(--shadow-lg);
  transform: scale(1.03) translateY(-2px);
  z-index: 1000;
}

.canvas-block-inner {
  padding: var(--sp-3);
}

.canvas-block-header {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  margin-bottom: var(--sp-1);
}

.canvas-block-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.canvas-block-meta {
  flex: 1;
  min-width: 0;
}

.canvas-block-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
  word-break: break-word;
}

.canvas-block-category {
  font-size: 10px;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.canvas-block-desc {
  font-size: 11px;
  color: var(--color-text-muted);
  line-height: 1.4;
  margin-top: var(--sp-1);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.canvas-block-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: var(--sp-2);
}

.canvas-block-tag {
  font-size: 9px;
  font-weight: 500;
  background: var(--color-bg-2);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}

/* ---------- Canvas Empty State ---------- */
.canvas-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
}

.canvas-empty-inner {
  pointer-events: auto;
  text-align: center;
  max-width: 920px;
  padding: var(--sp-6);
}

.canvas-empty-icon { /* legacy, kept for backwards compatibility */
  font-size: 48px;
  margin-bottom: var(--sp-4);
  display: block;
  filter: grayscale(0.3);
}

.canvas-empty-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #2563EB;
  margin-bottom: 6px;
}

.canvas-empty-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--color-text, #111827);
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.canvas-empty-lede {
  font-size: 14px;
  color: var(--color-text-muted, #6B7280);
  line-height: 1.55;
  margin: 0 auto 24px;
  max-width: 520px;
}

.canvas-empty h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text-2);
  margin-bottom: var(--sp-2);
}

.canvas-empty p {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: var(--sp-2);
}

.canvas-empty-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin: 0 auto 22px;
  max-width: 880px;
}

.canvas-empty-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 16px 16px 14px;
  background: var(--color-surface, #FFF);
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s, background 0.12s;
  font: inherit;
  color: inherit;
}
.canvas-empty-card:hover {
  border-color: rgba(37, 99, 235, 0.45);
  background: #F8FAFF;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.08);
}
.canvas-empty-card:active { transform: translateY(0); }

.canvas-empty-card--blank {
  background: linear-gradient(180deg, #F9FAFB 0%, #FFF 100%);
  border-style: dashed;
}
.canvas-empty-card--blank:hover { background: #F3F4F6; }

.canvas-empty-card-icon { font-size: 26px; line-height: 1; }
.canvas-empty-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text, #111827);
}
.canvas-empty-card-desc {
  font-size: 12px;
  color: var(--color-text-muted, #6B7280);
  line-height: 1.45;
}

.canvas-empty-hint {
  font-size: 11px !important;
  color: var(--color-text-muted) !important;
  opacity: 0.7;
  margin-top: 12px;
}

[data-theme="dark"] .canvas-empty-card {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .canvas-empty-card:hover {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(147, 197, 253, 0.4);
}
[data-theme="dark"] .canvas-empty-card-title { color: #F1F5F9; }
[data-theme="dark"] .canvas-empty-card-desc { color: #CBD5E1; }
[data-theme="dark"] .canvas-empty-eyebrow { color: #93C5FD; }
[data-theme="dark"] .canvas-empty-title { color: #F1F5F9; }
[data-theme="dark"] .canvas-empty-card--blank {
  background: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.02) 100%);
}

@media (max-width: 720px) {
  .canvas-empty-inner { max-width: 100%; }
  .canvas-empty-cards { grid-template-columns: 1fr; }
  .canvas-empty-title { font-size: 22px; }
}

.canvas-empty kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border-2);
  border-radius: 3px;
  padding: 1px 4px;
}

/* ---------- Drop zone indicator ---------- */
.canvas-viewport.drag-over {
  background: rgba(37,99,235,0.04);
  outline: 2px dashed var(--color-accent);
  outline-offset: -4px;
}

/* ---------- Detail Panel ---------- */
.detail-panel {
  width: var(--detail-width);
  min-width: var(--detail-width);
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
}

.detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: var(--sp-6);
  color: var(--color-text-muted);
  gap: var(--sp-3);
}

.detail-empty-icon {
  font-size: 32px;
  opacity: 0.4;
}

.detail-empty p {
  font-size: 13px;
  line-height: 1.5;
}

.detail-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.detail-header-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.detail-header-meta {
  flex: 1;
  min-width: 0;
}

.detail-type-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.detail-category-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  border-radius: 20px;
  padding: 2px 8px;
  color: #FFFFFF;
  margin-top: 3px;
}

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.detail-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.detail-input,
.detail-textarea {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 7px 10px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  width: 100%;
  resize: vertical;
}

.detail-input:focus,
.detail-textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.detail-textarea {
  min-height: 70px;
  line-height: 1.5;
}

.detail-textarea--notes {
  min-height: 90px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.detail-tags-input {
  font-family: var(--font-mono);
  font-size: 11px;
}

.detail-readonly {
  font-size: 12px;
  color: var(--color-text-2);
  font-family: var(--font-mono);
  background: var(--color-surface-2);
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  border: 1px solid var(--color-border);
}

.detail-meta-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding: var(--sp-3);
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.detail-meta-item {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--color-text-muted);
}

.detail-meta-item span:last-child {
  font-family: var(--font-mono);
  color: var(--color-text-2);
}

.detail-footer {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
  background: var(--color-surface);
}

.btn-detail {
  flex: 1;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--color-border);
  background: var(--color-bg-2);
  color: var(--color-text-2);
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.btn-detail:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.btn-detail--danger {
  background: transparent;
  border-color: rgba(220,38,38,0.4);
  color: var(--color-danger);
}

.btn-detail--danger:hover {
  background: rgba(220,38,38,0.08);
  border-color: var(--color-danger);
}

/* ---------- Footer ---------- */
.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--footer-height);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-4);
  z-index: 100;
}

.footer-trademark {
  font-size: 10px;
  color: var(--color-text-muted);
}

.footer-brand {
  font-size: 10px;
  color: var(--color-text-muted);
}

.footer-brand a {
  color: var(--color-accent);
  text-decoration: none;
}

.footer-brand a:hover {
  text-decoration: underline;
}

.footer-feedback {
  font-size: 10px;
  color: var(--color-text-muted);
}

.footer-feedback a {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 500;
}

.footer-feedback a:hover {
  text-decoration: underline;
}

/* ---------- Mobile/tablet block — Designer is desktop-only ---------- */
#desktop-only-gate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: linear-gradient(135deg, #1B3A5C 0%, #0F1F33 100%);
  color: #fff;
  padding: 32px 24px;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: "Inter", system-ui, sans-serif;
}

#desktop-only-gate .dog-card {
  max-width: 440px;
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 36px 28px;
  backdrop-filter: blur(10px);
}

#desktop-only-gate .dog-icon {
  font-size: 52px;
  margin-bottom: 14px;
}

#desktop-only-gate h2 {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

#desktop-only-gate p {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
}

#desktop-only-gate .dog-specs {
  margin: 18px 0 8px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.7;
  text-align: left;
}

#desktop-only-gate .dog-brand {
  margin-top: 20px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.03em;
}

/* Trigger the gate only on small viewports OR touch-primary devices
   (catches iPad which has wide viewport but is coarse-pointer). */
@media (max-width: 1024px), (pointer: coarse) and (max-width: 1366px) {
  #desktop-only-gate { display: flex; }
  body { overflow: hidden !important; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: calc(var(--footer-height) + var(--sp-4));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-primary);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease, transform 250ms ease;
  z-index: 9999;
  white-space: nowrap;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.toast--success {
  background: var(--color-success);
}

.toast.toast--error {
  background: var(--color-danger);
}

/* ---------- Scrollbars (webkit) ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--color-border-2);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* ---------- Drag ghost/preview ---------- */
.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 9000;
  background: var(--color-surface);
  border: 2px solid var(--color-accent);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.9;
  transform: rotate(2deg);
  max-width: 200px;
}

/* ---------- Connector handles on block hover (4-side system) ---------- */
.connect-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-primary, #1B3A5C);
  border: 2px solid white;
  box-shadow: 0 0 0 1px var(--color-primary, #1B3A5C);
  opacity: 0;
  pointer-events: auto;
  cursor: crosshair;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 10;
}

.canvas-block:hover .connect-handle,
.canvas-block.connecting .connect-handle,
.connecting-active .connect-handle {
  opacity: 1;
}

.connect-handle--top    { top: -5px;    left: 50%;   transform: translateX(-50%); }
.connect-handle--right  { right: -5px;  top: 50%;    transform: translateY(-50%); }
.connect-handle--bottom { bottom: -5px; left: 50%;   transform: translateX(-50%); }
.connect-handle--left   { left: -5px;   top: 50%;    transform: translateY(-50%); }

.connect-handle--top:hover    { transform: translateX(-50%) scale(1.4); }
.connect-handle--right:hover  { transform: translateY(-50%) scale(1.4); }
.connect-handle--bottom:hover { transform: translateX(-50%) scale(1.4); }
.connect-handle--left:hover   { transform: translateY(-50%) scale(1.4); }

/* Connector target highlight (when dragging a connector) */
.canvas-block.connector-target {
  outline: 2px dashed var(--color-accent);
  outline-offset: 3px;
}

.canvas-block.connector-target:hover {
  outline: 2.5px solid var(--color-accent);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.15), var(--shadow-md);
}

/* ---------- Block connections badge ---------- */
.block-connections-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--color-accent, #2563EB);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  pointer-events: none;
  z-index: 11;
  white-space: nowrap;
}

/* ---------- Selection rectangle ---------- */
.selection-rect {
  position: absolute;
  border: 1.5px dashed var(--color-accent);
  background: rgba(37,99,235,0.07);
  pointer-events: none;
  z-index: 50;
  border-radius: 3px;
}

/* Multi-selected block */
.canvas-block.multi-selected {
  border-color: var(--color-accent) !important;
  border-left-color: var(--color-accent) !important;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.25), var(--shadow-md);
}

/* ---------- Alignment toolbar ---------- */
.align-toolbar {
  position: absolute;
  top: calc(var(--toolbar-height) + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  z-index: 200;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.align-toolbar.hidden {
  display: none;
}

.btn-align {
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-2);
  transition: background var(--transition-fast), color var(--transition-fast);
  position: relative;
}

.btn-align:hover {
  background: var(--color-bg-2);
  color: var(--color-text);
}

.btn-align[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-primary);
  color: #FFFFFF;
  font-size: 10px;
  padding: 3px 6px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 9999;
  pointer-events: none;
}

.align-toolbar-sep {
  width: 1px;
  height: 18px;
  background: var(--color-border);
  margin: 0 3px;
}

/* ---------- Minimap ---------- */
.minimap {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 180px;
  height: 120px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 100;
  cursor: pointer;
}

.minimap-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.minimap-viewport-box {
  position: absolute;
  border: 1.5px solid var(--color-accent);
  background: rgba(37,99,235,0.08);
  pointer-events: none;
  border-radius: 2px;
}

.minimap-toggle {
  position: absolute;
  bottom: 12px;
  right: 200px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 3px 8px;
  z-index: 101;
  box-shadow: var(--shadow-sm);
}

/* ---------- Header dropdowns ---------- */
.header-dropdown {
  position: relative;
}

.dropdown-arrow {
  font-size: 9px;
  margin-left: 4px;
  opacity: 0.7;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 220px;
  max-height: 75vh;
  overflow-y: auto;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  padding: 4px;
  z-index: 500;
  display: none;
}

.dropdown-menu--wide {
  min-width: 340px;
  max-width: 420px;
  max-height: 70vh;
  overflow-y: auto;
}

/* Value Streams menu group headers */
.vs-menu-group-header {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-text-muted, #6B7280);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 10px 12px 6px;
  border-top: 1px solid var(--color-border, #E5E7EB);
  margin-top: 4px;
}

.vs-menu-group-header:first-child {
  border-top: none;
  margin-top: 0;
}

.vs-menu-empty {
  font-size: 11px;
  color: var(--color-text-muted, #9CA3AF);
  padding: 8px 12px;
  font-style: italic;
}

.vs-menu-item-meta {
  display: block;
  font-size: 10px;
  color: var(--color-accent, #2563EB);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.header-dropdown.open .dropdown-menu {
  display: block;
  animation: dropdown-fade 0.12s ease-out;
}

@keyframes dropdown-fade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  text-align: left;
  font-size: 13px;
  color: var(--color-text, #111827);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.dropdown-item:hover {
  background: var(--color-surface-2, #F3F4F6);
}

.dropdown-separator {
  height: 1px;
  background: var(--color-border, #E5E7EB);
  margin: 4px 0;
}

.btn-icon-only {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.btn-icon-only .btn-icon {
  font-size: 16px;
}

/* Templates dropdown items (populated by JS) */
.templates-menu-item {
  display: block;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  text-align: left;
  padding: 10px 14px;
  transition: background var(--transition-fast);
  font-family: var(--font-sans);
  border-radius: 0;
}

.templates-menu-item:last-child {
  border-bottom: none;
}

.templates-menu-item:hover {
  background: var(--color-surface-2);
}

.templates-menu-item-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
  display: block;
  margin-bottom: 2px;
}

.templates-menu-item-desc {
  font-size: 10px;
  color: var(--color-text-muted);
  display: block;
  line-height: 1.4;
}

/* ---------- Keyboard shortcuts modal ---------- */
.shortcuts-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.shortcuts-modal-overlay.visible {
  display: flex;
  animation: overlay-fade 0.15s ease-out;
}

.shortcuts-modal {
  background: var(--color-surface);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.05);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modal-pop 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.shortcuts-modal h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--color-border);
}

.shortcuts-modal-close {
  margin-left: auto;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 8px;
  font-size: 20px;
  color: var(--color-text-muted);
  cursor: pointer;
  flex-shrink: 0;
}

.shortcuts-modal-close:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.shortcuts-modal .shortcut-table {
  margin: 0;
}

.shortcuts-modal-body {
  padding: 20px 28px 24px;
  overflow-y: auto;
}

.shortcut-table {
  width: 100%;
  border-collapse: collapse;
}

.shortcut-table tr {
  border-bottom: 1px solid var(--color-border);
}

.shortcut-table tr:last-child {
  border-bottom: none;
}

.shortcut-table td {
  padding: 7px 4px;
  font-size: 12px;
  color: var(--color-text-2);
  vertical-align: middle;
}

.shortcut-table td:first-child {
  width: 55%;
}

.shortcut-key {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.shortcut-key kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border-2);
  border-radius: 4px;
  padding: 2px 5px;
  color: var(--color-text);
}

/* ---------- Grid snap toggle ---------- */
.btn-toolbar.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #FFFFFF;
}

/* ---------- Connector detail in panel ---------- */
.connector-detail-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.connector-detail-icon {
  font-size: 24px;
}

.connector-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

/* ---------- Undo/Redo button disabled state ---------- */
.btn-toolbar:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

/* ---------- Responsive (narrow screens) ---------- */
@media (max-width: 900px) {
  .detail-panel {
    display: none;
  }
  .palette {
    width: 220px;
    min-width: 220px;
  }
  .minimap {
    display: none;
  }
}

@media (max-width: 600px) {
  .palette {
    display: none;
  }
}

/* ---------- Context Menu ---------- */
.context-menu {
  position: fixed;
  z-index: 9999;
  background: var(--color-surface, white);
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
  padding: 4px;
  min-width: 200px;
  font-size: 13px;
  overflow: hidden;
}

.context-menu--submenu {
  min-width: 160px;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  color: var(--color-text, #111827);
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
}

.context-menu-item:hover {
  background: var(--color-surface-2, #F3F4F6);
}

.context-menu-item--danger {
  color: #DC2626;
}

.context-menu-item--danger:hover {
  background: #FEE2E2;
}

.context-menu-icon {
  font-size: 14px;
  width: 18px;
  display: inline-flex;
  justify-content: center;
  flex-shrink: 0;
}

.context-menu-arrow {
  margin-left: auto;
  font-size: 11px;
  color: var(--color-text-muted, #6B7280);
}

.context-menu-separator {
  height: 1px;
  background: var(--color-border, #E5E7EB);
  margin: 4px 0;
}

/* ============================================================
   FASE 3 STYLES
   ============================================================ */

/* ---------- Shared Modal Base ---------- */
@keyframes overlay-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.visible {
  display: flex;
  animation: overlay-fade 0.15s ease-out;
}

.modal {
  background: var(--color-surface);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.05);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modal-pop 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--color-border, #E5E7EB);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text, #111827);
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 8px;
  font-size: 20px;
  color: var(--color-text-muted, #6B7280);
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
}
.modal-close:hover {
  background: var(--color-surface-2, #F3F4F6);
  color: var(--color-text, #111827);
}

.modal-body {
  padding: 20px 28px;
  overflow-y: auto;
  flex: 1;
}

.modal-desc {
  color: var(--color-text-muted, #6B7280);
  font-size: 14px;
  margin: 0 0 16px;
  line-height: 1.5;
}

.modal-footer {
  padding: 16px 28px 24px;
  border-top: 1px solid var(--color-border, #E5E7EB);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.btn-modal-action {
  padding: 10px 20px;
  background: var(--color-primary, #1B3A5C);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-modal-action:hover { background: var(--color-accent, #2563EB); }
.btn-modal-action:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-modal-cancel {
  padding: 10px 20px;
  background: none;
  color: var(--color-text, #111827);
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.btn-modal-cancel:hover { background: var(--color-surface-2, #F3F4F6); }

/* ---------- Guided Tips ---------- */
.guided-tips-container {
  position: absolute;
  top: 56px;
  right: 12px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  pointer-events: none;
  max-width: 320px;
}

.guided-tip {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  border-left: 4px solid var(--color-accent);
  padding: var(--sp-3) var(--sp-4);
  pointer-events: all;
  animation: guided-tip-in 0.2s ease;
}

@keyframes guided-tip-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.guided-tip--warning { border-left-color: #D97706; }
.guided-tip--error   { border-left-color: #DC2626; }
.guided-tip--info    { border-left-color: var(--color-accent); }

.guided-tip-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.guided-tip-icon { font-size: 16px; flex-shrink: 0; }

.guided-tip-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  flex: 1;
}

.guided-tip-dismiss {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--color-text-muted);
  line-height: 1;
  padding: 0 2px;
}
.guided-tip-dismiss:hover { color: var(--color-danger); }

.guided-tip-msg {
  font-size: 12px;
  color: var(--color-text-2);
  line-height: 1.5;
  margin-bottom: var(--sp-2);
}

.guided-tip-action {
  display: inline-block;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.guided-tip-action:hover { background: var(--color-accent-hover); }

/* Guided button active state */
.btn-header--active {
  background: rgba(37,99,235,0.35) !important;
  border-color: rgba(255,255,255,0.45) !important;
}

/* ---------- Canvas Verification Badge ---------- */
.validator-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 18px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--color-border);
  background: var(--color-bg-2);
  color: var(--color-text-muted);
  transition: all 0.18s ease;
  white-space: nowrap;
  font-family: inherit;
}

.validator-badge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  min-width: 14px;
}

.validator-badge-text {
  font-size: 12px;
  letter-spacing: 0.01em;
}

.validator-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.validator-badge--ok {
  background: #D1FAE5;
  border-color: #6EE7B7;
  color: #065F46;
}

.validator-badge--info {
  background: #DBEAFE;
  border-color: #93C5FD;
  color: #1E40AF;
}

.validator-badge--warning {
  background: #FEF3C7;
  border-color: #FCD34D;
  color: #92400E;
}

.validator-badge--error {
  background: #FEE2E2;
  border-color: #FCA5A5;
  color: #991B1B;
}

/* Pulse animation when the count changes */
@keyframes validator-pulse {
  0%   { transform: scale(1);    box-shadow: 0 0 0 0 currentColor; }
  40%  { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(217,119,6,0.12); }
  100% { transform: scale(1);    box-shadow: 0 0 0 0 transparent; }
}

.validator-badge--pulse {
  animation: validator-pulse 0.6s ease-out;
}

[data-theme="dark"] .validator-badge--ok {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #6EE7B7;
}
[data-theme="dark"] .validator-badge--info {
  background: rgba(37, 99, 235, 0.15);
  border-color: rgba(37, 99, 235, 0.4);
  color: #93C5FD;
}
[data-theme="dark"] .validator-badge--warning {
  background: rgba(217, 119, 6, 0.15);
  border-color: rgba(217, 119, 6, 0.4);
  color: #FCD34D;
}
[data-theme="dark"] .validator-badge--error {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.4);
  color: #FCA5A5;
}

/* Validator modal */
.validator-modal { width: 480px; }

.validator-all-ok {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-6) 0;
  text-align: center;
  color: var(--color-success);
}
.validator-ok-icon { font-size: 32px; }

.validator-issues-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.validator-issue {
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  border-left: 4px solid var(--color-border);
  background: var(--color-bg-2);
}
.validator-issue--error   { border-left-color: #DC2626; background: #FFF5F5; }
.validator-issue--warning { border-left-color: #D97706; background: #FFFBEB; }
.validator-issue--info    { border-left-color: var(--color-accent); background: #EFF6FF; }

[data-theme="dark"] .validator-issue--error   { background: rgba(220,38,38,0.1); }
[data-theme="dark"] .validator-issue--warning { background: rgba(217,119,6,0.1); }
[data-theme="dark"] .validator-issue--info    { background: rgba(37,99,235,0.1); }

.validator-issue-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: 4px;
}
.validator-issue-icon { font-size: 14px; flex-shrink: 0; }

.validator-issue-sev {
  margin-left: auto;
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 600;
  opacity: 0.65;
}

.validator-issue-desc {
  font-size: 12px;
  color: var(--color-text-2);
  line-height: 1.5;
  margin: 0 0 6px;
}

.validator-issue-citation {
  font-size: 11px;
  color: var(--color-text-muted, #6B7280);
  margin: 6px 0 8px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 4px;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.validator-issue-citation code {
  font-size: 10px;
  background: transparent;
  padding: 0;
  font-style: normal;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

[data-theme="dark"] .validator-issue-citation {
  background: rgba(0, 0, 0, 0.2);
}

.validator-fix-btn {
  background: var(--color-accent, #2563EB);
  color: white;
  border: none;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 6px;
  transition: background 0.15s ease;
}

.validator-fix-btn:hover {
  background: var(--color-accent-hover, #1D4ED8);
}

.validator-summary {
  font-size: 12px;
  color: var(--color-text, #111827);
  margin: 0 0 12px;
  padding: 8px 12px;
  background: var(--color-surface-2, #F9FAFB);
  border-radius: 6px;
  font-weight: 500;
}

.validator-summary-error { color: #DC2626; }
.validator-summary-warning { color: #D97706; }
.validator-summary-info { color: #2563EB; }

/* ---------- Share Modal ---------- */
.share-modal { width: 520px; }

.share-url-row {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.share-url-input {
  flex: 1;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--color-text-2);
  background: var(--color-bg-2);
  min-width: 0;
}

.btn-copy {
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-copy:hover { opacity: 0.88; }

.share-url-warning {
  font-size: 12px;
  color: #D97706;
  background: #FFFBEB;
  border: 1px solid #FCD34D;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  margin-bottom: var(--sp-3);
}

.share-qr-section {
  margin-top: var(--sp-4);
  text-align: center;
}
.share-qr-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: var(--sp-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.share-qr-container {
  display: inline-block;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--sp-2);
  background: #fff;
  min-width: 170px;
  min-height: 30px;
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 40px;
}

/* ---------- XLSX Populate Modal ---------- */
.xlsx-modal { width: 480px; }

.xlsx-checks {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.xlsx-check-row {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.xlsx-check-row:hover { background: var(--color-bg-2); }

.xlsx-check-row input[type="checkbox"] {
  flex-shrink: 0;
  margin-top: 2px;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.xlsx-check-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  display: block;
}

.xlsx-check-desc {
  font-size: 11px;
  color: var(--color-text-muted);
  display: block;
}

.xlsx-note {
  font-size: 11px;
  color: var(--color-text-muted);
  background: var(--color-bg-2);
  border-radius: var(--radius-sm);
  padding: var(--sp-3);
  line-height: 1.5;
}

.xlsx-empty-note {
  font-size: 13px;
  color: var(--color-text-muted);
  padding: 24px;
  text-align: center;
  background: var(--color-bg-2);
  border-radius: var(--radius-md);
}

/* Shared export metadata modal (used by xlsx, pdf, pptx) */
.export-meta-modal { width: 660px; max-width: 92vw; }

.em-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted, #6B7280);
  margin: 14px 0 8px;
}

.em-section-label:first-child { margin-top: 0; }

.em-section-label--opt { color: #9CA3AF; }

.em-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  margin-bottom: 8px;
}

.em-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.em-field span {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.em-field input,
.em-field select {
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm, 6px);
  background: var(--color-surface, #fff);
  color: var(--color-text);
  font-family: inherit;
}

.em-field input:focus,
.em-field select:focus {
  outline: none;
  border-color: var(--color-accent, #2563EB);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.em-textarea {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.em-textarea span {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.em-textarea textarea {
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm, 6px);
  background: var(--color-surface, #fff);
  color: var(--color-text);
  font-family: inherit;
  resize: vertical;
}

.em-note {
  font-size: 11px;
  color: var(--color-text-muted);
  margin: 8px 0 0;
  font-style: italic;
}

/* Executive summary editor modal */
.summary-editor-modal { width: 700px; max-width: 92vw; }

.summary-editor-textarea {
  width: 100%;
  min-height: 200px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm, 6px);
  background: var(--color-surface, #fff);
  color: var(--color-text);
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}

.summary-editor-textarea:focus {
  outline: none;
  border-color: var(--color-accent, #2563EB);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.summary-editor-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.summary-editor-reset {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.summary-editor-reset:hover {
  background: var(--color-bg-2, #F3F4F6);
  color: var(--color-text);
}

/* Welcome / disclaimer modal (first visit) */
.welcome-overlay {
  z-index: 9999;
}

.welcome-modal {
  width: 720px;
  max-width: 94vw;
  max-height: 94vh;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.welcome-hero {
  background: linear-gradient(135deg, #1B3A5C 0%, #2563EB 100%);
  color: white;
  padding: 32px 36px 26px;
  position: relative;
  flex-shrink: 0;
}

.welcome-badge {
  position: absolute;
  top: 18px;
  right: 22px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 12px;
  color: white;
}

.welcome-title {
  font-family: 'Playfair Display', 'Inter', serif;
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 8px;
  line-height: 1.2;
  color: white;
}

.welcome-subtitle {
  font-size: 14px;
  opacity: 0.85;
  margin: 0;
  color: white;
}

.welcome-body {
  padding: 22px 36px 14px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

/* Section label used across welcome sections */
.welcome-section-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #2563EB;
  margin: 0 0 10px;
}

/* Capabilities list (what you can do here) */
.welcome-capabilities {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.welcome-capabilities li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  color: var(--color-text, #374151);
  line-height: 1.55;
  padding: 10px 14px;
  background: linear-gradient(135deg, #EFF6FF 0%, transparent 60%);
  border-left: 3px solid #2563EB;
  border-radius: 6px;
}

.welcome-capabilities li strong {
  color: var(--color-text, #111827);
  font-weight: 700;
}

.welcome-cap-icon {
  font-size: 20px;
  line-height: 1.2;
  flex-shrink: 0;
}

[data-theme="dark"] .welcome-capabilities li {
  background: linear-gradient(135deg, rgba(37,99,235,0.12) 0%, transparent 60%);
  border-left-color: #60A5FA;
  color: #E5E7EB;
}

/* Audience row */
.welcome-audience {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  background: var(--color-surface-2, #F9FAFB);
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 8px;
  margin-bottom: 18px;
}

.welcome-audience-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted, #6B7280);
}

.welcome-audience-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.welcome-audience-tags span {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  background: var(--color-surface, white);
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 12px;
  color: var(--color-text, #374151);
}

[data-theme="dark"] .welcome-audience {
  background: rgba(255,255,255,0.02);
  border-color: #374151;
}

[data-theme="dark"] .welcome-audience-tags span {
  background: rgba(255,255,255,0.04);
  border-color: #374151;
  color: #D1D5DB;
}

/* Attribution block */
.welcome-attribution {
  background: var(--color-surface-2, #F9FAFB);
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 18px;
}

.welcome-attr-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 3px 0;
  flex-wrap: wrap;
}

.welcome-attr-label {
  min-width: 100px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted, #6B7280);
}

.welcome-attr-value {
  color: var(--color-text, #111827);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.welcome-cred {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background-color: #1B3A5C;
  background-image: linear-gradient(135deg, #1B3A5C 0%, #2563EB 100%);
  color: white;
  border-radius: 10px;
  text-transform: uppercase;
}

/* Fact bullets */
.welcome-facts {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.welcome-facts li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  color: var(--color-text, #374151);
  line-height: 1.55;
}

.welcome-facts li strong {
  color: var(--color-text, #111827);
}

.welcome-fact-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}

.welcome-trademark {
  font-size: 10px;
  color: var(--color-text-muted, #6B7280);
  margin: 0;
  font-style: italic;
  text-align: center;
}

/* Footer buttons */
.welcome-footer {
  padding: 16px 36px 22px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--color-border, #E5E7EB);
  flex-shrink: 0;
}

.welcome-btn {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
  letter-spacing: 0.01em;
}

.welcome-btn--secondary {
  background: transparent;
  color: var(--color-text-muted, #6B7280);
  border: 1px solid var(--color-border, #D1D5DB);
}

.welcome-btn--secondary:hover {
  background: var(--color-bg-2, #F3F4F6);
  color: var(--color-text, #111827);
}

.welcome-btn--primary {
  background-color: #1B3A5C;
  background-image: linear-gradient(135deg, #1B3A5C 0%, #2563EB 100%);
  color: white;
}

.welcome-btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

[data-theme="dark"] .welcome-attribution {
  background: rgba(255,255,255,0.03);
  border-color: #374151;
}

[data-theme="dark"] .welcome-btn--secondary {
  border-color: #374151;
  color: #9CA3AF;
}

[data-theme="dark"] .welcome-btn--secondary:hover {
  background: rgba(255,255,255,0.05);
  color: #E5E7EB;
}

/* ========== Templates library — palette gateway ========== */
.palette-category--templates .palette-category-header {
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.09) 0%, transparent 60%);
}

.palette-templates-hint {
  list-style: none;
  padding: 12px 14px;
  margin: 0 8px 6px;
  font-size: 11px;
  color: var(--color-text-muted, #6B7280);
  font-style: italic;
  line-height: 1.5;
  background: rgba(8, 145, 178, 0.06);
  border-radius: 6px;
  border: 1px dashed rgba(8, 145, 178, 0.3);
}

.palette-templates-btn {
  background: #0891B2 !important;
  color: white !important;
  border-color: #0891B2 !important;
}

.palette-templates-btn:hover {
  background: #0E7490 !important;
}

/* ========== Templates browser modal ========== */
.templates-browser-modal {
  width: 1040px;
  max-width: 95vw;
  max-height: 90vh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.templates-browser-overlay .modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--color-border, #E5E7EB);
  flex: 0 0 auto;
}

.templates-browser-toolbar {
  padding: 14px 24px;
  border-bottom: 1px solid var(--color-border, #E5E7EB);
  background: var(--color-surface-2, #F9FAFB);
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tb-search {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 8px;
  background: var(--color-surface, #fff);
  color: var(--color-text);
  font-family: inherit;
  box-sizing: border-box;
}

.tb-search:focus {
  outline: none;
  border-color: #0891B2;
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.15);
}

.tb-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tb-filter-row select {
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 6px;
  background: var(--color-surface, #fff);
  color: var(--color-text);
  font-family: inherit;
}

.tb-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted, #6B7280);
  padding: 4px 10px;
  background: var(--color-surface, #fff);
  border-radius: 12px;
}

.templates-browser-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 24px;
}

.templates-browser-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.templates-browser-loadmore {
  display: flex;
  justify-content: center;
  padding: 20px 0 0;
}

.templates-browser-empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--color-text-muted, #6B7280);
  grid-column: 1 / -1;
}

.templates-browser-footer {
  padding: 14px 24px;
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.tb-site-link {
  font-size: 12px;
  color: var(--color-accent, #2563EB);
  text-decoration: none;
}

.tb-site-link:hover { text-decoration: underline; }

/* Template card (used in browser and Practice Explorer) */
.tb-card {
  padding: 14px;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tb-card:hover {
  border-color: #0891B2;
  box-shadow: 0 4px 14px rgba(8, 145, 178, 0.1);
}

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

.tb-card-format {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 7px;
  border-radius: 4px;
  text-transform: uppercase;
}

.tb-format-docx { background: #DBEAFE; color: #1E40AF; }
.tb-format-xlsx { background: #D1FAE5; color: #065F46; }

.tb-card-category {
  font-size: 10px;
  color: var(--color-text-muted, #6B7280);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

.tb-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text, #111827);
  line-height: 1.3;
}

.tb-card-desc {
  font-size: 12px;
  color: var(--color-text-muted, #6B7280);
  line-height: 1.5;
  flex: 1;
}

.tb-card-langs {
  display: flex;
  gap: 6px;
}

.tb-lang {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
}

.tb-lang--on  { background: #DCFCE7; color: #166534; }
.tb-lang--off { background: #F3F4F6; color: #9CA3AF; font-style: italic; }

.tb-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.tb-btn {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--color-border, #E5E7EB);
  background: var(--color-surface, #fff);
  color: var(--color-text, #374151);
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.tb-btn:hover {
  background: var(--color-bg-2, #F3F4F6);
  border-color: #9CA3AF;
}

.tb-btn--primary {
  background: #0891B2;
  color: white;
  border-color: #0891B2;
  flex: 1;
  justify-content: center;
}

.tb-btn--primary:hover {
  background: #0E7490;
  border-color: #0E7490;
}

/* ========== Template-block on canvas (distinct cyan outline) ========== */
.canvas-block[data-category="templates"] {
  border-left-color: #0891B2 !important;
}

/* ========== Detail panel — tabs (General / Templates) ========== */
.detail-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--color-border, #E5E7EB);
  margin: 0 0 10px;
  padding: 0 2px;
}

.detail-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted, #6B7280);
  cursor: pointer;
  letter-spacing: 0.01em;
  margin-bottom: -1px;
}

.detail-tab:hover { color: var(--color-text, #111827); }

.detail-tab.active {
  color: #0891B2;
  border-bottom-color: #0891B2;
}

.detail-tabs { flex-shrink: 0; }

.detail-tab-panel {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  min-height: 0;
}
.detail-tab-panel.hidden { display: none; }

.detail-tab-empty {
  padding: 18px;
  font-size: 12px;
  color: var(--color-text-muted, #6B7280);
  text-align: center;
  font-style: italic;
}

/* ========== Detail panel — recommended templates ========== */
.detail-section {
  margin: 14px 0;
  padding-top: 12px;
  border-top: 1px solid var(--color-border, #E5E7EB);
}

.detail-tab-panel > .detail-section:first-child {
  margin-top: 4px;
  padding-top: 0;
  border-top: none;
}

.detail-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted, #6B7280);
  margin-bottom: 10px;
}

.detail-section-count {
  background: #0891B2;
  color: #fff;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0;
}

.detail-rec-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-rec-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--color-surface-2, #F9FAFB);
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 8px;
}

.detail-rec-item:hover {
  border-color: #0891B2;
  box-shadow: 0 1px 6px rgba(8, 145, 178, 0.08);
}

.detail-rec-main {
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-word;
}

.detail-rec-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text, #111827);
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.35;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.detail-rec-desc {
  font-size: 12px;
  color: var(--color-text, #374151);
  line-height: 1.5;
  white-space: normal;
}

.detail-rec-langs {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  align-items: center;
  font-size: 10px;
  flex-wrap: wrap;
}

.detail-rec-cat {
  font-size: 10px;
  color: var(--color-text-muted, #9CA3AF);
}

.detail-rec-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  align-items: stretch;
}

.detail-rec-add {
  padding: 6px 10px;
  background: #0891B2;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
}

.detail-rec-add:hover { background: #0E7490; }

.detail-rec-dl {
  padding: 5px 8px;
  background: var(--color-surface, #fff);
  color: var(--color-text, #111827);
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 500;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
}

.detail-rec-dl:hover {
  border-color: #0891B2;
  color: #0891B2;
}

.detail-rec-seeall {
  margin-top: 8px;
  background: transparent;
  border: none;
  color: #0891B2;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  text-align: left;
  font-family: inherit;
}

.detail-rec-seeall:hover { text-decoration: underline; }

/* ========== Detail panel — template-block download section ========== */
.detail-section--template-dl .detail-section-header {
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 700;
  color: var(--color-text, #111827);
}

.detail-dl-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-dl-btn {
  flex: 1 1 auto;
  min-width: 130px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--color-border, #E5E7EB);
  background: var(--color-surface, #fff);
  color: var(--color-text, #111827);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.detail-dl-btn:hover {
  background: var(--color-bg-2, #F3F4F6);
}

.detail-dl-btn--primary {
  background: #0891B2;
  color: white;
  border-color: #0891B2;
}

.detail-dl-btn--primary:hover { background: #0E7490; border-color: #0E7490; }

.detail-dl-btn--disabled {
  opacity: 0.5;
  cursor: not-allowed;
  font-style: italic;
}

.detail-dl-article {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  color: var(--color-accent, #2563EB);
  text-decoration: none;
}

.detail-dl-article:hover { text-decoration: underline; }

/* ========== Practice Explorer Templates tab ========== */
.pe-section-info {
  font-size: 12px;
  color: var(--color-text-muted, #6B7280);
  margin-bottom: 10px;
}

.pe-templates-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pe-template-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 10px;
  background: var(--color-surface, #fff);
}

.pe-template-card:hover {
  border-color: #0891B2;
  box-shadow: 0 2px 10px rgba(8, 145, 178, 0.08);
}

.pe-template-main {
  flex: 1 1 auto;
  min-width: 0;  /* crucial so flex child text can wrap instead of overflowing */
  word-break: break-word;
}

.pe-template-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text, #111827);
  display: flex;
  gap: 8px;
  align-items: center;
  line-height: 1.35;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.pe-template-desc {
  font-size: 13px;
  color: var(--color-text, #374151);
  line-height: 1.55;
  margin-bottom: 8px;
  white-space: normal;
}

.pe-template-langs {
  display: flex;
  gap: 6px;
  font-size: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.pe-template-cat {
  font-size: 10px;
  color: var(--color-text-muted, #9CA3AF);
}

.pe-template-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.pe-footer-link {
  margin-top: 16px;
  text-align: center;
}

/* ========== Dark mode for all the above ========== */
[data-theme="dark"] .tb-card { background: #1F2937; border-color: #374151; }
[data-theme="dark"] .tb-card:hover { border-color: #06B6D4; }
[data-theme="dark"] .tb-search { background: #111827; color: #E5E7EB; border-color: #374151; }
[data-theme="dark"] .tb-filter-row select { background: #111827; color: #E5E7EB; border-color: #374151; }
[data-theme="dark"] .templates-browser-toolbar { background: rgba(255,255,255,0.02); border-bottom-color: #374151; }
[data-theme="dark"] .tb-format-docx { background: rgba(59,130,246,0.2); color: #93C5FD; }
[data-theme="dark"] .tb-format-xlsx { background: rgba(16,185,129,0.2); color: #6EE7B7; }
[data-theme="dark"] .tb-lang--on { background: rgba(16,185,129,0.2); color: #6EE7B7; }
[data-theme="dark"] .tb-lang--off { background: rgba(255,255,255,0.04); color: #6B7280; }
[data-theme="dark"] .tb-btn { background: #374151; color: #E5E7EB; border-color: #4B5563; }
[data-theme="dark"] .tb-btn:hover { background: #4B5563; }
[data-theme="dark"] .detail-rec-item { background: rgba(255,255,255,0.02); border-color: #374151; }
[data-theme="dark"] .detail-tabs { border-bottom-color: #374151; }
[data-theme="dark"] .detail-tab { color: #9CA3AF; }
[data-theme="dark"] .detail-tab:hover { color: #E5E7EB; }
[data-theme="dark"] .detail-tab.active { color: #06B6D4; border-bottom-color: #06B6D4; }
[data-theme="dark"] .detail-rec-dl { background: #1F2937; color: #E5E7EB; border-color: #374151; }
[data-theme="dark"] .detail-rec-dl:hover { border-color: #06B6D4; color: #06B6D4; }
[data-theme="dark"] .detail-rec-desc { color: #D1D5DB; }
[data-theme="dark"] .detail-dl-btn { background: #374151; color: #E5E7EB; border-color: #4B5563; }
[data-theme="dark"] .pe-template-card { background: #1F2937; border-color: #374151; }

/* ========== Custom blocks — palette integration ========== */
.palette-category--custom .palette-category-header {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, transparent 60%);
}

.palette-custom-actions {
  display: flex;
  gap: 6px;
  padding: 8px 10px 12px;
  flex-wrap: wrap;
}

.palette-custom-btn {
  flex: 1 1 auto;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px dashed #C4B5FD;
  background: rgba(139, 92, 246, 0.06);
  color: #6D28D9;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.palette-custom-btn:hover {
  background: rgba(139, 92, 246, 0.12);
  border-color: #8B5CF6;
}

.palette-custom-btn--primary {
  border-style: solid;
  background: #8B5CF6;
  color: white;
  border-color: #8B5CF6;
}

.palette-custom-btn--primary:hover {
  background: #7C3AED;
}

.palette-custom-empty {
  list-style: none;
  padding: 14px 12px;
  margin: 0 8px;
  font-size: 11px;
  color: var(--color-text-muted, #6B7280);
  font-style: italic;
  line-height: 1.5;
  background: rgba(139, 92, 246, 0.05);
  border-radius: 6px;
  border: 1px dashed rgba(139, 92, 246, 0.3);
}

[data-theme="dark"] .palette-custom-btn {
  background: rgba(139, 92, 246, 0.12);
  color: #C4B5FD;
  border-color: rgba(139, 92, 246, 0.4);
}

[data-theme="dark"] .palette-custom-empty {
  background: rgba(139, 92, 246, 0.08);
}

/* Custom block mark on palette item */
.palette-block[data-custom="true"] {
  position: relative;
}
.palette-block[data-custom="true"]::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8B5CF6;
  box-shadow: 0 0 0 2px var(--color-surface, #fff);
}

/* ========== Custom blocks — editor modal ========== */
.custom-editor-modal { width: 600px; max-width: 92vw; }
.custom-manager-modal { width: 780px; max-width: 94vw; }

.custom-editor-delete {
  color: #DC2626;
  border-color: #FCA5A5 !important;
}

.custom-editor-delete:hover {
  background: #FEE2E2;
}

.custom-editor-right {
  display: flex;
  gap: 8px;
}

/* ========== Custom blocks — manager table ========== */
.custom-manager-body {
  max-height: 60vh;
  overflow-y: auto;
}

.custom-manager-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.custom-manager-table thead th {
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted, #6B7280);
  padding: 6px 10px;
  border-bottom: 1px solid var(--color-border, #E5E7EB);
  background: var(--color-surface-2, #F9FAFB);
  position: sticky;
  top: 0;
}

.custom-manager-table tbody td {
  padding: 10px;
  border-bottom: 1px solid var(--color-border, #E5E7EB);
  vertical-align: top;
}

.custom-manager-table tbody tr:hover {
  background: var(--color-surface-2, #F9FAFB);
}

.cm-icon {
  font-size: 20px;
  width: 40px;
  text-align: center;
}

.cm-desc {
  font-size: 11px;
  color: var(--color-text-muted, #6B7280);
  margin-top: 3px;
  line-height: 1.4;
}

.cm-cat {
  font-size: 11px;
  color: var(--color-text-muted, #6B7280);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cm-tags {
  font-size: 11px;
}
.cm-tags span {
  display: inline-block;
  padding: 1px 7px;
  background: #F3F4F6;
  color: #6B7280;
  border-radius: 8px;
  margin-right: 3px;
  margin-bottom: 3px;
}

.cm-actions {
  white-space: nowrap;
  text-align: right;
}

.cm-actions button {
  width: 26px;
  height: 26px;
  padding: 0;
  font-size: 14px;
  background: transparent;
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 4px;
  cursor: pointer;
  margin-left: 3px;
}

.cm-actions button:hover {
  background: #F3F4F6;
}

.cm-actions [data-action="delete"]:hover {
  background: #FEE2E2;
  border-color: #FCA5A5;
  color: #DC2626;
}

.cm-count {
  font-size: 12px;
  padding: 2px 8px;
  background: #EDE9FE;
  color: #6D28D9;
  border-radius: 10px;
  margin-left: 6px;
  font-weight: 600;
}

.custom-manager-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-muted, #6B7280);
}

.custom-manager-empty button {
  margin-top: 16px;
}

.custom-manager-footer-left {
  display: flex;
  gap: 8px;
  flex: 1;
}

/* ========== Custom blocks — right-click context menu ========== */
.custom-ctx-menu {
  position: fixed;
  background: white;
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  padding: 4px;
  z-index: 10000;
  min-width: 140px;
  animation: ctx-in 0.1s ease-out;
}

@keyframes ctx-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.custom-ctx-menu button {
  display: block;
  width: 100%;
  padding: 7px 12px;
  font-size: 13px;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  color: var(--color-text, #111827);
}

.custom-ctx-menu button:hover {
  background: #F3F4F6;
}

[data-theme="dark"] .custom-ctx-menu {
  background: #1F2937;
  border-color: #374151;
}

[data-theme="dark"] .custom-ctx-menu button {
  color: #E5E7EB;
}

[data-theme="dark"] .custom-ctx-menu button:hover {
  background: rgba(255,255,255,0.06);
}

/* Guided tour overlay */
.tour-root {
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: none;
}

.tour-dim {
  position: fixed;
  background: rgba(15, 23, 42, 0.72);
  pointer-events: auto;
  animation: tour-fade-in 0.18s ease-out;
}

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

.tour-highlight {
  position: fixed;
  border-radius: 10px;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.7), 0 0 0 9999px transparent;
  animation: tour-pulse 1.6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes tour-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.7); }
  50%      { box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.35); }
}

.tour-tooltip {
  position: fixed;
  width: 340px;
  max-width: 92vw;
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.04);
  padding: 18px 20px 14px;
  pointer-events: auto;
  font-family: inherit;
  animation: tour-tooltip-in 0.2s ease-out;
}

@keyframes tour-tooltip-in {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

.tour-tooltip--center {
  transform: translate(-50%, -50%) !important;
}

.tour-tooltip-arrow {
  position: absolute;
  width: 14px;
  height: 14px;
  background: white;
  border-right: 1px solid rgba(0,0,0,0.04);
  border-top: 1px solid rgba(0,0,0,0.04);
  pointer-events: none;
}

.tour-tooltip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.tour-tooltip-step {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #2563EB;
}

.tour-tooltip-close {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  font-size: 18px;
  color: #9CA3AF;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  border-radius: 4px;
}

.tour-tooltip-close:hover {
  background: #F3F4F6;
  color: #111827;
}

.tour-tooltip-title {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 8px;
  line-height: 1.3;
}

.tour-tooltip-text {
  font-size: 13px;
  color: #374151;
  line-height: 1.55;
  margin-bottom: 14px;
}

.tour-tooltip-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.tour-tooltip-skip {
  background: transparent;
  border: none;
  color: #6B7280;
  font-size: 11px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  font-family: inherit;
}

.tour-tooltip-skip:hover { color: #374151; background: #F9FAFB; }

.tour-tooltip-nav { display: flex; gap: 6px; }

.tour-tooltip-back,
.tour-tooltip-next {
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.tour-tooltip-back {
  background: transparent;
  color: #374151;
  border: 1px solid #E5E7EB;
}

.tour-tooltip-back:hover { background: #F3F4F6; }

.tour-tooltip-next {
  background-color: #1B3A5C;
  background-image: linear-gradient(135deg, #1B3A5C 0%, #2563EB 100%);
  color: white;
}

.tour-tooltip-next:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35); }

/* Post-welcome floating prompt */
.tour-prompt {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.04);
  padding: 14px 16px 14px 48px;
  z-index: 2000;
  max-width: 300px;
  font-family: inherit;
  animation: tour-prompt-slide-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes tour-prompt-slide-in {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.tour-prompt::before {
  content: "👋";
  position: absolute;
  top: 14px;
  left: 16px;
  font-size: 22px;
}

.tour-prompt-title {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 3px;
}

.tour-prompt-desc {
  font-size: 12px;
  color: #6B7280;
  margin-bottom: 10px;
  line-height: 1.4;
}

.tour-prompt-actions {
  display: flex;
  gap: 8px;
}

.tour-prompt-primary,
.tour-prompt-dismiss {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.tour-prompt-primary {
  background-color: #2563EB;
  color: white;
}

.tour-prompt-primary:hover { background-color: #1D4ED8; }

.tour-prompt-dismiss {
  background: transparent;
  color: #6B7280;
}

.tour-prompt-dismiss:hover { color: #111827; }

.tour-prompt-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  font-size: 14px;
  color: #9CA3AF;
  cursor: pointer;
  line-height: 1;
}

.tour-prompt-close:hover { color: #374151; }

[data-theme="dark"] .tour-tooltip,
[data-theme="dark"] .tour-tooltip-arrow,
[data-theme="dark"] .tour-prompt {
  background: #1F2937;
  color: #E5E7EB;
}

[data-theme="dark"] .tour-tooltip-title,
[data-theme="dark"] .tour-prompt-title { color: #E5E7EB; }

[data-theme="dark"] .tour-tooltip-text,
[data-theme="dark"] .tour-prompt-desc { color: #9CA3AF; }

[data-theme="dark"] .tour-tooltip-back { background: transparent; color: #D1D5DB; border-color: #374151; }
[data-theme="dark"] .tour-tooltip-back:hover { background: rgba(255,255,255,0.05); }

/* PPTX options row with toggle */
.pptx-toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
}

.pptx-toggle-row:hover {
  background: var(--color-bg-2, #F9FAFB);
}

.pptx-toggle-row input[type="checkbox"] {
  flex-shrink: 0;
  margin-top: 3px;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.pptx-toggle-main {
  flex: 1;
  min-width: 0;
}

.pptx-toggle-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
}

.pptx-toggle-desc {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* Legacy class kept for backward compat with any older markup */
.xlsx-meta-modal { width: 620px; max-width: 90vw; }
.xlsx-meta-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; margin-bottom: 12px; }
.xlsx-meta-field { display: flex; flex-direction: column; gap: 4px; }
.xlsx-meta-field span { font-size: 11px; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.xlsx-meta-field input, .xlsx-meta-field select { padding: 8px 10px; font-size: 13px; border: 1px solid var(--color-border); border-radius: var(--radius-sm, 6px); background: var(--color-surface, #fff); color: var(--color-text); font-family: inherit; }
.xlsx-meta-note { font-size: 11px; color: var(--color-text-muted); margin: 4px 0 0; font-style: italic; }

/* Template selection (step 2) */
.xlsx-modal { width: 680px; max-width: 92vw; }

.xlsx-ctx-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}

.xlsx-ctx-chip {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  background: #EFF6FF;
  color: #1E40AF;
  border-radius: 12px;
}

[data-theme="dark"] .xlsx-ctx-chip {
  background: rgba(37, 99, 235, 0.2);
  color: #93C5FD;
}

.xlsx-tpl-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  margin-bottom: 8px;
  transition: all 0.15s ease;
}

.xlsx-tpl-row:hover {
  background: var(--color-bg-2);
  border-color: var(--color-accent, #2563EB);
}

.xlsx-tpl-row--suggested {
  border-color: var(--color-accent, #2563EB);
  background: linear-gradient(135deg, #EFF6FF 0%, transparent 60%);
}

[data-theme="dark"] .xlsx-tpl-row--suggested {
  background: linear-gradient(135deg, rgba(37,99,235,0.08) 0%, transparent 60%);
}

.xlsx-tpl-row input[type="checkbox"] {
  flex-shrink: 0;
  margin-top: 3px;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.xlsx-tpl-main {
  flex: 1;
  min-width: 0;
}

.xlsx-tpl-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.xlsx-tpl-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 7px;
  background: var(--color-bg-2);
  color: var(--color-text-muted);
  border-radius: 10px;
}

.xlsx-tpl-suggested {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  background: var(--color-accent, #2563EB);
  color: white;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.xlsx-tpl-desc {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ---------- Sticky Notes ---------- */
.canvas-block--sticky {
  background: #FCD34D !important;
  border-color: #F59E0B !important;
  color: #78350F !important;
  box-shadow: 2px 3px 8px rgba(245,158,11,0.35) !important;
  font-family: cursive, var(--font-sans) !important;
}

.canvas-block--sticky .block-title {
  color: #78350F !important;
  font-size: 13px;
}

.canvas-block--sticky .block-category {
  opacity: 0.65;
  color: #92400E;
}

/* ---------- Keyboard Shortcuts Table ---------- */
.shortcut-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.shortcut-table td {
  padding: 7px var(--sp-3);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.shortcut-table td:first-child {
  color: var(--color-text-2);
}

.shortcut-table .shortcut-key {
  text-align: right;
  white-space: nowrap;
}

.shortcut-table tr:last-child td {
  border-bottom: none;
}

kbd {
  display: inline-block;
  background: var(--color-bg-2);
  border: 1px solid var(--color-border-2);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text);
  box-shadow: 0 1px 0 var(--color-border-2);
}

/* ============================================================
   Context Badge (Feature 2)
   ============================================================ */

.context-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 12px;
  background: var(--color-surface-2, #F3F4F6);
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text, #111827);
  margin-left: 12px;
  flex-shrink: 0;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.context-badge[data-context="new-product"] { background: #DBEAFE; border-color: #BFDBFE; color: #1E40AF; }
.context-badge[data-context="service"]      { background: #D1FAE5; border-color: #A7F3D0; color: #065F46; }
.context-badge[data-context="value-stream"] { background: #FCE7F3; border-color: #FBCFE8; color: #9D174D; }
.context-badge[data-context="learn"]        { background: #FEF3C7; border-color: #FDE68A; color: #92400E; }
.context-badge[data-context="blank"]        { background: transparent; border-color: rgba(255,255,255,0.25); color: rgba(255,255,255,0.75); }

.context-badge-icon {
  font-size: 14px;
  line-height: 1;
}

.context-badge-label {
  white-space: nowrap;
}

.context-badge-change {
  background: rgba(0,0,0,0.06);
  border: none;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  color: inherit;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.context-badge-change:hover { background: rgba(0,0,0,0.12); }

/* Dark mode adjustments for blank context badge */
[data-theme="dark"] .context-badge[data-context="blank"] {
  border-color: rgba(255,255,255,0.20);
  color: rgba(255,255,255,0.65);
}

/* ============================================================
   Onboarding Modal (Feature 1)
   ============================================================ */

.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.onboarding-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.onboarding-modal {
  background: var(--color-surface, #FFFFFF);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.24), 0 8px 24px rgba(0,0,0,0.12);
  padding: 32px;
  max-width: 600px;
  width: calc(100% - 32px);
  max-height: 90vh;
  overflow-y: auto;
}

.onboarding-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.onboarding-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-text, #111827);
  line-height: 1.3;
}

.onboarding-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--color-text-muted, #6B7280);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  line-height: 1;
  flex-shrink: 0;
}

.onboarding-close:hover { background: var(--color-surface-2, #F3F4F6); }

.onboarding-subtitle {
  font-size: 0.9rem;
  color: var(--color-text-muted, #6B7280);
  margin-bottom: 24px;
}

.onboarding-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.onboarding-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 16px;
  background: var(--color-surface-2, #F8FAFC);
  border: 2px solid var(--color-border, #E5E7EB);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.onboarding-card:hover {
  border-color: var(--color-accent, #2563EB);
  background: #EFF6FF;
  box-shadow: 0 2px 12px rgba(37,99,235,0.12);
}

[data-theme="dark"] .onboarding-card:hover {
  background: rgba(37,99,235,0.12);
}

.onboarding-card-icon {
  font-size: 1.75rem;
  line-height: 1;
  margin-bottom: 4px;
}

.onboarding-card-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text, #111827);
}

.onboarding-card-desc {
  font-size: 0.82rem;
  color: var(--color-text-muted, #6B7280);
}

/* Last card (blank) spans full width when odd count */
.onboarding-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.onboarding-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 8px;
  border-top: 1px solid var(--color-border, #E5E7EB);
}

.onboarding-skip {
  background: none;
  border: none;
  color: var(--color-text-muted, #6B7280);
  font-size: 0.875rem;
  cursor: pointer;
  font-family: inherit;
  padding: 6px 8px;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}

.onboarding-skip:hover {
  color: var(--color-text, #111827);
  background: var(--color-surface-2, #F3F4F6);
}

/* ============================================================
   Shortcuts Modal — "Start over" button
   ============================================================ */

.shortcuts-modal-actions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border, #E5E7EB);
  display: flex;
  justify-content: center;
}

.btn-start-over {
  background: none;
  border: 1px solid var(--color-border-2, #CBD5E1);
  padding: 8px 16px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  color: var(--color-text-muted, #6B7280);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-start-over:hover {
  border-color: var(--color-danger, #DC2626);
  color: var(--color-danger, #DC2626);
  background: #FEF2F2;
}

/* ============================================================
   Practice Explorer Modal — Feature B
   ============================================================ */

/* Modal tabs */
.modal-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--color-border, #E5E7EB);
  padding: 0 28px;
  flex-shrink: 0;
}

.pe-tab {
  padding: 12px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted, #6B7280);
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s;
  white-space: nowrap;
}

.pe-tab:hover {
  color: var(--color-text, #111827);
}

.pe-tab.active {
  color: var(--color-primary, #1B3A5C);
  border-bottom-color: var(--color-primary, #1B3A5C);
}

/* Practice Explorer modal sizing */
.practice-explorer-modal {
  max-width: 920px;
  width: 92vw;
  display: flex;
  flex-direction: column;
  max-height: 88vh;
  min-height: 0;
  overflow: hidden;
}

.pe-body {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  padding: 20px 28px;
}

/* Practice category chip in modal header */
.practice-category-chip {
  font-size: 11px;
  font-weight: 500;
  background: var(--color-surface-2, #F3F4F6);
  padding: 2px 10px;
  border-radius: 10px;
  margin-left: 8px;
  color: var(--color-text-muted, #6B7280);
  vertical-align: middle;
}

/* Practice icon in header */
.practice-icon {
  font-size: 22px;
  margin-right: 8px;
}

/* Section wrapper */
.pe-section {
  margin-bottom: 20px;
}

.pe-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted, #6B7280);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 8px;
}

/* Source + page-ref badges (official data citations) */
.pe-source-badge {
  font-size: 11px;
  color: var(--color-text-muted, #6B7280);
  background: #EFF6FF;
  border-left: 3px solid #2563EB;
  padding: 8px 12px;
  border-radius: 6px;
  margin: 0 0 12px;
}

.pe-source-badge code {
  font-size: 10px;
  background: transparent;
  padding: 0;
}

.pe-page-ref {
  font-size: 10px;
  font-weight: 500;
  color: #2563EB;
  background: #DBEAFE;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-family: 'JetBrains Mono', monospace;
}

.pe-page-ref-line {
  font-size: 11px;
  color: var(--color-text-muted, #6B7280);
  margin: 8px 0 0;
  font-style: italic;
}

/* Inputs / Activities / Outputs 3-column grid inside a process collapsible */
.pe-ioa-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr;
  gap: 16px;
  margin-top: 10px;
}

.pe-ioa-col {
  background: var(--color-surface-2, #F9FAFB);
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 8px;
  padding: 12px;
}

.pe-ioa-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text, #111827);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 8px;
}

.pe-ioa-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--color-text, #374151);
}

.pe-ioa-list.pe-ioa-ordered {
  counter-reset: none;
}

.pe-ioa-list li {
  padding: 3px 0;
  border-bottom: 1px dashed var(--color-border, #E5E7EB);
}

.pe-ioa-list li:last-child {
  border-bottom: none;
}

@media (max-width: 900px) {
  .pe-ioa-grid {
    grid-template-columns: 1fr;
  }
}

/* Collapsible sections (details/summary) */
.pe-collapsible {
  background: var(--color-surface-2, #F9FAFB);
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
}

.pe-collapsible[open] {
  background: var(--color-surface, #FFFFFF);
}

.pe-collapsible-summary {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text, #111827);
  padding: 12px 14px 12px 36px;
  cursor: pointer;
  position: relative;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pe-collapsible-summary::-webkit-details-marker {
  display: none;
}

.pe-collapsible-summary::before {
  content: "▸";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted, #6B7280);
  font-size: 11px;
  transition: transform 0.15s ease;
}

.pe-collapsible[open] > .pe-collapsible-summary::before {
  transform: translateY(-50%) rotate(90deg);
}

.pe-collapsible-summary:hover {
  background: var(--color-surface-3, #F3F4F6);
}

.pe-collapsible-body {
  padding: 4px 14px 14px;
  animation: pe-slide-down 0.15s ease;
}

@keyframes pe-slide-down {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Toolbar for expand/collapse all */
.pe-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 10px;
}

.pe-toolbar-btn {
  background: transparent;
  border: 1px solid var(--color-border, #E5E7EB);
  color: var(--color-text-muted, #6B7280);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}

.pe-toolbar-btn:hover {
  background: var(--color-surface-2, #F3F4F6);
  color: var(--color-text, #111827);
}

.pe-text {
  font-size: 14px;
  color: var(--color-text, #111827);
  line-height: 1.6;
  margin: 0;
}

.pe-text--muted {
  color: var(--color-text-muted, #6B7280);
  font-style: italic;
}

/* Tags */
.pe-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pe-tag {
  font-size: 12px;
  background: var(--color-surface-2, #F1F5F9);
  border: 1px solid var(--color-border, #E2E8F0);
  padding: 3px 10px;
  border-radius: 12px;
  color: var(--color-text-2, #374151);
}

.pe-tag--output {
  background: #EFF6FF;
  border-color: #BFDBFE;
  color: #1D4ED8;
}

/* List */
.pe-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 13px;
  color: var(--color-text-2, #374151);
  line-height: 1.7;
}

.pe-list li::before {
  content: "→ ";
  color: var(--color-text-muted, #6B7280);
}

/* 4 Dimensions grid */
.pe-dimensions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.pe-dimension-card {
  background: var(--color-surface-2, #F3F4F6);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--color-border, #E5E7EB);
}

/* When dimension card is a collapsible, the details wrapper handles padding/bg */
.pe-collapsible.pe-dimension-card {
  padding: 0;
  background: var(--color-surface-2, #F9FAFB);
}

.pe-collapsible.pe-dimension-card[open] {
  background: var(--color-surface, #FFFFFF);
}

.pe-dimension-card h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text, #111827);
  margin: 0 0 10px;
}

.pe-dimension-card ul {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--color-text-muted, #6B7280);
  line-height: 1.6;
}

.pe-dimension-card li {
  padding: 1px 0;
}

.pe-dim-sub {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted, #6B7280);
  margin: 8px 0 4px;
}

.pe-dim-culture {
  font-size: 11px;
  font-style: italic;
  color: var(--color-text-muted, #6B7280);
  margin: 4px 0 0;
  padding-top: 6px;
  border-top: 1px dashed var(--color-border, #E5E7EB);
}

/* Processes */
.pe-process-item {
  background: var(--color-surface-2, #F3F4F6);
  padding: 14px 16px;
  border-radius: 10px;
  margin-bottom: 10px;
  border: 1px solid var(--color-border, #E2E8F0);
}

/* When process item is a collapsible, summary handles padding */
.pe-collapsible.pe-process-item {
  padding: 0;
}

.pe-process-item h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text, #111827);
  margin: 0 0 4px;
}

.pe-process-item p {
  font-size: 12px;
  color: var(--color-text-muted, #6B7280);
  margin: 0 0 8px;
  line-height: 1.5;
}

.pe-process-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.pe-process-step {
  font-size: 11px;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #E5E7EB);
  padding: 2px 8px;
  border-radius: 12px;
  color: var(--color-text-2, #374151);
}

/* KPI table */
.pe-kpi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.pe-kpi-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted, #6B7280);
  border-bottom: 2px solid var(--color-border, #E2E8F0);
}

.pe-kpi-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border, #E2E8F0);
  vertical-align: top;
}

.pe-kpi-name {
  font-weight: 600;
  color: var(--color-text, #111827);
  white-space: nowrap;
}

.pe-kpi-def {
  color: var(--color-text-2, #374151);
}

.pe-kpi-target {
  color: var(--color-success, #059669);
  font-weight: 500;
  white-space: nowrap;
}

.pe-kpi-table tr:last-child td {
  border-bottom: none;
}

/* Maturity levels */
.pe-maturity-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pe-maturity-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--color-surface-2, #F3F4F6);
  border: 1px solid var(--color-border, #E2E8F0);
}

/* When maturity item is a collapsible, the details element takes over layout */
.pe-collapsible.pe-maturity-item {
  display: block;
  padding: 0;
}

.pe-maturity-badge {
  font-size: 11px;
  font-weight: 700;
  min-width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-border-2, #CBD5E1);
  color: var(--color-text-2, #374151);
  flex-shrink: 0;
}

.pe-maturity-1 .pe-maturity-badge { background: #FEE2E2; color: #B91C1C; }
.pe-maturity-2 .pe-maturity-badge { background: #FEF3C7; color: #92400E; }
.pe-maturity-3 .pe-maturity-badge { background: #DBEAFE; color: #1D4ED8; }
.pe-maturity-4 .pe-maturity-badge { background: #D1FAE5; color: #065F46; }
.pe-maturity-5 .pe-maturity-badge { background: #EDE9FE; color: #5B21B6; }

.pe-maturity-content strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text, #111827);
  display: block;
  margin-bottom: 2px;
}

.pe-maturity-content p {
  font-size: 12px;
  color: var(--color-text-muted, #6B7280);
  margin: 0;
  line-height: 1.5;
}

/* Integrations */
.pe-integrations-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.pe-integration-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--color-surface-2, #F3F4F6);
  border-radius: 8px;
  border: 1px solid var(--color-border, #E2E8F0);
}

.pe-integration-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.pe-integration-link {
  background: none;
  border: none;
  color: var(--color-accent, #2563EB);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pe-integration-link:hover {
  color: var(--color-accent-hover, #1D4ED8);
}

/* "Explore this practice" button in detail panel */
.detail-footer--practice {
  padding: 8px 16px 12px;
  border-top: 1px solid var(--color-border, #E2E8F0);
}

.btn-practice-explorer {
  width: 100%;
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--color-primary, #1B3A5C) 0%, var(--color-accent, #2563EB) 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s, transform 0.1s;
  text-align: center;
}

.btn-practice-explorer:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn-practice-explorer:active {
  transform: translateY(0);
}

/* Dark theme overrides for Practice Explorer */
[data-theme="dark"] .pe-dimension-card,
[data-theme="dark"] .pe-process-item,
[data-theme="dark"] .pe-maturity-item,
[data-theme="dark"] .pe-integration-item {
  background: var(--color-surface, #1E293B);
  border-color: var(--color-border, #334155);
}

[data-theme="dark"] .pe-tag--output {
  background: rgba(29,78,216,0.15);
  border-color: rgba(191,219,254,0.3);
  color: #93C5FD;
}

[data-theme="dark"] .practice-category-chip {
  background: var(--color-surface, #1E293B);
}

[data-theme="dark"] .pe-kpi-target {
  color: #34D399;
}

[data-theme="dark"] .detail-footer--practice {
  border-color: var(--color-border, #334155);
}

/* ========================================================== */
/* Help & Guide Panel                                           */
/* ========================================================== */

/* Palette footer (contains Help button) */
.palette-footer {
  flex-shrink: 0;
  padding: 10px 12px;
  border-top: 1px solid #E5E7EB;
  background: var(--color-surface, #FFFFFF);
}

[data-theme="dark"] .palette-footer {
  border-top-color: #374151;
}

.palette-help-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background-color: #EFF6FF;
  background-image: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
  border: 1px solid #93C5FD;
  border-radius: 8px;
  color: #1E40AF;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  line-height: 1.3;
}

.palette-help-btn:hover {
  background: linear-gradient(135deg, #DBEAFE 0%, #BFDBFE 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
}

.palette-help-icon {
  font-size: 16px;
}

.palette-help-label {
  font-size: 13px;
  letter-spacing: 0.01em;
}

[data-theme="dark"] .palette-help-btn {
  background: linear-gradient(135deg, rgba(37,99,235,0.15) 0%, rgba(37,99,235,0.08) 100%);
  border-color: rgba(37,99,235,0.4);
  color: #93C5FD;
}

[data-theme="dark"] .palette-help-btn:hover {
  background: linear-gradient(135deg, rgba(37,99,235,0.25) 0%, rgba(37,99,235,0.15) 100%);
}

/* Palette credit (Better Skills + João Rodrigues) — explicit colors for Firefox */
.palette-credit {
  margin-top: 10px;
  padding: 10px 4px 2px;
  text-align: center;
  border-top: 1px dashed #D1D5DB;
  font-size: 10px;
  line-height: 1.5;
}

[data-theme="dark"] .palette-credit {
  border-top-color: #374151;
}

.palette-credit-brand {
  font-size: 11px;
  color: #6B7280;
  margin: 0 0 4px;
}

.palette-credit-brand a {
  font-weight: 700;
  color: #1B3A5C;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.palette-credit-brand a:hover {
  text-decoration: underline;
}

[data-theme="dark"] .palette-credit-brand {
  color: #9CA3AF;
}

[data-theme="dark"] .palette-credit-brand a {
  color: #93C5FD;
}

.palette-credit-author {
  color: #6B7280;
  font-size: 10.5px;
  font-style: italic;
  margin: 0;
}

[data-theme="dark"] .palette-credit-author {
  color: #9CA3AF;
}

.palette-credit-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  margin-top: 4px;
}

.palette-credit-badge {
  display: inline-block;
  padding: 2px 6px;
  background-color: #1B3A5C;
  background-image: linear-gradient(135deg, #1B3A5C 0%, #2563EB 100%);
  color: #FFFFFF;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 10px;
  font-style: normal;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1.5;
}

[data-theme="dark"] .palette-credit-badge {
  background-color: #2563EB;
  background-image: linear-gradient(135deg, #2563EB 0%, #60A5FA 100%);
}

/* Help modal — Firefox-safe flex sizing */
.help-overlay .help-modal {
  width: 92vw;
  max-width: 1100px;
  height: 85vh;
  max-height: 780px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.help-overlay .modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--color-border, #E5E7EB);
  flex: 0 0 auto;
}

.help-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

/* Left nav — explicit full-height to survive Firefox flex quirks */
.help-nav {
  width: 270px;
  min-width: 270px;
  flex: 0 0 270px;
  border-right: 1px solid var(--color-border, #E5E7EB);
  background: var(--color-surface-2, #F9FAFB);
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.help-nav-search {
  margin: 14px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  background: var(--color-surface, #fff);
  color: var(--color-text);
}

.help-nav-search:focus {
  outline: none;
  border-color: var(--color-accent, #2563EB);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.help-nav-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 8px 14px;
}

.help-nav-group {
  margin-bottom: 12px;
}

.help-nav-group-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 8px 6px;
}

.help-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: 6px;
  text-align: left;
  font-size: 12.5px;
  color: var(--color-text);
  cursor: pointer;
  font-family: inherit;
  margin-bottom: 2px;
  transition: background 0.1s ease;
}

.help-nav-item:hover {
  background: var(--color-surface-3, rgba(0,0,0,0.04));
}

.help-nav-item.active {
  background: var(--color-accent, #2563EB);
  color: white;
  font-weight: 600;
}

.help-nav-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.help-nav-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Content pane */
.help-content {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  padding: 32px 40px;
  background: var(--color-surface, #fff);
}

.help-article-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--color-border);
}

.help-article-icon {
  font-size: 32px;
  line-height: 1;
}

.help-article-header h1 {
  margin: 0;
  font-size: 22px;
  color: var(--color-text);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.help-article-body {
  font-size: 14px;
  line-height: 1.65;
  color: var(--color-text);
}

.help-article-body .help-lede {
  font-size: 15px;
  color: var(--color-text-2, var(--color-text));
  margin: 0 0 24px;
  padding: 14px 16px;
  border-left: 3px solid var(--color-accent, #2563EB);
  background: var(--color-surface-2, #F9FAFB);
  border-radius: 0 6px 6px 0;
}

.help-article-body h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  margin: 28px 0 10px;
}

.help-article-body p {
  margin: 0 0 14px;
}

.help-article-body .help-list {
  margin: 0 0 18px;
  padding-left: 22px;
}

.help-article-body .help-list li {
  margin-bottom: 6px;
}

.help-article-body a {
  color: var(--color-accent, #2563EB);
  text-decoration: underline;
}

.help-article-body kbd {
  display: inline-block;
  padding: 2px 6px;
  font-size: 11px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  background: var(--color-surface-2, #F3F4F6);
  border: 1px solid var(--color-border);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--color-text);
}

.help-article-body em {
  font-style: italic;
  color: var(--color-text-muted);
}

.help-cta {
  margin-top: 28px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #EFF6FF 0%, transparent 60%);
  border-radius: 8px;
  color: var(--color-text-2);
  border: 1px solid #DBEAFE;
  font-size: 13px;
}

.help-tour-cta {
  margin-top: 16px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #1B3A5C 0%, #2563EB 100%);
  border-radius: 10px;
  color: white;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: space-between;
}

.help-tour-cta strong {
  color: white;
  font-weight: 700;
}

.help-tour-start-btn {
  background: white;
  color: #1B3A5C;
  border: none;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.help-tour-start-btn:hover {
  background: #DBEAFE;
  transform: translateY(-1px);
}

[data-theme="dark"] .help-cta {
  background: linear-gradient(135deg, rgba(37,99,235,0.12) 0%, transparent 60%);
  border-color: rgba(37,99,235,0.3);
}

/* Cards grid */
.help-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 16px 0 24px;
}

.help-card {
  padding: 14px;
  background: var(--color-surface-2, #F9FAFB);
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.help-card-icon {
  font-size: 22px;
  margin-bottom: 6px;
}

.help-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 4px;
}

.help-card-body {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* Table */
.help-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 24px;
  font-size: 13px;
}

.help-table thead th {
  background: #1B3A5C;
  color: white;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.help-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.help-table tbody tr:nth-child(even) {
  background: var(--color-surface-2, #F9FAFB);
}

[data-theme="dark"] .help-table tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.02);
}

/* Glossary */
.help-glossary {
  margin: 0;
}

.help-glossary dt {
  font-weight: 700;
  color: var(--color-text);
  margin-top: 12px;
  font-size: 13.5px;
}

.help-glossary dd {
  margin: 2px 0 0;
  padding-left: 0;
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.55;
}

/* SVG diagrams */
.help-svg-wrap {
  margin: 10px 0 20px;
  padding: 14px;
  background: var(--color-surface-2, #F9FAFB);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow-x: auto;
}

.help-svg {
  display: block;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  height: auto;
}

[data-theme="dark"] .help-svg text {
  fill: #E5E7EB;
}

[data-theme="dark"] .help-svg-wrap {
  background: rgba(255,255,255,0.03);
}

@media (max-width: 800px) {
  .help-overlay .help-modal {
    width: 96vw;
    height: 90vh;
  }
  .help-nav {
    width: 200px;
    min-width: 200px;
    flex: 0 0 200px;
  }
  .help-content {
    padding: 20px;
  }
  .help-cards-grid {
    grid-template-columns: 1fr;
  }
}


/* =============================================================
   Validation Rules Library — modal, filters, cards, toggles
   ============================================================= */

.btn-toolbar.btn-toolbar--rules {
  border-color: rgba(37, 99, 235, 0.4);
  color: #1B3A5C;
  background: rgba(37, 99, 235, 0.06);
  font-weight: 600;
}
.btn-toolbar.btn-toolbar--rules:hover {
  background: rgba(37, 99, 235, 0.14);
  border-color: rgba(37, 99, 235, 0.6);
}
[data-theme="dark"] .btn-toolbar.btn-toolbar--rules {
  color: #93C5FD;
  border-color: rgba(147, 197, 253, 0.4);
  background: rgba(37, 99, 235, 0.18);
}

.rules-library-overlay { z-index: 9000; }
.rules-library-modal {
  width: min(1100px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.rules-library-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
}
.rules-library-header h2 { margin: 0 0 4px; }
.rules-library-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-muted, #6B7280);
  max-width: 760px;
}

.rules-library-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--color-border, #E5E7EB);
  background: var(--color-bg-subtle, #F9FAFB);
}
.rules-library-toolbar input[type=search],
.rules-library-toolbar select {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--color-border, #D1D5DB);
  border-radius: 6px;
  background: #FFF;
  color: inherit;
}
.rules-library-toolbar input[type=search] {
  flex: 1 1 240px;
  min-width: 200px;
}
.rules-library-toolbar select { flex: 0 0 auto; }

.rules-library-bulk {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 24px;
  background: var(--color-bg-subtle, #F9FAFB);
  border-bottom: 1px solid var(--color-border, #E5E7EB);
  font-size: 13px;
}
.rules-library-bulk-label { color: var(--color-text-muted, #6B7280); margin-right: 4px; }
.rules-library-bulk-btn {
  font: inherit;
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--color-border, #D1D5DB);
  border-radius: 4px;
  background: #FFF;
  cursor: pointer;
}
.rules-library-bulk-btn:hover { background: #F3F4F6; }

.rules-library-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  background: #FFF;
}

.rules-library-group { margin-bottom: 28px; }
.rules-library-group-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #1B3A5C;
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border, #E5E7EB);
  display: flex;
  align-items: center;
  gap: 8px;
}
.rules-library-group-count {
  background: #1B3A5C;
  color: #FFF;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0;
  text-transform: none;
}

.rules-library-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 10px;
}

.rules-library-card {
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 8px;
  padding: 12px 14px;
  background: #FFF;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: opacity 0.15s, box-shadow 0.15s;
}
.rules-library-card--info { border-left: 3px solid #2563EB; }
.rules-library-card--warning { border-left: 3px solid #F59E0B; }
.rules-library-card--error { border-left: 3px solid #DC2626; }
.rules-library-card--disabled { opacity: 0.55; }

.rules-library-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.rules-library-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.rules-library-sev {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.rules-library-sev--info    { background: #DBEAFE; color: #1E40AF; }
.rules-library-sev--warning { background: #FEF3C7; color: #92400E; }
.rules-library-sev--error   { background: #FEE2E2; color: #991B1B; }

.rules-library-state {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}
.rules-library-state--ok       { background: #ECFDF5; color: #065F46; }
.rules-library-state--firing   { background: #FEE2E2; color: #991B1B; }
.rules-library-state--disabled { background: #F3F4F6; color: #6B7280; }

.rules-library-toggle {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  cursor: pointer;
}
.rules-library-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.rules-library-toggle-track {
  display: inline-block;
  width: 36px;
  height: 20px;
  background: #D1D5DB;
  border-radius: 10px;
  position: relative;
  transition: background 0.18s;
}
.rules-library-toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #FFF;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transition: transform 0.18s;
}
.rules-library-toggle input:checked + .rules-library-toggle-track {
  background: #2563EB;
}
.rules-library-toggle input:checked + .rules-library-toggle-track::after {
  transform: translateX(16px);
}
.rules-library-toggle input:focus + .rules-library-toggle-track {
  outline: 2px solid #93C5FD;
  outline-offset: 2px;
}

.rules-library-card-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  color: #111827;
  line-height: 1.35;
}
.rules-library-card-desc {
  font-size: 13px;
  color: var(--color-text-muted, #4B5563);
  margin: 0;
  line-height: 1.45;
}

.rules-library-related {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.rules-library-chip {
  font-size: 11px;
  background: #F3F4F6;
  color: #374151;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid #E5E7EB;
}
.rules-library-chip--more {
  background: transparent;
  color: var(--color-text-muted, #6B7280);
  border: none;
}

.rules-library-citation {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--color-text-muted, #6B7280);
  font-style: italic;
}
.rules-library-citation-icon { font-style: normal; }

.rules-library-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-muted, #6B7280);
}
.rules-library-empty p { margin-bottom: 12px; }

.rules-library-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  border-top: 1px solid var(--color-border, #E5E7EB);
  background: var(--color-bg-subtle, #F9FAFB);
}
.rules-library-summary {
  font-size: 13px;
  color: #374151;
}
.rules-library-summary strong { color: #1B3A5C; }
.rules-library-summary-on { color: #065F46; }
.rules-library-summary-off { color: #6B7280; }
.rules-library-summary-firing { color: #991B1B; font-weight: 600; }
.rules-library-actions {
  display: flex;
  gap: 8px;
}

/* Dark mode */
[data-theme="dark"] .rules-library-toolbar,
[data-theme="dark"] .rules-library-bulk,
[data-theme="dark"] .rules-library-footer {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .rules-library-toolbar input[type=search],
[data-theme="dark"] .rules-library-toolbar select,
[data-theme="dark"] .rules-library-bulk-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  color: #E5E7EB;
}
[data-theme="dark"] .rules-library-body { background: #0F172A; }
[data-theme="dark"] .rules-library-card {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .rules-library-card-title { color: #F1F5F9; }
[data-theme="dark"] .rules-library-card-desc { color: #CBD5E1; }
[data-theme="dark"] .rules-library-group-title {
  color: #93C5FD;
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .rules-library-chip {
  background: rgba(255, 255, 255, 0.06);
  color: #CBD5E1;
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .rules-library-summary { color: #CBD5E1; }
[data-theme="dark"] .rules-library-summary strong { color: #93C5FD; }

/* Responsive */
@media (max-width: 720px) {
  .rules-library-list { grid-template-columns: 1fr; }
  .rules-library-toolbar { padding: 10px 16px; }
  .rules-library-body { padding: 12px 16px; }
  .rules-library-footer { flex-direction: column; align-items: stretch; }
}

/* Rules-for-this-block sub-section in Detail panel */
.rules-for-block {
  margin: 12px 16px;
  padding: 12px;
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.04);
}
.rules-for-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.rules-for-block-header h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #1B3A5C;
  margin: 0;
}
.rules-for-block-meta {
  font-size: 11px;
  color: var(--color-text-muted, #6B7280);
}
.rules-for-block-firing-count { color: #991B1B; font-weight: 600; }

.rules-for-block-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rules-for-block-item {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 4px 0;
}
.rules-for-block-sev {
  text-align: center;
  font-size: 11px;
}
.rules-for-block-sev--info { color: #2563EB; }
.rules-for-block-sev--warning { color: #F59E0B; }
.rules-for-block-sev--error { color: #DC2626; }
.rules-for-block-name {
  color: #111827;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rules-for-block-state {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 8px;
  flex-shrink: 0;
}
.rules-for-block-state--ok { background: #ECFDF5; color: #065F46; }
.rules-for-block-state--firing { background: #FEE2E2; color: #991B1B; }
.rules-for-block-state--off { background: #F3F4F6; color: #6B7280; }

.rules-for-block-btn {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  width: 100%;
  padding: 8px 10px;
  background: rgba(37, 99, 235, 0.1);
  color: #1B3A5C;
  border: 1px dashed rgba(37, 99, 235, 0.4);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.rules-for-block-btn:hover {
  background: rgba(37, 99, 235, 0.18);
}

[data-theme="dark"] .rules-for-block {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .rules-for-block-header h4 { color: #93C5FD; }
[data-theme="dark"] .rules-for-block-name { color: #F1F5F9; }
[data-theme="dark"] .rules-for-block-btn {
  color: #93C5FD;
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(147, 197, 253, 0.4);
}

/* =============================================================
   Inline Intelligence (Sprint 6)
   - Suggestion chips on block hover
   - Auto-connect prompt balloon
   - Cmd+K global search modal
   - Starter suggestion toast
   ============================================================= */

/* Toolbar Cmd+K button */
.btn-toolbar.btn-toolbar--cmdk {
  font-size: 14px;
  padding: 4px 10px;
  border-color: rgba(37, 99, 235, 0.3);
}
.btn-toolbar.btn-toolbar--cmdk:hover {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.5);
}

/* ---------- Suggestion chips ---------- */

#inline-suggest-host {
  position: fixed;
  z-index: 8500;
  width: 280px;
  max-height: 80vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.15s, transform 0.15s;
  background: #FFF;
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
/* Subtle scrollbar inside the suggest panel */
#inline-suggest-host::-webkit-scrollbar { width: 6px; }
#inline-suggest-host::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.18); border-radius: 3px; }
#inline-suggest-host::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.3); }
#inline-suggest-host.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.inline-suggest-tip {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #1B3A5C;
  padding: 4px 4px 6px;
  border-bottom: 1px solid #F1F5F9;
}
.inline-suggest-chip {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: #F9FAFB;
  color: #1F2937;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.inline-suggest-chip:hover {
  background: #EFF6FF;
  border-color: rgba(37, 99, 235, 0.3);
}
.inline-suggest-chip:active {
  transform: translateY(1px);
}
.inline-suggest-chip--warning {
  background: #FEF3C7;
  color: #78350F;
}
.inline-suggest-chip--warning:hover {
  background: #FDE68A;
  border-color: rgba(245, 158, 11, 0.5);
}
.inline-suggest-chip--info {
  background: #DBEAFE;
  color: #1E40AF;
}
.inline-suggest-chip--info:hover {
  background: #BFDBFE;
  border-color: rgba(37, 99, 235, 0.5);
}
.inline-suggest-footer {
  font-size: 10px;
  color: #9CA3AF;
  text-align: center;
  padding: 4px 4px 2px;
  font-style: italic;
}

/* ---------- Auto-connect prompt ---------- */

.inline-connect-prompt {
  position: fixed;
  z-index: 8500;
  background: #1B3A5C;
  color: #FFF;
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  transform: translate(-50%, -50%);
  animation: inline-prompt-in 0.2s ease-out;
}
@keyframes inline-prompt-in {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 6px)); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}
.inline-connect-prompt--leaving {
  opacity: 0;
  transition: opacity 0.18s;
}
.inline-connect-text strong { color: #93C5FD; }
.inline-connect-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.inline-connect-yes,
.inline-connect-skip {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
}
.inline-connect-yes {
  background: #10B981;
  color: #FFF;
}
.inline-connect-yes:hover { background: #059669; }
.inline-connect-skip {
  background: rgba(255, 255, 255, 0.12);
  color: #E5E7EB;
}
.inline-connect-skip:hover { background: rgba(255, 255, 255, 0.2); }

/* ---------- Cmd+K modal ---------- */

.cmdk-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
.cmdk-overlay.visible { display: flex; }

.cmdk-modal {
  width: min(620px, 92vw);
  max-height: 70vh;
  background: #FFF;
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cmdk-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #E5E7EB;
}
.cmdk-input-icon { font-size: 18px; flex-shrink: 0; }
#cmdk-input {
  font: inherit;
  font-size: 16px;
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: #111827;
}
#cmdk-input::placeholder { color: #9CA3AF; }
.cmdk-input-hint {
  font-size: 11px;
  color: #9CA3AF;
  white-space: nowrap;
}

.cmdk-results {
  overflow-y: auto;
  padding: 8px;
  flex: 1;
}
.cmdk-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6B7280;
  padding: 8px 8px 4px;
}
.cmdk-result {
  width: 100%;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  text-align: left;
  color: #111827;
  transition: background 0.1s;
}
.cmdk-result--active,
.cmdk-result:hover {
  background: #EFF6FF;
}
.cmdk-result-icon { font-size: 18px; text-align: center; }
.cmdk-result-body { min-width: 0; }
.cmdk-result-title {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmdk-result-subtitle {
  font-size: 12px;
  color: #6B7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}
.cmdk-result-action {
  font-size: 11px;
  font-weight: 600;
  color: #2563EB;
  background: rgba(37, 99, 235, 0.08);
  padding: 3px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}
.cmdk-empty {
  padding: 32px 16px;
  text-align: center;
  color: #9CA3AF;
  font-size: 14px;
}

/* ---------- Starter suggestion toast ---------- */

.inline-starter-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 8000;
  background: #FFF;
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 520px;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
}
.inline-starter-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.inline-starter-icon {
  font-size: 22px;
  line-height: 1;
}
.inline-starter-body {
  flex: 1;
  min-width: 0;
}
.inline-starter-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}
.inline-starter-sub {
  font-size: 13px;
  color: #4B5563;
  margin-top: 2px;
}
.inline-starter-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.inline-starter-load,
.inline-starter-dismiss {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
}
.inline-starter-load {
  background: #2563EB;
  color: #FFF;
}
.inline-starter-load:hover { background: #1D4ED8; }
.inline-starter-dismiss {
  background: #F3F4F6;
  color: #4B5563;
}
.inline-starter-dismiss:hover { background: #E5E7EB; }

/* ---------- Dark mode ---------- */

[data-theme="dark"] #inline-suggest-host {
  background: #1F2937;
  border-color: rgba(147, 197, 253, 0.3);
}
[data-theme="dark"] .inline-suggest-tip {
  color: #93C5FD;
  border-color: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .inline-suggest-chip {
  background: rgba(255, 255, 255, 0.05);
  color: #E5E7EB;
}
[data-theme="dark"] .inline-suggest-chip:hover {
  background: rgba(37, 99, 235, 0.18);
}
[data-theme="dark"] .inline-suggest-chip--warning {
  background: rgba(245, 158, 11, 0.2);
  color: #FCD34D;
}
[data-theme="dark"] .inline-suggest-chip--info {
  background: rgba(37, 99, 235, 0.22);
  color: #93C5FD;
}
[data-theme="dark"] .inline-suggest-footer { color: #6B7280; }

[data-theme="dark"] .cmdk-modal {
  background: #1F2937;
  color: #E5E7EB;
}
[data-theme="dark"] .cmdk-input-wrap { border-color: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] #cmdk-input { color: #F1F5F9; }
[data-theme="dark"] .cmdk-result { color: #F1F5F9; }
[data-theme="dark"] .cmdk-result--active,
[data-theme="dark"] .cmdk-result:hover {
  background: rgba(37, 99, 235, 0.18);
}
[data-theme="dark"] .cmdk-result-subtitle { color: #94A3B8; }
[data-theme="dark"] .cmdk-result-action {
  background: rgba(37, 99, 235, 0.25);
  color: #93C5FD;
}
[data-theme="dark"] .cmdk-group-label { color: #94A3B8; }
[data-theme="dark"] .cmdk-empty { color: #94A3B8; }

[data-theme="dark"] .inline-starter-toast {
  background: #1F2937;
  border-color: rgba(147, 197, 253, 0.3);
}
[data-theme="dark"] .inline-starter-title { color: #F1F5F9; }
[data-theme="dark"] .inline-starter-sub { color: #CBD5E1; }
[data-theme="dark"] .inline-starter-dismiss {
  background: rgba(255, 255, 255, 0.08);
  color: #CBD5E1;
}
[data-theme="dark"] .inline-starter-dismiss:hover { background: rgba(255, 255, 255, 0.14); }

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
  .cmdk-modal { width: 96vw; max-height: 80vh; }
  .cmdk-input-hint { display: none; }
  #inline-suggest-host { width: 240px; }
  .inline-starter-toast {
    max-width: calc(100vw - 24px);
    flex-direction: column;
    align-items: stretch;
  }
  .inline-starter-actions { justify-content: flex-end; }
}

/* ---------- Inline suggestions: templates expand area ---------- */

.inline-suggest-chips {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inline-suggest-chip--templates {
  background: #ECFEFF !important;
  color: #155E75 !important;
  font-weight: 600;
  font-size: 12px;
  padding: 6px 10px !important;
  border: 1px dashed rgba(8, 145, 178, 0.4) !important;
  margin-top: 2px;
}
.inline-suggest-chip--templates:hover {
  background: #CFFAFE !important;
  border-color: rgba(8, 145, 178, 0.7) !important;
}
.inline-suggest-chip--templates.inline-suggest-chip--expanded {
  background: #CFFAFE !important;
  border-style: solid !important;
}

.inline-suggest-templates {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed #E5E7EB;
  max-height: 1600px;          /* effectively unbounded — outer panel handles scroll */
  overflow: visible;
  transition: max-height 0.18s, opacity 0.18s, margin 0.18s, padding 0.18s;
}
.inline-suggest-templates.is-collapsed {
  max-height: 0;
  margin-top: 0;
  padding-top: 0;
  border-top-color: transparent;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.inline-suggest-template {
  font: inherit;
  font-size: 12px;
  text-align: left;
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  color: #1F2937;
  transition: background 0.1s;
}
.inline-suggest-template:hover {
  background: #F0F9FF;
}
.inline-suggest-template-icon { font-size: 14px; text-align: center; }
.inline-suggest-template-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

.inline-suggest-template-more {
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  padding: 6px 6px;
  border: none;
  background: rgba(8, 145, 178, 0.06);
  color: #0E7490;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.1s;
}
.inline-suggest-template-more:hover { background: rgba(8, 145, 178, 0.14); }

/* Dark mode */
[data-theme="dark"] .inline-suggest-chip--templates {
  background: rgba(8, 145, 178, 0.18) !important;
  color: #67E8F9 !important;
  border-color: rgba(103, 232, 249, 0.35) !important;
}
[data-theme="dark"] .inline-suggest-chip--templates:hover,
[data-theme="dark"] .inline-suggest-chip--templates.inline-suggest-chip--expanded {
  background: rgba(8, 145, 178, 0.3) !important;
}
[data-theme="dark"] .inline-suggest-templates { border-top-color: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .inline-suggest-template { color: #E5E7EB; }
[data-theme="dark"] .inline-suggest-template:hover { background: rgba(8, 145, 178, 0.12); }
[data-theme="dark"] .inline-suggest-template-more {
  background: rgba(8, 145, 178, 0.18);
  color: #67E8F9;
}
[data-theme="dark"] .inline-suggest-template-more:hover { background: rgba(8, 145, 178, 0.3); }

/* ---------- Detail panel: Rules tab cards ---------- */

.detail-section-meta {
  font-size: 11px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--color-text-muted, #6B7280);
}
.rule-section-firing { color: #991B1B; font-weight: 600; }

.rule-card-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rule-card {
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 6px;
  padding: 10px 12px;
  background: #FFF;
  transition: opacity 0.15s;
}
.rule-card--info { border-left: 3px solid #2563EB; }
.rule-card--warning { border-left: 3px solid #F59E0B; }
.rule-card--error { border-left: 3px solid #DC2626; }
.rule-card--disabled { opacity: 0.6; }

.rule-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.rule-card-sev {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.rule-card-sev--info { background: #DBEAFE; color: #1E40AF; }
.rule-card-sev--warning { background: #FEF3C7; color: #92400E; }
.rule-card-sev--error { background: #FEE2E2; color: #991B1B; }

.rule-card-state {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 8px;
  flex: 1 1 auto;
  text-align: center;
}
.rule-card-state--ok { background: #ECFDF5; color: #065F46; }
.rule-card-state--firing { background: #FEE2E2; color: #991B1B; }
.rule-card-state--off { background: #F3F4F6; color: #6B7280; }

.rule-card-toggle {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  cursor: pointer;
}
.rule-card-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.rule-card-toggle-track {
  display: inline-block;
  width: 30px;
  height: 16px;
  background: #D1D5DB;
  border-radius: 8px;
  position: relative;
  transition: background 0.18s;
}
.rule-card-toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: #FFF;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transition: transform 0.18s;
}
.rule-card-toggle input:checked + .rule-card-toggle-track { background: #2563EB; }
.rule-card-toggle input:checked + .rule-card-toggle-track::after { transform: translateX(14px); }

.rule-card-title {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  line-height: 1.35;
  margin-bottom: 4px;
}
.rule-card-desc {
  font-size: 12px;
  color: var(--color-text-muted, #4B5563);
  line-height: 1.45;
  margin-bottom: 6px;
}
.rule-card-citation {
  font-size: 11px;
  color: var(--color-text-muted, #6B7280);
  font-style: italic;
}

[data-theme="dark"] .rule-card { background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .rule-card-title { color: #F1F5F9; }
[data-theme="dark"] .rule-card-desc { color: #CBD5E1; }

/* ---------- Snap button + grid: make state more discoverable ---------- */
.btn-toolbar.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #FFFFFF;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}
.canvas-viewport.grid-on .canvas-grid {
  opacity: 0.55;
}
[data-theme="dark"] .canvas-viewport.grid-on .canvas-grid {
  opacity: 0.4;
}

/* ---------- Block hover quick actions + inline title edit ---------- */

.canvas-block-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.12s;
  pointer-events: none;
  z-index: 5;
}
.canvas-block:hover .canvas-block-actions,
.canvas-block.selected .canvas-block-actions {
  opacity: 1;
  pointer-events: auto;
}

.canvas-block-action {
  font: inherit;
  font-size: 13px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border, #E5E7EB);
  background: rgba(255, 255, 255, 0.95);
  color: #374151;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.canvas-block-action:hover {
  background: #2563EB;
  color: #FFF;
  border-color: #2563EB;
}
.canvas-block-action--danger:hover {
  background: #DC2626;
  border-color: #DC2626;
}

.canvas-block-title-edit {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  background: #FFF;
  border: 1px solid #2563EB;
  border-radius: 3px;
  padding: 2px 4px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  margin: -2px 0;
}

[data-theme="dark"] .canvas-block-action {
  background: rgba(31, 41, 55, 0.95);
  border-color: rgba(255, 255, 255, 0.12);
  color: #E5E7EB;
}
[data-theme="dark"] .canvas-block-action:hover {
  background: #2563EB;
  color: #FFF;
}
[data-theme="dark"] .canvas-block-title-edit {
  background: #1F2937;
  color: #F1F5F9;
  border-color: #93C5FD;
}

/* ---------- Narrative export modal ---------- */

.narrative-overlay { z-index: 9200; }

.narrative-modal {
  width: min(820px, 96vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.narrative-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.narrative-header h2 { margin: 0 0 4px; }
.narrative-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-muted, #6B7280);
}

.narrative-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--color-border, #E5E7EB);
  background: var(--color-bg-subtle, #F9FAFB);
  flex-wrap: wrap;
}

.narrative-lang-switch {
  display: inline-flex;
  border: 1px solid var(--color-border, #D1D5DB);
  border-radius: 6px;
  overflow: hidden;
}
.narrative-lang-btn {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  background: #FFF;
  color: #4B5563;
  border: none;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.narrative-lang-btn:hover { background: #F3F4F6; }
.narrative-lang-btn.active {
  background: #1B3A5C;
  color: #FFF;
}

.narrative-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.narrative-body {
  flex: 1;
  overflow: hidden;
  padding: 16px 24px;
  background: #FFF;
  display: flex;
}

.narrative-textarea {
  width: 100%;
  flex: 1;
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 6px;
  padding: 14px;
  background: #F9FAFB;
  color: #111827;
  resize: none;
  outline: none;
  min-height: 380px;
}
.narrative-textarea:focus { border-color: #2563EB; background: #FFF; }

.narrative-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  border-top: 1px solid var(--color-border, #E5E7EB);
  background: var(--color-bg-subtle, #F9FAFB);
}
.narrative-hint {
  font-size: 12px;
  color: var(--color-text-muted, #6B7280);
  font-style: italic;
}

[data-theme="dark"] .narrative-toolbar,
[data-theme="dark"] .narrative-footer {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .narrative-body { background: #0F172A; }
[data-theme="dark"] .narrative-textarea {
  background: rgba(255, 255, 255, 0.04);
  color: #F1F5F9;
  border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .narrative-textarea:focus { background: rgba(255, 255, 255, 0.06); border-color: #93C5FD; }
[data-theme="dark"] .narrative-lang-btn {
  background: rgba(255, 255, 255, 0.05);
  color: #CBD5E1;
}
[data-theme="dark"] .narrative-lang-btn.active { background: #2563EB; color: #FFF; }

/* ---------- Branded confirm modal ---------- */

.confirm-modal-overlay {
  z-index: 10000;
}

.confirm-modal {
  width: min(440px, 92vw);
  background: #FFF;
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  padding: 28px 28px 20px;
  display: grid;
  grid-template-columns: 56px 1fr;
  grid-template-rows: auto auto;
  column-gap: 16px;
  row-gap: 14px;
  animation: confirm-pop 0.18s ease-out;
}
@keyframes confirm-pop {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.confirm-modal-icon {
  font-size: 36px;
  line-height: 1;
  text-align: center;
}
.confirm-modal--danger .confirm-modal-icon { color: #DC2626; }

.confirm-modal-body { min-width: 0; }
.confirm-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 8px;
}
.confirm-modal-message {
  font-size: 14px;
  color: #4B5563;
  line-height: 1.55;
  margin: 0;
}

.confirm-modal-actions {
  grid-column: 1 / 3;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

.confirm-modal-cancel,
.confirm-modal-ok {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 20px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.1s, transform 0.05s;
}
.confirm-modal-cancel {
  background: #F3F4F6;
  color: #374151;
  border-color: #E5E7EB;
}
.confirm-modal-cancel:hover { background: #E5E7EB; }

.confirm-modal-ok {
  background: #2563EB;
  color: #FFF;
}
.confirm-modal-ok:hover { background: #1D4ED8; }

.confirm-modal--danger .confirm-modal-ok {
  background: #DC2626;
  color: #FFF;
}
.confirm-modal--danger .confirm-modal-ok:hover { background: #B91C1C; }

.confirm-modal-cancel:focus-visible,
.confirm-modal-ok:focus-visible {
  outline: 2px solid #93C5FD;
  outline-offset: 2px;
}

[data-theme="dark"] .confirm-modal {
  background: #1F2937;
}
[data-theme="dark"] .confirm-modal-title { color: #F1F5F9; }
[data-theme="dark"] .confirm-modal-message { color: #CBD5E1; }
[data-theme="dark"] .confirm-modal-cancel {
  background: rgba(255, 255, 255, 0.05);
  color: #E5E7EB;
  border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .confirm-modal-cancel:hover { background: rgba(255, 255, 255, 0.1); }

/* Hide empty-state when user explicitly dismisses it */
.canvas-empty.canvas-empty--dismissed {
  display: none !important;
}

/* Lifecycle B.1 sections inside the inline-suggest panel */
.inline-suggest-section {
  margin-top: 6px;
}
.inline-suggest-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 4px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.inline-suggest-section-title--enabling { color: #15803D; }
.inline-suggest-section-title--enabling::before {
  content: "E";
  display: inline-flex;
  width: 14px;
  height: 14px;
  align-items: center;
  justify-content: center;
  background: #15803D;
  color: #FFF;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
}
.inline-suggest-section-title--supporting { color: #2563EB; }
.inline-suggest-section-title--supporting::before {
  content: "S";
  display: inline-flex;
  width: 14px;
  height: 14px;
  align-items: center;
  justify-content: center;
  background: #2563EB;
  color: #FFF;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
}

.inline-suggest-chip--enabling {
  background: #DCFCE7 !important;
  color: #14532D !important;
  border: 1px solid rgba(21, 128, 61, 0.3) !important;
}
.inline-suggest-chip--enabling:hover {
  background: #BBF7D0 !important;
  border-color: rgba(21, 128, 61, 0.6) !important;
}
.inline-suggest-chip--supporting {
  background: #DBEAFE !important;
  color: #1E40AF !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
}
.inline-suggest-chip--supporting:hover {
  background: #BFDBFE !important;
  border-color: rgba(37, 99, 235, 0.6) !important;
}

[data-theme="dark"] .inline-suggest-section-title--enabling { color: #86EFAC; }
[data-theme="dark"] .inline-suggest-chip--enabling {
  background: rgba(21, 128, 61, 0.2) !important;
  color: #86EFAC !important;
  border-color: rgba(134, 239, 172, 0.35) !important;
}
[data-theme="dark"] .inline-suggest-chip--enabling:hover {
  background: rgba(21, 128, 61, 0.35) !important;
}
[data-theme="dark"] .inline-suggest-section-title--supporting { color: #93C5FD; }
[data-theme="dark"] .inline-suggest-chip--supporting {
  background: rgba(37, 99, 235, 0.22) !important;
  color: #93C5FD !important;
  border-color: rgba(147, 197, 253, 0.35) !important;
}
[data-theme="dark"] .inline-suggest-chip--supporting:hover {
  background: rgba(37, 99, 235, 0.4) !important;
}

/* PSLM role badge inside block (Enabling / Supporting from Table B.1) */
.canvas-block-pslm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 3px 8px 3px 4px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  align-self: flex-start;
  max-width: 100%;
}
.canvas-block-pslm-letter {
  display: inline-flex;
  width: 14px;
  height: 14px;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  color: #FFF;
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
}
.canvas-block-pslm-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.canvas-block-pslm--enabling {
  background: #DCFCE7;
  color: #14532D;
  border: 1px solid rgba(21, 128, 61, 0.25);
}
.canvas-block-pslm--enabling .canvas-block-pslm-letter { background: #15803D; }
.canvas-block-pslm--supporting {
  background: #DBEAFE;
  color: #1E40AF;
  border: 1px solid rgba(37, 99, 235, 0.25);
}
.canvas-block-pslm--supporting .canvas-block-pslm-letter { background: #2563EB; }

[data-theme="dark"] .canvas-block-pslm--enabling {
  background: rgba(21, 128, 61, 0.18);
  color: #86EFAC;
  border-color: rgba(134, 239, 172, 0.3);
}
[data-theme="dark"] .canvas-block-pslm--supporting {
  background: rgba(37, 99, 235, 0.2);
  color: #93C5FD;
  border-color: rgba(147, 197, 253, 0.3);
}

/* Template-blocks on the canvas — make them visually distinct from regular blocks */
.canvas-block[data-block-id]:has(.canvas-block-category:not(:empty)) {}  /* placeholder */
.canvas-block.canvas-block--template,
.canvas-block[data-category="templates"] {
  background: linear-gradient(180deg, #ECFEFF 0%, #FFF 100%);
  border-left-color: #0891B2;
}
.canvas-block.canvas-block--template .canvas-block-title,
.canvas-block[data-category="templates"] .canvas-block-title {
  color: #155E75;
}
[data-theme="dark"] .canvas-block.canvas-block--template,
[data-theme="dark"] .canvas-block[data-category="templates"] {
  background: linear-gradient(180deg, rgba(8, 145, 178, 0.18) 0%, rgba(8, 145, 178, 0.06) 100%);
}
[data-theme="dark"] .canvas-block.canvas-block--template .canvas-block-title {
  color: #67E8F9;
}

/* Practice context — reverse B.1 + Inside-this-practice section */
.inline-suggest-section-title--reverse { color: #7C3AED; }
.inline-suggest-section-title--reverse::before {
  content: "🔄";
  display: inline-flex;
  font-size: 12px;
  background: none;
  border-radius: 0;
  width: auto; height: auto;
  color: inherit;
}
.inline-suggest-section-title--inside { color: #0891B2; }
.inline-suggest-section-title--inside::before {
  content: "📚";
  display: inline-flex;
  font-size: 12px;
  background: none;
  border-radius: 0;
  width: auto; height: auto;
  color: inherit;
}

.inline-suggest-internals {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.inline-internal-chip {
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border: 1px solid #E5E7EB;
  background: #F9FAFB;
  color: #374151;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.1s;
}
.inline-internal-chip:hover { background: #EFF6FF; border-color: rgba(8, 145, 178, 0.4); color: #155E75; }
.inline-internal-chip--active {
  background: #ECFEFF;
  border-color: rgba(8, 145, 178, 0.6);
  color: #155E75;
}

.inline-internal-panel {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed #E5E7EB;
  max-height: 1600px;          /* effectively unbounded — outer panel handles scroll */
  overflow: visible;
  transition: max-height 0.18s, opacity 0.18s, margin 0.18s, padding 0.18s;
}
.inline-internal-panel.is-collapsed {
  max-height: 0;
  margin-top: 0;
  padding-top: 0;
  border-top-color: transparent;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.inline-internal-item {
  font: inherit;
  font-size: 12px;
  text-align: left;
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  color: #1F2937;
}
.inline-internal-item:hover { background: #F0F9FF; }
.inline-internal-icon { font-size: 13px; text-align: center; }
.inline-internal-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}
.inline-internal-lacmt {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: #1B3A5C;
  color: #FFF;
  padding: 1px 6px;
  border-radius: 8px;
}

[data-theme="dark"] .inline-internal-chip {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: #CBD5E1;
}
[data-theme="dark"] .inline-internal-chip:hover,
[data-theme="dark"] .inline-internal-chip--active {
  background: rgba(8, 145, 178, 0.15);
  color: #67E8F9;
}
[data-theme="dark"] .inline-internal-panel { border-top-color: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .inline-internal-item { color: #E5E7EB; }
[data-theme="dark"] .inline-internal-item:hover { background: rgba(8, 145, 178, 0.1); }
[data-theme="dark"] .inline-suggest-section-title--reverse { color: #C4B5FD; }
[data-theme="dark"] .inline-suggest-section-title--inside { color: #67E8F9; }

/* ---------- Canvas search bar (Cmd+F / Ctrl+F) ---------- */

.canvas-search-bar {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  z-index: 80;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--color-surface, #FFF);
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  min-width: 380px;
  max-width: 90%;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
}
.canvas-search-bar.visible {
  display: flex;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.canvas-search-icon { font-size: 14px; padding: 0 2px; flex-shrink: 0; }
#canvas-search-input {
  font: inherit;
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: inherit;
  padding: 4px 6px;
}
.canvas-search-counter {
  font-size: 11px;
  color: var(--color-text-muted, #6B7280);
  font-variant-numeric: tabular-nums;
  padding: 2px 8px;
  background: #F3F4F6;
  border-radius: 10px;
}
.canvas-search-counter--zero { background: #FEE2E2; color: #991B1B; }

.canvas-search-btn {
  font: inherit;
  font-size: 12px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border, #D1D5DB);
  background: #FFF;
  color: #374151;
  border-radius: 4px;
  cursor: pointer;
}
.canvas-search-btn:hover { background: #F3F4F6; }
.canvas-search-btn--close { color: #DC2626; }

/* Block match states */
.canvas-block--search-dimmed {
  opacity: 0.25;
  filter: grayscale(0.6);
  transition: opacity 0.18s, filter 0.18s;
}
.canvas-block--search-match {
  outline: 2px solid #F59E0B;
  outline-offset: 2px;
}
.canvas-block--search-active {
  outline: 3px solid #DC2626 !important;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.15) !important;
  z-index: 5;
}

[data-theme="dark"] .canvas-search-bar {
  background: #1F2937;
  border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .canvas-search-counter {
  background: rgba(255, 255, 255, 0.06);
  color: #CBD5E1;
}
[data-theme="dark"] .canvas-search-btn {
  background: rgba(255, 255, 255, 0.05);
  color: #E5E7EB;
  border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .canvas-search-btn:hover { background: rgba(255, 255, 255, 0.1); }

/* ---------- Theme presets (overlay on top of light/dark) ---------- */

/* Print preset: B&W high contrast for A4 print or screenshots */
[data-theme-preset="print"] {
  --color-accent: #000000;
}
[data-theme-preset="print"] .canvas-block {
  background: #FFFFFF !important;
  border: 2px solid #000000 !important;
  border-left-width: 4px !important;
  box-shadow: none !important;
  color: #000000 !important;
}
[data-theme-preset="print"] .canvas-block .canvas-block-title { color: #000000 !important; }
[data-theme-preset="print"] .canvas-block .canvas-block-desc,
[data-theme-preset="print"] .canvas-block .canvas-block-category { color: #333333 !important; }
[data-theme-preset="print"] .canvas-block-tag { background: #FFFFFF !important; color: #000000 !important; border: 1px solid #000000 !important; }
[data-theme-preset="print"] .canvas-block.selected { box-shadow: 0 0 0 3px #000000 !important; }
[data-theme-preset="print"] .connector-line { stroke: #000000 !important; stroke-width: 2 !important; }
[data-theme-preset="print"] .connector-label-bg { fill: #FFFFFF !important; stroke: #000000 !important; }
[data-theme-preset="print"] .connector-label-text { fill: #000000 !important; }
[data-theme-preset="print"] .canvas-grid { display: none !important; }
[data-theme-preset="print"] .minimap { display: none !important; }
[data-theme-preset="print"] .canvas-block-pslm--enabling,
[data-theme-preset="print"] .canvas-block-pslm--supporting {
  background: #FFFFFF !important;
  color: #000000 !important;
  border: 1px solid #000000 !important;
}
[data-theme-preset="print"] .canvas-block-pslm-letter { background: #000000 !important; }

/* Pitch preset: vivid saturated colours for projector / presentation */
[data-theme-preset="pitch"] .canvas-block {
  border-left-width: 6px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15) !important;
}
[data-theme-preset="pitch"] .canvas-block .canvas-block-title { font-weight: 700 !important; }
[data-theme-preset="pitch"] .canvas-block-tag { font-weight: 600 !important; }
[data-theme-preset="pitch"] .connector-line { stroke-width: 2.5 !important; opacity: 1 !important; }

/* Pastel preset: muted calm tones */
[data-theme-preset="pastel"] .canvas-block {
  background: #FAFAFA !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
  border-left-width: 3px !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03) !important;
}
[data-theme-preset="pastel"] .canvas-block .canvas-block-title { color: #4B5563 !important; font-weight: 500 !important; }
[data-theme-preset="pastel"] .canvas-block-tag { background: #F5F3FF !important; color: #6B7280 !important; }
[data-theme-preset="pastel"] .connector-line { stroke: #D4D4D8 !important; stroke-width: 1.5 !important; }

/* ---------- History dock ---------- */

.history-dock {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 70;
  background: var(--color-surface, #FFF);
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 10px 14px;
  display: none;
  flex-direction: column;
  gap: 8px;
  min-width: 380px;
  max-width: 80vw;
  opacity: 0;
  transition: opacity 0.18s, transform 0.18s;
}
.history-dock.visible {
  display: flex;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.history-dock-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.history-dock-title {
  font-weight: 700;
  color: #1B3A5C;
}
.history-dock-counter {
  flex: 1;
  color: var(--color-text-muted, #6B7280);
  font-variant-numeric: tabular-nums;
}
.history-dock-close {
  font: inherit;
  font-size: 16px;
  background: none;
  border: none;
  color: #6B7280;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.history-dock-track {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 4px 0;
}
.history-dock-dot {
  font: inherit;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s;
}
.history-dock-dot:hover { transform: scale(1.3); }
.history-dock-dot--past   { background: #94A3B8; }
.history-dock-dot--now    {
  background: #2563EB;
  width: 18px;
  height: 18px;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}
.history-dock-dot--future { background: #D1D5DB; }
.history-dock-ellipsis {
  font-size: 11px;
  color: var(--color-text-muted, #6B7280);
  padding: 0 6px;
}

.history-dock-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.history-dock-btn {
  font: inherit;
  font-size: 12px;
  padding: 6px 12px;
  background: #F3F4F6;
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 6px;
  cursor: pointer;
  color: #374151;
  flex: 1;
}
.history-dock-btn:hover:not(:disabled) { background: #E5E7EB; }
.history-dock-btn:disabled { opacity: 0.4; cursor: not-allowed; }

[data-theme="dark"] .history-dock {
  background: #1F2937;
  border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .history-dock-title { color: #93C5FD; }
[data-theme="dark"] .history-dock-btn {
  background: rgba(255, 255, 255, 0.05);
  color: #E5E7EB;
  border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .history-dock-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); }

/* ---------- Presentation mode (fullscreen slides) ---------- */

.presentation-overlay {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: none;
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
  color: #F1F5F9;
}
.presentation-overlay.visible { display: block; }

.presentation-canvas {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 80px;
  overflow-y: auto;
}

.pres-slide {
  max-width: 960px;
  width: 100%;
  text-align: left;
  animation: pres-slide-in 0.25s ease-out;
}
@keyframes pres-slide-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.pres-eyebrow {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #93C5FD;
  margin-bottom: 12px;
}

.pres-cover-title {
  font-size: 56px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 32px;
  line-height: 1.1;
  color: #FFF;
}

.pres-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}
.pres-stat {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 18px 12px;
  text-align: center;
}
.pres-stat-num {
  font-size: 36px;
  font-weight: 700;
  color: #93C5FD;
  line-height: 1;
}
.pres-stat-label {
  font-size: 12px;
  color: #CBD5E1;
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.pres-cover-footnote {
  font-size: 12px;
  color: #94A3B8;
  font-style: italic;
}

.pres-section-title {
  font-size: 36px;
  font-weight: 700;
  margin: 0 0 24px;
  color: #FFF;
  letter-spacing: -0.01em;
}
.pres-subtitle {
  font-size: 16px;
  font-weight: 600;
  margin: 18px 0 10px;
  color: #93C5FD;
}

.pres-purpose {
  font-size: 19px;
  line-height: 1.55;
  color: #E2E8F0;
  margin-bottom: 18px;
}

.pres-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.pres-list li { font-size: 15px; line-height: 1.5; color: #E2E8F0; padding-left: 18px; position: relative; }
.pres-list li::before { content: "•"; position: absolute; left: 0; color: #93C5FD; }
.pres-list strong { color: #FFF; font-weight: 600; }
.pres-list--inline {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px 18px;
}
.pres-list--inline li::before { display: none; }
.pres-mute { color: #94A3B8; }

.pres-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.pres-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 14px;
}
.pres-card-icon { font-size: 22px; margin-bottom: 6px; }
.pres-card-title { font-weight: 600; color: #FFF; margin-bottom: 4px; }
.pres-card-desc { font-size: 12px; color: #CBD5E1; line-height: 1.45; }

.pres-pslm-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}
.pres-pslm-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  color: #FFF;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pres-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pres-pill {
  background: rgba(147, 197, 253, 0.15);
  color: #93C5FD;
  padding: 6px 14px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 500;
}

.pres-lacmt {
  font-size: 9px;
  font-weight: 700;
  background: #1B3A5C;
  color: #FFF;
  padding: 1px 6px;
  border-radius: 6px;
  margin-left: 6px;
  vertical-align: middle;
}

.pres-slide--closing {
  text-align: center;
}
.pres-closing-icon { font-size: 64px; margin-bottom: 24px; }
.pres-closing-title { font-size: 56px; font-weight: 800; margin: 0 0 16px; color: #FFF; }
.pres-closing-sub { font-size: 18px; color: #CBD5E1; margin-bottom: 12px; }
.pres-closing-meta { font-size: 12px; color: #94A3B8; }

.presentation-controls {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 8px 16px;
  backdrop-filter: blur(8px);
  z-index: 11001;
}
.presentation-btn {
  font: inherit;
  font-size: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #FFF;
  cursor: pointer;
  transition: background 0.15s;
}
.presentation-btn:hover { background: rgba(255, 255, 255, 0.2); }
.presentation-btn--close { background: rgba(220, 38, 38, 0.3); }
.presentation-btn--close:hover { background: rgba(220, 38, 38, 0.6); }
.presentation-counter {
  color: #CBD5E1;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  padding: 0 12px;
  min-width: 70px;
  text-align: center;
}

body.presentation-active { overflow: hidden; }

/* ---------- Assessment dashboard (modal) ---------- */

.btn-toolbar.btn-toolbar--assessment {
  border-color: rgba(124, 58, 237, 0.4);
  color: #6D28D9;
  background: rgba(124, 58, 237, 0.06);
  font-weight: 600;
}
.btn-toolbar.btn-toolbar--assessment:hover {
  background: rgba(124, 58, 237, 0.14);
}
[data-theme="dark"] .btn-toolbar.btn-toolbar--assessment {
  color: #C4B5FD;
  background: rgba(124, 58, 237, 0.18);
  border-color: rgba(196, 181, 253, 0.4);
}

.assessment-overlay { z-index: 9300; }
.assessment-modal {
  width: min(1100px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}
.assessment-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.assessment-header h2 { margin: 0 0 4px; }
.assessment-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-muted, #6B7280);
}

.assessment-tabs {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  border-bottom: 1px solid var(--color-border, #E5E7EB);
}
.assessment-tab {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 16px;
  color: var(--color-text-muted, #6B7280);
  cursor: pointer;
  margin-bottom: -1px;
}
.assessment-tab:hover { color: #1B3A5C; }
.assessment-tab.active {
  color: #7C3AED;
  border-bottom-color: #7C3AED;
}

.assessment-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  background: #FFF;
}

.assess-lede {
  font-size: 13px;
  color: var(--color-text-muted, #4B5563);
  line-height: 1.55;
  margin: 0 0 18px;
}
.assess-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #1B3A5C;
  margin: 22px 0 10px;
}
.assess-footnote {
  font-size: 11px;
  font-style: italic;
  color: var(--color-text-muted, #9CA3AF);
  margin-top: 18px;
}

/* What's missing */
.assess-missing-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.assess-missing-row {
  display: grid;
  grid-template-columns: 32px 180px 1fr 60px;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  background: #F9FAFB;
}
.assess-missing-row--ok   { background: #ECFDF5; }
.assess-missing-row--warn { background: #FFFBEB; }
.assess-missing-row--low  { background: #FEF2F2; }
.assess-missing-icon { font-size: 16px; text-align: center; }
.assess-missing-label { font-size: 13px; color: #1F2937; font-weight: 500; }
.assess-missing-bar {
  height: 8px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 4px;
  overflow: hidden;
}
.assess-missing-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #DC2626 0%, #F59E0B 50%, #15803D 100%);
  background-size: 200% 100%;
  background-position: right;
  transition: width 0.4s;
}
.assess-missing-row--ok   .assess-missing-bar-fill { background: #15803D; }
.assess-missing-row--warn .assess-missing-bar-fill { background: #F59E0B; }
.assess-missing-row--low  .assess-missing-bar-fill { background: #DC2626; }
.assess-missing-count {
  font-size: 12px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #4B5563;
}

.assess-quick-adds {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.assess-quick-btn {
  font: inherit;
  font-size: 12px;
  padding: 6px 12px;
  border: 1px dashed rgba(124, 58, 237, 0.4);
  background: rgba(124, 58, 237, 0.06);
  color: #6D28D9;
  border-radius: 12px;
  cursor: pointer;
  text-transform: capitalize;
}
.assess-quick-btn:hover {
  background: rgba(124, 58, 237, 0.16);
  border-color: rgba(124, 58, 237, 0.6);
}

/* Heatmap */
.assess-heatmap-scroll { overflow-x: auto; max-width: 100%; }
.assess-heatmap-table {
  border-collapse: collapse;
  font-size: 11px;
  width: 100%;
}
.assess-heatmap-table th,
.assess-heatmap-table td {
  border: 1px solid #E5E7EB;
  padding: 4px 6px;
  text-align: center;
}
.assess-heatmap-row-header {
  text-align: left !important;
  font-weight: 500;
  color: #374151;
  background: #F9FAFB;
  position: sticky;
  left: 0;
  z-index: 1;
  white-space: nowrap;
  padding-right: 12px !important;
}
.assess-heatmap-row--on .assess-heatmap-row-header {
  background: #DBEAFE;
  color: #1E40AF;
  font-weight: 700;
}
.assess-heatmap-col-header {
  font-weight: 600;
  background: #F3F4F6;
  color: #374151;
  width: 48px;
}
.assess-heatmap-col-header--on {
  background: #DBEAFE;
  color: #1E40AF;
}
.assess-heatmap-cell {
  font-weight: 700;
  font-size: 11px;
  width: 48px;
  height: 28px;
  color: #FFF;
}
.assess-heatmap-cell--e          { background: rgba(21, 128, 61, 0.25); color: #14532D; }
.assess-heatmap-cell--s          { background: rgba(37, 99, 235, 0.25); color: #1E40AF; }
.assess-heatmap-cell--practice-on,
.assess-heatmap-cell--lifecycle-on {
  background: var(--cell-mid, rgba(124, 58, 237, 0.4));
}
.assess-heatmap-cell--e.assess-heatmap-cell--practice-on,
.assess-heatmap-cell--e.assess-heatmap-cell--lifecycle-on { background: rgba(21, 128, 61, 0.55); color: #FFF; }
.assess-heatmap-cell--s.assess-heatmap-cell--practice-on,
.assess-heatmap-cell--s.assess-heatmap-cell--lifecycle-on { background: rgba(37, 99, 235, 0.55); color: #FFF; }
.assess-heatmap-cell--both-on { box-shadow: inset 0 0 0 2px #FFF; }
.assess-heatmap-cell--e.assess-heatmap-cell--both-on { background: #15803D !important; color: #FFF; }
.assess-heatmap-cell--s.assess-heatmap-cell--both-on { background: #2563EB !important; color: #FFF; }

.assess-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--color-text-muted, #6B7280);
}
.assess-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.assess-legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
}
.assess-legend-swatch--both { background: #15803D; }
.assess-legend-swatch--one  { background: rgba(21, 128, 61, 0.55); }
.assess-legend-swatch--none { background: rgba(21, 128, 61, 0.25); }
.assess-legend-pill {
  display: inline-block;
  padding: 0 6px;
  border-radius: 3px;
  font-weight: 700;
  font-size: 11px;
}

/* Score */
.assess-score-hero {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 28px;
}
.assess-score-num {
  font-size: 72px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}
.assess-score-grade {
  font-size: 28px;
  font-weight: 800;
  color: #FFF;
  padding: 6px 16px;
  border-radius: 8px;
}
.assess-score-of {
  font-size: 20px;
  color: var(--color-text-muted, #6B7280);
}
.assess-score-breakdown {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.assess-score-row {
  display: grid;
  grid-template-columns: 160px 1fr 60px;
  grid-template-rows: auto auto;
  gap: 4px 12px;
  align-items: center;
}
.assess-score-label { font-weight: 600; color: #1F2937; }
.assess-score-bar {
  grid-column: 2;
  height: 10px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 5px;
  overflow: hidden;
}
.assess-score-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563EB 0%, #7C3AED 100%);
  transition: width 0.4s;
}
.assess-score-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; color: #4B5563; }
.assess-score-hint {
  grid-column: 2 / 4;
  font-size: 11px;
  color: var(--color-text-muted, #6B7280);
  font-style: italic;
}
.assess-score-tip {
  margin-top: 24px;
  padding: 12px 16px;
  background: #EFF6FF;
  border-radius: 8px;
  font-size: 13px;
  color: #1E40AF;
}

[data-theme="dark"] .assessment-body { background: #0F172A; }
[data-theme="dark"] .assess-missing-row { background: rgba(255, 255, 255, 0.03); }
[data-theme="dark"] .assess-missing-row--ok   { background: rgba(21, 128, 61, 0.15); }
[data-theme="dark"] .assess-missing-row--warn { background: rgba(245, 158, 11, 0.15); }
[data-theme="dark"] .assess-missing-row--low  { background: rgba(220, 38, 38, 0.15); }
[data-theme="dark"] .assess-missing-label,
[data-theme="dark"] .assess-score-label { color: #F1F5F9; }
[data-theme="dark"] .assess-heatmap-table th,
[data-theme="dark"] .assess-heatmap-table td { border-color: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .assess-heatmap-row-header,
[data-theme="dark"] .assess-heatmap-col-header { background: rgba(255, 255, 255, 0.04); color: #E5E7EB; }
[data-theme="dark"] .assess-heatmap-row--on .assess-heatmap-row-header,
[data-theme="dark"] .assess-heatmap-col-header--on { background: rgba(37, 99, 235, 0.3); color: #93C5FD; }
[data-theme="dark"] .assess-score-tip { background: rgba(37, 99, 235, 0.18); color: #93C5FD; }
[data-theme="dark"] .assess-quick-btn {
  background: rgba(124, 58, 237, 0.16);
  color: #C4B5FD;
  border-color: rgba(196, 181, 253, 0.4);
}

/* ---------- Toolbar Mode group (Select / Pan toggle) ---------- */
.toolbar-group--mode {
  background: rgba(0, 0, 0, 0.04);
  padding: 2px;
  border-radius: 6px;
  gap: 0 !important;
}
.btn-toolbar.btn-toolbar--mode {
  border: none;
  background: transparent;
  color: #6B7280;
  font-weight: 500;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 4px;
}
.btn-toolbar.btn-toolbar--mode .btn-toolbar-icon {
  font-size: 13px;
}
.btn-toolbar.btn-toolbar--mode:hover:not(.active) {
  color: #1B3A5C;
  background: rgba(255, 255, 255, 0.6);
}
.btn-toolbar.btn-toolbar--mode.active {
  background: #2563EB;
  color: #FFF;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  font-weight: 600;
}
.btn-toolbar.btn-toolbar--mode.active:hover { background: #1D4ED8; }

[data-theme="dark"] .toolbar-group--mode {
  background: rgba(255, 255, 255, 0.05);
}
[data-theme="dark"] .btn-toolbar.btn-toolbar--mode {
  color: #94A3B8;
}
[data-theme="dark"] .btn-toolbar.btn-toolbar--mode:hover:not(.active) {
  color: #F1F5F9;
  background: rgba(255, 255, 255, 0.08);
}

/* Header section in dropdowns */
.dropdown-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted, #6B7280);
  padding: 8px 12px 4px;
}

/* Header nav variants */
.header-nav.header-nav--left {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 16px;
}
.header-nav.header-nav--right {
  display: flex;
  align-items: center;
  gap: 4px;
}
.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 0 12px;
  min-width: 0;
}
.canvas-name-input {
  max-width: 320px;
  width: 100%;
}

/* Hidden helpers should not show */
.hidden { display: none !important; }

/* Palette collapsed state */
.palette.collapsed { display: none !important; }

/* Make the Mode group obviously two separate buttons */
.toolbar-group--mode {
  gap: 2px !important;        /* small gap between Select and Pan */
}
.btn-toolbar.btn-toolbar--mode {
  min-width: 70px;
  justify-content: center;
}
.btn-toolbar.btn-toolbar--mode:not(.active) {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.btn-toolbar.btn-toolbar--mode .btn-toolbar-icon {
  font-size: 14px;
  margin-right: 2px;
}
[data-theme="dark"] .btn-toolbar.btn-toolbar--mode:not(.active) {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

/* Detail panel collapses when nothing is selected — gives canvas full width */
.detail-panel.detail-panel--collapsed {
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  border-left: none !important;
  overflow: hidden !important;
}

/* ============================================================
   License watermark — set by app.js when window.__BS_LICENSE present
   ============================================================ */
.license-watermark {
  position: fixed;
  bottom: 8px;
  right: 12px;
  z-index: 50;
  font-size: 10px;
  font-weight: 500;
  color: rgba(27, 58, 92, 0.45);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(27, 58, 92, 0.08);
  padding: 3px 8px;
  border-radius: 10px;
  pointer-events: none;
  user-select: none;
  letter-spacing: 0.2px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
[data-theme="dark"] .license-watermark {
  color: rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.08);
}
