/* ==========================================================
   SFDT Design System — v0.2
   Geist + Geist Mono · Indigo/Violet · 4px grid · CSS vars
   Dark sidebar, dark content default (light mode opt-in via .content-light)
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&family=JetBrains+Mono:wght@400;500&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ==========================================================
   TOKENS
   ========================================================== */
:root {
  color-scheme: dark;
  /* Brand (Indigo) */
  --brand-50:  #eef1ff;
  --brand-100: #e0e5ff;
  --brand-200: #c6cdff;
  --brand-300: #a4acff;
  --brand-400: #8183ff;
  --brand-500: #6a62f5;
  --brand-600: #5b4ee3;
  --brand-700: #4a3cc0;
  --brand-800: #3c329b;
  --brand-900: #2f2978;
  --brand-950: #1b174a;

  /* Accent (Violet) */
  --accent-400: #b78bff;
  --accent-500: #9a66ff;
  --accent-600: #8247ef;

  /* Neutrals */
  --n-0:   #ffffff;
  --n-25:  #fafbfc;
  --n-50:  #f5f6f8;
  --n-100: #eceef2;
  --n-200: #dfe2e8;
  --n-300: #c9ced6;
  --n-400: #9aa1ad;
  --n-500: #6b7280;
  --n-600: #4b5260;
  --n-700: #363b47;
  --n-800: #22252e;
  --n-900: #14161c;
  --n-950: #0a0b10;

  /* Semantic surfaces — content area (dark default) */
  --bg-app:     oklch(11% 0.008 250);
  --bg-surface: oklch(15.5% 0.012 250);
  --bg-subtle:  oklch(20% 0.014 250);
  --bg-muted:   oklch(20% 0.014 250);
  --bg-input:   oklch(11% 0.008 250);

  --border-subtle:  oklch(24% 0.012 250);
  --border-default: oklch(24% 0.012 250);
  --border-strong:  oklch(30% 0.012 250);
  --border-input:   oklch(24% 0.012 250);

  --fg-default:  oklch(94% 0.006 250);
  --fg-muted:    oklch(52% 0.012 250);
  --fg-subtle:   oklch(44% 0.010 250);
  --fg-on-brand: #ffffff;
  --fg-brand:    var(--brand-400);

  /* Selected-row background — translucent brand so it reads on dark surfaces. */
  --bg-selected: rgba(106, 98, 245, 0.16);

  /* Status: source (blue) */
  --status-source-bg:     rgba(47,107,239,.15);
  --status-source-border: rgba(47,107,239,.45);
  --status-source-fg:     #9bbcff;
  --status-source-solid:  #2f6bef;

  /* Status: target (violet) */
  --status-target-bg:     rgba(124,58,237,.18);
  --status-target-border: rgba(124,58,237,.5);
  --status-target-fg:     #c2a9ff;
  --status-target-solid:  #7c3aed;

  /* Status: modified (amber) */
  --status-modified-bg:     rgba(217,119,6,.18);
  --status-modified-border: rgba(217,119,6,.5);
  --status-modified-fg:     #f3c969;
  --status-modified-solid:  #d97706;

  /* Status: identical (green) */
  --status-identical-bg:     rgba(16,162,61,.18);
  --status-identical-border: rgba(16,162,61,.5);
  --status-identical-fg:     #7ed39a;
  --status-identical-solid:  #10a23d;

  /* Status: conflict (red) */
  --status-conflict-bg:     rgba(220,38,38,.18);
  --status-conflict-border: rgba(220,38,38,.5);
  --status-conflict-fg:     #ffa3a3;
  --status-conflict-solid:  #dc2626;
  --status-error-fg:        var(--status-conflict-fg);

  /* Diff */
  --diff-added-bg:      rgba(16,162,61,.14);
  --diff-added-fg:      #9ce4b3;
  --diff-added-gutter:  #10a23d;
  --diff-removed-bg:    rgba(220,38,38,.14);
  --diff-removed-fg:    #ffa8a8;
  --diff-removed-gutter:#dc2626;

  /* Typography */
  --font-sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'IBM Plex Mono', 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Monaco, Consolas, monospace;

  --fs-xs:   11px;
  --fs-sm:   12px;
  --fs-base: 13px;
  --fs-md:   14px;
  --fs-lg:   16px;
  --fs-xl:   18px;
  --fs-2xl:  22px;
  --fs-3xl:  28px;
  --fs-4xl:  36px;

  --lh-tight:  1.15;
  --lh-snug:   1.35;
  --lh-normal: 1.5;

  --fw-regular:  400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;

  /* Spacing (4px base) */
  --s-1:  4px;  --s-2:  8px;  --s-3: 12px;  --s-4: 16px;
  --s-5: 20px;  --s-6: 24px;  --s-8: 32px;  --s-10: 40px;
  --s-12: 48px; --s-16: 64px;

  /* Radius */
  --r-sm:   4px;  --r-md:  6px;  --r-lg:  8px;
  --r-xl:  12px;  --r-2xl: 16px; --r-full: 9999px;

  /* Shadows */
  --shadow-xs:    0 1px 2px rgba(0,0,0,.3);
  --shadow-sm:    0 1px 3px rgba(0,0,0,.35), 0 1px 2px rgba(0,0,0,.25);
  --shadow-md:    0 4px 12px rgba(0,0,0,.45), 0 2px 4px rgba(0,0,0,.3);
  --shadow-lg:    0 12px 32px rgba(0,0,0,.55), 0 4px 8px rgba(0,0,0,.35);
  --shadow-focus: 0 0 0 3px rgba(106,98,245,.25);

  /* Motion */
  --ease-out:    cubic-bezier(.16,1,.3,1);
  --ease-in-out: cubic-bezier(.4,0,.2,1);
  --dur-fast: 120ms;
  --dur-base: 180ms;
  --dur-slow: 280ms;
}

/* Light mode opt-in for content area */
.content-light {
  color-scheme: light;
  --bg-app:     oklch(98% 0.004 250);
  --bg-surface: oklch(96% 0.006 250);
  --bg-subtle:  oklch(93% 0.008 250);
  --bg-muted:   oklch(93% 0.008 250);
  --bg-input:   oklch(98% 0.004 250);

  --border-subtle:  oklch(85% 0.008 250);
  --border-default: oklch(78% 0.010 250);
  --border-strong:  oklch(68% 0.010 250);
  --border-input:   oklch(78% 0.010 250);

  --fg-default:  oklch(12% 0.008 250);
  --fg-muted:    oklch(45% 0.010 250);
  --fg-subtle:   oklch(55% 0.008 250);
  --fg-brand:    var(--brand-600);
  --bg-selected: var(--brand-50);

  --status-source-bg:     #e6f0ff;
  --status-source-border: #9bbcff;
  --status-source-fg:     #1e4cb8;

  --status-target-bg:     #f0e9ff;
  --status-target-border: #c2a9ff;
  --status-target-fg:     #5a2bb0;

  --status-modified-bg:     #fff4d6;
  --status-modified-border: #f3c969;
  --status-modified-fg:     #7a4b05;

  --status-identical-bg:     #dcf5e5;
  --status-identical-border: #7ed39a;
  --status-identical-fg:     #0f5d2f;

  --status-conflict-bg:     #ffe4e4;
  --status-conflict-border: #ffa3a3;
  --status-conflict-fg:     #9f1818;

  --diff-added-bg:   #e3f5e8;
  --diff-added-fg:   #0d5a2a;
  --diff-removed-bg: #fde8e8;
  --diff-removed-fg: #8a1313;

  --shadow-xs: 0 1px 2px rgba(17,19,30,.04);
  --shadow-sm: 0 1px 3px rgba(17,19,30,.06), 0 1px 2px rgba(17,19,30,.04);
  --shadow-md: 0 4px 12px rgba(17,19,30,.07), 0 2px 4px rgba(17,19,30,.04);
  --shadow-lg: 0 12px 32px rgba(17,19,30,.10), 0 4px 8px rgba(17,19,30,.05);
}

/* ==========================================================
   BASE
   ========================================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg-app);
  color: var(--fg-default);
}
#root { height: 100%; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, select, textarea { font-family: inherit; }
* { transition-property: background-color, border-color, color, box-shadow;
    transition-duration: var(--dur-fast);
    transition-timing-function: var(--ease-out); }

/* ==========================================================
   APP SHELL
   ========================================================== */
.app-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ==========================================================
   SIDEBAR — always dark
   ========================================================== */
.sidebar {
  background: #0d0e18;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid rgba(255,255,255,.06);
  height: 100vh;
}

.sidebar-brand {
  padding: var(--s-4) var(--s-3) var(--s-3);
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}
.brand-icon {
  width: 28px; height: 28px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--brand-500), var(--accent-600));
  display: grid; place-items: center;
  color: white; font-weight: 700; font-size: 12px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(106,98,245,.4), inset 0 -1px 0 rgba(0,0,0,.2);
}
.brand-name {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-md);
  color: #fff;
  letter-spacing: -0.01em;
}
.brand-sub {
  display: block;
  font-size: var(--fs-xs);
  color: rgba(255,255,255,.35);
  font-family: var(--font-mono);
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--s-2) var(--s-2);
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-group-title {
  font-size: 10px;
  font-weight: var(--fw-medium);
  color: rgba(255,255,255,.25);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: var(--s-4) var(--s-2) var(--s-1);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px var(--s-2);
  border-radius: var(--r-md);
  color: rgba(255,255,255,.5);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: all var(--dur-fast);
  white-space: nowrap;
  overflow: hidden;
}
.nav-item:hover {
  color: rgba(255,255,255,.85);
  background: rgba(255,255,255,.07);
}
.nav-item.active {
  color: #fff;
  background: rgba(106,98,245,.22);
}
.nav-item svg {
  width: 15px; height: 15px;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-item.active svg { opacity: 1; }
.nav-item:hover svg { opacity: 0.9; }

.nav-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: var(--r-full);
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.5);
  flex-shrink: 0;
}
.nav-item.active .nav-badge {
  background: rgba(106,98,245,.35);
  color: var(--brand-300);
}

.sidebar-footer {
  padding: var(--s-2) var(--s-3) var(--s-3);
  border-top: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.user-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px var(--s-1);
  border-radius: var(--r-md);
  cursor: pointer;
}
.user-row:hover { background: rgba(255,255,255,.06); }
.user-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-400), var(--accent-500));
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.user-info { min-width: 0; flex: 1; }
.user-name {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: rgba(255,255,255,.7);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-version {
  font-size: 10px;
  color: rgba(255,255,255,.28);
  font-family: var(--font-mono);
}
.org-picker-caret {
  margin-left: 4px;
  font-size: 9px;
  opacity: .5;
}
.org-picker-wrap { position: relative; }
.org-picker-dropdown {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg-card, #1e1e2e);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--r-md);
  overflow: hidden;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.org-picker-empty {
  padding: 8px 12px;
  font-size: var(--fs-xs);
  color: rgba(255,255,255,.3);
}
.org-picker-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 12px;
  font-size: var(--fs-sm);
  color: rgba(255,255,255,.7);
  background: none;
  border: none;
  cursor: pointer;
}
.org-picker-item:hover { background: rgba(255,255,255,.06); }
.org-picker-item.active { color: var(--brand-400, #818cf8); }

/* ==========================================================
   MAIN AREA
   ========================================================== */
.main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-app);
  overflow: hidden;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 10px var(--s-6);
  border-bottom: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--bg-app) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}
.topbar-crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  color: var(--fg-muted);
}
.topbar-crumbs .sep { color: var(--fg-subtle); }
.topbar-crumbs .current {
  color: var(--fg-default);
  font-weight: var(--fw-medium);
}
.topbar-spacer { flex: 1; }
.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  border-radius: var(--r-full);
  cursor: pointer;
  font-size: var(--fs-xs);
  color: var(--fg-muted);
}
.theme-toggle:hover { border-color: var(--border-default); color: var(--fg-default); }
.theme-toggle svg { width: 13px; height: 13px; }

/* Page content */
.page-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--s-8) var(--s-10); /* Increased padding */
}

/* Page header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--s-8); /* Increased margin */
  gap: var(--s-4);
  flex-wrap: wrap;
}
.page-header-text h1 {
  margin: 0;
  font-size: var(--fs-2xl);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.02em;
  line-height: var(--lh-tight);
  color: var(--fg-default);
}
.page-header-text .page-subtitle {
  color: var(--fg-muted);
  font-size: var(--fs-sm);
  margin-top: var(--s-1);
}
.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-shrink: 0;
}

/* ==========================================================
   CARDS
   ========================================================== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
}
.card-pad { padding: var(--s-5); }
.card-sm { padding: var(--s-4); }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
}
.card-title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--fg-default);
}
.card-subtitle {
  font-size: var(--fs-xs);
  color: var(--fg-muted);
  margin-top: 1px;
}
.card-actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.card-body { padding: var(--s-4); }
.card-foot {
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* ==========================================================
   STAT CARDS
   ========================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-4);
  margin-bottom: var(--s-6);
}
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr; }
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--stat-accent, var(--brand-500));
  border-radius: var(--r-lg) 0 0 var(--r-lg);
}
.stat-kicker {
  font-size: var(--fs-xs);
  color: var(--fg-muted);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.stat-value {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.025em;
  line-height: var(--lh-tight);
  color: var(--fg-default);
}
.stat-sub {
  font-size: var(--fs-xs);
  color: var(--fg-muted);
  font-family: var(--font-mono);
}
.stat-card.accent-green  { --stat-accent: var(--status-identical-solid); }
.stat-card.accent-red    { --stat-accent: var(--status-conflict-solid); }
.stat-card.accent-amber  { --stat-accent: var(--status-modified-solid); }
.stat-card.accent-brand  { --stat-accent: var(--brand-500); }
.stat-card.accent-violet { --stat-accent: var(--accent-500); }

/* ==========================================================
   BUTTONS
   ========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  padding: 7px 13px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: translateY(0.5px); }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 13px; height: 13px; flex-shrink: 0; }

.btn-primary {
  background: var(--brand-500);
  color: #fff;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.18), 0 1px 2px rgba(74,60,192,.2);
}
.btn-primary:not(:disabled):hover { background: var(--brand-600); }

.btn-secondary {
  background: var(--bg-surface);
  border-color: var(--border-default);
  color: var(--fg-default);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:not(:disabled):hover { background: var(--bg-subtle); border-color: var(--border-strong); }

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
}
.btn-ghost:not(:disabled):hover { background: var(--bg-muted); color: var(--fg-default); }

.btn-danger {
  background: var(--status-conflict-solid);
  color: #fff;
}
.btn-danger:not(:disabled):hover { filter: brightness(.92); }

.btn-sm {
  padding: 4px 9px;
  font-size: var(--fs-xs);
}
.btn-xs {
  padding: 2px 7px;
  font-size: 11px;
  border-radius: var(--r-sm);
  gap: 4px;
}
.btn-xs svg { width: 11px; height: 11px; }
.btn-icon {
  padding: 5px;
  background: transparent;
  border-color: transparent;
  color: var(--fg-muted);
}
.btn-icon:not(:disabled):hover { background: var(--bg-muted); color: var(--fg-default); border-color: transparent; }
.btn-icon svg { width: 15px; height: 15px; }

/* ==========================================================
   BADGES
   ========================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  padding: 2px 8px;
  border-radius: var(--r-full);
  border: 1px solid transparent;
  line-height: 1.6;
  white-space: nowrap;
}
.badge-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-source    { background: var(--status-source-bg);    color: var(--status-source-fg);    border-color: var(--status-source-border); }
.badge-source .badge-dot    { background: var(--status-source-solid); }
.badge-target    { background: var(--status-target-bg);    color: var(--status-target-fg);    border-color: var(--status-target-border); }
.badge-target .badge-dot    { background: var(--status-target-solid); }
.badge-modified  { background: var(--status-modified-bg);  color: var(--status-modified-fg);  border-color: var(--status-modified-border); }
.badge-modified .badge-dot  { background: var(--status-modified-solid); }
.badge-identical { background: var(--status-identical-bg); color: var(--status-identical-fg); border-color: var(--status-identical-border); }
.badge-identical .badge-dot { background: var(--status-identical-solid); }
.badge-conflict  { background: var(--status-conflict-bg);  color: var(--status-conflict-fg);  border-color: var(--status-conflict-border); }
.badge-conflict .badge-dot  { background: var(--status-conflict-solid); }
.badge-neutral   { background: var(--bg-muted); color: var(--fg-muted); border-color: var(--border-subtle); }
.badge-neutral .badge-dot { background: var(--fg-subtle); }
.badge-success   { background: var(--status-identical-bg); color: var(--status-identical-fg); border-color: var(--status-identical-border); }
.badge-success .badge-dot { background: var(--status-identical-solid); }
.badge-warning   { background: var(--status-modified-bg);  color: var(--status-modified-fg);  border-color: var(--status-modified-border); }
.badge-warning .badge-dot { background: var(--status-modified-solid); }
.badge-error     { background: var(--status-conflict-bg);  color: var(--status-conflict-fg);  border-color: var(--status-conflict-border); }
.badge-error .badge-dot { background: var(--status-conflict-solid); }

/* ==========================================================
   INPUTS
   ========================================================== */
.input-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.input-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--fg-muted);
}
.input {
  width: 100%;
  font: inherit;
  font-size: var(--fs-sm);
  padding: 7px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-input);
  background: var(--bg-input);
  color: var(--fg-default);
  outline: none;
}
.input::placeholder { color: var(--fg-subtle); }
.input:focus {
  border-color: var(--brand-500);
  box-shadow: var(--shadow-focus);
}
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-wrap .input-icon {
  position: absolute;
  left: 9px;
  color: var(--fg-subtle);
  pointer-events: none;
  display: flex;
  align-items: center;
}
.input-wrap .input-icon svg { width: 13px; height: 13px; }
.input-wrap.has-icon .input { padding-left: 28px; }

select.input { cursor: pointer; }

/* ==========================================================
   DATA TABLE
   ========================================================== */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-sm);
}
.data-table th {
  padding: 8px 12px;
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--fg-muted);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-subtle);
  letter-spacing: 0.025em;
  white-space: nowrap;
}
.data-table th:first-child { border-radius: var(--r-sm) 0 0 0; }
.data-table th:last-child  { border-radius: 0 var(--r-sm) 0 0; }
.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--fg-default);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--bg-subtle); }
.data-table .td-name { font-weight: var(--fw-medium); }
.data-table .td-sub  { color: var(--fg-muted); font-size: var(--fs-xs); }
.data-table .td-mono { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--fg-muted); }

.table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  overflow: hidden;
}

/* Checkbox */
.cbx {
  appearance: none;
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  vertical-align: middle;
}
.cbx:hover { border-color: var(--brand-500); }
.cbx:checked {
  background: var(--brand-500);
  border-color: var(--brand-500);
}
.cbx:checked::after {
  content: '';
  position: absolute;
  left: 3px; top: 0.5px;
  width: 5px; height: 8px;
  border: solid white;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.cbx:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

/* ==========================================================
   PROGRESS / SKELETON / SPINNER
   ========================================================== */
.progress {
  width: 100%;
  height: 5px;
  background: var(--bg-muted);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-500), var(--accent-500));
  border-radius: var(--r-full);
  transition: width var(--dur-slow) var(--ease-out);
}
.progress.indeterminate .progress-fill {
  width: 40% !important;
  animation: indeterminate 1.4s var(--ease-in-out) infinite;
}
@keyframes indeterminate {
  0%   { transform: translateX(-200%); }
  100% { transform: translateX(400%); }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-muted) 0%, var(--bg-subtle) 50%, var(--bg-muted) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border-default);
  border-top-color: var(--brand-500);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
.spinner-sm { width: 14px; height: 14px; border-width: 1.5px; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.spinner-center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-12) 0;
}

/* ==========================================================
   EMPTY STATE
   ========================================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--s-12) var(--s-6);
}
.empty-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-xl);
  background: var(--bg-muted);
  display: grid; place-items: center;
  margin-bottom: var(--s-4);
}
.empty-icon svg { width: 18px; height: 18px; color: var(--fg-subtle); }
.empty-title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--fg-default);
  margin: 0 0 var(--s-2);
}
.empty-desc {
  font-size: var(--fs-sm);
  color: var(--fg-muted);
  margin: 0 0 var(--s-4);
  max-width: 36ch;
}

/* ==========================================================
   COMMAND RUNNER
   ========================================================== */
.cmd-runner {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: var(--s-4);
}
.cmd-runner-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 10px var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
}
.cmd-runner-title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--fg-default);
}
.cmd-terminal {
  background: #0d0e18;
  padding: var(--s-3) var(--s-4);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: rgba(255,255,255,.8);
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.6;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}
.cmd-terminal::-webkit-scrollbar { width: 5px; }
.cmd-terminal::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }
.cmd-line { word-break: break-all; }

/* ==========================================================
   FILTER BAR
   ========================================================== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
  margin-bottom: var(--s-3);
}
.filter-bar .search-wrap {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--fg-muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.filter-chip:hover { border-color: var(--border-strong); color: var(--fg-default); }
.filter-chip.active {
  background: rgba(106,98,245,.15);
  border-color: rgba(106,98,245,.4);
  color: var(--brand-300);
}
.content-light .filter-chip.active {
  background: var(--brand-50);
  border-color: var(--brand-300);
  color: var(--brand-700);
}

/* ==========================================================
   BULK ACTION BAR
   ========================================================== */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 9px var(--s-4);
  border: 1px solid rgba(106,98,245,.35);
  background: rgba(106,98,245,.1);
  border-radius: var(--r-md);
  margin-bottom: var(--s-3);
}
.content-light .bulk-bar {
  background: var(--brand-50);
  border-color: var(--brand-300);
}
.bulk-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--brand-300);
}
.content-light .bulk-label { color: var(--brand-700); }
.bulk-spacer { flex: 1; }

/* ==========================================================
   ORG PAIR HEADER
   ========================================================== */
.org-pair {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-4);
}
.org-pair-side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.org-pair-avt {
  width: 26px; height: 26px;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  font-weight: 700; color: white; font-size: 10px;
  flex-shrink: 0;
}
.org-pair-info {}
.org-pair-role {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: var(--fw-medium);
  color: var(--fg-subtle);
}
.org-pair-name {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
  color: var(--fg-default);
}
.org-pair-alias {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--fg-muted);
}
.org-pair-arrow {
  color: var(--fg-subtle);
  flex-shrink: 0;
}
.org-pair-arrow svg { width: 16px; height: 16px; }

/* ==========================================================
   DIFF PANEL (slide-over)
   ========================================================== */
.diff-panel {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(54vw, 860px);
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  animation: slideIn var(--dur-base) var(--ease-out);
}
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
.diff-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.2);
  z-index: 999;
  animation: fadeIn var(--dur-base) var(--ease-out);
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.diff-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
  gap: var(--s-3);
  flex-shrink: 0;
}
.diff-panel-title {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-md);
  color: var(--fg-default);
}
.diff-panel-sub {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--fg-muted);
  margin-top: 2px;
}

.diff-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  flex-shrink: 0;
}
.diff-tab {
  padding: 9px 14px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--fg-muted);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--dur-fast);
}
.diff-tab:hover { color: var(--fg-default); }
.diff-tab.active {
  color: var(--brand-400);
  border-bottom-color: var(--brand-500);
}
.content-light .diff-tab.active { color: var(--brand-600); }
.diff-tab-body { flex: 1; overflow: auto; padding: var(--s-4); }

.diff-view {
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
}
.diff-row {
  display: grid;
  grid-template-columns: 36px 36px 20px 1fr;
  align-items: baseline;
}
.diff-gutter {
  text-align: right;
  padding: 2px 6px;
  font-size: 10px;
  color: var(--fg-subtle);
  background: var(--bg-subtle);
  border-right: 1px solid var(--border-subtle);
  user-select: none;
}
.diff-sign {
  text-align: center;
  padding: 2px 0;
  font-size: 11px;
  color: var(--fg-subtle);
}
.diff-code { padding: 2px 10px; white-space: pre; overflow: hidden; text-overflow: ellipsis; color: var(--fg-default); }
.diff-row.added  { background: var(--diff-added-bg); }
.diff-row.added .diff-code  { color: var(--diff-added-fg); }
.diff-row.added .diff-sign  { color: var(--diff-added-gutter); font-weight: 700; }
.diff-row.removed { background: var(--diff-removed-bg); }
.diff-row.removed .diff-code { color: var(--diff-removed-fg); }
.diff-row.removed .diff-sign { color: var(--diff-removed-gutter); font-weight: 700; }

.xml-view {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-all;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  color: var(--fg-default);
  overflow: auto;
  max-height: calc(100vh - 280px);
}

/* ==========================================================
   ALERT / CALLOUT
   ========================================================== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: 10px 14px;
  border-radius: var(--r-md);
  border: 1px solid;
  font-size: var(--fs-sm);
}
.alert svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
.alert-title { font-weight: var(--fw-semibold); margin-bottom: 2px; }
.alert-close {
  margin-left: auto;
  background: transparent;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: .6;
  padding: 0;
  flex-shrink: 0;
}
.alert-close:hover { opacity: 1; }
.alert-close svg { width: 14px; height: 14px; }
.alert-error {
  background: var(--status-conflict-bg);
  border-color: var(--status-conflict-border);
  color: var(--status-conflict-fg);
}
.alert-warning {
  background: var(--status-modified-bg);
  border-color: var(--status-modified-border);
  color: var(--status-modified-fg);
}
.alert-info {
  background: var(--status-source-bg);
  border-color: var(--status-source-border);
  color: var(--status-source-fg);
}
.alert-success {
  background: var(--status-identical-bg);
  border-color: var(--status-identical-border);
  color: var(--status-identical-fg);
}

/* ==========================================================
   MODAL
   ========================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 900;
  display: grid;
  place-items: center;
  padding: var(--s-6);
  animation: fadeIn var(--dur-base) var(--ease-out);
}
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 680px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: modalIn var(--dur-base) var(--ease-out);
}
@keyframes modalIn {
  from { transform: scale(.97) translateY(4px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.modal-title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.01em;
}
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-4) var(--s-5);
}
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-5);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
  flex-shrink: 0;
}

/* ==========================================================
   UPDATE PILL + MODAL CONTENT
   ========================================================== */
.update-pill {
  display: inline-flex;
  align-items: center;
  margin-left: var(--s-1);
  padding: 1px 6px;
  border-radius: var(--r-full);
  background: var(--status-modified-bg);
  color: var(--status-modified-fg);
  border: 1px solid var(--status-modified-border);
  font-size: 9px;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.03em;
  cursor: pointer;
  line-height: 1.6;
  vertical-align: middle;
  transition: opacity var(--dur-fast);
}
.update-pill:hover { opacity: 0.8; }

.update-version-row {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-4);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
}
.update-version-item { display: flex; flex-direction: column; gap: 2px; }
.update-version-label { font-size: var(--fs-xs); color: var(--fg-muted); font-weight: var(--fw-medium); text-transform: uppercase; letter-spacing: 0.05em; }
.update-version-value { font-family: var(--font-mono); font-size: var(--fs-base); color: var(--fg-default); }
.update-version-new { color: var(--brand-600); font-weight: var(--fw-semibold); }
.update-version-arrow { font-size: var(--fs-xl); color: var(--fg-muted); }

.update-notice {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-lg);
  background: var(--status-modified-bg);
  color: var(--status-modified-fg);
  border: 1px solid var(--status-modified-border);
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.update-notice code {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  padding: 1px 4px;
  border-radius: var(--r-sm);
  background: rgba(0,0,0,.08);
}
.update-notice-error {
  background: var(--status-conflict-bg);
  color: var(--status-conflict-fg);
  border-color: var(--status-conflict-border);
}

/* ==========================================================
   SSE / LIVE INDICATOR
   ========================================================== */
.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--status-identical-fg);
}
.live-dot::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--status-identical-solid);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* ==========================================================
   ACTIVITY FEED
   ========================================================== */
.activity-list {
  display: flex;
  flex-direction: column;
}
.activity-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: var(--s-3);
  padding: 10px var(--s-4);
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--dur-fast);
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: var(--bg-subtle); }
.activity-ico {
  width: 28px; height: 28px;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.activity-ico svg { width: 13px; height: 13px; }
.activity-ico.success { background: var(--status-identical-bg); color: var(--status-identical-fg); }
.activity-ico.warn    { background: var(--status-modified-bg);  color: var(--status-modified-fg); }
.activity-ico.error   { background: var(--status-conflict-bg);  color: var(--status-conflict-fg); }
.activity-ico.info    { background: rgba(106,98,245,.15); color: var(--brand-400); }
.content-light .activity-ico.info { background: var(--brand-50); color: var(--brand-600); }
.activity-title { font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.activity-meta  { font-size: var(--fs-xs); color: var(--fg-muted); font-family: var(--font-mono); margin-top: 1px; }
.activity-time  { font-size: var(--fs-xs); color: var(--fg-subtle); font-family: var(--font-mono); flex-shrink: 0; }

/* ==========================================================
   UTILITIES
   ========================================================== */
.mono  { font-family: var(--font-mono); }
.muted { color: var(--fg-muted); }
.subtle { color: var(--fg-subtle); }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: var(--s-1); }
.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); }
.mt-2 { margin-top: var(--s-2); }
.mt-4 { margin-top: var(--s-4); }
.mt-6 { margin-top: var(--s-6); }
.mb-2 { margin-bottom: var(--s-2); }
.mb-3 { margin-bottom: var(--s-3); }
.mb-4 { margin-bottom: var(--s-4); }
.mb-6 { margin-bottom: var(--s-6); }
.ml-auto { margin-left: auto; }
.section-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: var(--s-3);
}
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
}
@media (max-width: 960px) { .two-col { grid-template-columns: 1fr; } }
.three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-4);
}
@media (max-width: 1100px) { .three-col { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .three-col { grid-template-columns: 1fr; } }

/* ==========================================================
   STAT CARD EXTENSIONS — sparkline, trend, valueColor
   ========================================================== */
.stat-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--s-2);
  gap: var(--s-2);
}
.stat-trend {
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
  white-space: nowrap;
}
.stat-trend-success { color: var(--status-identical-fg); }
.stat-trend-danger  { color: var(--status-conflict-fg); }
.stat-trend-muted   { color: var(--fg-muted); }

.stat-sparkline {
  display: block;
  flex-shrink: 0;
  overflow: visible;
}

.stat-value-success { color: var(--status-identical-fg); }
.stat-value-warning { color: var(--status-modified-fg); }
.stat-value-danger  { color: var(--status-conflict-fg); }

/* ==========================================================
   FILTER TABS
   ========================================================== */
.filter-tabs {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--s-1);
  flex-wrap: wrap;
  margin-bottom: var(--s-3);
}
.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: 5px 10px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--fg-muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: all var(--dur-fast);
}
.filter-tab:hover {
  border-color: var(--border-strong);
  color: var(--fg-default);
}
.filter-tab.active {
  background: color-mix(in srgb, var(--brand-500) 15%, transparent);
  border-color: color-mix(in srgb, var(--brand-500) 40%, transparent);
  color: var(--brand-300);
}
.content-light .filter-tab.active {
  background: var(--brand-50);
  border-color: var(--brand-300);
  color: var(--brand-700);
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  min-width: 16px;
  padding: 1px 4px;
  border-radius: var(--r-full);
  background: var(--bg-muted);
  color: var(--fg-subtle);
  line-height: 1.4;
}
.filter-tab.active .tab-count {
  background: color-mix(in srgb, var(--brand-500) 25%, transparent);
  color: var(--brand-300);
}

/* Variant badge colors */
.filter-tab-mod .tab-count {
  background: var(--status-modified-bg);
  color: var(--status-modified-fg);
}
.filter-tab-add .tab-count {
  background: var(--status-identical-bg);
  color: var(--status-identical-fg);
}
.filter-tab-rm .tab-count {
  background: var(--status-conflict-bg);
  color: var(--status-conflict-fg);
}
.filter-tab-conflict .tab-count {
  background: var(--status-conflict-bg);
  color: var(--status-conflict-fg);
  border: 1px solid var(--status-conflict-border);
}

/* ==========================================================
   ORG BAR
   ========================================================== */
.org-bar {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--s-3);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s-2) var(--s-4);
  margin-bottom: var(--s-4);
}
.org-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
}
.org-alias {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--fg-default);
}
.org-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status-identical-solid);
  flex-shrink: 0;
}
.org-dot.stg {
  background: transparent;
  border: 1.5px solid var(--status-modified-solid);
}
.org-arrow {
  color: var(--fg-subtle);
  font-size: var(--fs-sm);
  flex-shrink: 0;
}
.org-meta {
  margin-left: auto;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  white-space: nowrap;
}

/* ==========================================================
   STATUS PILLS (Compare page)
   ========================================================== */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 500;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pill-match    { background: color-mix(in srgb, var(--fg-muted) 10%, transparent); color: var(--fg-muted); }
.pill-mod      { background: color-mix(in srgb, var(--status-modified-fg) 15%, transparent); color: var(--status-modified-fg); }
.pill-add      { background: color-mix(in srgb, var(--status-identical-fg) 15%, transparent); color: var(--status-identical-fg); }
.pill-rm       { background: color-mix(in srgb, var(--status-conflict-fg) 15%, transparent); color: var(--status-conflict-fg); }
.pill-conflict { background: color-mix(in srgb, var(--status-conflict-fg) 18%, transparent); color: var(--status-conflict-fg); border: 1px solid color-mix(in srgb, var(--status-conflict-fg) 30%, transparent); }

/* ==========================================================
   COMPARE PAGE LAYOUT
   ========================================================== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}
@media (max-width: 720px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
}

.compare-row:hover td {
  background: color-mix(in srgb, var(--fg-default) 3%, transparent);
}

/* ==========================================================
   RELEASE HUB — horizontal stepper
   ========================================================== */
.stepper {
  display: flex;
  align-items: flex-start;
  margin-bottom: 20px;
  position: relative;
}
.stepper::before {
  content: '';
  position: absolute;
  top: 14px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-subtle);
  z-index: 0;
}
.step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  position: relative;
  z-index: 1;
  cursor: pointer;
}
.step-ring {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border-subtle);
  background: var(--bg-app);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
}
.step.done .step-ring {
  background: var(--status-identical-solid);
  border-color: var(--status-identical-solid);
  color: var(--bg-app);
}
.step.active .step-ring {
  background: var(--status-modified-solid);
  border-color: var(--status-modified-solid);
  color: var(--bg-app);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--status-modified-solid) 20%, transparent);
}
.step.pending .step-ring {
  color: var(--fg-muted);
}
.step-lbl {
  font-size: 11px;
  color: var(--fg-muted);
  text-align: center;
}
.step.done .step-lbl  { color: var(--status-identical-fg); }
.step.active .step-lbl { color: var(--fg-default); font-weight: 500; }

/* ==========================================================
   RELEASE HUB — deploy step 2-col grid + metrics panel
   ========================================================== */
.deploy-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 14px;
}
@media (max-width: 900px) {
  .deploy-grid { grid-template-columns: 1fr; }
}
.metrics-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  overflow: hidden;
}
.metrics-panel .panel-hdr {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
  font-weight: 500;
}
.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  font-size: 12px;
}
.metric-key { color: var(--fg-muted); }
.metric-val {
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.metric-val.ok   { color: var(--status-identical-fg); }
.metric-val.warn { color: var(--status-modified-fg); }

/* ── Subtask check-item rows (Preflight page) ─────────────────────── */
.subtask { display: flex; align-items: center; gap: 10px; padding: 7px 14px; font-size: 12.5px; border-bottom: 1px solid color-mix(in srgb, var(--border-subtle) 50%, transparent); }
.subtask:last-child { border-bottom: none; }
.subtask .s-icon { width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.subtask .s-name { flex: 1; }
.subtask .s-time { font-family: var(--font-mono); font-size: 11px; color: var(--fg-muted); }
.subtask.done .s-name { color: var(--fg-muted); }
.subtask.done .s-icon { color: var(--status-identical-fg); }
.subtask.fail .s-name { color: var(--status-error-fg); font-weight: 500; }
.subtask.fail .s-icon { color: var(--status-error-fg); }
.subtask.active .s-icon { color: var(--status-modified-fg); }
.subtask.active .s-name { color: var(--status-modified-fg); }
.subtask.pending .s-name { color: var(--fg-muted); opacity: 0.55; }

/* ==========================================================
   DEPENDENCY GRAPH PAGE
   ========================================================== */
/* graph-layout must break out of .page-content padding to fill available height */
.page-content:has(.graph-layout) {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.graph-layout {
  display: grid;
  grid-template-columns: 1fr 272px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.graph-canvas-wrap {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.graph-truncation-banner {
  padding: 6px 12px;
  font-size: 12px;
  color: var(--status-conflict-fg);
  background: var(--status-conflict-bg);
  border-bottom: 1px solid var(--status-conflict-border);
}

.graph-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.graph-select {
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--fg-default);
  cursor: pointer;
  outline: none;
}
.graph-select:focus { border-color: var(--brand-500); }

.graph-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-family: var(--font-mono);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--fg-muted);
  cursor: pointer;
  transition: border-color 0.1s, color 0.1s, background 0.1s;
}
.graph-chip.active {
  border-color: var(--brand-500);
  color: var(--fg-default);
  background: color-mix(in srgb, var(--brand-500) 12%, transparent);
}
.graph-chip:hover { color: var(--fg-default); }

.graph-chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.graph-legend { font-size: 11px; color: var(--fg-muted); margin-left: 4px; white-space: nowrap; }

.graph-badge {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--fg-muted);
  padding: 2px 6px;
  background: color-mix(in srgb, var(--fg-muted) 10%, transparent);
  border-radius: 4px;
  white-space: nowrap;
}

.graph-svg {
  flex: 1;
  width: 100%;
  display: block;
  min-height: 0;
  background: var(--bg-app);
}

.graph-empty-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--fg-muted);
  pointer-events: none;
  z-index: 1;
}

.graph-loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--bg-app) 70%, transparent);
  z-index: 10;
}

/* ── Detail Rail ─────────────────────────────────────────────────────── */
.graph-rail {
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.rail-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--fg-muted);
  font-size: 12px;
  text-align: center;
  padding: 32px 20px;
}

.rail-node-hdr {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.rail-node-name {
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-mono);
  word-break: break-all;
  color: var(--fg-default);
}

.rail-section {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.rail-section-lbl {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  margin-bottom: 7px;
}

.rail-dep-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
  color: var(--fg-muted);
  transition: color 0.1s;
}
.rail-dep-item:hover { color: var(--brand-500); }

.rail-dep-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.rail-actions {
  padding: 12px 16px;
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
}

/* ── Explain result card body ───────────────────────────────────────────── */
.result-body h2,
.result-body h3 {
  font-weight: 600;
  border-left: 3px solid var(--brand-400, #8183ff);
  padding-left: 8px;
  margin: 16px 0 6px;
}

.result-body p {
  margin: 6px 0;
}

.result-body ul,
.result-body ol {
  margin: 6px 0 6px 20px;
  padding: 0;
}

.result-body li {
  margin: 3px 0;
}

.result-body code {
  font-family: var(--font-mono, monospace);
  font-size: 0.875em;
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: 3px;
  padding: 0 4px;
}

.result-body pre {
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  padding: 10px 12px;
  overflow-x: auto;
  margin: 8px 0;
}

.result-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.875em;
}

.result-body blockquote {
  border-left: 3px solid var(--border-default);
  margin: 8px 0;
  padding: 4px 12px;
  color: var(--fg-muted);
}

/* ── AI badge variant ───────────────────────────────────────────────────── */
.badge-ai {
  background: var(--brand-50);
  color: var(--brand-500);
  border-color: var(--brand-300);
}

.badge-ai .badge-dot {
  background: var(--brand-400);
}
.btn-link:hover { color: var(--brand-500) !important; }

select option {
  background: var(--bg-surface);
  color: var(--fg-default);
}

.graph-seed-input {
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input, var(--bg-app));
  color: var(--fg);
  min-width: 160px;
}
.graph-more-badge { pointer-events: none; }

.gaps-panel { position: absolute; inset: 0; overflow: auto; padding: 12px; background: var(--bg-app); }
.gaps-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.gaps-table th, .gaps-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.gaps-evidence { font-family: var(--font-mono); color: var(--fg-muted); }
.gaps-line { opacity: 0.6; }
.gaps-status { font-size: 11px; padding: 1px 6px; border-radius: 4px; }
.gaps-missing { color: var(--status-conflict-fg); background: var(--status-conflict-bg); }
.gaps-confirmed { color: var(--status-identical-fg); background: var(--status-identical-bg); }
.gaps-inferred { color: var(--status-modified-fg); background: var(--status-modified-bg); }
