/* ==========================================================================
   FileScope Web - Impeccable Design System & Modern Responsive UI
   ========================================================================== */

:root {
  /* Dark Theme (Default - Deep Slate) */
  --bg-app: #080c14;
  --bg-surface: #0e1524;
  --bg-surface-elevated: #162035;
  --bg-surface-hover: #1e2c46;
  --bg-input: #0a0f1a;
  --bg-subtle: rgba(255, 255, 255, 0.03);
  
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-medium: rgba(255, 255, 255, 0.13);
  --border-strong: rgba(255, 255, 255, 0.22);
  --border-focus: #6366f1;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #080c14;
  
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-primary-subtle: rgba(99, 102, 241, 0.14);
  --accent-cyan: #38bdf8;
  --accent-cyan-subtle: rgba(56, 189, 248, 0.12);
  
  /* Semantic Status Tokens */
  --status-match-bg: rgba(16, 185, 129, 0.12);
  --status-match-border: rgba(16, 185, 129, 0.25);
  --status-match-text: #34d399;
  --status-match-dot: #10b981;
  
  --status-only-a-bg: rgba(59, 130, 246, 0.12);
  --status-only-a-border: rgba(59, 130, 246, 0.25);
  --status-only-a-text: #60a5fa;
  --status-only-a-dot: #3b82f6;
  
  --status-only-b-bg: rgba(239, 68, 68, 0.12);
  --status-only-b-border: rgba(239, 68, 68, 0.25);
  --status-only-b-text: #f87171;
  --status-only-b-dot: #ef4444;
  
  --status-diff-bg: rgba(245, 158, 11, 0.12);
  --status-diff-border: rgba(245, 158, 11, 0.25);
  --status-diff-text: #fbbf24;
  --status-diff-dot: #f59e0b;
  
  --status-moved-bg: rgba(168, 85, 247, 0.12);
  --status-moved-border: rgba(168, 85, 247, 0.25);
  --status-moved-text: #c084fc;
  --status-moved-dot: #a855f7;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Fira Code', 'Cascadia Code', Consolas, Monaco, monospace;
  
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
  --shadow-modal: 0 24px 48px -8px rgba(0, 0, 0, 0.75);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-surface-hover: #e2e8f0;
  --bg-input: #ffffff;
  --bg-subtle: #f8fafc;
  
  --border-subtle: rgba(0, 0, 0, 0.07);
  --border-medium: rgba(0, 0, 0, 0.14);
  --border-strong: rgba(0, 0, 0, 0.25);
  --border-focus: #4f46e5;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 4px 16px -2px rgba(0, 0, 0, 0.05);
  --shadow-modal: 0 24px 48px -8px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   Browser Surfaces (Selection, Scrollbars, Focus)
   ========================================================================== */

::selection {
  background-color: var(--accent-primary);
  color: #ffffff;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-app);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-surface-hover);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-app);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

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

*:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Tabular Numerals */
.tnum, td, .kpi-value, .prefix-count, .chip-count {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ==========================================================================
   App Header & Navigation
   ========================================================================== */

.app-header {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #6366f1, #38bdf8);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--accent-cyan-subtle);
  color: var(--accent-cyan);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.header-nav {
  display: flex;
  gap: 0.25rem;
  background-color: var(--bg-input);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.nav-tab:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface-hover);
}

.nav-tab.active {
  background-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.icon-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.icon-btn:active {
  transform: scale(0.96);
}

/* ==========================================================================
   Main Container, Grid & Strict Height Alignment
   ========================================================================== */

.main-container {
  flex: 1;
  max-width: 1560px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
}

.view-panel {
  display: none;
  animation: fadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-panel.active {
  display: block;
}

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

.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-title .title-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.25rem;
  align-items: start;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}

/* Strict uniform label row height to guarantee left/right horizontal baseline alignment */
.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  line-height: 1.2;
}

.form-label-left {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.form-label-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Inputs with strictly uniform 42px height */
.input-with-action {
  display: flex;
  gap: 0.5rem;
  height: 42px;
  min-height: 42px;
  max-height: 42px;
  align-items: stretch;
}

.form-input {
  flex: 0 0 42px;
  width: 100%;
  height: 42px;
  min-height: 42px;
  max-height: 42px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0 0.85rem;
  font-size: 0.875rem;
  font-family: var(--font-mono);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-with-action .form-input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

.input-with-action .form-select {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-select {
  width: 100%;
  height: 42px;
  min-height: 42px;
  max-height: 42px;
  flex: 0 0 42px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0 0.85rem;
  font-size: 0.875rem;
  font-family: var(--font-mono);
  font-weight: 400;
  line-height: 1.2;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Dynamic Tag Input with matching 42px initial height */
.tags-input-container {
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.25rem 0.55rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  min-height: 42px;
  height: 42px;
  overflow-y: auto;
  transition: border-color var(--transition-fast);
}

.tags-input-container:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.tag-badge {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.tag-badge .tag-close {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1;
}

.tag-badge .tag-close:hover {
  color: var(--status-only-b-text);
}

.tag-input-field {
  flex: 1;
  min-width: 130px;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  white-space: nowrap;
}

.input-with-action .btn {
  height: 100%;
}

.filename-template-manager .input-with-action {
  gap: 0.5rem;
}

.filename-template-manager .input-with-action .form-select,
.filename-template-manager .input-with-action .form-input {
  min-width: 0;
}

/* Export workspace: explicit rows keep template, parsing, and output settings aligned. */
.export-config-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 1rem;
  row-gap: 1rem;
  align-items: end;
}

.export-section-label {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--border-subtle);
}

.export-section-label:first-child {
  padding-top: 0;
  border-top: none;
}

.export-section-label > span {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.export-section-label strong {
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 700;
}

.export-config-grid > .filename-template-manager {
  grid-column: span 6;
}

.export-config-grid > .export-path-field {
  grid-column: span 7;
}

.export-config-grid > .export-fields-field {
  grid-column: span 5;
}

.export-config-grid > .export-delimiter-field {
  grid-column: span 4;
}

.export-config-grid > .export-layout-field {
  grid-column: span 8;
}

.export-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border-subtle);
}

.export-footer .btn-primary {
  min-width: 220px;
}

.export-footer #btn-preview-filename {
  min-width: 130px;
}

.filename-preview-card {
  margin-top: 1.25rem;
}

.filename-preview-table {
  min-width: 920px;
}

.filename-preview-table th:first-child,
.filename-preview-table td:first-child {
  min-width: 190px;
}

.filename-preview-table th:nth-child(2),
.filename-preview-table td:nth-child(2) {
  min-width: 150px;
}

.filename-preview-table th:nth-child(3),
.filename-preview-table td:nth-child(3) {
  min-width: 220px;
}

.filename-preview-empty {
  text-align: center;
  color: var(--text-muted) !important;
  padding: 2rem !important;
}

@media (max-width: 900px) {
  .export-config-grid > .filename-template-manager,
  .export-config-grid > .export-path-field,
  .export-config-grid > .export-fields-field,
  .export-config-grid > .export-delimiter-field,
  .export-config-grid > .export-layout-field {
    grid-column: 1 / -1;
  }

  .export-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .export-footer .btn-primary {
    width: 100%;
  }
}

.btn-primary {
  background-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  background-color: var(--accent-primary-hover);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background-color: var(--bg-surface-elevated);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-medium);
}

.btn-secondary:active {
  transform: scale(0.98);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-medium);
  color: var(--text-secondary);
}

.btn-outline:hover {
  color: var(--text-primary);
  border-color: var(--text-primary);
  background-color: var(--bg-subtle);
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.775rem;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   KPI Summary Metrics
   ========================================================================== */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.kpi-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  position: relative;
}

.kpi-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.kpi-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
}

.dot-blue { background-color: #3b82f6; }
.dot-green { background-color: #10b981; }
.dot-purple { background-color: #8b5cf6; }
.dot-amber { background-color: #f59e0b; }
.dot-red { background-color: #ef4444; }

.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  letter-spacing: -0.03em;
}

.kpi-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Prefix Breakdown Cards */
.prefix-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.prefix-item-card {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.prefix-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.prefix-title {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent-cyan);
}

.prefix-count {
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.progress-bar-container {
  width: 100%;
  height: 5px;
  background-color: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #38bdf8);
  border-radius: var(--radius-full);
}

.ext-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ext-pill {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ==========================================================================
   Toolbars & Filter Chips
   ========================================================================== */

.toolbar-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.filter-chips-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.filter-chip {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all var(--transition-fast);
  white-space: nowrap;
  line-height: 1;
}

.filter-chip:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
  background-color: var(--bg-surface-hover);
}

.filter-chip.active {
  background-color: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 0.725rem;
  font-weight: 700;
  font-family: var(--font-mono);
  line-height: 1;
  border-radius: var(--radius-full);
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.filter-chip:hover .chip-count {
  color: var(--text-primary);
}

.filter-chip.active .chip-count {
  background-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

[data-theme="light"] .chip-count {
  background-color: rgba(0, 0, 0, 0.06);
  color: var(--text-secondary);
}

[data-theme="light"] .filter-chip.active .chip-count {
  background-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

/* ==========================================================================
   Status Badges (Strictly Single Line, Clean Dot)
   ========================================================================== */

.status-badge {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  padding: 0.25rem 0.65rem !important;
  border-radius: var(--radius-sm) !important;
  white-space: nowrap !important;
  word-break: keep-all !important;
  line-height: 1.2 !important;
  flex-shrink: 0 !important;
}

.badge-exact {
  background: var(--status-match-bg);
  border: 1px solid var(--status-match-border);
  color: var(--status-match-text);
}
.badge-exact .status-dot { background-color: var(--status-match-dot); }

.badge-only-a {
  background: var(--status-only-a-bg);
  border: 1px solid var(--status-only-a-border);
  color: var(--status-only-a-text);
}
.badge-only-a .status-dot { background-color: var(--status-only-a-dot); }

.badge-only-b {
  background: var(--status-only-b-bg);
  border: 1px solid var(--status-only-b-border);
  color: var(--status-only-b-text);
}
.badge-only-b .status-dot { background-color: var(--status-only-b-dot); }

.badge-diff {
  background: var(--status-diff-bg);
  border: 1px solid var(--status-diff-border);
  color: var(--status-diff-text);
}
.badge-diff .status-dot { background-color: var(--status-diff-dot); }

.badge-moved {
  background: var(--status-moved-bg);
  border: 1px solid var(--status-moved-border);
  color: var(--status-moved-text);
}
.badge-moved .status-dot { background-color: var(--status-moved-dot); }

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* ==========================================================================
   Adaptive Responsive Data Tables (Fluid Proportions & Word Wrapping)
   ========================================================================== */

.table-wrapper {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow-x: auto;
  background-color: var(--bg-surface);
  width: 100%;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.data-table th {
  background-color: var(--bg-surface-elevated);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  user-select: none;
  white-space: nowrap;
  vertical-align: middle;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background-color: var(--bg-surface-hover);
}

.table-code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-primary);
  word-break: break-all;
}

.path-sub {
  font-family: var(--font-mono);
  font-size: 0.725rem;
  color: var(--text-muted);
  word-break: break-all;
}

.form-hint {
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: 0.775rem;
  line-height: 1.5;
}

.clickable-path {
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: color var(--transition-fast);
}

.clickable-path:hover,
.clickable-path:focus-visible {
  color: var(--accent-cyan);
}

.clickable-path:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

.path-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: color var(--transition-fast);
}

.path-link:hover {
  color: var(--accent-cyan);
}

.path-link .link-icon {
  opacity: 0.55;
  color: var(--accent-cyan);
  flex-shrink: 0;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.path-link:hover .link-icon {
  opacity: 1;
  transform: translateX(1px);
}

/* Adaptive Column Width Proportions - Leaf Table */
.col-leaf-path {
  min-width: 200px;
  width: 28%;
}

.col-leaf-depth {
  min-width: 145px !important;
  width: 14% !important;
  text-align: center;
  white-space: nowrap !important;
}

.col-leaf-count {
  min-width: 95px;
  width: 10%;
  text-align: right;
  white-space: nowrap;
}

.col-leaf-size {
  min-width: 100px;
  width: 10%;
  text-align: right;
  white-space: nowrap;
}

.col-leaf-exts {
  min-width: 140px;
  width: 16%;
}

/* Adaptive Column Width Proportions - Prefix Table */
.col-prefix-name {
  min-width: 140px;
  width: 16%;
}

.col-prefix-count {
  min-width: 100px;
  width: 12%;
  text-align: right;
  white-space: nowrap;
}

.col-prefix-pct {
  min-width: 160px;
  width: 18%;
}

.col-prefix-size {
  min-width: 110px;
  width: 12%;
  text-align: right;
  white-space: nowrap;
}

.col-prefix-exts {
  min-width: 150px;
  width: 18%;
}

.col-prefix-samples {
  min-width: 180px;
  width: 24%;
}

.prefix-progress-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.prefix-progress-bar {
  flex: 1;
  height: 6px;
  background-color: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
  min-width: 60px;
}

.prefix-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #38bdf8);
  border-radius: var(--radius-full);
}

/* Adaptive Column Width Proportions - Diff Table */
.col-diff-idx {
  width: 48px;
  min-width: 48px;
  text-align: center;
  white-space: nowrap;
}

.col-diff-status {
  min-width: 125px !important;
  width: 12% !important;
  white-space: nowrap !important;
}

.col-diff-filename {
  min-width: 160px;
  width: 18%;
  font-weight: 600;
  word-break: break-all;
}

.col-diff-path-a {
  min-width: 190px;
  width: 23%;
  word-break: break-all;
}

.col-diff-path-b {
  min-width: 190px;
  width: 23%;
  word-break: break-all;
}

.col-diff-reason {
  min-width: 140px;
  width: 16%;
  line-height: 1.4;
}

.col-diff-action {
  width: 70px;
  min-width: 70px;
  text-align: center;
  white-space: nowrap;
}

/* ==========================================================================
   Empty State Placeholder Guide
   ========================================================================== */

.empty-state-guide {
  border: 1px dashed var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 3rem 1.5rem;
  text-align: center;
  background-color: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
}

.empty-state-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.empty-state-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  max-width: 480px;
  line-height: 1.6;
}

/* Pagination Bar */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.25rem;
  color: var(--text-secondary);
  font-size: 0.825rem;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 2000;
}

.toast {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: slideInRight 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */

@media (max-width: 900px) {
  .app-header {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
  }
  .header-nav {
    overflow-x: auto;
    scrollbar-width: none;
  }
  .header-nav::-webkit-scrollbar {
    display: none;
  }
  .control-grid {
    grid-template-columns: 1fr;
  }
  .toolbar-bar {
    flex-direction: column;
    align-items: stretch;
  }
}
/* Server directory picker */
.modal-backdrop { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.7); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.modal-backdrop.active { opacity: 1; pointer-events: auto; }
.modal-card { width: min(640px, 90vw); max-height: 80vh; display: flex; flex-direction: column; background: var(--bg-surface); border: 1px solid var(--border-medium); border-radius: var(--radius-lg); box-shadow: var(--shadow-modal); }
.modal-header, .modal-footer { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .85rem 1.25rem; border-color: var(--border-subtle); }
.modal-header { border-bottom: 1px solid var(--border-subtle); }
.modal-header h3 { margin: 0; font-size: .95rem; }
.modal-body { padding: 1.25rem; overflow-y: auto; }
.modal-footer { justify-content: flex-end; border-top: 1px solid var(--border-subtle); }
.browser-path-bar { display: flex; gap: .5rem; margin-bottom: .75rem; }
.browser-current-path { flex: 1; min-width: 0; padding: .45rem .75rem; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-input); font-family: var(--font-mono); overflow-wrap: anywhere; }
.browser-list-container { max-height: 360px; overflow-y: auto; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: .35rem; }
.browser-item { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: .55rem .75rem; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-primary); cursor: pointer; text-align: left; }
.browser-item:hover { background: var(--bg-surface-hover); }
.browser-item-left { display: flex; align-items: center; gap: .6rem; font-family: var(--font-mono); font-size: .85rem; }
.browser-item-meta { color: var(--text-muted); font-size: .75rem; }
.browser-loading, .browser-error { padding: 1.5rem; color: var(--text-muted); text-align: center; font-size: .85rem; }
.browser-error { color: var(--status-only-b-text); }
