/* ==========================================================================
   LedgerVault AI — Minimalist & Professional Design System
   Architecture: Executive Sidebar + Workspace Studio Layout
   Palette: Deep Slate / Obsidian Charcoal + Precision Indigo & Emerald
   ========================================================================== */

:root, [data-theme="dark"] {
  /* Canvas & Surfaces */
  --bg-canvas: #090a0f;
  --bg-sidebar: #0d0f15;
  --bg-surface: #13161f;
  --bg-surface-elevated: #181d28;
  --bg-subtle: #161922;
  --bg-hover: #1e2330;
  --bg-input: #0e1118;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(255, 255, 255, 0.24);

  /* Typography */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-dim: #475569;

  /* Brand & Accents */
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-primary-subtle: rgba(99, 102, 241, 0.14);
  
  --accent-emerald: #10b981;
  --accent-emerald-subtle: rgba(16, 185, 129, 0.12);
  --accent-emerald-border: rgba(16, 185, 129, 0.3);

  --accent-amber: #f59e0b;
  --accent-amber-subtle: rgba(245, 158, 11, 0.12);

  --accent-rose: #f43f5e;
  --accent-rose-subtle: rgba(244, 63, 94, 0.14);

  --accent-ink: #ffffff;
  --accent-inverse: #090a0f;

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);

  /* Typography & Transitions */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  --transition-fast: 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --bg-canvas: #f8fafc;
  --bg-sidebar: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-hover: #e2e8f0;
  --bg-input: #ffffff;

  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-strong: #94a3b8;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  --accent-primary: #4f46e5;
  --accent-primary-hover: #4338ca;
  --accent-primary-subtle: rgba(79, 70, 229, 0.08);

  --accent-emerald: #059669;
  --accent-emerald-subtle: rgba(5, 150, 105, 0.08);
  --accent-emerald-border: rgba(5, 150, 105, 0.25);

  --accent-amber: #d97706;
  --accent-amber-subtle: rgba(217, 119, 6, 0.08);

  --accent-rose: #e11d48;
  --accent-rose-subtle: rgba(225, 29, 72, 0.08);

  --accent-ink: #0f172a;
  --accent-inverse: #ffffff;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);
}

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

html, body {
  height: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  overflow: hidden;
}

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

/* Typography Helpers */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.25;
}

p {
  color: var(--text-secondary);
  font-size: 0.86rem;
}

.num-font {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.sub-muted {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.text-highlight {
  color: var(--accent-emerald) !important;
}

.text-danger {
  color: var(--accent-rose) !important;
}

.w-full {
  width: 100%;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Buttons & Interactive Elements
   ========================================================================== */

button, input, select, textarea {
  font-family: inherit;
}

.btn-solid {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 500;
  background: var(--accent-ink);
  color: var(--accent-inverse);
  border: 1px solid var(--accent-ink);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn-solid:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

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

.btn-solid.btn-confirm {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
}

.btn-solid.btn-confirm:hover {
  background: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
}

.btn-subtle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

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

.btn-subtle.btn-sm {
  padding: 6px 11px;
  font-size: 0.78rem;
}

.btn-minimal {
  background: transparent;
  border: none;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  transition: all var(--transition-fast);
}

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

.btn-link {
  background: transparent;
  border: none;
  font-size: 0.76rem;
  color: var(--accent-primary);
  font-weight: 500;
  cursor: pointer;
  padding: 2px 4px;
}

.btn-link:hover {
  text-decoration: underline;
}

.btn-xs {
  padding: 5px 9px;
  font-size: 0.72rem;
}

/* ==========================================================================
   APP SHELL & LAYOUT
   ========================================================================== */

.app-shell {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-canvas);
}

/* Reconstructed Left Sidebar */
.app-sidebar {
  width: 260px;
  min-width: 260px;
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 60;
  transition: transform var(--transition-normal);
}

.sidebar-header {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-decoration: none;
}

.brand-monogram {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-primary), #4338ca);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.brand-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--accent-primary-subtle);
  color: var(--accent-primary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.privacy-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.73rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 5px 10px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.privacy-dot {
  width: 6px;
  height: 6px;
  background: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulseGlow 2.5s infinite;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.9); }
}

/* Sidebar Section Headers */
.sidebar-section-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding: 0 6px;
}

/* Navigation Menu */
.sidebar-nav-wrap {
  padding: 16px 14px 10px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item.seg-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.nav-item.seg-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.seg-btn.active {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.nav-item.seg-btn:hover .nav-icon,
.nav-item.seg-btn.active .nav-icon {
  color: var(--accent-primary);
}

.nav-label {
  flex: 1;
}

.seg-count {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 1px 7px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}

.nav-item.seg-btn.active .seg-count {
  background: var(--accent-primary-subtle);
  color: var(--accent-primary);
  border-color: transparent;
}

/* Engine Settings Card in Sidebar */
.sidebar-engine-box {
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
}

.engine-selector-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.engine-select-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--accent-emerald);
  font-weight: 500;
}

.engine-subtext {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.minimal-select {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.76rem;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.minimal-select:focus {
  border-color: var(--accent-primary);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 14px 14px 18px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-sidebar);
}

.sidebar-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.sidebar-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

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

.sidebar-action-btn.btn-license {
  color: var(--text-primary);
  border-color: var(--border-medium);
  background: var(--bg-hover);
}

.sidebar-user-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
}

.theme-switch-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-switch-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

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

.icon-toggle:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.storage-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.storage-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-emerald);
}

/* ==========================================================================
   APP MAIN & TOPBAR
   ========================================================================== */

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}

/* Topbar Header */
.app-topbar {
  height: 54px;
  min-height: 54px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 40;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
}

.topbar-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
}

.crumb-root {
  color: var(--text-muted);
}

.crumb-separator {
  color: var(--border-strong);
  font-size: 0.75rem;
}

.crumb-current {
  color: var(--text-primary);
  font-weight: 500;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  padding: 3px 9px;
  background: var(--bg-subtle);
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

.topbar-stat-dot {
  width: 5px;
  height: 5px;
  background: var(--accent-emerald);
  border-radius: 50%;
}

.app-content-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-canvas);
}

.app-layout {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 24px 60px;
}

/* ==========================================================================
   RECONSTRUCTED KPI METRIC STRIP
   ========================================================================== */

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 1080px) {
  .kpi-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .kpi-strip {
    grid-template-columns: 1fr;
  }
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.kpi-card:hover {
  border-color: var(--border-medium);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.kpi-card.highlight-card {
  border-color: var(--accent-emerald-border);
  background: linear-gradient(180deg, var(--bg-surface), var(--bg-subtle));
}

.kpi-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

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

.kpi-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

.kpi-badge.neutral {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.kpi-badge.success {
  background: var(--accent-emerald-subtle);
  color: var(--accent-emerald);
}

.kpi-badge.primary {
  background: var(--accent-primary-subtle);
  color: var(--accent-primary);
}

.kpi-num {
  font-family: var(--font-mono);
  font-size: 1.55rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -0.03em;
}

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

/* ==========================================================================
   VIEW SWITCHING
   ========================================================================== */

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
  animation: viewFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* ==========================================================================
   VIEW 1: INTAKE & SCANNER
   ========================================================================== */

.minimal-dropzone {
  background: var(--bg-surface);
  border: 1.5px dashed var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.minimal-dropzone:hover, .minimal-dropzone.drag-active {
  border-color: var(--accent-primary);
  background: var(--bg-surface-elevated);
  box-shadow: 0 0 0 4px var(--accent-primary-subtle);
}

.file-input-hidden {
  display: none;
}

.dropzone-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.dropzone-icon-wrap {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--bg-hover);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.minimal-dropzone:hover .dropzone-icon-wrap {
  background: var(--accent-primary-subtle);
  color: var(--accent-primary);
  transform: scale(1.05);
}

.dropzone-text h4 {
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.dropzone-text p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.dropzone-buttons {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

/* Progress Status Card */
.minimal-progress {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  margin-bottom: 10px;
}

.progress-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.progress-pulse-dot {
  width: 7px;
  height: 7px;
  background: var(--accent-primary);
  border-radius: 50%;
  animation: pulseGlow 1.2s infinite;
}

.progress-val {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-primary);
}

.progress-track {
  width: 100%;
  height: 5px;
  background: var(--bg-hover);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-emerald));
  border-radius: 3px;
  transition: width 0.15s ease;
}

.progress-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.progress-engine-tag {
  font-family: var(--font-mono);
  background: var(--bg-hover);
  padding: 1px 6px;
  border-radius: 3px;
}

/* Test Suite Strip */
.test-suite-strip {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}

.strip-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.strip-title {
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.strip-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.strip-tag {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 6px;
  background: var(--bg-hover);
  border-radius: 4px;
  color: var(--text-secondary);
}

.sample-chips-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.sample-chip {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all var(--transition-fast);
}

.sample-chip:hover {
  background: var(--bg-hover);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.chip-vendor {
  font-weight: 500;
  font-size: 0.82rem;
  color: var(--text-primary);
}

.chip-total {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-emerald);
}

/* ==========================================================================
   VIEW 2: SPLIT-SCREEN INSPECTOR
   ========================================================================== */

.split-workspace {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 960px) {
  .split-workspace {
    grid-template-columns: 1fr;
  }
}

.viewer-pane, .form-pane {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* Left Viewer Pane */
.pane-toolbar {
  padding: 10px 16px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pane-file-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.pane-filename {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-weight: 500;
}

.pane-controls {
  display: flex;
  gap: 4px;
}

.ctrl-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 3px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.ctrl-btn-active {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.viewer-viewport {
  height: 520px;
  background: var(--bg-canvas);
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}

.viewer-wrapper {
  position: relative;
  display: inline-block;
  transform-origin: center center;
  transition: transform 0.12s ease;
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-xs);
}

.viewer-image {
  max-width: 100%;
  max-height: 480px;
  display: block;
  border-radius: var(--radius-xs);
  background: #ffffff;
}

.ocr-bounding-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.ocr-box {
  position: absolute;
  border: 1.5px solid rgba(16, 185, 129, 0.65);
  background: rgba(16, 185, 129, 0.08);
  border-radius: 2px;
}

.minimal-raw-ocr {
  border-top: 1px solid var(--border-subtle);
  padding: 10px 16px;
  font-size: 0.78rem;
  background: var(--bg-subtle);
}

.minimal-raw-ocr summary {
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.summary-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.minimal-raw-ocr pre {
  margin-top: 10px;
  padding: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  color: var(--text-secondary);
  font-size: 0.72rem;
  white-space: pre-wrap;
  max-height: 140px;
  overflow-y: auto;
}

/* Right Form Pane */
.form-pane {
  padding: 22px;
}

.form-pane-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.pane-title {
  font-size: 0.98rem;
  margin-bottom: 2px;
}

.minimal-confidence {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.73rem;
  font-weight: 500;
  color: var(--accent-emerald);
  padding: 3px 8px;
  background: var(--accent-emerald-subtle);
  border-radius: 12px;
}

.confidence-dot {
  width: 5px;
  height: 5px;
  background: var(--accent-emerald);
  border-radius: 50%;
}

.minimal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-row {
  display: flex;
  gap: 14px;
}

@media (max-width: 600px) {
  .field-row {
    flex-direction: column;
    gap: 12px;
  }
}

.field-col {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-col label {
  font-size: 0.73rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.align-center { justify-content: center; }

.min-input, .min-select {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 0.82rem;
  font-family: var(--font-sans);
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
}

.min-input:focus, .min-select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-subtle);
}

.deductible-summary {
  background: var(--bg-input);
  border: 1px solid var(--accent-emerald-border);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.deductible-pct {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.deductible-calc {
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--accent-emerald);
}

/* Custom Toggle Switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-secondary);
  user-select: none;
  height: 100%;
}

.toggle-wrap input {
  display: none;
}

.toggle-slider {
  width: 32px;
  height: 18px;
  background: var(--bg-hover);
  border: 1px solid var(--border-medium);
  border-radius: 12px;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all 0.2s ease;
}

.toggle-wrap input:checked + .toggle-slider {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

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

/* Items Block Table */
.items-block {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.items-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.items-title {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.items-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  padding: 4px 6px;
  font-size: 0.72rem;
}

.items-table td {
  padding: 4px 6px;
}

.items-table input {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-xs);
  padding: 5px 8px;
  width: 100%;
  font-size: 0.78rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.items-table input:focus {
  border-color: var(--accent-primary);
}

.line-item-del-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 2px 4px;
}

.line-item-del-btn:hover {
  color: var(--accent-rose);
}

.w-8 { width: 28px; }
.w-16 { width: 54px; }
.w-24 { width: 84px; }

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.action-nav-group {
  display: flex;
  gap: 8px;
}

/* ==========================================================================
   VIEW 3: EXPENSE LEDGER
   ========================================================================== */

.ledger-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.search-strip {
  flex: 1;
  min-width: 260px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding-left: 32px !important;
}

.filters-strip, .export-strip {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ledger-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

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

.minimal-table th {
  padding: 12px 16px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-subtle);
  user-select: none;
}

.minimal-table th.sortable {
  cursor: pointer;
}

.minimal-table th.sortable:hover {
  color: var(--text-primary);
}

.sort-indicator {
  font-size: 0.75rem;
  opacity: 0.6;
}

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

.minimal-table tbody tr {
  transition: background-color var(--transition-fast);
}

.minimal-table tbody tr:hover td {
  background: var(--bg-hover);
}

.text-right { text-align: right; }
.text-center { text-align: center; }

.table-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 500;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.table-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 3px 7px;
  font-size: 0.72rem;
  transition: all var(--transition-fast);
}

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

.btn-row-del:hover {
  color: var(--accent-rose);
  border-color: var(--accent-rose);
}

/* Empty State */
.minimal-empty {
  padding: 56px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-icon-box {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.minimal-empty h4 {
  font-size: 1rem;
}

.minimal-empty p {
  color: var(--text-muted);
  max-width: 320px;
  margin-bottom: 6px;
}

/* Sticky Bulk Action Dock */
.minimal-bulk-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  z-index: 50;
  animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translate(-50%, 15px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.bulk-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-primary);
}

.bulk-dot {
  width: 6px;
  height: 6px;
  background: var(--accent-primary);
  border-radius: 50%;
}

.bulk-actions {
  display: flex;
  gap: 8px;
}

/* ==========================================================================
   VIEW 4: TAX & ANALYTICS
   ========================================================================== */

.analytics-layout {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .analytics-layout {
    grid-template-columns: 1fr;
  }
}

.minimal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
}

.card-title-group h4 {
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.chart-legend-pills {
  display: flex;
  gap: 8px;
}

.chart-pill {
  font-size: 0.68rem;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 4px;
}

.pill-gross {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.pill-deductible {
  background: var(--accent-emerald-subtle);
  color: var(--accent-emerald);
}

.chart-canvas-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  min-height: 250px;
}

.minimal-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.76rem;
  min-width: 140px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-color {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ==========================================================================
   MODALS
   ========================================================================== */

.minimal-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.minimal-modal {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  max-width: 680px;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: modalSlideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
  from { transform: translateY(12px) scale(0.98); }
  to { transform: translateY(0) scale(1); }
}

.modal-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent-primary);
}

.modal-title-wrap h3 {
  font-size: 1.05rem;
  color: var(--text-primary);
}

.close-x {
  background: transparent;
  border: none;
  font-size: 1.35rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 2px;
  transition: color var(--transition-fast);
}

.close-x:hover {
  color: var(--text-primary);
}

.modal-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-foot {
  padding: 14px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-subtle);
}

.minimal-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .minimal-grid-2 {
    grid-template-columns: 1fr;
  }
}

.info-block {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.info-block h5 {
  font-size: 0.84rem;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.info-block p {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.simple-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  margin-top: 6px;
}

.simple-table th {
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 500;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
}

.simple-table td {
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.pricing-highlight {
  text-align: center;
  padding: 20px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.price-val {
  font-family: var(--font-mono);
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--accent-primary);
  display: block;
  letter-spacing: -0.04em;
}

.price-unit {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: block;
}

.price-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 440px;
  margin: 0 auto;
}

.metrics-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.metric-line {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  font-size: 0.82rem;
}

.quote-card {
  padding: 14px 16px;
  border-left: 3px solid var(--accent-emerald);
  background: var(--bg-surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.8rem;
}

.quote-card p {
  color: var(--text-primary);
}

.author {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.camera-feed {
  width: 100%;
  max-height: 340px;
  background: #000000;
  border-radius: var(--radius-sm);
}

.status-msg {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 8px 10px;
  background: var(--bg-surface);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
}

/* ==========================================================================
   RESPONSIVENESS (MOBILE & TABLET)
   ========================================================================== */

@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: inline-flex;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  .app-sidebar.mobile-open {
    transform: translateX(0);
  }

  .app-layout {
    padding: 16px 16px 40px;
  }
}

/* Clean Print Optimization */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .app-sidebar, .app-topbar, .minimal-dropzone, .test-suite-strip, .filters-strip,
  .minimal-bulk-bar, .minimal-modal-backdrop, .export-strip, .form-actions {
    display: none !important;
  }
  .app-shell, .app-main, .app-content-scroll, .app-layout {
    height: auto !important;
    overflow: visible !important;
    max-width: 100% !important;
    padding: 0 !important;
  }
  .view-panel {
    display: block !important;
  }
  #viewScan, #viewInspector {
    display: none !important;
  }
  .minimal-table th, .minimal-table td {
    color: #000000 !important;
    border-bottom: 1px solid #cccccc !important;
  }
}
