/* Modern CSS Design System & Variables */
:root {
  --bg-dark: #1b2332;
  --bg-canvas: radial-gradient(circle at 50% 50%, #28354a 0%, #17202e 100%);
  --surface-glass: rgba(30, 41, 59, 0.90);
  --surface-card: rgba(51, 65, 85, 0.75);
  --surface-code: #0f172a;

  --border-subtle: rgba(255, 255, 255, 0.12);
  --border-medium: rgba(255, 255, 255, 0.20);
  --border-focus: #06b6d4;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-purple: #a855f7;
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-danger: #b91c1c;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 20px rgba(6, 182, 212, 0.2);

  --transition-fast: all 0.15s ease;
  --transition-normal: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Custom Webkit Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(2, 6, 23, 0.5);
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.2);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.4);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* App Header Bar */
header {
  height: 64px;
  background: var(--surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 30;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
}

.brand-logo svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #ffffff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.4px;
  background: linear-gradient(135deg, #ffffff 30%, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-tag {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Stats Indicator Pills in Header */
.stats-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(2, 6, 23, 0.4);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-value {
  color: var(--text-primary);
  font-weight: 600;
}

.stat-divider {
  width: 1px;
  height: 12px;
  background: var(--border-subtle);
}

/* Header Controls */
.controls-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 1;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  stroke: var(--text-muted);
  fill: none;
  pointer-events: none;
}

input,
select,
button {
  font-family: inherit;
  font-size: 12px;
  border-radius: var(--radius-sm);
  outline: none;
}

input[type="text"],
select {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 6px 10px;
  transition: var(--transition-normal);
}

.search-input {
  padding-left: 28px !important;
  width: 130px;
}

input[type="text"]:focus,
select:focus {
  border-color: var(--border-focus);
  background: rgba(30, 41, 59, 0.9);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.25);
}

select {
  cursor: pointer;
}

/* Lineage View Mode Toggle Switch */
.switch-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-subtle);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: var(--transition-normal);
  white-space: nowrap;
  height: 31px;
}

.switch-control:hover {
  background: rgba(51, 65, 85, 0.6);
  border-color: var(--border-medium);
}

.switch-control:has(input:checked) {
  border-color: rgba(6, 182, 212, 0.4);
  background: rgba(6, 182, 212, 0.08);
}

.switch-control:has(input:focus-visible) {
  border-color: var(--border-focus);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.3);
}

.switch-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition-fast);
}

.switch-control:has(input:checked) .switch-label {
  color: var(--text-primary);
  font-weight: 600;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
  margin: 0;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(71, 85, 105, 0.7);
  border: 1px solid var(--border-subtle);
  transition: var(--transition-normal);
  border-radius: 18px;
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 2px;
  bottom: 2px;
  background-color: #94a3b8;
  transition: var(--transition-normal);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toggle-switch input:checked + .toggle-slider {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  border-color: transparent;
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.4);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(14px);
  background-color: #ffffff;
}

.toggle-switch input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 2px var(--bg-dark), 0 0 0 4px var(--accent-cyan);
}


/* Buttons System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #ffffff;
  font-weight: 600;
  border: none;
  padding: 8px 16px;
  cursor: pointer;
  transition: var(--transition-normal);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

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

.btn-secondary {
  background: rgba(51, 65, 85, 0.5);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  box-shadow: none;
}

.btn-secondary:hover {
  background: rgba(71, 85, 105, 0.8);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
}

/* Main Container & Graph Canvas */
.main-container {
  display: flex;
  height: calc(100vh - 64px);
  width: 100vw;
  position: relative;
  overflow: hidden;
}

#network-canvas {
  flex: 1;
  height: 100%;
  background: var(--bg-canvas);
}

/* Right Sidebar Inspector */
.sidebar {
  width: 400px;
  background: var(--surface-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid var(--border-subtle);
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 20;
  box-shadow: var(--shadow-lg);
  transition: var(--transition-normal);
}

.sidebar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 16px;
  gap: 12px;
}

.sidebar-title-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}

.sidebar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  word-break: break-word;
  line-height: 1.3;
}

.sidebar-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

/* Badges */
.node-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.badge-Dataset {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border: 1px solid var(--accent-cyan);
}

.badge-Column {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid var(--accent-purple);
}

.badge-Pipeline {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid var(--accent-amber);
}

.badge-User {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid var(--accent-emerald);
}

.badge-BusinessTerm {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid var(--accent-rose);
}

/* Property Cards & Code Blocks */
.detail-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.detail-value {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  background: var(--surface-card);
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  word-break: break-all;
}

.code-block {
  background: var(--surface-code);
  padding: 14px;
  border-radius: var(--radius-sm);
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  color: #38bdf8;
  border: 1px solid rgba(255, 255, 255, 0.06);
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  line-height: 1.5;
}

/* Empty Inspector State */
.empty-inspector {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  gap: 16px;
  color: var(--text-muted);
  margin: auto 0;
}

.empty-icon {
  width: 48px;
  height: 48px;
  stroke: var(--text-muted);
  opacity: 0.5;
}

/* Floating Legend Panel */
.legend-panel {
  position: absolute;
  bottom: 24px;
  left: 24px;
  background: var(--surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  z-index: 10;
  box-shadow: var(--shadow-lg);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: default;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* Floating Action Dock */
.sidebar-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

/* AI Assistant Chat Drawer */
.chat-drawer {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: calc(100vh - 96px);
  background: var(--surface-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  z-index: 25;
  overflow: hidden;
  transition: left 0.35s cubic-bezier(0.16, 1, 0.3, 1), right 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s ease, opacity 0.2s ease;
}

.chat-drawer.dock-left {
  left: 16px;
  right: auto;
}

.chat-drawer.dock-right {
  right: 16px;
  left: auto;
}

.chat-header {
  padding: 14px 16px;
  background: rgba(2, 6, 23, 0.5);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-bot-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.4);
}

.chat-bot-icon svg {
  width: 16px;
  height: 16px;
  stroke: #ffffff;
  fill: none;
}

.chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 90%;
}

.chat-msg-user {
  align-self: flex-end;
}

.chat-msg-ai {
  align-self: flex-start;
}

.msg-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.chat-msg-user .msg-bubble {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #ffffff;
  border-bottom-right-radius: 2px;
  white-space: pre-wrap;
}

.chat-msg-ai .msg-bubble {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-bottom-left-radius: 2px;
  line-height: 1.6;
}

.chat-msg-ai .msg-bubble p {
  margin-bottom: 8px;
}

.chat-msg-ai .msg-bubble p:last-child {
  margin-bottom: 0;
}

.chat-msg-ai .msg-bubble ul,
.chat-msg-ai .msg-bubble ol {
  margin: 6px 0 8px 18px;
}

.chat-msg-ai .msg-bubble li {
  margin-bottom: 4px;
}

.chat-msg-ai .msg-bubble code {
  background: rgba(2, 6, 23, 0.6);
  color: var(--accent-cyan);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Fira Code', monospace;
  font-size: 12px;
}

.chat-msg-ai .msg-bubble strong {
  color: var(--text-primary);
  font-weight: 600;
}

.chat-prompts-bar {
  padding: 8px 12px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  border-top: 1px solid var(--border-subtle);
  background: rgba(2, 6, 23, 0.3);
}

.prompt-pill {
  font-size: 11px;
  white-space: nowrap;
  background: rgba(30, 41, 59, 0.8);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.prompt-pill:hover {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

.chat-input-bar {
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Floating Timeline Scrubbing Panel */
.timeline-panel {
  position: absolute;
  top: 16px;
  left: 24px;
  background: var(--surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 15;
  box-shadow: var(--shadow-lg);
  width: fit-content;
  max-width: calc(100vw - 48px);
  height: auto;
  max-height: fit-content;
  flex-shrink: 0;
}

.timeline-slider {
  width: 180px;
  max-width: 180px;
  accent-color: var(--accent-cyan);
  cursor: pointer;
  flex-shrink: 0;
}

.timeline-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  font-family: 'Fira Code', monospace;
  flex-shrink: 0;
}

/* Modal Backdrop & Time Travel Diff Dashboard */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(2, 6, 23, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  width: 820px;
  max-width: 95vw;
  max-height: 85vh;
  background: var(--surface-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 30px rgba(6, 182, 212, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  background: rgba(2, 6, 23, 0.6);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Diff Selection Form Bar */
.diff-select-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(2, 6, 23, 0.4);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.diff-select-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 180px;
}

.diff-select-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Metric Cards Grid */
.diff-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.diff-metric-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.diff-metric-value {
  font-size: 22px;
  font-weight: 700;
}

.diff-metric-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.card-added { border-color: rgba(16, 185, 129, 0.4); }
.card-added .diff-metric-value { color: var(--accent-emerald); }

.card-removed { border-color: rgba(244, 63, 94, 0.4); }
.card-removed .diff-metric-value { color: var(--accent-rose); }

.card-modified { border-color: rgba(245, 158, 11, 0.4); }
.card-modified .diff-metric-value { color: var(--accent-amber); }

.card-edges { border-color: rgba(6, 182, 212, 0.4); }
.card-edges .diff-metric-value { color: var(--accent-cyan); }

/* Tabbed Diff Details Container */
.diff-tabs-bar {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.diff-tab {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  transition: var(--transition-fast);
}

.diff-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.diff-tab.active {
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.3);
}

.diff-item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.diff-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
}

.diff-tag-added {
  color: var(--accent-emerald);
  font-weight: 700;
  margin-right: 6px;
}

.diff-tag-removed {
  color: var(--accent-rose);
  font-weight: 700;
  margin-right: 6px;
}

.diff-tag-modified {
  color: var(--accent-amber);
  font-weight: 700;
  margin-right: 6px;
}

/* Mobile Sheet Drag Handle */
.sheet-drag-handle {
  display: none;
}

/* Mobile Drawer Backdrop Overlay */
.drawer-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(2, 6, 23, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 35;
  transition: opacity var(--transition-normal);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  pointer-events: none;
}

.toast-notification {
  background: var(--surface-card);
  border: 1px solid var(--border-focus);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  pointer-events: auto;
  animation: toast-slideup 0.25s ease forwards;
}

.toast-fadeout {
  opacity: 0;
  transform: translateY(6px);
  transition: all 0.25s ease;
}

@keyframes toast-slideup {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Responsive Breakpoints & Mobile Friendly Layouts
   ========================================================================== */

/* Tablet Viewport (<= 1024px) */
@media (max-width: 1024px) {
  header {
    padding: 0 12px;
    gap: 10px;
  }

  .stats-bar {
    gap: 8px;
    padding: 3px 8px;
    font-size: 10px;
  }

  .controls-group {
    gap: 6px;
  }

  .search-input {
    width: 115px;
  }

  .sidebar {
    width: 360px;
  }
}

/* Mobile Viewport (<= 768px) */
@media (max-width: 768px) {
  /* Header adjustments for mobile */
  header {
    height: auto;
    min-height: 58px;
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
    overflow-x: visible;
  }

  .brand-container {
    gap: 8px;
  }

  .brand-title {
    font-size: 16px;
  }

  .brand-tag {
    display: none;
  }

  /* Stats bar moved under brand on mobile */
  .stats-bar {
    order: 3;
    width: 100%;
    justify-content: space-around;
    padding: 5px 8px;
    font-size: 10px;
    margin-top: 2px;
    border-radius: var(--radius-sm);
  }

  .stat-item {
    gap: 4px;
  }

  .controls-group {
    order: 2;
    margin-left: auto;
    gap: 6px;
    flex-wrap: wrap;
  }

  .search-input {
    width: 110px;
    font-size: 11px;
    height: 36px;
  }

  .switch-control {
    height: 36px;
    padding: 4px 8px;
    gap: 6px;
  }

  .switch-label {
    font-size: 11px;
  }

  .btn {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 11px;
  }

  /* Mobile Bottom Sheet: Node Inspector Drawer */
  .sidebar {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    height: 65vh !important;
    max-height: 80vh !important;
    border-radius: 20px 20px 0 0 !important;
    border-left: none !important;
    border-top: 1px solid var(--border-medium) !important;
    box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.75) !important;
    z-index: 40 !important;
    padding: 12px 16px 24px 16px !important;
    animation: sheet-slideup 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  /* Mobile Bottom Sheet: AI Assistant Chat Drawer */
  .chat-drawer {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    height: 80vh !important;
    max-height: 90vh !important;
    border-radius: 20px 20px 0 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
    border-top: 1px solid var(--border-medium) !important;
    box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.75) !important;
    z-index: 45 !important;
    animation: sheet-slideup 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  /* Show sheet drag handle on mobile */
  .sheet-drag-handle {
    display: block;
    width: 44px;
    height: 5px;
    background: rgba(148, 163, 184, 0.4);
    border-radius: 3px;
    margin: 4px auto 12px auto;
    flex-shrink: 0;
    cursor: grab;
  }

  /* Desktop-only docking button hidden on mobile */
  #dock-btn {
    display: none !important;
  }

  /* Floating Timeline Panel for mobile (compact banner under header) */
  .timeline-panel {
    position: absolute !important;
    top: 10px !important;
    bottom: auto !important;
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    max-width: calc(100% - 20px) !important;
    height: auto !important;
    max-height: fit-content !important;
    flex-wrap: wrap !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 8px 12px !important;
    gap: 8px !important;
    border-radius: var(--radius-sm) !important;
  }

  .timeline-slider {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    order: 2;
    margin: 4px 0 !important;
  }

  .timeline-label {
    min-width: 0 !important;
    font-size: 10px !important;
    order: 1;
    flex: 1;
    text-align: right;
  }

  /* Time Diff Modal on mobile */
  .modal-container {
    width: 95vw !important;
    max-width: 95vw !important;
    height: 90vh !important;
    max-height: 90vh !important;
    border-radius: var(--radius-md) !important;
  }

  .diff-selectors {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .diff-select-col {
    width: 100% !important;
  }

  .diff-tabs-bar {
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .diff-tab {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }

  /* Canvas legend position on mobile */
  .legend-panel {
    bottom: 10px !important;
    left: 10px !important;
    padding: 6px 12px !important;
    gap: 10px !important;
    max-width: calc(100% - 20px) !important;
    flex-wrap: wrap !important;
    font-size: 11px !important;
  }
}

@keyframes sheet-slideup {
  from {
    transform: translateY(100%);
    opacity: 0.8;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}


