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

/* ── Accessibility: Skip Link & Screen Reader Only ── */
.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #0f172a;
  padding: 10px 20px;
  border-radius: 0 0 var(--radius) var(--radius);
  font-weight: 600;
  font-size: 14px;
  z-index: 10000;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 0;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Focus Styles ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.sidebar-item:focus-visible {
  background: var(--accent-glow);
  color: var(--accent);
}
.mobile-bottom-nav-item:focus-visible {
  color: var(--accent);
  background: var(--accent-glow);
  border-radius: var(--radius);
}
.content-area:focus {
  outline: none;
}

:root {
  --bg-base: #0a0f1e;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: #1e293b;
  --bg-card: #1e293b;
  --bg-card2: #162032;
  --bg-input: #0f172a;
  --bg-modal: #1a2540;
  --border: #1e293b;
  --border-light: #2d3f5a;
  --accent: #2dd4bf;
  --accent-dim: #1a8a7a;
  --accent-glow: rgba(45,212,191,0.15);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  --text-accent: #2dd4bf;
  --status-draft: #94a3b8;
  --status-open: #60a5fa;
  --status-in_progress: #2dd4bf;
  --status-blocked: #f87171;
  --status-closed: #4ade80;
  --status-canceled: #6b7280;
  --priority-1: #f87171;
  --priority-2: #fb923c;
  --priority-3: #facc15;
  --priority-4: #60a5fa;
  --priority-5: #94a3b8;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --transition: 0.15s ease;
}

html, body { height: 100%; font-family: 'Inter', sans-serif; background: var(--bg-base); color: var(--text-primary); font-size: 14px; line-height: 1.5; }

/* ── Scrollbars ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Layout ── */
#app { height: 100vh; display: flex; flex-direction: column; }
#auth-screen { display: flex; height: 100vh; }
#main-app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ── Auth Screen ── */
.auth-left {
  flex: 1; background: linear-gradient(135deg, #0f172a 0%, #0a1628 60%, #061020 100%);
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 60px; position: relative; overflow: hidden;
}
.auth-left::before {
  content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle at 40% 40%, rgba(45,212,191,0.08) 0%, transparent 60%);
  pointer-events: none;
}
.auth-brand { text-align: center; z-index: 1; }
.auth-logo {
  font-family: 'JetBrains Mono', monospace; font-size: 48px; font-weight: 500;
  color: var(--accent); letter-spacing: -2px; margin-bottom: 16px;
}
.auth-logo span { color: var(--text-secondary); }
.auth-tagline { font-size: 18px; color: var(--text-secondary); margin-bottom: 40px; font-weight: 300; }
.auth-features { list-style: none; text-align: left; display: inline-block; }
.auth-features li {
  color: var(--text-secondary); padding: 8px 0; font-size: 14px;
  display: flex; align-items: center; gap: 10px;
}
.auth-features li::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

.auth-right {
  width: 440px; background: var(--bg-sidebar); display: flex; flex-direction: column;
  justify-content: center; padding: 60px 48px; border-left: 1px solid var(--border);
}
.auth-form-title { font-size: 24px; font-weight: 600; margin-bottom: 8px; }
.auth-form-sub { color: var(--text-secondary); margin-bottom: 32px; font-size: 14px; }
.auth-toggle {
  display: flex; gap: 4px; background: var(--bg-input); border-radius: var(--radius);
  padding: 4px; margin-bottom: 32px;
}
.auth-toggle button {
  flex: 1; padding: 8px; border: none; border-radius: 6px; cursor: pointer;
  font-size: 13px; font-weight: 500; transition: var(--transition);
  background: transparent; color: var(--text-secondary);
}
.auth-toggle button.active { background: var(--bg-card); color: var(--text-primary); }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; letter-spacing: 0.5px; text-transform: uppercase; }
.form-input, .form-select, .form-textarea {
  width: 100%; background: var(--bg-input); border: 1px solid var(--border-light);
  color: var(--text-primary); border-radius: var(--radius); padding: 10px 12px;
  font-family: inherit; font-size: 14px; transition: var(--transition); outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-select { cursor: pointer; }
.form-select option { background: var(--bg-card); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-error { color: #f87171; font-size: 12px; margin-top: 8px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px;
  border: none; border-radius: var(--radius); cursor: pointer; font-family: inherit;
  font-size: 13px; font-weight: 500; transition: var(--transition); text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #0f172a; }
.btn-primary:hover { background: #34ead4; }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border-light); }
.btn-secondary:hover { background: var(--bg-sidebar-hover); border-color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-sidebar-hover); color: var(--text-primary); }
.btn-danger { background: rgba(248,113,113,0.15); color: #f87171; border: 1px solid rgba(248,113,113,0.3); }
.btn-danger:hover { background: rgba(248,113,113,0.25); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; font-weight: 600; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Top Nav ── */
#top-nav {
  height: 52px; background: var(--bg-sidebar); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 16px; gap: 12px; flex-shrink: 0;
  z-index: 100;
}
.nav-logo { font-family: 'JetBrains Mono', monospace; font-size: 18px; color: var(--accent); font-weight: 500; letter-spacing: -1px; flex-shrink: 0; }
.nav-logo span { color: var(--text-muted); }
.nav-divider { width: 1px; height: 20px; background: var(--border-light); flex-shrink: 0; }
.project-selector-wrap { flex: 1; max-width: 320px; }
.project-selector {
  width: 100%; background: var(--bg-input); border: 1px solid var(--border-light);
  color: var(--text-primary); border-radius: var(--radius); padding: 7px 10px;
  font-family: inherit; font-size: 13px; cursor: pointer; outline: none; transition: var(--transition);
}
.project-selector:focus { border-color: var(--accent); }
.project-selector option { background: var(--bg-sidebar); }
.nav-spacer { flex: 1; }
.nav-search-hint {
  font-size: 11px; color: var(--text-muted); background: var(--bg-input);
  border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px;
  font-family: 'JetBrains Mono', monospace; cursor: pointer; transition: var(--transition);
}
.nav-search-hint:hover { border-color: var(--accent); color: var(--text-secondary); }
.user-menu { display: flex; align-items: center; gap: 8px; }
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent-dim);
  display: flex; align-items: center; justify-content: center; font-size: 12px;
  font-weight: 600; color: var(--accent); flex-shrink: 0;
}
.user-name { font-size: 13px; color: var(--text-secondary); }

/* ── App Body ── */
#app-body { display: flex; flex: 1; overflow: hidden; }

/* ── Sidebar ── */
#sidebar {
  width: 220px; background: var(--bg-sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto;
  padding: 12px 0;
}
.sidebar-section { margin-bottom: 4px; }
.sidebar-section-label {
  font-size: 10px; font-weight: 600; color: var(--text-muted); letter-spacing: 1px;
  text-transform: uppercase; padding: 8px 16px 4px;
}
.sidebar-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px;
  cursor: pointer; transition: var(--transition); color: var(--text-secondary);
  font-size: 13px; border-left: 2px solid transparent; user-select: none;
}
.sidebar-item:hover { background: var(--bg-sidebar-hover); color: var(--text-primary); }
.sidebar-item.active { background: var(--accent-glow); color: var(--accent); border-left-color: var(--accent); }
.sidebar-item-icon { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-badge {
  margin-left: auto; font-size: 10px; background: var(--bg-card);
  color: var(--text-muted); padding: 1px 6px; border-radius: 10px; font-family: 'JetBrains Mono', monospace;
}
.sidebar-item.active .sidebar-badge { background: var(--accent-dim); color: var(--accent); }

.sidebar-empty {
  padding: 24px 16px; text-align: center; color: var(--text-muted); font-size: 12px;
}

/* ── Main Content ── */
#main-content { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.content-area { padding: 24px; flex: 1; }

/* ── Page Header ── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.page-title { font-size: 20px; font-weight: 600; }
.page-subtitle { color: var(--text-secondary); font-size: 13px; margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── Welcome / No Project ── */
.welcome-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; min-height: 400px; text-align: center; padding: 40px;
}
.welcome-icon { font-size: 48px; margin-bottom: 20px; opacity: 0.4; }
.welcome-title { font-size: 22px; font-weight: 600; margin-bottom: 8px; }
.welcome-text { color: var(--text-secondary); max-width: 360px; line-height: 1.7; margin-bottom: 24px; }

/* ── Cards ── */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 14px; font-weight: 600; }
.card-body { padding: 20px; }

/* ── Filter Bar ── */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-select {
  background: var(--bg-input); border: 1px solid var(--border-light); color: var(--text-secondary);
  border-radius: var(--radius); padding: 6px 10px; font-family: inherit; font-size: 12px;
  cursor: pointer; outline: none; transition: var(--transition);
}
.filter-select:focus, .filter-select:hover { border-color: var(--accent); color: var(--text-primary); }
.filter-select option { background: var(--bg-sidebar); }

/* ── Item List ── */
.item-list { display: flex; flex-direction: column; gap: 2px; }
.item-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: var(--transition);
}
.item-row:hover { border-color: var(--border-light); background: var(--bg-sidebar-hover); transform: translateX(2px); }
.item-type-icon { font-size: 14px; width: 20px; text-align: center; flex-shrink: 0; color: var(--text-muted); }
.item-id { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-muted); flex-shrink: 0; min-width: 70px; }
.item-title { flex: 1; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.status-badge {
  font-size: 10px; font-weight: 500; padding: 2px 8px; border-radius: 10px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.status-draft { background: rgba(148,163,184,0.15); color: var(--status-draft); }
.status-open { background: rgba(96,165,250,0.15); color: var(--status-open); }
.status-in_progress { background: rgba(45,212,191,0.15); color: var(--status-in_progress); }
.status-blocked { background: rgba(248,113,113,0.15); color: var(--status-blocked); }
.status-closed { background: rgba(74,222,128,0.15); color: var(--status-closed); }
.status-canceled { background: rgba(107,114,128,0.15); color: var(--status-canceled); }

.priority-dot {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
}
.priority-1 { background: var(--priority-1); }
.priority-2 { background: var(--priority-2); }
.priority-3 { background: var(--priority-3); }
.priority-4 { background: var(--priority-4); }
.priority-5 { background: var(--priority-5); }

.item-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.tag { font-size: 10px; background: rgba(45,212,191,0.1); color: var(--accent); padding: 1px 6px; border-radius: 4px; font-family: 'JetBrains Mono', monospace; }

/* ── Empty State ── */
.empty-state { padding: 48px; text-align: center; color: var(--text-muted); }
.empty-state-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }
.empty-state-text { font-size: 14px; }
.empty-state-sub { font-size: 12px; margin-top: 4px; }

/* ── Loading ── */
.loading-spinner {
  display: inline-block; width: 16px; height: 16px; border: 2px solid var(--border-light);
  border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state { padding: 48px; text-align: center; }
.loading-state .loading-spinner { width: 24px; height: 24px; }

/* ── Modals ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
  padding: 20px; animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-modal); border: 1px solid var(--border-light); border-radius: var(--radius-lg);
  width: 100%; max-width: 560px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: var(--shadow); animation: slideUp 0.15s ease;
}
.modal-wide { max-width: 740px; }
@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 18px; padding: 4px; border-radius: 4px; transition: var(--transition); }
.modal-close:hover { color: var(--text-primary); background: var(--bg-sidebar-hover); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex-shrink: 0; }

/* ── Item Detail ── */
.item-detail-header { margin-bottom: 24px; }
.item-detail-id { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.item-detail-title { font-size: 20px; font-weight: 600; margin-bottom: 12px; line-height: 1.3; }
.item-detail-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.meta-chip {
  display: flex; align-items: center; gap: 5px; background: var(--bg-input);
  border: 1px solid var(--border-light); border-radius: 6px; padding: 4px 10px;
  font-size: 12px; color: var(--text-secondary);
}
.meta-chip strong { color: var(--text-primary); }
.item-detail-desc { color: var(--text-secondary); line-height: 1.7; font-size: 14px; white-space: pre-wrap; }
.item-detail-section { margin-bottom: 24px; }
.item-detail-section-title { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; }

.comment-item { display: flex; gap: 12px; margin-bottom: 16px; }
.comment-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--bg-card); display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.comment-body { flex: 1; }
.comment-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.comment-text { font-size: 13px; color: var(--text-secondary); line-height: 1.6; white-space: pre-wrap; }

.history-item { display: flex; gap: 12px; margin-bottom: 10px; align-items: flex-start; }
.history-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-dim); flex-shrink: 0; margin-top: 5px; }
.history-text { font-size: 12px; color: var(--text-secondary); }
.history-time { font-size: 11px; color: var(--text-muted); }

/* ── Activity ── */
.activity-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-icon { width: 28px; height: 28px; border-radius: 6px; background: var(--bg-input); display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.activity-body { flex: 1; }
.activity-desc { font-size: 13px; color: var(--text-primary); }
.activity-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Stats ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card { background: var(--bg-card2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }
.stat-icon { font-size: 16px; color: var(--text-muted); margin-bottom: 6px; line-height: 1; }
.stat-value { font-size: 28px; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: var(--accent); line-height: 1; }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }

.breakdown-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.breakdown-row:last-child { border-bottom: none; }
.breakdown-label { flex: 1; font-size: 13px; color: var(--text-secondary); }
.breakdown-count { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--text-primary); min-width: 30px; text-align: right; }
.breakdown-bar-wrap { width: 80px; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.breakdown-bar { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.5s ease; }

/* ── Calendar ── */
.calendar-event { padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--bg-card2); border-radius: 0 var(--radius) var(--radius) 0; margin-bottom: 8px; cursor: pointer; transition: var(--transition); }
.calendar-event:hover { background: var(--bg-sidebar-hover); }
.calendar-event-title { font-size: 13px; font-weight: 500; }
.calendar-event-date { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.calendar-event-id { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--text-muted); }

/* ── Context ── */
.context-section { margin-bottom: 20px; }
.context-section-title { font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.context-block { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-secondary); white-space: pre-wrap; overflow-x: auto; }
.context-item-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.context-item-row:last-child { border-bottom: none; }

/* ── Graph (Immersive) ── */

/* Full-screen graph mode: hide sidebar */
body.graph-mode #sidebar {
  display: none;
}
body.graph-mode #app-body {
  position: relative;
}

#content-graph {
  padding: 0;
  overflow: hidden;
  position: relative;
}

.graph-immersive-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #080d1a;
}

.graph-canvas-host {
  position: absolute;
  inset: 0;
  background: #080d1a;
  overflow: hidden;
}

/* HUD Top bar */
.graph-hud-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(to bottom, rgba(8,13,26,0.94) 0%, rgba(8,13,26,0) 100%);
  pointer-events: none;
}
.graph-hud-top > * { pointer-events: auto; }

.graph-hud-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
  min-width: 0;
}
.graph-hud-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}
.graph-mode-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(148,163,184,0.12);
  color: var(--text-muted);
  border: 1px solid rgba(148,163,184,0.2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.graph-mode-chip.neo4j {
  background: rgba(45,212,191,0.1);
  color: var(--accent);
  border-color: rgba(45,212,191,0.3);
}
.graph-hud-stats {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.graph-hud-stats span { white-space: nowrap; }
.graph-hud-stats b { color: var(--text-secondary); font-weight: 600; margin-right: 2px; }
.graph-hud-warn b { color: #fb923c; }
.graph-hud-center {
  flex: 1;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.graph-search-hud {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10,15,30,0.82);
  border: 1px solid rgba(148,163,184,0.18);
  border-radius: 8px;
  padding: 0 12px;
  height: 36px;
  backdrop-filter: blur(8px);
  transition: border-color 0.15s;
}
.graph-search-hud:focus-within { border-color: rgba(45,212,191,0.5); }
.graph-search-hud-icon { color: var(--text-muted); font-size: 15px; flex-shrink: 0; }
.graph-search-hud-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
}
.graph-search-hud-input::placeholder { color: var(--text-muted); }
.graph-preset-rail {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
  pointer-events: auto;
}
.graph-preset-btn {
  min-width: 0;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid rgba(148,163,184,0.16);
  border-radius: 7px;
  background: rgba(10,15,30,0.74);
  color: var(--text-secondary);
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.graph-preset-btn:hover {
  border-color: rgba(148,163,184,0.34);
  background: rgba(10,15,30,0.92);
  color: var(--text-primary);
}
.graph-preset-btn.active {
  border-color: rgba(45,212,191,0.42);
  background: rgba(45,212,191,0.10);
  color: var(--accent);
}
.graph-preset-btn span,
.graph-preset-btn strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.graph-preset-btn span {
  font-size: 11px;
  font-weight: 650;
}
.graph-preset-btn strong {
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
}
.graph-preset-btn.active strong { color: var(--accent); }
.graph-hud-right {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.graph-hud-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(10,15,30,0.82);
  border: 1px solid rgba(148,163,184,0.18);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  height: 30px;
  flex-shrink: 0;
}
.graph-hud-btn:hover {
  border-color: rgba(148,163,184,0.4);
  color: var(--text-primary);
  background: rgba(10,15,30,0.92);
}
.graph-hud-btn.active {
  border-color: rgba(45,212,191,0.45);
  color: var(--accent);
  background: rgba(45,212,191,0.08);
}

/* Filter overlay (bottom-left) */
.graph-filter-overlay {
  position: absolute;
  bottom: 40px;
  left: 12px;
  z-index: 20;
  min-width: 240px;
  background: rgba(8,13,26,0.96);
  border: 1px solid rgba(148,163,184,0.18);
  border-radius: 12px;
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.graph-filter-overlay.open { display: flex; }
.graph-filter-overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(148,163,184,0.1);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.graph-filter-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1;
}
.graph-filter-close-btn:hover { color: var(--text-primary); background: rgba(148,163,184,0.1); }
.graph-filter-overlay-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.graph-filter-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 8px;
}
.graph-filter-row-depth {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.graph-filter-row-depth label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}
.graph-filter-row label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}
.graph-filter-row select {
  background: rgba(15,20,35,0.9);
  border: 1px solid rgba(148,163,184,0.18);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 5px 8px;
  cursor: pointer;
  outline: none;
  appearance: none;
}
.graph-filter-row select:focus { border-color: rgba(45,212,191,0.4); }
.graph-scope-btn {
  margin-top: 4px;
  width: 100%;
  background: rgba(45,212,191,0.1);
  border: 1px solid rgba(45,212,191,0.25);
  border-radius: 6px;
  color: var(--accent);
  font-size: 12px;
  padding: 7px 10px;
  cursor: pointer;
  transition: background 0.15s;
  text-align: center;
  font-family: 'Inter', sans-serif;
}
.graph-scope-btn:hover { background: rgba(45,212,191,0.18); }
.graph-dep-mode-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin-top: 2px;
  background: rgba(251,146,60,0.08);
  border: 1px solid rgba(251,146,60,0.22);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 7px 9px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}
.graph-dep-mode-btn:hover,
.graph-dep-mode-btn.active {
  background: rgba(251,146,60,0.14);
  border-color: rgba(251,146,60,0.48);
  color: #fed7aa;
}
.graph-dep-mode-btn strong {
  color: #fb923c;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
}
.graph-filter-note {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
}

/* Legend HUD (bottom-center) */
.graph-legend-hud {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px 12px;
  align-items: center;
  background: rgba(8,13,26,0.82);
  border: 1px solid rgba(148,163,184,0.14);
  border-radius: 999px;
  padding: 5px 16px;
  backdrop-filter: blur(10px);
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
}
.graph-legend-hud span { display: inline-flex; align-items: center; gap: 5px; }

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.legend-item { background: var(--accent); }
.legend-facet { background: #60a5fa; }
.legend-sep { color: var(--text-muted); padding: 0 2px; }
.legend-external { background: #f87171; }
.legend-line {
  width: 18px;
  height: 1px;
  display: inline-block;
  background: rgba(148,163,184,0.5);
}
.legend-tag-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px 1px 4px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  color: var(--text-secondary);
  transition: background 0.12s, border-color 0.12s;
}
.legend-tag-btn:hover { background: rgba(255,255,255,0.06); }
.legend-tag-btn.active { background: rgba(45,212,191,0.10); border-color: rgba(45,212,191,0.35); }

/* Info drawer (right side) */
.graph-info-drawer {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  z-index: 20;
  width: 304px;
  background: rgba(8,13,26,0.97);
  border-left: 1px solid rgba(148,163,184,0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(0.4,0,0.2,1);
  backdrop-filter: blur(16px);
  box-shadow: -4px 0 24px rgba(0,0,0,0.45);
}
.graph-info-drawer.open { transform: translateX(0); }
.graph-info-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(148,163,184,0.1);
  flex-shrink: 0;
  gap: 8px;
}
.graph-info-drawer-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.graph-info-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148,163,184,0.2) transparent;
}

/* Relationship drawer (bottom) */
.graph-rel-drawer {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 18;
  max-height: 300px;
  background: rgba(8,13,26,0.97);
  border-top: 1px solid rgba(148,163,184,0.15);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.22s cubic-bezier(0.4,0,0.2,1);
  backdrop-filter: blur(16px);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
}
.graph-rel-drawer.open { transform: translateY(0); }
.graph-rel-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 16px;
  border-bottom: 1px solid rgba(148,163,184,0.1);
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.graph-rel-drawer-body {
  overflow-y: auto;
  padding: 0 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148,163,184,0.2) transparent;
}

/* Info panel content (used inside drawer) */
.graph-panel-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.graph-panel-title-spaced { margin-top: 18px; }
.graph-limit-note { margin-top: 10px; color: var(--text-muted); font-size: 12px; }
.graph-rel-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.graph-rel-row:last-child { border-bottom: none; }
.graph-rel-row:hover .graph-rel-title { color: var(--accent); }
.graph-rel-title {
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.graph-rel-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
}
.graph-rel-type {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--accent);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 4px 8px;
  white-space: nowrap;
}
.graph-rel-props {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.graph-rel-props em {
  color: var(--text-secondary);
  font-style: normal;
  font-weight: 600;
}
.graph-rel-props span {
  background: rgba(148,163,184,0.07);
  border-radius: 4px;
  padding: 1px 5px;
}
.graph-type-list { display: flex; flex-direction: column; gap: 0; margin-top: 4px; }
.graph-type-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding: 7px 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.graph-type-row strong { color: var(--text-primary); font-family: 'JetBrains Mono', monospace; }
.graph-node-list { display: flex; flex-direction: column; gap: 6px; }
.graph-node {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 9px 10px;
  cursor: pointer;
}
.graph-node:hover { border-color: var(--accent-dim); }
.graph-node strong {
  display: block;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.graph-node small {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
}
.graph-node em {
  color: var(--accent);
  font-style: normal;
  font-size: 11px;
  flex-shrink: 0;
}
.graph-node-empty { color: var(--text-muted); font-size: 13px; line-height: 1.45; }
.graph-coverage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.graph-coverage-card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  padding: 9px 10px;
}
.graph-coverage-card span {
  display: block;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}
.graph-coverage-card strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.graph-coverage-card em {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.3;
}
/* Coverage progress bar */
.graph-coverage-bar {
  width: 100%;
  height: 4px;
  background: rgba(148,163,184,0.12);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}
.graph-coverage-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.6s ease;
}
/* HUD select dropdown (layout) */
.graph-hud-select-wrap {
  display: inline-flex;
  align-items: center;
}
.graph-hud-select {
  background: rgba(10,15,30,0.82);
  border: 1px solid rgba(148,163,184,0.18);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  padding: 5px 8px;
  cursor: pointer;
  outline: none;
  appearance: none;
  height: 30px;
  backdrop-filter: blur(8px);
  transition: border-color 0.15s, color 0.15s;
}
.graph-hud-select:hover {
  border-color: rgba(148,163,184,0.4);
  color: var(--text-primary);
}
.graph-hud-select option {
  background: #0f172a;
  color: var(--text-primary);
}
/* Relationship edit bar */
.graph-rel-edit-bar {
  display: flex;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.graph-selected-title { font-size: 15px; font-weight: 700; color: var(--text-primary); line-height: 1.3; }
.graph-selected-meta { margin-top: 4px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; font-size: 11px; overflow-wrap: anywhere; }
.graph-selected-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.graph-selected-counts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.graph-selected-counts span {
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  padding: 4px 8px;
}
.graph-blocker-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.graph-blocker-strip span {
  border: 1px solid rgba(251,146,60,0.24);
  border-radius: 999px;
  background: rgba(251,146,60,0.08);
  color: #fed7aa;
  font-size: 10px;
  padding: 4px 8px;
}
.graph-blocker-strip strong { color: #fb923c; }
.graph-blocker-strip .critical {
  border-color: rgba(251,191,36,0.45);
  background: rgba(251,191,36,0.12);
  color: #fde68a;
}
.graph-blocker-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.graph-blocker-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  width: 100%;
  padding: 8px 9px;
  background: rgba(15,23,42,0.74);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.graph-blocker-row:hover { border-color: rgba(251,146,60,0.42); }
.graph-blocker-row span {
  color: #fb923c;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  text-transform: uppercase;
}
.graph-blocker-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 12px;
}
.graph-property-grid {
  display: grid;
  gap: 0;
  margin-top: 10px;
}
.graph-property-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding: 5px 0;
  font-size: 12px;
}
.graph-property-row span { color: var(--text-muted); }
.graph-property-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text-secondary);
  font-weight: 500;
}
.graph-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.graph-tag-chip {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid rgba(45,212,191,0.24);
  border-radius: 999px;
  background: rgba(45,212,191,0.08);
  color: var(--accent);
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
}
.graph-tag-chip:hover { border-color: var(--accent); }
.graph-neighbor {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  background: transparent;
  border: 0;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.graph-neighbor:last-child { border-bottom: none; }
.graph-neighbor span { color: var(--text-muted); }
.graph-neighbor strong { color: var(--text-secondary); font-weight: 500; }
.graph-neighbor:hover strong { color: var(--text-primary); }
.graph-rel-badge {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--accent);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 2px 6px;
  margin-right: 4px;
  white-space: nowrap;
}
.graph-insight-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.graph-insight-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(28px, auto);
  gap: 4px 10px;
  width: 100%;
  padding: 9px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.graph-insight-row:hover { border-color: var(--accent-dim); }
.graph-insight-row.critical {
  border-color: rgba(251,191,36,0.28);
  background: rgba(251,191,36,0.06);
}
.graph-insight-row.critical b { color: #fbbf24; }
.graph-insight-row span { min-width: 0; }
.graph-insight-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.graph-insight-row em {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-style: normal;
}
.graph-insight-row b {
  align-self: center;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
}
.graph-insight-row small {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.graph-chain-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.graph-chain-row {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(15,23,42,0.74);
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.graph-chain-row:hover { border-color: var(--accent-dim); }
.graph-chain-row.critical {
  border-color: rgba(251,191,36,0.30);
  background: rgba(251,191,36,0.07);
}
.graph-chain-row.warning {
  border-color: rgba(248,113,113,0.34);
  background: rgba(248,113,113,0.08);
}
.graph-chain-row.root {
  border-color: rgba(45,212,191,0.24);
  background: rgba(45,212,191,0.06);
}
.graph-chain-row span {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}
.graph-chain-row i {
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-style: normal;
  font-weight: 500;
}
.graph-chain-row small {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
}
.graph-path-section { margin-bottom: 10px; }
.graph-path-label {
  margin-bottom: 6px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
}
.graph-path-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.graph-path-chips span {
  color: var(--text-muted);
  font-size: 12px;
}
.graph-path-chip {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
}
.graph-path-chip:hover {
  border-color: var(--accent-dim);
  color: var(--text-primary);
}

/* ── Physics Controls Panel ──────────────────────────────────── */
.graph-physics-panel {
  position: absolute;
  bottom: 56px;
  left: 14px;
  z-index: 30;
  width: 270px;
  background: rgba(8,13,26,0.96);
  border: 1px solid rgba(148,163,184,0.2);
  border-radius: 10px;
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: fadeIn 0.12s ease;
}
.graph-physics-panel.open { display: flex; }
.graph-physics-body {
  padding: 10px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.graph-physics-row {
  display: grid;
  grid-template-columns: 90px 1fr 38px;
  align-items: center;
  gap: 8px;
}
.graph-physics-row label {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
.graph-physics-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--accent);
  text-align: right;
}
.graph-physics-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: rgba(148,163,184,0.18);
  outline: none;
  cursor: pointer;
}
.graph-physics-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px rgba(45,212,191,0.5);
  cursor: pointer;
  transition: transform 0.1s;
}
.graph-physics-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 10px rgba(45,212,191,0.7);
}
.graph-physics-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

/* ── Depth slider in filter panel ────────────────────────────── */
.graph-filter-row-depth label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.graph-depth-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--accent);
  min-width: 14px;
  text-align: center;
}
.graph-depth-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  border-radius: 2px;
  background: rgba(148,163,184,0.18);
  outline: none;
  cursor: pointer;
}
.graph-depth-slider:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.graph-depth-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 5px rgba(45,212,191,0.4);
  cursor: pointer;
}
.graph-depth-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
}

/* Graph context menu */
.graph-ctx-menu {
  position: fixed;
  z-index: 999;
  background: rgba(8,13,26,0.97);
  border: 1px solid rgba(148,163,184,0.22);
  border-radius: 8px;
  padding: 4px 0;
  min-width: 170px;
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  animation: fadeIn 0.08s ease;
}
.graph-ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: 'Inter', sans-serif;
}
.graph-ctx-item:hover {
  background: rgba(148,163,184,0.08);
  color: var(--text-primary);
}
.graph-ctx-item.danger { color: #f87171; }
.graph-ctx-item.danger:hover { background: rgba(248,113,113,0.1); }
.graph-ctx-sep {
  height: 1px;
  background: rgba(148,163,184,0.1);
  margin: 3px 0;
}

/* ── Admin ── */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.admin-panel {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}
.admin-table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}
.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  text-align: left;
  vertical-align: middle;
}
.admin-table th {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.admin-table td { color: var(--text-secondary); font-size: 13px; }
.admin-table td strong {
  display: block;
  color: var(--text-primary);
  font-weight: 650;
}
.admin-table td span {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}
.admin-pill {
  display: inline-flex !important;
  width: max-content;
  margin-top: 0 !important;
  padding: 3px 8px;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  color: var(--text-secondary) !important;
  font-family: inherit !important;
  font-size: 11px !important;
}
.admin-pill-strong {
  border-color: rgba(45,212,191,0.35);
  color: var(--accent) !important;
}
.admin-grid-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.admin-group-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  padding: 12px;
}
.admin-group-card strong { display: block; margin-bottom: 4px; }
.admin-group-card span {
  color: var(--text-muted);
  font-size: 12px;
}
.admin-group-card p {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 13px;
}

/* ── Search ── */
.search-box-wrap { position: relative; margin-bottom: 16px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 14px; pointer-events: none; }
.search-input { width: 100%; background: var(--bg-input); border: 1px solid var(--border-light); color: var(--text-primary); border-radius: var(--radius); padding: 10px 12px 10px 36px; font-family: inherit; font-size: 14px; outline: none; transition: var(--transition); }
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

/* ── Notifications ── */
#toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 2000; }
.toast {
  padding: 12px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 500;
  min-width: 240px; max-width: 360px; box-shadow: var(--shadow);
  animation: toastIn 0.2s ease;
}
@keyframes toastIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast-success { background: rgba(74,222,128,0.15); border: 1px solid rgba(74,222,128,0.3); color: #4ade80; }
.toast-error { background: rgba(248,113,113,0.15); border: 1px solid rgba(248,113,113,0.3); color: #f87171; }
.toast-info { background: rgba(45,212,191,0.15); border: 1px solid rgba(45,212,191,0.3); color: var(--accent); }

/* ── Health ── */
.health-indicator { display: flex; align-items: center; gap: 8px; }
.health-dot { width: 8px; height: 8px; border-radius: 50%; }
.health-good { background: #4ade80; }
.health-warn { background: #facc15; }
.health-bad { background: #f87171; }

/* ── Tabs ── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab { padding: 8px 16px; cursor: pointer; font-size: 13px; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: var(--transition); }
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Project cards (no project selected) ── */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.project-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; cursor: pointer; transition: var(--transition); position: relative;
}
.project-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
.project-card-name { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.project-card-slug { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }
.project-card-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.project-card-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }
.project-card-prefix { font-family: 'JetBrains Mono', monospace; font-size: 11px; background: var(--accent-glow); color: var(--accent); padding: 2px 8px; border-radius: 4px; }
.project-card-date { font-size: 11px; color: var(--text-muted); }
.project-card-del { position: absolute; top: 12px; right: 12px; opacity: 0; transition: var(--transition); }
.project-card:hover .project-card-del { opacity: 1; }

/* ── Inline edit ── */
.inline-edit-row { display: flex; gap: 8px; align-items: flex-end; }
.inline-edit-row .form-input { flex: 1; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .auth-left { display: none; }
  .auth-right { width: 100%; padding: 40px 24px; }
  #sidebar { width: 180px; }
  .content-area { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .projects-grid { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  #sidebar { display: none; }
  .modal { max-width: 100%; max-height: 100vh; border-radius: 0; }
}

/* ── Divider ── */
hr.section-divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── Code/mono snippets ── */
.mono { font-family: 'JetBrains Mono', monospace; }

/* ── Two-col layout ── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .two-col { grid-template-columns: 1fr; } }

/* ── GitHub sync two-panel layout ── */
.github-sync-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .github-sync-grid { grid-template-columns: 1fr; } }

.row { display: flex; gap: 12px; align-items: center; }
.flex-1 { flex: 1; }

/* ── Notes / Tests / Health ── */
.notes-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.notes-item:last-child { border-bottom: none; }
.notes-item-text { font-size: 13px; color: var(--text-primary); line-height: 1.5; }
.notes-item-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.test-item { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; gap: 10px; }
.test-item:last-child { border-bottom: none; }
.test-item-cmd { font-family: 'JetBrains Mono', monospace; font-size: 12px; background: var(--bg-input); border-radius: 4px; padding: 2px 6px; }
.health-score-display { text-align: center; padding: 32px; }
.health-score-number { font-size: 72px; font-weight: 700; line-height: 1; }
.health-score-label { font-size: 14px; color: var(--text-secondary); margin-top: 8px; }
.health-issue-item { padding: 10px 12px; border-left: 3px solid var(--priority-2); background: var(--bg-card2); border-radius: 4px; margin-bottom: 8px; font-size: 13px; }

/* ── Deps / Learnings / Shares ── */
.dep-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.dep-row:last-child { border-bottom: none; }
.dep-rel { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; background: var(--bg-input); color: var(--text-muted); padding: 2px 7px; border-radius: 4px; flex-shrink: 0; }
.dep-id { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.learning-row { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.learning-row:last-child { border-bottom: none; }
.share-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.share-row:last-child { border-bottom: none; }
.share-perm { font-size: 10px; font-weight: 600; text-transform: uppercase; background: var(--accent-glow); color: var(--accent); padding: 2px 8px; border-radius: 4px; flex-shrink: 0; }
.group-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: var(--transition); }
.group-row:hover { border-color: var(--border-light); background: var(--bg-sidebar-hover); }
.group-name { font-size: 13px; font-weight: 500; flex: 1; }
.group-desc { font-size: 12px; color: var(--text-muted); }
.member-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.member-row:last-child { border-bottom: none; }
.member-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-dim); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; color: var(--accent); flex-shrink: 0; }
.claim-btn-wrap { display: flex; gap: 8px; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }

/* ── PWA Install Banner ── */
.offline-banner {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 950;
  background: #7c3aed; color: #fff; font-size: 13px; font-weight: 500;
  padding: 10px 20px; text-align: center;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.4);
}
.offline-banner.visible { display: flex; align-items: center; justify-content: center; gap: 8px; }

.install-banner {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 900;
  background: var(--bg-sidebar); border-top: 1px solid var(--border-light);
  padding: 14px 20px; gap: 12px; align-items: center; justify-content: space-between;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
}
.install-banner.visible { display: flex; }
.install-banner-text { font-size: 13px; color: var(--text-secondary); }
.install-banner-text strong { color: var(--text-primary); }

/* ── Mobile Bottom Nav (PWA) ── */
.mobile-bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 800;
  background: var(--bg-sidebar); border-top: 1px solid var(--border);
  height: 56px; padding-bottom: env(safe-area-inset-bottom, 0px);
}
.mobile-bottom-nav-inner {
  display: flex; align-items: center; justify-content: space-around; height: 56px;
}
.mobile-bottom-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--text-muted); font-size: 10px; text-decoration: none;
  padding: 6px 8px; cursor: pointer; transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mobile-bottom-nav-item:active, .mobile-bottom-nav-item.active { color: var(--accent); }
.mobile-bottom-nav-item-icon { font-size: 18px; line-height: 1; }
.mobile-bottom-nav-item-label { font-weight: 500; }

@media (max-width: 768px) {
  .mobile-bottom-nav.visible { display: block; }
  #main-content { padding-bottom: 72px; }
  #app-body { padding-bottom: 56px; }
}

/* ── Safe area support for notched devices ── */
@supports (padding: env(safe-area-inset-top)) {
  #top-nav { padding-top: env(safe-area-inset-top, 0px); }
  .mobile-bottom-nav { padding-bottom: env(safe-area-inset-bottom, 0px); }
}

/* ── Skeleton Loading ── */
.skeleton { background: var(--bg-card); border-radius: var(--radius); position: relative; overflow: hidden; }
.skeleton::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.04) 50%, transparent 100%); animation: shimmer 1.5s ease-in-out infinite; }
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.skeleton-row { height: 42px; margin-bottom: 4px; }
.skeleton-card { height: 120px; margin-bottom: 12px; }
.skeleton-text { height: 14px; margin-bottom: 8px; width: 80%; }
.skeleton-text-sm { height: 10px; margin-bottom: 6px; width: 50%; }

/* ── Confirm Dialog ── */
.confirm-dialog {
  text-align: center; padding: 8px 0;
}
.confirm-dialog-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.7; }
.confirm-dialog-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.confirm-dialog-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 20px; line-height: 1.6; }
.confirm-dialog-actions { display: flex; gap: 8px; justify-content: center; }

/* ── Pull to Refresh ── */
.pull-indicator {
  position: absolute; top: -40px; left: 50%; transform: translateX(-50%);
  height: 36px; display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--accent); transition: top 0.2s ease;
}
.pull-indicator.pulling { top: 8px; }
.pull-indicator.refreshing { animation: spin 0.7s linear infinite; }

/* ── Calendar Grid ── */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 16px; }
.cal-header { font-size: 10px; font-weight: 600; color: var(--text-muted); text-align: center; padding: 8px 2px; text-transform: uppercase; }
.cal-day {
  min-height: 64px; background: var(--bg-card2); border: 1px solid var(--border); border-radius: 4px;
  padding: 3px; font-size: 11px; position: relative; cursor: pointer; transition: var(--transition);
}
.cal-day:hover { border-color: var(--border-light); }
.cal-day.other-month { opacity: 0.35; }
.cal-day.today { border-color: var(--accent); background: var(--accent-glow); }
.cal-day-num { font-size: 10px; color: var(--text-muted); font-weight: 600; margin-bottom: 2px; }
.cal-day.today .cal-day-num { color: var(--accent); }
.cal-event-dot {
  display: block; font-size: 9px; padding: 1px 3px; border-radius: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 1px; cursor: pointer;
}
.cal-event-dot.status-open { background: rgba(96,165,250,0.2); color: var(--status-open); }
.cal-event-dot.status-in_progress { background: rgba(45,212,191,0.2); color: var(--status-in_progress); }
.cal-event-dot.status-blocked { background: rgba(248,113,113,0.2); color: var(--status-blocked); }
.cal-event-dot.status-closed { background: rgba(74,222,128,0.2); color: var(--status-closed); }
.cal-event-dot.more { background: var(--bg-input); color: var(--text-muted); text-align: center; }

/* ── Export / Import ── */
.export-card { display: flex; align-items: center; gap: 16px; padding: 16px; background: var(--bg-card2); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.export-card-icon { font-size: 24px; flex-shrink: 0; }
.export-card-info { flex: 1; }
.export-card-title { font-size: 14px; font-weight: 600; }
.export-card-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Files ── */
.file-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.file-row:last-child { border-bottom: none; }
.file-path { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--accent); flex: 1; }

/* ── SSE Real-time Indicator ── */
.sse-indicator {
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; cursor: default; flex-shrink: 0;
}
.sse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-muted); transition: background 0.4s ease;
}
.sse-indicator.connected .sse-dot {
  background: #4ade80;
  box-shadow: 0 0 6px rgba(74,222,128,0.6);
  animation: ssePulse 2s ease-in-out infinite;
}
.sse-indicator.reconnecting .sse-dot {
  background: #facc15;
  animation: sseBlink 1s ease-in-out infinite;
}
@keyframes ssePulse {
  0%, 100% { box-shadow: 0 0 4px rgba(74,222,128,0.4); }
  50% { box-shadow: 0 0 10px rgba(74,222,128,0.8); }
}
@keyframes sseBlink {
  0%, 100% { opacity: 1; } 50% { opacity: 0.3; }
}

/* ── Presence bar ── */
.presence-bar {
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}
.presence-label {
  font-size: 10px; color: var(--text-muted); margin-right: 2px; white-space: nowrap;
}
.presence-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  font-size: 10px; font-weight: 700; letter-spacing: 0.02em;
  border: 1px solid transparent;
  cursor: default; flex-shrink: 0; transition: transform 0.15s ease;
}
.presence-chip:hover { transform: scale(1.15); }
.presence-chip-extra {
  background: rgba(148,163,184,0.12);
  border-color: rgba(148,163,184,0.3);
  color: var(--text-secondary);
  font-size: 9px;
}

/* ── Drag Handle ── */
.drag-hint { font-size: 11px; color: var(--text-muted); padding: 8px 0; display: flex; align-items: center; gap: 6px; }

/* ── Optimistic overlay ── */
.optimistic-overlay {
  position: absolute; inset: 0; background: rgba(10,15,30,0.6); display: flex;
  align-items: center; justify-content: center; border-radius: var(--radius); z-index: 5;
}

/* ── Guide View ── */
.guide-topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.guide-topic-card {
  display: flex; align-items: flex-start; gap: 12px; padding: 16px;
  transition: border-color 0.15s, transform 0.1s;
}
.guide-topic-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.guide-topic-icon { font-size: 24px; flex-shrink: 0; line-height: 1; margin-top: 2px; }
.guide-topic-body { flex: 1; min-width: 0; }
.guide-topic-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.guide-topic-summary { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.guide-cmd-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.guide-cmd-row:last-child { border-bottom: none; }
.guide-cmd-code {
  flex: 1; font-family: var(--font-mono); font-size: 13px;
  color: var(--accent); background: var(--bg-input); padding: 4px 8px;
  border-radius: 4px; word-break: break-all;
}
.guide-copy-btn { flex-shrink: 0; opacity: 0.6; }
.guide-copy-btn:hover { opacity: 1; }

/* ── Mobile command sheet ── */
.mobile-command-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.mobile-command-project {
  min-width: 0;
}
.mobile-command-project-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.mobile-command-project-name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mobile-command-sync {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  flex-shrink: 0;
}
.mobile-command-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.mobile-command-group {
  margin-bottom: 18px;
}
.mobile-command-group-title {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.mobile-command {
  width: 100%;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card2);
  color: var(--text-primary);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.mobile-command:active,
.mobile-command:hover {
  border-color: var(--accent);
  background: var(--bg-sidebar-hover);
}
.mobile-command[disabled] {
  cursor: not-allowed;
  opacity: 0.5;
}
.mobile-command-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}
.mobile-command-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--accent-glow);
  color: var(--accent);
  font-size: 14px;
  flex-shrink: 0;
}
.mobile-command-title {
  font-size: 13px;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.mobile-command-desc {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
}

@media (max-width: 768px) {
  html, body {
    overscroll-behavior-y: contain;
  }
  #top-nav {
    height: auto;
    min-height: 56px;
    padding: 8px 10px;
    gap: 8px;
  }
  .nav-logo {
    font-size: 16px;
  }
  .nav-divider,
  .nav-search-hint,
  .user-name,
  .user-menu .btn {
    display: none;
  }
  .project-selector-wrap {
    max-width: none;
    min-width: 0;
  }
  .project-selector {
    min-height: 38px;
    font-size: 14px;
  }
  .user-menu {
    gap: 4px;
  }
  .user-avatar {
    width: 34px;
    height: 34px;
  }
  .sse-indicator {
    width: 18px;
  }
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
  }
  .page-title {
    font-size: 18px;
  }
  .page-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .page-actions .btn,
  .filter-bar .btn,
  .filter-select {
    min-height: 38px;
  }
  .page-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
  .item-row {
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
  }
  .item-id {
    min-width: 58px;
  }
  .item-title {
    white-space: normal;
    line-height: 1.35;
  }
  .item-meta {
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
  }
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .graph-hud-top { flex-wrap: wrap; gap: 8px; padding: 8px 10px; }
  .graph-hud-left { width: 100%; }
  .graph-hud-left > div:first-child {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr);
    width: 100%;
  }
  .graph-hud-left .graph-back-btn { width: auto; }
  .graph-hud-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .graph-hud-center { order: 3; max-width: 100%; width: 100%; }
  .graph-hud-right {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    flex-shrink: 1;
    justify-content: stretch;
  }
  .graph-hud-btn,
  .graph-hud-select {
    width: 100%;
    height: 32px;
    justify-content: center;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .graph-preset-rail { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .graph-preset-btn { height: 30px; padding-inline: 6px; font-size: 11px; }
  .graph-info-drawer { width: 100%; top: auto; height: 60vh; transform: translateY(100%); }
  .graph-info-drawer.open { transform: translateY(0); }
  .graph-rel-row { grid-template-columns: 1fr; gap: 6px; }
  .graph-rel-type { width: max-content; }
  .graph-coverage-grid { grid-template-columns: 1fr 1fr; }
  .tab {
    flex: 0 0 auto;
  }
  #toast-container {
    left: 12px;
    right: 12px;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
  .toast {
    min-width: 0;
    max-width: none;
    width: 100%;
  }
}

@media (max-width: 540px) {
  .graph-preset-rail { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .content-area {
    padding: 14px 12px;
  }
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .modal {
    max-height: 92vh;
    border-right: none;
    border-left: none;
    border-bottom: none;
    border-radius: 18px 18px 0 0;
  }
  .modal-header {
    padding: 16px 18px 12px;
  }
  .modal-body {
    padding: 18px;
  }
  .modal-footer {
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
    flex-wrap: wrap;
  }
  .modal-footer .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
  .mobile-command-grid {
    grid-template-columns: 1fr;
  }
  .install-banner.visible {
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    align-items: stretch;
    flex-direction: column;
  }
}

/* ═══════════════════════════════════════════════════════════════
   PLAN VIEW
   ═══════════════════════════════════════════════════════════════ */

.plan-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.plan-list-panel {
  min-width: 260px;
  max-width: 300px;
  flex-shrink: 0;
}

.plan-detail-panel {
  flex: 1;
  min-width: 0;
}

.plan-step-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.plan-step-row:last-child {
  border-bottom: none;
}

.plan-step-row:hover {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm, 4px);
}

.plan-steps-list {
  padding: 4px 0;
}

@media (max-width: 700px) {
  .plan-layout {
    flex-direction: column;
  }
  .plan-list-panel {
    min-width: 0;
    max-width: none;
    width: 100%;
  }
}
