/* ═══════════════════════════════════════════════
   PUG Tracker — Design System v2

   Brand: Beletage teal #0BA49A
   Font: Inter — one family, weight hierarchy only
   Modes: light (warm stone) / dark (deep charcoal)
   ═══════════════════════════════════════════════ */

/* ─── Light Theme ─── */
:root, [data-theme="light"] {
  --bg-base: #faf8f5;
  --bg-elevated: #ffffff;
  --bg-surface: #f2efeb;
  --bg-surface-hover: #ebe7e2;
  --bg-overlay: rgba(255, 255, 255, 0.8);

  --text-primary: #1a1a1d;
  --text-secondary: #4a4a52;
  --text-tertiary: #8a8a95;
  --text-inverse: #ffffff;

  --border: rgba(0, 0, 0, 0.07);
  --border-strong: rgba(0, 0, 0, 0.12);

  --brand: #0BA49A;
  --brand-soft: rgba(11, 164, 154, 0.10);
  --brand-hover: #099e94;

  /* Status — refined, muted for light mode */
  --st-approved: #2d8a5e;
  --st-approved-bg: #e6f4ed;
  --st-conditional: #6aab3d;
  --st-conditional-bg: #f0f7e4;
  --st-responded: #2e8eb8;
  --st-responded-bg: #e4f0f8;
  --st-action: #d44a2e;
  --st-action-bg: #fde8e4;
  --st-study: #7c5cbf;
  --st-study-bg: #f0ebfa;
  --st-waiting: #8a8a95;
  --st-waiting-bg: #f0f0f3;
  --st-rejected: #b52828;

  /* Swim bands — more visible on light */
  --band-0: rgba(212, 74, 46, 0.08);
  --band-1: rgba(180, 140, 60, 0.07);
  --band-2: rgba(124, 92, 191, 0.07);
  --band-3: rgba(196, 138, 26, 0.07);
  --band-4: rgba(45, 138, 94, 0.06);
  --band-border: rgba(0, 0, 0, 0.08);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.08), 0 16px 40px rgba(0,0,0,0.10);
  --shadow-panel: -2px 0 16px rgba(0,0,0,0.06), -8px 0 40px rgba(0,0,0,0.08);

  --node-bg: #ffffff;
  --node-bg-opacity: 0.95;
  --node-stroke-width: 1.8;
  --node-stroke-done: 1.2;

  --minimap-bg: rgba(255, 255, 255, 0.85);
  --minimap-viewport-border: var(--brand);
  --minimap-viewport-bg: rgba(11, 164, 154, 0.06);
}

/* ─── Dark Theme ─── */
[data-theme="dark"] {
  --bg-base: #121214;
  --bg-elevated: #1c1c20;
  --bg-surface: #232328;
  --bg-surface-hover: #2c2c32;
  --bg-overlay: rgba(28, 28, 32, 0.85);

  --text-primary: #e8e8ec;
  --text-secondary: #a0a0aa;
  --text-tertiary: #6a6a75;
  --text-inverse: #121214;

  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);

  --brand: #1cc4b8;
  --brand-soft: rgba(28, 196, 184, 0.12);
  --brand-hover: #2ad4c8;

  --st-approved: #3dbd7a;
  --st-approved-bg: rgba(61, 189, 122, 0.12);
  --st-conditional: #8ecc44;
  --st-conditional-bg: rgba(142, 204, 68, 0.12);
  --st-responded: #4ab8e0;
  --st-responded-bg: rgba(74, 184, 224, 0.12);
  --st-action: #f06848;
  --st-action-bg: rgba(240, 104, 72, 0.12);
  --st-study: #a78bef;
  --st-study-bg: rgba(167, 139, 239, 0.12);
  --st-waiting: #6a6a75;
  --st-waiting-bg: rgba(106, 106, 117, 0.12);
  --st-rejected: #e04040;

  --band-0: rgba(240, 104, 72, 0.05);
  --band-1: rgba(220, 180, 80, 0.05);
  --band-2: rgba(167, 139, 239, 0.05);
  --band-3: rgba(224, 168, 50, 0.05);
  --band-4: rgba(61, 189, 122, 0.04);
  --band-border: rgba(255, 255, 255, 0.04);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.2);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.3), 0 16px 40px rgba(0,0,0,0.25);
  --shadow-panel: -2px 0 16px rgba(0,0,0,0.3), -8px 0 40px rgba(0,0,0,0.25);

  --node-bg: #232328;
  --node-bg-opacity: 0.9;
  --node-stroke-width: 1.8;
  --node-stroke-done: 1.2;

  --minimap-bg: rgba(28, 28, 32, 0.85);
  --minimap-viewport-border: var(--brand);
  --minimap-viewport-bg: rgba(28, 196, 184, 0.08);
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-base);
  transition: background 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Header ─── */
#header {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  z-index: 100;
  position: relative;
  transition: background 0.3s ease;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.logo-img {
  height: 22px;
  width: auto;
  flex-shrink: 0;
}
.header-divider {
  width: 1px;
  height: 20px;
  background: var(--border-strong);
  flex-shrink: 0;
}
#project-selector {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  padding-right: 18px;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%238a8a95' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
}
.header-right {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ─── Project List (PUG rows) ─── */
#project-list {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s ease;
}
.project-row {
  display: flex;
  align-items: center;
  padding: 0 16px;
  height: 36px;
  gap: 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s ease;
}
.project-row:last-child { border-bottom: none; }
.project-row:hover { background: var(--bg-surface); }
.project-row.active { background: var(--bg-surface); }
.project-row-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  min-width: 120px;
}
.project-row-summary {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.row-pct {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  margin-right: 2px;
  font-variant-numeric: tabular-nums;
}
.row-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}
.project-row-expand {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.project-row.active .project-row-expand { transform: rotate(90deg); }

/* Score bar (inline in project row) */
.project-row-score {
  flex: 1;
  min-width: 80px;
}
.project-row-score .score-bar-container {
  height: 6px;
  border-radius: 3px;
}
.score-bar-container {
  flex: 1;
  display: flex;
  border-radius: 5px;
  overflow: hidden;
  height: 8px;
  background: var(--bg-surface);
}
.score-segment {
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.score-segment:not(:last-child) {
  border-right: 1px solid var(--bg-elevated);
}
.score-pct {
  font-weight: 700;
  color: var(--brand);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.score-legend {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
}
.score-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: default;
}
.score-legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ─── Graph Container ─── */
#graph-container {
  position: relative;
  height: calc(100vh - 48px - 36px); /* adjusted dynamically by app.js */
  overflow: hidden;
  cursor: grab;
  background: var(--bg-base);
  transition: background 0.3s ease;
}
#graph-container:active { cursor: grabbing; }
#flow-map {
  width: 100%;
  height: 100%;
  display: block;
}

/* ─── Autosave status ─── */
.autosave-status {
  position: sticky;
  top: 0;
  z-index: 5;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  min-height: 0;
  line-height: 26px;
  border-radius: 0 0 6px 6px;
  transition: all 0.3s;
  overflow: hidden;
  max-height: 0;
}
.autosave-status.saving,
.autosave-status.saved,
.autosave-status.error {
  max-height: 26px;
}
.autosave-status.saving {
  color: var(--text-tertiary);
  background: var(--bg-elevated);
}
.autosave-status.saved {
  color: var(--st-approved);
  background: var(--st-approved-bg);
  animation: saved-shrink 2.5s ease forwards;
}
@keyframes saved-shrink {
  0%, 70% { max-height: 26px; opacity: 1; }
  100% { max-height: 0; opacity: 0; }
}
.autosave-status.error {
  color: var(--st-rejected);
  background: var(--st-action-bg);
}
/* Autocomplete */
.ac-wrap { position: relative; }
.ac-dropdown {
  display: none;
  position: fixed;
  z-index: 99999;
  background: #1a1a1d;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.4);
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}
[data-theme="light"] .ac-dropdown {
  background: #ffffff;
  box-shadow: 0 8px 28px rgba(0,0,0,0.15);
}
.ac-item {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
}
.ac-item:hover { background: var(--bg-elevated); }
.ac-item-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.ac-item-sub { font-size: 10px; color: var(--text-tertiary); }
.ac-section-label {
  padding: 4px 10px 2px;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ac-empty, .ac-creating {
  padding: 10px;
  font-size: 11px;
  color: var(--text-tertiary);
  text-align: center;
}
.ac-created {
  padding: 10px;
  font-size: 11px;
  color: var(--st-approved);
  text-align: center;
  font-weight: 600;
}
.ac-create {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  border-top: 1px solid var(--border);
  margin-top: 2px;
  transition: background 0.1s;
}
.ac-create:hover { background: var(--bg-elevated); }
.ac-create-icon { margin-right: 4px; }
.ac-linked {
  font-size: 9px;
  color: var(--brand);
  opacity: 0.7;
  margin-top: 2px;
}

/* Create contact modal */
.cc-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.cc-modal {
  background: #1a1a1d;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4);
}
[data-theme="light"] .cc-modal {
  background: #ffffff;
  box-shadow: 0 16px 48px rgba(0,0,0,0.15);
}
.cc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.cc-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.cc-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.cc-close:hover { color: var(--text-primary); }
.cc-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}
.cc-field {
  flex: 1;
}
.cc-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.cc-input {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--text-primary);
  outline: none;
}
.cc-input:focus { border-color: var(--brand); }
.cc-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}
.cc-btn-cancel, .cc-btn-create {
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all 0.15s;
}
.cc-btn-cancel {
  background: none;
  color: var(--text-secondary);
}
.cc-btn-cancel:hover { background: var(--bg-elevated); }
.cc-btn-create {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.cc-btn-create:hover { opacity: 0.85; }
@media (max-width: 480px) {
  .cc-row { flex-direction: column; gap: 8px; }
  .cc-modal { padding: 18px; }
}

/* Settings panel rows */
.settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-info { flex: 1; min-width: 0; }
.settings-row-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.settings-row-code { font-size: 10px; color: var(--text-tertiary); }
.settings-type {
  font-size: 11px; font-family: inherit; padding: 3px 6px;
  border: 1px solid var(--border); border-radius: 5px;
  background: var(--bg-surface); color: var(--text-primary);
  cursor: pointer; outline: none;
}
/* Toggle switch */
.settings-toggle-wrap {
  position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0;
}
.settings-toggle-wrap input { opacity: 0; width: 0; height: 0; }
.settings-toggle-slider {
  position: absolute; inset: 0; background: var(--border-strong); border-radius: 10px;
  cursor: pointer; transition: background 0.2s;
}
.settings-toggle-slider::before {
  content: ''; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px;
  background: #fff; border-radius: 50%; transition: transform 0.2s;
}
.settings-toggle-wrap input:checked + .settings-toggle-slider { background: var(--brand); }
.settings-toggle-wrap input:checked + .settings-toggle-slider::before { transform: translateX(16px); }

/* Dashboard search */
.dash-search-input {
  padding: 6px 12px; font-size: 12px; font-family: inherit;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-surface); color: var(--text-primary);
  outline: none; width: 180px; margin-left: 12px;
}
.dash-search-input:focus { border-color: var(--brand); }
.dash-search-input::placeholder { color: var(--text-tertiary); }

/* Dashboard type filters */
.dash-filters {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}
.dash-filter {
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.15s;
}
.dash-filter:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}
.dash-filter.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.dash-card-code {
  font-size: 9px; font-weight: 700; color: var(--brand);
  background: var(--brand-soft, rgba(11,164,154,0.12));
  padding: 1px 6px; border-radius: 8px; margin-left: 6px;
  letter-spacing: 0.03em; vertical-align: middle;
}

.panel-hint {
  text-align: center;
  font-size: 9px;
  color: var(--text-tertiary);
  padding: 2px 0 6px;
  opacity: 0.7;
}

/* ─── Aviz file upload ─── */
.aviz-upload-zone {
  margin-top: 10px;
  padding: 10px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 8px;
  background: var(--bg-elevated);
}
.aviz-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}
.aviz-file-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.aviz-file-link:hover { text-decoration: underline; }
.aviz-file-icon { font-size: 14px; }
.aviz-del-btn {
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--st-rejected);
  color: var(--st-rejected);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  cursor: pointer;
  line-height: 1;
}
.aviz-del-btn:hover { background: var(--st-rejected); color: #fff; }
.aviz-upload-btn {
  display: block;
  text-align: center;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.aviz-upload-btn:hover {
  background: var(--brand);
  color: #fff;
}
.aviz-progress {
  margin-top: 6px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.aviz-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--brand);
  border-radius: 2px;
  transition: width 0.2s;
}
.aviz-viewer {
  margin-bottom: 8px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-primary);
  border: 1px solid var(--border);
}
.aviz-preview-img {
  width: 100%;
  height: auto;
  display: block;
  cursor: zoom-in;
  max-height: 400px;
  object-fit: contain;
}
.aviz-preview-pdf {
  width: 100%;
  height: 500px;
  border: none;
  display: block;
}
.aviz-paste-hint {
  text-align: center;
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 4px;
}
@media (max-width: 768px) {
  .aviz-preview-pdf { height: 280px; }
  .aviz-preview-img { max-height: 300px; }
}

/* ─── Dashboard Cards ─── */
#project-list.dash-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding: 20px 24px;
  max-width: 1200px;
  margin: 0 auto;
  border-bottom: none;
  background: var(--bg-base);
}
.dash-card {
  display: flex;
  gap: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow-sm);
}
.dash-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  background: var(--bg-surface-hover);
}
.dash-card-left {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dash-donut {
  width: 120px;
  height: 120px;
}
.dash-donut-bg {
  fill: none;
  stroke: var(--bg-surface);
  stroke-width: 10;
}
.dash-donut-seg {
  fill: none;
  stroke-width: 10;
  stroke-linecap: butt;
  transition: stroke-dasharray 0.6s ease, stroke-dashoffset 0.6s ease;
}
.dash-donut-pct {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 22px;
  font-weight: 800;
  fill: var(--text-primary);
  text-anchor: middle;
  dominant-baseline: central;
}
.dash-donut-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 9px;
  font-weight: 600;
  fill: var(--text-tertiary);
  text-anchor: middle;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.dash-card-right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}
.dash-card-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-card-sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-top: -4px;
}
.dash-card-bar {
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  background: var(--bg-surface);
}
.dash-card-bar .score-segment {
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.dash-card-bar .score-segment:not(:last-child) {
  border-right: 1px solid var(--bg-elevated);
}
.dash-card-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.dash-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}
.dash-pill strong {
  font-weight: 700;
  color: var(--text-primary);
}
.dash-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dash-card-btn {
  align-self: flex-start;
  padding: 5px 14px !important;
  font-size: 11px !important;
  font-weight: 600;
  color: var(--brand) !important;
  border: 1px solid var(--brand) !important;
  border-radius: 20px !important;
  background: transparent !important;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  margin-top: 4px;
}
.dash-card-btn:hover {
  background: var(--brand) !important;
  color: var(--text-inverse) !important;
}

/* Header subtitle */
.header-subtitle {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Responsive: dashboard cards 1 column on mobile */
@media (max-width: 768px) {
  #project-list.dash-grid {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 14px;
  }
  .dash-card {
    padding: 18px;
    gap: 14px;
  }
  .dash-donut {
    width: 90px;
    height: 90px;
  }
  .dash-card-name {
    font-size: 15px;
  }
  .header-subtitle {
    display: none;
  }
}

/* ─── SVG Graph Elements ─── */
.swim-band { transition: fill 0.3s ease; }
.swim-band-border {
  stroke: var(--band-border);
  stroke-width: 1.5;
  stroke-dasharray: 8 4;
}
.swim-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  fill: var(--text-secondary);
  opacity: 0.6;
  user-select: none;
}

/* Edges */
.edge-path {
  fill: none;
  stroke-linecap: round;
  transition: stroke 0.3s, stroke-width 0.3s, opacity 0.3s;
}
.edge-path.resolved {
  stroke: var(--text-tertiary);
  stroke-width: 1;
  opacity: 0.25;
}
.edge-path.active {
  stroke: var(--text-tertiary);
  stroke-width: 1.5;
  opacity: 0.4;
}

/* Arrowhead markers */
.arrowhead-resolved { fill: var(--text-tertiary); opacity: 0.2; }
.arrowhead-active { fill: var(--text-tertiary); opacity: 0.35; }

/* Nodes (pill shape) */
.permit-node { cursor: pointer; }
.permit-node:hover .node-ring { stroke-width: 3 !important; }
.permit-node:hover { filter: brightness(1.1) drop-shadow(0 0 8px rgba(0,0,0,0.2)); }
.permit-node:hover .node-bg { fill: #fff !important; }
[data-theme="dark"] .permit-node:hover .node-bg { fill: #2a2a2e !important; }
.node-bg { transition: fill 0.2s ease; }
.node-fill { transition: fill 0.2s ease; }
.node-ring { transition: all 0.2s ease; }
.node-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10.5px;
  font-weight: 600;
  fill: var(--text-primary);
  text-anchor: middle;
  pointer-events: none;
  user-select: none;
}
.node-badge {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 7.5px;
  font-weight: 700;
  fill: var(--text-tertiary);
  pointer-events: none;
  user-select: none;
}
.node-days {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 8px;
  font-weight: 700;
  pointer-events: none;
  user-select: none;
  font-variant-numeric: tabular-nums;
}

/* Done nodes recede */
.permit-node.done { opacity: 0.4; }
.permit-node.done:hover { opacity: 0.75; }

/* Urgency pulse */
.permit-node.urgent .node-ring {
  animation: urgency-pulse 2.5s ease-in-out infinite;
}
.permit-node.very-urgent .node-ring {
  animation: urgency-pulse-intense 1.5s ease-in-out infinite;
}
@keyframes urgency-pulse {
  0%, 100% { stroke-opacity: 1; }
  50% { stroke-opacity: 0.35; }
}
@keyframes urgency-pulse-intense {
  0%, 100% { stroke-opacity: 1; }
  50% { stroke-opacity: 0.2; }
}

.permit-node.selected .node-ring {
  stroke: var(--brand) !important;
  stroke-width: 2.5 !important;
  filter: drop-shadow(0 0 4px var(--brand));
}
.permit-node.selected.done { opacity: 0.8 !important; }

/* Hover: pale yellow accent on connected edges */
.edge-path.edge-hover {
  stroke: #e8b83a !important;
  stroke-width: 2.5 !important;
  opacity: 0.85 !important;
}
/* Node selected: strong yellow on its edges */
.edge-path.edge-node-selected {
  stroke: #daa520 !important;
  stroke-width: 3 !important;
  opacity: 0.9 !important;
}

/* Critical blocker — animated edges + glow on node */
.edge-path.critical {
  stroke: var(--brand);
  stroke-width: 2.5;
  opacity: 0.85;
  stroke-dasharray: 8 4;
  animation: critical-flow 1s linear infinite;
}
@keyframes critical-flow {
  to { stroke-dashoffset: -12; }
}
.permit-node.critical .node-ring {
  stroke-width: 2.5 !important;
  filter: drop-shadow(0 0 4px var(--brand));
  animation: critical-glow 2s ease-in-out infinite;
}
@keyframes critical-glow {
  0%, 100% { filter: drop-shadow(0 0 3px var(--brand)); }
  50% { filter: drop-shadow(0 0 8px var(--brand)); }
}

/* Status Legend */
#status-legend {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  box-shadow: var(--shadow-sm);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Selection Toolbar */
.sel-toolbar {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 4px 8px;
  box-shadow: var(--shadow-md);
}
.sel-toolbar-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--brand);
  margin-right: 4px;
}
.sel-tb-btn {
  font-size: 10px !important;
  padding: 3px 8px !important;
  border-radius: 4px !important;
}

/* Chronology blocks in detail panel */
.crono-block {
  position: relative;
  padding-left: 16px;
  margin-bottom: 10px;
  border-left: 2px solid var(--border);
}
.crono-block:last-child { border-left-color: transparent; }
.crono-marker {
  position: absolute;
  left: -5px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-tertiary);
}
.crono-marker.crono-blue { background: var(--st-responded); }
.crono-marker.crono-orange { background: var(--st-conditional); }
.crono-marker.crono-green { background: var(--st-approved); }
.crono-round {
  padding-left: 16px;
  margin: 8px 0;
  border-left: 2px solid var(--border);
  position: relative;
}
.crono-round .crono-marker { left: -5px; top: 4px; }
.crono-round input[type="date"] {
  padding-right: 28px;
}
.round-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 4px;
}
.round-attach-btn {
  display: block;
  margin-top: 4px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.round-attach-btn:hover {
  color: var(--brand);
  background: var(--bg-elevated);
}

/* Edge selection — animated yellow */
.edge-path.edge-selected {
  stroke: #f0c030 !important;
  stroke-width: 3 !important;
  opacity: 1 !important;
  stroke-dasharray: 10 5 !important;
  animation: edge-sel-flow 0.6s linear infinite !important;
}
@keyframes edge-sel-flow {
  to { stroke-dashoffset: -15; }
}

/* Edge action buttons (floating at midpoint) */
.edge-actions {
  position: absolute;
  z-index: 400;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 3px 10px;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
}
.edge-actions-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-tertiary);
}
.edge-act-del {
  width: 22px; height: 22px;
  border-radius: 50% !important;
  padding: 0 !important;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px !important;
  color: var(--st-rejected) !important;
  border-color: var(--st-rejected) !important;
  background: transparent !important;
}
.edge-act-del:hover { background: var(--st-action-bg) !important; }
.edge-act-yes {
  font-size: 10px !important; padding: 2px 10px !important;
  background: var(--st-rejected) !important; color: #fff !important; border-color: transparent !important;
}
.edge-act-no {
  font-size: 10px !important; padding: 2px 10px !important;
}

/* Delete confirm toast */
.delete-confirm-toast {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1.5px solid var(--st-rejected);
  border-radius: 8px;
  padding: 8px 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  font-size: 12px;
  color: var(--text-primary);
  animation: toast-in 0.15s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
.delete-confirm-toast span { font-weight: 600; white-space: nowrap; }
.dc-yes {
  font-size: 11px !important; padding: 4px 12px !important;
  background: var(--st-rejected) !important; color: #fff !important;
  border: none !important; border-radius: 5px !important; cursor: pointer;
  font-weight: 600;
}
.dc-yes:hover { opacity: 0.85; }
.dc-no {
  font-size: 11px !important; padding: 4px 12px !important;
  background: transparent !important; color: var(--text-secondary) !important;
  border: 1px solid var(--border) !important; border-radius: 5px !important; cursor: pointer;
}

/* Connection ports — subtle, appear on node hover */
.port { opacity: 0; pointer-events: none; transition: opacity 0.12s ease; }
.port-dot { fill: var(--text-tertiary); }
.port-out .port-dot { fill: var(--brand); }
.permit-node:hover .port { opacity: 0.5; }
.permit-node:hover .port-out { opacity: 0.7; }
/* Hit area is always active, dot is just visual */
.port-hit { fill: transparent; cursor: crosshair; pointer-events: all; }
/* During drag: target input ports visible */
.port-target { opacity: 0.6 !important; }
.port-target .port-dot { fill: var(--brand); }
.port-hover { opacity: 1 !important; }
.port-hover .port-dot { fill: var(--brand); filter: drop-shadow(0 0 4px var(--brand)); }
/* Temp line */
.connect-line {
  fill: none; stroke: var(--brand); stroke-width: 1.5;
  stroke-dasharray: 6 3; opacity: 0.6;
}

/* Add node dialog */
.add-node-dialog {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 500;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  width: 360px;
  max-height: 80vh;
  overflow-y: auto;
}
.add-node-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
}
.add-node-templates {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.add-node-tpl {
  font-size: 10px !important;
  padding: 3px 8px !important;
  border-radius: 12px !important;
}

/* Marquee overlay — sits above SVG, only active during Shift */
#marquee-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 10;
  pointer-events: none;
}
#marquee-overlay.active {
  pointer-events: all;
  cursor: crosshair;
}
.marquee-rect {
  position: absolute;
  border: 1.5px dashed var(--brand);
  background: rgba(11, 164, 154, 0.08);
  border-radius: 2px;
  pointer-events: none;
  z-index: 11;
}

/* Band resize handle */
.band-resize-handle:hover {
  fill: var(--brand) !important;
  opacity: 0.2;
}
.band-drag-handle:hover {
  fill: var(--brand) !important;
  opacity: 0.06;
}
/* Band drop feedback */
.band-drop-highlight,
.band-confirm-flash {
  pointer-events: none;
}

/* Disable all band handles during node drag */
.node-dragging .band-resize-handle,
.node-dragging .band-drag-handle {
  pointer-events: none !important;
  fill: transparent !important;
  opacity: 0 !important;
}

/* Subtle attention animations */
.permit-node.needs-attention .node-ring {
  animation: needs-attn 3s ease-in-out infinite;
}
@keyframes needs-attn {
  0%, 100% { stroke-opacity: 1; }
  50% { stroke-opacity: 0.4; }
}
.permit-node.needs-attention .unassigned-dot {
  animation: dot-blink 2s ease-in-out infinite;
}
@keyframes dot-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
/* RESPONDED — spinning dashed ring = "action needed, review response" */
.permit-node.responded-action .node-ring {
  stroke-dasharray: 6 3;
  stroke-dashoffset: 0;
  animation: responded-spin 4s linear infinite;
}
@keyframes responded-spin {
  to { stroke-dashoffset: -36; }
}

/* MDLPA locked state — greyed out */
.permit-node.mdlpa-locked .node-fill { opacity: 0.3; }
.permit-node.mdlpa-locked .node-label,
.permit-node.mdlpa-locked .node-badge { opacity: 0.5; }

/* MDLPA unlocked — ready pulse */
.permit-node.mdlpa-unlocked .node-ring {
  animation: mdlpa-ready 2s ease-in-out infinite;
}
@keyframes mdlpa-ready {
  0%, 100% { stroke-width: 2; }
  50% { stroke-width: 3.5; }
}
.permit-node.at-avizator .node-ring {
  animation: aviz-breathe 3s ease-in-out infinite;
}
@keyframes aviz-breathe {
  0%, 100% { stroke-width: 2; stroke-opacity: 1; }
  50% { stroke-width: 3.2; stroke-opacity: 0.6; }
}

/* Dragging */
.permit-node.dragging {
  cursor: grabbing !important;
  opacity: 0.85;
}
.permit-node.dragging .node-ring {
  stroke-dasharray: 4 2;
}

/* Gate nodes */
.gate-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 600;
  fill: var(--text-secondary);
  text-anchor: middle;
  user-select: none;
}

/* ─── Tooltip ─── */
.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: var(--shadow-md);
  z-index: 300;
  max-width: 280px;
  transition: opacity 0.12s ease;
}
.tooltip.hidden { opacity: 0; display: none; }
.tooltip-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}
.tooltip-status {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}
.tooltip-detail {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ─── Minimap ─── */
#minimap {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 160px;
  height: 100px;
  background: var(--minimap-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  z-index: 50;
}
#minimap-svg { width: 100%; height: 100%; display: block; }
#minimap-viewport {
  position: absolute;
  border: 1.5px solid var(--minimap-viewport-border);
  border-radius: 2px;
  background: var(--minimap-viewport-bg);
  pointer-events: none;
}

/* ─── Detail Panel ─── */
#detail-panel {
  position: fixed;
  right: 0;
  top: 0;
  width: 380px;
  height: 100vh;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-panel);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s ease;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
}
#detail-panel.open { transform: translateX(0); }
#detail-panel.hidden { display: none; }
#panel-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  color: var(--text-tertiary);
  z-index: 1;
  padding: 0;
}
#panel-close:hover { background: var(--bg-surface-hover); }

/* Panel layout */
.panel-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.panel-sort-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 4px;
}
.panel-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
}
.panel-section {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.panel-section:last-child { border-bottom: none; }
.panel-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.panel-field {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 3px 0;
  font-size: 13px;
}
.panel-field-label { color: var(--text-tertiary); font-weight: 500; }
.panel-field-value { color: var(--text-primary); font-weight: 500; text-align: right; max-width: 55%; }
.panel-notes {
  background: var(--bg-surface);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 6px;
}
.panel-study-card {
  background: var(--st-study-bg);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  margin-top: 6px;
  color: var(--text-secondary);
}
.panel-study-card strong { color: var(--st-study); }

/* ─── Study cards (detail panel) ─── */
.study-section {
  background: rgba(59, 130, 180, 0.06);
  border-radius: 14px;
  padding: 18px 16px 14px;
  border: none;
}
[data-theme="dark"] .study-section {
  background: rgba(59, 130, 180, 0.08);
}
.study-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
}
.study-card {
  position: relative;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px 14px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.study-card-del {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--st-rejected);
  cursor: pointer;
  padding: 0 4px;
  border-radius: 4px;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.study-card-del:hover {
  opacity: 1;
}
.study-field {
  margin-bottom: 10px;
}
.study-field:last-child {
  margin-bottom: 0;
}
.study-field label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}
.study-input {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}
.study-input:focus {
  border-color: var(--brand);
}
.study-textarea {
  min-height: 50px;
  resize: vertical;
}
.study-row-3 {
  display: flex;
  gap: 8px;
}
.study-row-3 .study-field {
  flex: 1;
  min-width: 0;
}
.study-add-btn {
  width: 100%;
  padding: 8px;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: rgba(59, 130, 180, 0.9);
  background: none;
  border: 1.5px solid rgba(59, 130, 180, 0.4);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.study-add-btn:hover {
  background: rgba(59, 130, 180, 0.9);
  border-color: rgba(59, 130, 180, 0.9);
  color: #fff;
}

/* Delete permit button */
.permit-delete-btn {
  width: 100%;
  padding: 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  text-align: center;
  color: var(--st-rejected);
  background: none;
  border: 1.5px solid var(--st-rejected);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.permit-delete-btn:hover {
  background: var(--st-rejected);
  color: #fff;
}

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.status-badge .dot { width: 6px; height: 6px; border-radius: 50%; }
.status-badge.approved { background: var(--st-approved-bg); color: var(--st-approved); }
.status-badge.approved .dot { background: var(--st-approved); }
.status-badge.conditional { background: var(--st-conditional-bg); color: var(--st-conditional); }
.status-badge.conditional .dot { background: var(--st-conditional); }
.status-badge.responded { background: var(--st-responded-bg); color: var(--st-responded); }
.status-badge.responded .dot { background: var(--st-responded); }
.status-badge.action { background: var(--st-action-bg); color: var(--st-action); }
.status-badge.action .dot { background: var(--st-action); }
.status-badge.study { background: var(--st-study-bg); color: var(--st-study); }
.status-badge.study .dot { background: var(--st-study); }
.status-badge.waiting { background: var(--st-waiting-bg); color: var(--st-waiting); }
.status-badge.waiting .dot { background: var(--st-waiting); }

/* ─── Buttons ─── */
button {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  cursor: pointer;
  transition: all 0.12s ease;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
button:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-strong);
}
button.primary {
  background: var(--brand);
  color: var(--text-inverse);
  border-color: transparent;
}
button.primary:hover { background: var(--brand-hover); }
.icon-btn {
  padding: 6px;
  border: 1px solid var(--border);
}

/* ─── Form controls for inline editing ─── */
.edit-select {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  width: 100%;
}
.edit-select:focus { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }

/* Native select styling */
select.edit-select,
select.study-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
}
.edit-textarea {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  outline: none;
  width: 100%;
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
}
.edit-textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.edit-group {
  margin-bottom: 10px;
}
.edit-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ─── Share header (beneficiary view) ─── */
.share-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}
.share-header-top { flex: 1; min-width: 0; }
.share-header-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 2px;
}
.share-header-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}
.share-header-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 1px;
}
.share-header-stats {
  display: flex;
  gap: 16px;
  flex-shrink: 0;
}
.share-stat {
  text-align: center;
}
.share-stat-num {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--brand);
  line-height: 1;
}
.share-stat-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.share-header-bar {
  flex: 1;
  min-width: 120px;
}
@media (max-width: 768px) {
  .share-header { flex-wrap: wrap; padding: 12px 16px; gap: 10px; }
  .share-header-title { font-size: 15px; }
  .share-header-stats { gap: 12px; }
  .share-stat-num { font-size: 18px; }
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  #detail-panel { width: 100%; }
  #minimap { display: none; }
  .header-center { display: none; }
  .score-legend { display: none; }
}
