/* ═══════════════════════════════════════════════════════════════
   FileCompare — Professional Stylesheet
   Dark & Light Mode + Full Layout
   ═══════════════════════════════════════════════════════════════ */

/* ─── CSS Variables ─── */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  --radius: 6px;
  --radius-sm: 4px;
  --transition: 0.18s ease;
  --topbar-h: 48px;
  --statusbar-h: 26px;
  --header-h: 40px;
}

/* ─── DARK THEME (default) ─── */
[data-theme="dark"] {
  --bg-app:       #1a1b1e;
  --bg-surface:   #25262b;
  --bg-surface2:  #2c2e33;
  --bg-surface3:  #383a40;
  --bg-hover:     #2f3136;
  --border:       #3a3d44;
  --border-light: #2f3136;

  --text-primary: #e8eaed;
  --text-secondary:#9ba0a9;
  --text-muted:   #6b717d;

  --accent:       #4dabf7;
  --accent-hover: #74c0fc;
  --accent2:      #69db7c;
  --accent-dim:   rgba(77,171,247,0.12);

  --diff-added:       #1a2f1a;
  --diff-added-hl:    #2d5a2d;
  --diff-added-text:  #69db7c;
  --diff-removed:     #2f1a1a;
  --diff-removed-hl:  #5a2d2d;
  --diff-removed-text:#ff6b6b;
  --diff-changed:     #2a2118;
  --diff-changed-hl:  #4d3a1f;

  --gutter-bg:    #1f2124;
  --scrollbar:    #3a3d44;
  --scrollbar-hover: #4a4d55;

  --shadow: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
}

/* ─── LIGHT THEME ─── */
[data-theme="light"] {
  --bg-app:       #f0f2f5;
  --bg-surface:   #ffffff;
  --bg-surface2:  #f7f8fa;
  --bg-surface3:  #e8eaed;
  --bg-hover:     #f0f2f5;
  --border:       #d0d4db;
  --border-light: #e4e7eb;

  --text-primary: #1a1b1e;
  --text-secondary:#4a5568;
  --text-muted:   #9ba0a9;

  --accent:       #1971c2;
  --accent-hover: #1864ab;
  --accent2:      #2f9e44;
  --accent-dim:   rgba(25,113,194,0.08);

  --diff-added:       #e6f4ea;
  --diff-added-hl:    #ceead6;
  --diff-added-text:  #1a7f37;
  --diff-removed:     #fce8e6;
  --diff-removed-hl:  #f5c6c2;
  --diff-removed-text:#c5221f;
  --diff-changed:     #fdf3e3;
  --diff-changed-hl:  #f7ddb0;

  --gutter-bg:    #f7f8fa;
  --scrollbar:    #d0d4db;
  --scrollbar-hover: #b8bec7;

  --shadow: 0 4px 16px rgba(0,0,0,0.1);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
}

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

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-primary);
  font-size: 11px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: inherit; }
input { font-family: inherit; font-size: inherit; }
svg { flex-shrink: 0; }

/* ─── Scrollbars ─── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); }

/* ═══════════════════════════════════════════════════════════════
   TOPBAR
   ═══════════════════════════════════════════════════════════════ */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 16px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 100;
  position: relative;
}

.topbar-left { display: flex; align-items: center; gap: 24px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.logo-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

/* Top navigation */
.topnav { display: flex; gap: 2px; }

.nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 11px;
  transition: all var(--transition);
  white-space: nowrap;
}
.nav-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.nav-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
}

/* Toolbar actions */
.toolbar-actions { display: flex; align-items: center; gap: 2px; }

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all var(--transition);
}
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.icon-btn[data-active="true"] {
  background: var(--accent-dim);
  color: var(--accent);
}

.separator {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

/* Diff stats in topbar */
.diff-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
}
.stat {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}
.stat.added    { background: var(--diff-added); color: var(--diff-added-text); }
.stat.removed  { background: var(--diff-removed); color: var(--diff-removed-text); }
.stat.changed  { color: #e8a04c; background: rgba(232,160,76,0.12); }

/* ═══════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════════ */
.main-content {
  height: calc(100vh - var(--topbar-h) - var(--statusbar-h));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.mode-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  height: 100%;
}
.mode-panel.active {
  display: flex;
}

/* ═══════════════════════════════════════════════════════════════
   PANEL HEADERS
   ═══════════════════════════════════════════════════════════════ */
.panel-headers {
  display: flex;
  align-items: stretch;
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-header {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  gap: 10px;
  min-width: 0;
}
.panel-header.left-header {
  border-right: 1px solid var(--border);
}

.panel-header-mid {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 4px;
  flex-shrink: 0;
  background: var(--gutter-bg);
  border-right: 1px solid var(--border);
}

.file-info {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--text-secondary);
}
.file-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}
.file-badge {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 20px;
  background: var(--bg-surface3);
  color: var(--text-muted);
  white-space: nowrap;
}

.panel-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ─── Pill buttons ─── */
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 500;
  background: var(--bg-surface3);
  color: var(--text-secondary);
  transition: all var(--transition);
  white-space: nowrap;
  border: 1px solid var(--border);
}
.pill-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.pill-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
.pill-btn.success:not(:disabled) {
  background: var(--diff-added);
  color: var(--diff-added-text);
  border-color: transparent;
}
.pill-btn.success:hover:not(:disabled) {
  background: var(--accent2);
  color: #fff;
}

/* Merge all buttons */
.merge-all-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition);
}
.merge-all-btn:hover {
  background: var(--accent-dim);
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════
   EDITORS CONTAINER
   ═══════════════════════════════════════════════════════════════ */
.editors-container {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

.editor-pane {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

.monaco-editor-container {
  width: 100%;
  height: 100%;
}

/* Diff gutter (between editors) */
.diff-gutter {
  width: 56px;
  flex-shrink: 0;
  background: var(--gutter-bg);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  cursor: default;
}

/* Connector bands between the panes (Beyond Compare style) */
.gutter-connectors {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* Full-file diff overview ribbon (click/drag to jump) */
.overview-ribbon {
  width: 16px;
  flex-shrink: 0;
  position: relative;
  background: var(--gutter-bg);
  border-right: 1px solid var(--border);
  cursor: pointer;
  overflow: hidden;
}
.overview-ribbon canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#overview-viewport {
  position: absolute;
  left: 0;
  right: 0;
  background: rgba(128, 160, 255, 0.14);
  border-top: 1px solid rgba(128, 160, 255, 0.5);
  border-bottom: 1px solid rgba(128, 160, 255, 0.5);
  pointer-events: none;
}

/* View zone placeholder (diagonal-stripe padding, like Beyond Compare) */
.wc-view-zone-gap {
  width: 100%;
  height: 100%;
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(128,128,128,0.30) 0px,
    rgba(128,128,128,0.30) 2px,
    transparent 2px,
    transparent 8px
  );
  background-color: rgba(80,80,100,0.12);
}

/* ─── Diff line highlighting ─── */
.diff-line-added {
  background: var(--diff-added) !important;
}
.diff-line-removed {
  background: var(--diff-removed) !important;
}
.diff-line-added-inline {
  background: var(--diff-added-hl);
  border-radius: 2px;
}
.diff-line-removed-inline {
  background: var(--diff-removed-hl);
  border-radius: 2px;
}
.diff-line-changed {
  background: var(--diff-changed) !important;
}

/* ═══════════════════════════════════════════════════════════════
   GUTTER ARROWS (merge arrows rendered as SVG)
   ═══════════════════════════════════════════════════════════════ */
.gutter-arrow-btn {
  /* Flex item within .gutter-arrow-group (a flex column) — NOT absolutely
     positioned. Both buttons used to be position:absolute with no `top`,
     which collapsed them to the same spot for "changed" hunks (both a
     to-left and to-right arrow), making one unclickable. */
  align-self: center;
  flex-shrink: 0;
  width: 44px;
  height: 20px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
  cursor: pointer;
  transition: all var(--transition);
  z-index: 10;
  border: 1px solid transparent;
}
.gutter-arrow-btn.to-right {
  background: rgba(77,171,247,0.15);
  color: var(--accent);
  border-color: rgba(77,171,247,0.3);
}
.gutter-arrow-btn.to-right:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.gutter-arrow-btn.to-left {
  background: rgba(105,219,124,0.15);
  color: var(--accent2);
  border-color: rgba(105,219,124,0.3);
}
.gutter-arrow-btn.to-left:hover {
  background: var(--accent2);
  color: #fff;
  border-color: var(--accent2);
}

/* ═══════════════════════════════════════════════════════════════
   WELCOME OVERLAY
   ═══════════════════════════════════════════════════════════════ */
.welcome-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, transparent 0%, var(--bg-app) 70%),
    var(--bg-app);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  overflow: hidden;
}
/* Faint dot grid texture */
.welcome-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, var(--border) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.35;
  pointer-events: none;
}

/* Ambient color glows behind the card */
.welcome-glow {
  position: absolute;
  width: 560px;
  height: 560px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.16;
  pointer-events: none;
}
.welcome-glow.glow-a { background: var(--accent);  top: -180px;   left: -120px; }
.welcome-glow.glow-b { background: var(--accent2); bottom: -220px; right: -140px; }

.welcome-card {
  position: relative;
  text-align: center;
  max-width: 780px;
  padding: 40px 44px;
  animation: welcomeIn 0.5s ease both;
}

@keyframes welcomeIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.welcome-logo {
  margin-bottom: 18px;
  filter: drop-shadow(0 6px 24px rgba(77, 171, 247, 0.25));
}

.welcome-title {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -1.2px;
  margin-bottom: 10px;
  color: var(--text-primary);
}
.welcome-title span {
  background: linear-gradient(120deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-tagline {
  color: var(--text-secondary);
  font-size: 14.5px;
  margin-bottom: 36px;
}

/* ── Feature cards ── */
.welcome-features {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-bottom: 30px;
}

.feature-card {
  flex: 1;
  min-width: 0;
  max-width: 232px;
  text-align: left;
  padding: 20px 18px 16px;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: welcomeIn 0.5s ease both;
}
.feature-card:nth-child(1) { animation-delay: 0.08s; }
.feature-card:nth-child(2) { animation-delay: 0.16s; }
.feature-card:nth-child(3) { animation-delay: 0.24s; }

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}
.fc-file:hover   { border-color: var(--accent); }
.fc-folder:hover { border-color: #e8a04c; }
.fc-text:hover   { border-color: var(--accent2); }

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  margin-bottom: 2px;
}
.fc-file   .feature-icon { background: var(--accent-dim);        color: var(--accent); }
.fc-folder .feature-icon { background: rgba(232,160,76,0.12);    color: #e8a04c; }
.fc-text   .feature-icon { background: rgba(105,219,124,0.12);   color: var(--accent2); }

.feature-card h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}
.feature-card p {
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-secondary);
  flex: 1;
}
.feature-cta {
  font-size: 11.5px;
  font-weight: 600;
  margin-top: 4px;
  transition: transform 0.2s ease;
}
.fc-file   .feature-cta { color: var(--accent); }
.fc-folder .feature-cta { color: #e8a04c; }
.fc-text   .feature-cta { color: var(--accent2); }
.feature-card:hover .feature-cta { transform: translateX(3px); }

/* ── Privacy badge ── */
.welcome-privacy {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--text-secondary);
  padding: 7px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  margin-bottom: 26px;
  animation: welcomeIn 0.5s ease 0.32s both;
}
.welcome-privacy svg { color: var(--accent2); flex-shrink: 0; }

/* ── Creator credit ── */
.welcome-footer {
  font-size: 11px;
  color: var(--text-muted);
  animation: welcomeIn 0.5s ease 0.4s both;
}
.welcome-footer strong {
  color: var(--text-secondary);
  font-weight: 600;
}
.welcome-footer .dot-sep { margin: 0 8px; }

@media (max-width: 860px) {
  .welcome-features { flex-direction: column; align-items: center; }
  .feature-card { max-width: 340px; width: 100%; }
}

/* ═══════════════════════════════════════════════════════════════
   FOLDER COMPARE
   ═══════════════════════════════════════════════════════════════ */
.folder-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.folder-path-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.folder-path-bar.right {
  justify-content: flex-end;
}
.folder-path-label {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
  font-family: var(--font-mono);
}

.folder-filter {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.filter-input {
  padding: 5px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-surface2);
  color: var(--text-primary);
  outline: none;
  width: 180px;
  font-size: 12.5px;
  transition: border-color var(--transition);
}
.filter-input:focus { border-color: var(--accent); }
.filter-input::placeholder { color: var(--text-muted); }

.folder-legend {
  display: flex;
  gap: 12px;
  align-items: center;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-muted);
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.dot.added   { background: var(--diff-added-text); }
.dot.removed { background: var(--diff-removed-text); }
.dot.changed { background: #e8a04c; }
.dot.same    { background: var(--text-muted); }

/* Folder content area */
.folder-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
}

.folder-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100%;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── Beyond Compare-style aligned folder tree ── */
.ft-statsbar {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface2);
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
  position: sticky;
  top: 0;
  z-index: 3;
}

.folder-tree-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}
.folder-tree-table thead th {
  position: sticky;
  top: 33px;               /* below the stats bar */
  background: var(--bg-surface2);
  border-bottom: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 2;
}
.folder-tree-table th.ft-size,  .folder-tree-table td.ft-size  { width: 84px;  text-align: right; }
.folder-tree-table th.ft-mod,   .folder-tree-table td.ft-mod   { width: 130px; }
.folder-tree-table th.ft-mid,   .folder-tree-table td.ft-mid   { width: 64px;  text-align: center; }

.ft-row {
  border-bottom: 1px solid var(--border-light);
  cursor: default;
  user-select: none;
}
.ft-row:hover { background: var(--bg-hover); }
.ft-row.ft-selected { background: var(--accent-dim); }

.folder-tree-table td {
  padding: 3px 10px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.folder-tree-table td.ft-name { padding-left: calc(10px + var(--depth, 0) * 18px); }
.folder-tree-table td.ft-size, .folder-tree-table td.ft-mod {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Left pane / divider / right pane separation */
.folder-tree-table td:nth-child(3), .folder-tree-table th:nth-child(3) { border-right: 1px solid var(--border); }
.folder-tree-table td.ft-mid, .folder-tree-table th.ft-mid {
  background: var(--gutter-bg);
  border-right: 1px solid var(--border);
}

/* Missing-side placeholder — same hatch pattern as editor alignment gaps */
td.ft-missing {
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(128,128,128,0.18) 0px,
    rgba(128,128,128,0.18) 2px,
    transparent 2px,
    transparent 8px
  );
  background-color: rgba(80,80,100,0.08);
}

/* Expander triangle */
.ft-expander, .ft-expander-spacer {
  display: inline-block;
  width: 14px;
  text-align: center;
  cursor: pointer;
  color: var(--text-muted);
}
.ft-expander::before { content: '▸'; font-size: 10px; }
.ft-expander.open::before { content: '▾'; }

.ft-icon { display: inline-block; vertical-align: -2px; margin-right: 5px; color: var(--text-muted); }
.ft-directory .ft-icon { color: var(--accent); }
.ft-label { color: var(--text-primary); }

/* Status colors — applied to the side(s) where the entry lives */
.st-changed .ft-label { color: #e8a04c; }
.st-added   .ft-label { color: var(--diff-added-text); }
.st-removed .ft-label { color: var(--diff-removed-text); }
.st-error   .ft-label { color: var(--diff-removed-text); opacity: 0.6; }
.st-same    .ft-label { color: var(--text-secondary); }

/* Copy action buttons in the divider (visible on row hover) */
.ft-act {
  visibility: hidden;
  padding: 0 5px;
  font-size: 13px;
  color: var(--accent);
  border-radius: var(--radius-sm);
  line-height: 18px;
}
.ft-row:hover .ft-act { visibility: visible; }
.ft-act:hover { background: var(--accent); color: #fff; }

/* Folder tree table */
.folder-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.folder-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-surface2);
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 1;
}
.folder-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition);
}
.folder-table tbody tr:hover { background: var(--bg-hover); }
.folder-table td {
  padding: 6px 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.folder-table td:first-child { color: var(--text-primary); }

.folder-row-added    td:first-child { color: var(--diff-added-text); }
.folder-row-removed  td:first-child { color: var(--diff-removed-text); }
.folder-row-changed  td:first-child { color: #e8a04c; }
.folder-row-same     td:first-child { color: var(--text-muted); }

.folder-row-added    td:first-child::before { content: '+ '; font-weight: 700; }
.folder-row-removed  td:first-child::before { content: '- '; font-weight: 700; }
.folder-row-changed  td:first-child::before { content: '~ '; font-weight: 700; }

.folder-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.folder-icon svg { color: var(--text-muted); }

.folder-status-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 600;
}
.badge-added    { background: var(--diff-added); color: var(--diff-added-text); }
.badge-removed  { background: var(--diff-removed); color: var(--diff-removed-text); }
.badge-changed  { background: rgba(232,160,76,0.15); color: #e8a04c; }
.badge-same     { background: var(--bg-surface3); color: var(--text-muted); }

.folder-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  background: var(--bg-surface3);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all var(--transition);
  margin: 0 2px;
}
.folder-copy-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════
   STATUS BAR
   ═══════════════════════════════════════════════════════════════ */
.statusbar {
  height: var(--statusbar-h);
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  flex-shrink: 0;
}

.status-left, .status-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-msg {
  font-size: 10px;
  color: rgba(255,255,255,0.9);
  font-weight: 500;
}

.status-credit {
  font-size: 9.5px;
  color: rgba(255,255,255,0.65);
  margin-right: 6px;
  white-space: nowrap;
}

.status-chip {
  font-size: 9.5px;
  color: rgba(255,255,255,0.8);
  padding: 1px 7px;
  border-radius: 3px;
  background: rgba(0,0,0,0.15);
  font-weight: 500;
}
.status-chip.diff-chip {
  background: rgba(0,0,0,0.2);
  color: #fff;
  font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════════
   CONTEXT MENU
   ═══════════════════════════════════════════════════════════════ */
.context-menu {
  position: fixed;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 4px;
  z-index: 1000;
  min-width: 160px;
  animation: fadeIn 0.1s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 11px;
  text-align: left;
  transition: all var(--transition);
}
.ctx-item:hover {
  background: var(--accent-dim);
  color: var(--accent);
}
.ctx-separator {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ═══════════════════════════════════════════════════════════════
   MODAL (Folder File Diff)
   ═══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 92vw;
  height: 85vh;
  max-width: 1400px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title {
  font-weight: 600;
  font-size: 13.5px;
  font-family: var(--font-mono);
}

.modal-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.modal-editor {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.modal-gutter {
  width: 56px;
  flex-shrink: 0;
}

.modal-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 40px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 13px;
  color: var(--text-primary);
  animation: toastIn 0.25s ease;
  min-width: 240px;
  max-width: 360px;
}
.toast.success { border-left: 3px solid var(--diff-added-text); }
.toast.error   { border-left: 3px solid var(--diff-removed-text); }
.toast.info    { border-left: 3px solid var(--accent); }
.toast.warning { border-left: 3px solid #e8a04c; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

/* ═══════════════════════════════════════════════════════════════
   TEXT COMPARE MODE SPECIFICS
   ═══════════════════════════════════════════════════════════════ */
.text-editors-container {
  height: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   MONACO EDITOR OVERRIDES
   ═══════════════════════════════════════════════════════════════ */
.monaco-editor .margin { background: var(--gutter-bg) !important; }
.monaco-editor-background { background: var(--bg-app) !important; }

/* Diff highlighting classes for Monaco decorations */
.monaco-diff-added    { background: var(--diff-added); }
.monaco-diff-removed  { background: var(--diff-removed); }
.monaco-diff-changed  { background: var(--diff-changed); }
.monaco-diff-added-inline   { background: var(--diff-added-hl); border-radius: 2px; }
.monaco-diff-removed-inline { background: var(--diff-removed-hl); border-radius: 2px; }

/* ── Inline character-level diff (Beyond Compare style) ── */
/* Applied to exact characters that changed within a line */
.wc-char-removed {
  background-color: var(--diff-removed-hl) !important;
  border-radius: 2px;
}
.wc-char-added {
  background-color: var(--diff-added-hl) !important;
  border-radius: 2px;
}
/* Stronger contrast in light mode */
[data-theme="light"] .wc-char-removed {
  background-color: #f5c6c2 !important;
}
[data-theme="light"] .wc-char-added {
  background-color: #ceead6 !important;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .logo-text { display: none; }
  .topnav .nav-btn span { display: none; }
  .diff-stats { display: none !important; }
  .folder-filter { display: none; }
  .file-name { max-width: 120px; }
}
