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

:root {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --text: #061B2A;
  --text-muted: rgba(14, 58, 82, 0.6);
  --border: #d1d9e0;
  --primary: #47A5D7;
  --primary-hover: #3590bf;
  --primary-light: rgba(71, 165, 215, 0.1);
  --accent-start: #53BFF9;
  --accent-end: #68DCA2;
  --navy: #061B2A;
  --navy-light: #0d2d42;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(6, 27, 42, 0.08), 0 1px 2px rgba(6, 27, 42, 0.06);
  --shadow-lg: 0 4px 12px rgba(6, 27, 42, 0.12);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* Header — dark navy ServiceStream branding */
header {
  background: var(--navy);
  padding: 1.25rem 2rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.help-btn {
  white-space: nowrap;
  margin-top: 0.25rem;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.2);
}

.help-btn:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.825rem;
  margin-top: 0.125rem;
}

/* Tabs — white text on dark navy */
.tabs {
  display: flex;
  gap: 0;
  margin-top: 1rem;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.tab {
  padding: 0.75rem 1.5rem;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab:hover {
  color: rgba(255, 255, 255, 0.85);
}

.tab.active {
  color: #ffffff;
  border-bottom-color: var(--primary);
}

/* Main */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
}

/* Views */
.view {
  display: none;
}

.view.active {
  display: block;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
  min-width: 36px;
  text-align: center;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg);
}

.btn-success {
  background: #2E7D32;
  color: white;
}

.btn-success:hover {
  background: #256b29;
}

.btn-danger {
  background: #C62828;
  color: white;
}

.btn-danger:hover {
  background: #a52222;
}

/* ── Forms ── */
.form-group {
  margin-bottom: 0.875rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--surface);
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

/* ── Tags ── */
.tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.tag-pex {
  background: #E8F5E9;
  color: #2E7D32;
  border: 1px solid #A5D6A7;
}

.tag-stoex {
  background: #FFF8E1;
  color: #F57F17;
  border: 1px solid #FFE082;
}

.tag-omex {
  background: #E3F2FD;
  color: #1565C0;
  border: 1px solid #90CAF9;
}

/* ── Qualification badges ── */
.qual-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.qual-pending { background: #FFF8E1; color: #F57F17; border: 1px solid #FFE082; }
.qual-qualified { background: #E8F5E9; color: #2E7D32; border: 1px solid #A5D6A7; }
.qual-not-required { background: #f5f5f5; color: #999; border: 1px solid #e0e0e0; }
.qual-excluded { background: #FFEBEE; color: #C62828; border: 1px solid #EF9A9A; }

/* ── Pipeline stage badges ── */
.stage-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.stage-new { background: #f5f5f5; color: #666; }
.stage-qualified { background: #E8EAF6; color: #283593; border: 1px solid #9FA8DA; }
.stage-estimated { background: #E3F2FD; color: #1565C0; border: 1px solid #90CAF9; }
.stage-approved { background: #E8F5E9; color: #2E7D32; border: 1px solid #A5D6A7; }
.stage-in-build { background: #FFF3E0; color: #E65100; border: 1px solid #FFCC80; }
.stage-hypercare { background: #F3E5F5; color: #6A1B9A; border: 1px solid #CE93D8; }
.stage-bau { background: #E0F2F1; color: #00695C; border: 1px solid #80CBC4; }
.stage-excluded { background: #FFEBEE; color: #C62828; border: 1px solid #EF9A9A; }

/* ── Opportunity table ── */
.opp-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.opp-table thead {
  background: #f4f6f8;
}

.opp-table th {
  text-align: left;
  padding: 0.65rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.opp-table td {
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

.opp-table tbody tr:hover {
  background: #fafbfc;
}

.opp-name {
  font-weight: 500;
}

/* ── Toolbar ── */
.opp-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.opp-filters {
  display: flex;
  gap: 0.25rem;
}

.opp-toolbar-right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.opp-filter {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  color: var(--text-muted);
}

.opp-filter:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.opp-filter.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.opp-info-banner {
  padding: 0.75rem 1rem;
  background: var(--primary-light);
  border: 1px solid rgba(71, 165, 215, 0.25);
  border-radius: var(--radius);
  font-size: 0.825rem;
  color: var(--navy);
  margin-bottom: 1rem;
  line-height: 1.6;
}

/* ── Add opportunity form ── */
.opp-add-form {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}

.opp-add-form h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.opp-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 700px) {
  .opp-form-grid {
    grid-template-columns: 1fr;
  }
}

.opp-form-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

/* ── Clickable opportunity rows ── */
.opp-row {
  cursor: pointer;
  transition: background 0.1s;
}

.opp-row:hover {
  background: var(--primary-light) !important;
}

.opp-row.opp-row-selected {
  background: rgba(71, 165, 215, 0.08) !important;
  box-shadow: inset 3px 0 0 var(--primary);
}

/* ── Opportunity detail panel (qualification gate) ── */
.opp-detail-panel {
  margin-top: 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--primary);
  border-left: 4px solid var(--primary);
}

.opp-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.opp-detail-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.opp-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 700px) {
  .opp-detail-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.opp-detail-field label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.opp-detail-field span {
  font-size: 0.9rem;
}

.opp-detail-field select {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--surface);
}

/* ── Qualification Gate UI ── */
.qual-gate {
  margin-top: 1.25rem;
  padding: 1.25rem;
  background: #f8f9fb;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.qual-gate h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.gate-auto-msg {
  padding: 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.gate-auto-msg.excluded {
  background: #FFEBEE;
  color: #C62828;
  border: 1px solid #EF9A9A;
}

.gate-auto-msg.qualified {
  background: #E8F5E9;
  color: #2E7D32;
  border: 1px solid #A5D6A7;
}

.gate-question {
  margin-bottom: 1rem;
}

.gate-question p {
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.gate-btn-group {
  display: flex;
  gap: 0.5rem;
}

.gate-btn {
  flex: 1;
  padding: 0.6rem 1rem;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  text-align: center;
}

.gate-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.gate-btn.selected-yes {
  border-color: #2E7D32;
  background: #E8F5E9;
  color: #2E7D32;
}

.gate-btn.selected-no {
  border-color: #C62828;
  background: #FFEBEE;
  color: #C62828;
}

.gate-result {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
}

.gate-result.pass {
  background: #E8F5E9;
  color: #2E7D32;
  border: 1px solid #A5D6A7;
}

.gate-result.fail {
  background: #FFEBEE;
  color: #C62828;
  border: 1px solid #EF9A9A;
}

.proceed-btn {
  margin-top: 0.75rem;
}

/* ── Estimation Wizard ── */
.est-queue-table {
  margin-bottom: 1.5rem;
}

.est-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 0.95rem;
}

.wizard-panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  border: 1px solid var(--primary);
  border-left: 4px solid var(--primary);
}

.wizard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.wizard-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

/* Wizard progress bar */
.wizard-progress {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
}

.wizard-step-indicator {
  flex: 1;
  text-align: center;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: #f4f6f8;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

.wizard-step-indicator:first-child {
  border-radius: var(--radius) 0 0 0;
}

.wizard-step-indicator:last-child {
  border-radius: 0 var(--radius) 0 0;
}

.wizard-step-indicator.active {
  color: var(--primary);
  background: var(--primary-light);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.wizard-step-indicator.completed {
  color: #2E7D32;
  background: rgba(46, 125, 50, 0.06);
  border-bottom-color: #2E7D32;
}

/* Wizard body */
.wizard-body {
  min-height: 300px;
}

.wizard-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1.5rem;
}

@media (max-width: 700px) {
  .wizard-form-grid {
    grid-template-columns: 1fr;
  }
}

.wizard-form-grid .form-group.full-width {
  grid-column: 1 / -1;
}

/* Module selection grid */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.module-card {
  padding: 0.75rem 1rem;
  background: #f8f9fb;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}

.module-card:hover {
  border-color: var(--primary);
}

.module-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.module-card.mandatory {
  border-color: rgba(71, 165, 215, 0.4);
  background: rgba(71, 165, 215, 0.06);
}

.module-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.module-card-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.module-card-days {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

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

.module-category-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.module-category-label:first-child {
  margin-top: 0;
}

/* Wizard results / summary */
.results-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

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

.result-card {
  padding: 1rem;
  background: #f8f9fb;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  text-align: center;
}

.result-card-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.result-card-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

.result-card-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.result-card.highlight {
  background: var(--primary-light);
  border-color: rgba(71, 165, 215, 0.3);
}

.result-card.highlight .result-card-value {
  color: var(--primary);
}

.module-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.module-summary-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: #f4f6f8;
}

.module-summary-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #f0f0f0;
}

.module-summary-table tfoot td {
  font-weight: 700;
  border-top: 2px solid var(--border);
  padding-top: 0.6rem;
}

/* Wizard navigation */
.wizard-nav {
  display: flex;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  margin-top: 1.5rem;
}

/* ── Pipeline View ── */
.pipeline-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.pipeline-toggle {
  display: flex;
  gap: 0.25rem;
}

.pipeline-toggle .btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.pipeline-toggle .btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Pipeline metrics */
.pipeline-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

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

.metric-card {
  padding: 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}

.metric-card-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.metric-card-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  margin-top: 0.15rem;
}

.metric-card-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Kanban board */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  min-height: 300px;
}

@media (max-width: 1000px) {
  .kanban-board {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .kanban-board {
    grid-template-columns: 1fr;
  }
}

.kanban-col {
  background: #f4f6f8;
  border-radius: var(--radius);
  padding: 0.75rem;
  min-height: 200px;
}

.kanban-col-header {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kanban-col-count {
  background: var(--border);
  color: var(--text-muted);
  padding: 0.1rem 0.4rem;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 700;
}

.kanban-card {
  background: var(--surface);
  border-radius: 6px;
  padding: 0.75rem;
  box-shadow: var(--shadow);
  margin-bottom: 0.5rem;
  border-left: 3px solid var(--primary);
  cursor: default;
}

.kanban-card-name {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.kanban-card-client {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.kanban-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.kanban-card-actions {
  display: flex;
  gap: 0.35rem;
}

.kanban-card-actions .btn {
  padding: 0.2rem 0.5rem;
  font-size: 0.72rem;
}

/* Pipeline table view */
.pipeline-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.pipeline-table thead {
  background: #f4f6f8;
}

.pipeline-table th {
  text-align: left;
  padding: 0.65rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.pipeline-table td {
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

.pipeline-table tbody tr:hover {
  background: #fafbfc;
}

/* ── Help Overlay ── */
.help-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(6, 27, 42, 0.7);
  z-index: 200;
  padding: 2rem;
  overflow-y: auto;
}

.help-overlay > * {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.help-overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.help-overlay-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

/* Diagram view */
.diagram-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.zoom-level {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.6);
  margin-left: 0.5rem;
  font-variant-numeric: tabular-nums;
}

.diagram-container {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
  cursor: grab;
  height: 70vh;
  min-height: 400px;
}

.diagram-container:active {
  cursor: grabbing;
}

.diagram-inner {
  transform-origin: 0 0;
  padding: 2rem;
  display: inline-block;
  min-width: 100%;
}

.diagram-inner .mermaid {
  display: flex;
  justify-content: center;
}

.diagram-legend {
  margin-top: 1rem;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.diagram-legend h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.legend-items {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
}

.swatch.start { background: #4caf50; border-radius: 50%; }
.swatch.end { background: #f44336; border-radius: 50%; }
.swatch.gateway { background: #ff9800; transform: rotate(45deg); width: 12px; height: 12px; }
.swatch.document { background: #E3F2FD; border: 1px solid #1565C0; }
.swatch.database { background: #F3E5F5; border: 1px solid #6A1B9A; border-radius: 50%; }
.swatch.dimmed-swatch { background: #eee; border: 1px solid #999; }
