/* -----------------------------------------------------------
   ALIGNBOOKS BULK UPLOADER - ENTERPRISE CORPORATE DESIGN SYSTEM
   Professional, high-precision financial SaaS interface
   ----------------------------------------------------------- */

:root {
  /* Corporate Palette - Slate & Deep Enterprise Blue */
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-subtle: #f1f5f9;
  --bg-surface-hover: #e2e8f0;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;

  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-focus: #2563eb;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  /* Corporate Brand & Functional Accents */
  --brand-primary: #1e3a8a;       /* Deep Navy */
  --brand-primary-hover: #172554;
  --brand-accent: #2563eb;        /* Enterprise Blue */
  --brand-accent-hover: #1d4ed8;
  --brand-accent-subtle: #eff6ff;

  --status-success: #059669;      /* Financial Emerald */
  --status-success-bg: #ecfdf5;
  --status-success-border: #a7f3d0;

  --status-warning: #d97706;      /* Amber */
  --status-warning-bg: #fffbeb;
  --status-warning-border: #fde68a;

  --status-danger: #dc2626;       /* Crimson */
  --status-danger-bg: #fef2f2;
  --status-danger-border: #fecaca;

  --status-info: #0284c7;         /* Sky */
  --status-info-bg: #f0f9ff;
  --status-info-border: #bae6fd;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Precision Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 9999px;

  /* Subtle Enterprise Elevation */
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 1px 2px -1px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);

  --transition-fast: 0.15s ease-in-out;
  --transition-normal: 0.2s ease-in-out;
}

/* Corporate Dark Theme */
[data-theme="dark"] {
  --bg-app: #090d16;
  --bg-surface: #111827;
  --bg-surface-subtle: #1e293b;
  --bg-surface-hover: #334155;
  --bg-card: #111827;
  --bg-elevated: #1e293b;

  --border-subtle: #1f2937;
  --border-strong: #374151;
  --border-focus: #3b82f6;

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

  --brand-primary: #2563eb;
  --brand-primary-hover: #3b82f6;
  --brand-accent: #3b82f6;
  --brand-accent-hover: #60a5fa;
  --brand-accent-subtle: rgba(37, 99, 235, 0.15);

  --status-success: #10b981;
  --status-success-bg: rgba(16, 185, 129, 0.12);
  --status-success-border: rgba(16, 185, 129, 0.25);

  --status-warning: #f59e0b;
  --status-warning-bg: rgba(245, 158, 11, 0.12);
  --status-warning-border: rgba(245, 158, 11, 0.25);

  --status-danger: #ef4444;
  --status-danger-bg: rgba(239, 68, 68, 0.12);
  --status-danger-border: rgba(239, 68, 68, 0.25);

  --status-info: #38bdf8;
  --status-info-bg: rgba(56, 189, 248, 0.12);
  --status-info-border: rgba(56, 189, 248, 0.25);

  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
}

/* Master Container */
.app-container {
  max-width: 1480px;
  margin: 0 auto;
  padding: 20px 28px 60px 28px;
}

/* Header & Enterprise Navbar */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo-badge {
  height: 60px;
  width: auto;
  max-width: 180px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-logo-img {
  height: 100%;
  width: auto;
  max-height: 60px;
  object-fit: contain;
}

.brand-logo-badge svg {
  width: 22px;
  height: 22px;
}

.brand-title h1 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.015em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title p {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  background: var(--status-success-bg);
  color: var(--status-success);
  border: 1px solid var(--status-success-border);
  letter-spacing: 0.01em;
}

.btn-danger-outline {
  background: var(--status-danger-bg);
  color: var(--status-danger);
  border: 1px solid var(--status-danger-border);
  transition: all var(--transition-fast);
}

.btn-danger-outline:hover {
  background: var(--status-danger);
  color: #ffffff;
  border-color: var(--status-danger);
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

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

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

/* Marketplace Selector Deck */
.marketplace-selector-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.marketplace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

.section-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand-accent);
  margin-bottom: 2px;
}

.marketplace-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.marketplace-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.marketplace-subtitle code {
  background: var(--bg-surface-subtle);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  border: 1px solid var(--border-subtle);
}

/* Tax Toggle Component */
.tax-toggle-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}

.tax-toggle-wrapper:hover {
  border-color: var(--border-focus);
}

.tax-toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.tax-toggle-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tax-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.03em;
  transition: all var(--transition-fast);
}

.tax-badge.active {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.tax-badge.disabled {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

/* Switch control */
.switch-control {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
  cursor: pointer;
  margin: 0;
}

.switch-control input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--bg-surface-hover);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  transition: all var(--transition-fast);
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-muted);
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.switch-control input:checked + .switch-slider {
  background-color: var(--brand-accent);
  border-color: var(--brand-accent);
}

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

.pack-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.pack-status-badge svg {
  color: var(--status-success);
}

.marketplaces-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 10px;
}

.marketplace-card {
  background: var(--bg-surface, #ffffff);
  border: 1.5px solid var(--border-subtle, #cbd5e1);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition-fast, 0.15s ease);
  position: relative;
  min-height: 56px;
  user-select: none;
}

.marketplace-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.marketplace-card:hover:not(.disabled):not(.active) {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.03);
}

.marketplace-card.active {
  border: 2px solid #2563eb !important;
  background: #eff6ff !important;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.1);
}

.market-card-content {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.market-code,
.market-flag {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  min-width: 24px;
  line-height: 1;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.market-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.market-info .market-brand {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted, #64748b);
  line-height: 1.15;
}

.market-info .market-country,
.market-info strong {
  display: block;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  line-height: 1.2;
  white-space: nowrap;
}

.market-info span:not(.market-brand) {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.market-status-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: auto;
  transition: all var(--transition-fast, 0.15s ease);
}

.marketplace-card.active .market-status-pill,
.market-status-pill.active {
  background: #2563eb !important;
  color: #ffffff !important;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.marketplace-card:not(.active) .market-status-pill {
  color: #64748b;
  background: transparent;
}

.marketplace-card:not(.active):hover .market-status-pill {
  color: #2563eb;
}

.marketplace-card.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--bg-surface-subtle, #f8fafc);
  border-color: var(--border-subtle, #e2e8f0);
}

.market-status-pill.disabled {
  background: var(--border-subtle, #e2e8f0);
  color: var(--text-muted, #94a3b8);
}

/* File Ingestion Hero Card */
.upload-hero-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.dropzone-container {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 32px 24px;
  text-align: center;
  background: var(--bg-surface-subtle);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.dropzone-container:hover,
.dropzone-container.drag-over {
  border-color: var(--brand-accent);
  background: var(--brand-accent-subtle);
}

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

.dropzone-icon-circle {
  width: 52px;
  height: 52px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-accent);
  margin-bottom: 12px;
  box-shadow: var(--shadow-xs);
}

.dropzone-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.dropzone-subtext {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.dropzone-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

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

.btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-xs);
}

.btn-primary:hover {
  background: var(--brand-primary-hover);
  border-color: var(--brand-primary-hover);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}

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

.btn-success {
  background: var(--status-success);
  color: #ffffff;
  border-color: var(--status-success);
  box-shadow: var(--shadow-xs);
}

.btn-success:hover {
  background: #047857;
  border-color: #047857;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
  border-radius: var(--radius-xs);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Active File Banner */
.file-active-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-normal);
}

.file-active-details {
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-icon-badge {
  width: 36px;
  height: 36px;
  background: var(--brand-accent-subtle);
  color: var(--brand-accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
}

.file-meta-text {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Rules Indicator Banner */
.rules-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.compact-rules-strip {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.rule-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* Global Window Drag Over Effect */
body.window-drag-over {
  outline: 3px dashed var(--brand-accent);
  outline-offset: -8px;
  background-color: var(--brand-accent-subtle) !important;
}

.rule-chip svg {
  color: var(--status-success);
}

.rule-chip strong {
  color: var(--text-primary);
}

/* KPI Statistics Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition-fast);
}

.stat-card:hover {
  border-color: var(--border-strong);
}

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

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

.stat-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon.green {
  background: var(--status-success-bg);
  color: var(--status-success);
}

.stat-icon.amber {
  background: var(--status-warning-bg);
  color: var(--status-warning);
}

.stat-icon.blue {
  background: var(--status-info-bg);
  color: var(--status-info);
}

.stat-icon.purple {
  background: var(--brand-accent-subtle);
  color: var(--brand-accent);
}

.stat-icon.pink {
  background: rgba(147, 51, 234, 0.12);
  color: #9333ea;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 4px;
  font-family: var(--font-sans);
  letter-spacing: -0.02em;
}

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

/* Master Data Section Card */
.data-section-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* Tabs Navigation */
.tabs-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 16px;
  background: var(--bg-surface);
  flex-wrap: wrap;
  gap: 12px;
}

.tab-buttons-group {
  display: flex;
  align-items: center;
  overflow-x: auto;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 14px 16px;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tab-btn svg {
  color: var(--text-muted);
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--brand-accent);
  border-bottom-color: var(--brand-accent);
}

.tab-btn.active svg {
  color: var(--brand-accent);
}

.tab-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.tab-btn.active .tab-badge {
  background: var(--brand-accent-subtle);
  color: var(--brand-accent);
  border-color: rgba(37, 99, 235, 0.25);
}

.tab-export-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

/* View Table Toggle Button */
.btn-view-table {
  background: var(--brand-accent-subtle);
  color: var(--brand-accent);
  border: 1px solid rgba(37, 99, 235, 0.3);
  font-weight: 600;
  transition: all var(--transition-fast);
}

.btn-view-table:hover {
  background: var(--brand-accent);
  color: #ffffff;
  border-color: var(--brand-accent);
}

.btn-view-table.active {
  background: var(--brand-accent);
  color: #ffffff;
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.btn-view-table svg {
  vertical-align: -2px;
}

/* Collapsible Table Section */
.collapsible-table-section {
  animation: fadeInTable 0.22s ease-out;
}

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

/* Table Collapsed Card (for Raw and Pivot tabs) */
.table-collapsed-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-fast);
}

.table-collapsed-card:hover {
  border-color: var(--brand-accent);
  background: var(--brand-accent-subtle);
}

.table-collapsed-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.table-collapsed-info svg {
  color: var(--brand-accent);
  flex-shrink: 0;
}

.table-collapsed-text h4 {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 2px 0;
}

.table-collapsed-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
}

/* Tab Content Areas */
.tab-content {
  padding: 20px;
}

/* Voucher Header Configuration Deck */
.voucher-config-card {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 18px;
}

.voucher-config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.voucher-config-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
}

.voucher-config-title svg {
  color: var(--brand-accent);
}

.voucher-config-auto-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.voucher-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.config-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.config-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.config-label code {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: rgba(0, 0, 0, 0.04);
  padding: 1px 4px;
  border-radius: 3px;
}

[data-theme="dark"] .config-label code {
  background: rgba(255, 255, 255, 0.08);
}

.config-label .required {
  color: var(--status-danger);
}

.config-field .input-control {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 0.8125rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-weight: 500;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.config-field .input-control:focus {
  outline: none;
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

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

.voucher-config-summary-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  background: var(--bg-surface);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.summary-pill .pill-label {
  color: var(--text-muted);
}

.summary-pill .pill-value {
  color: var(--text-primary);
  font-weight: 600;
  font-family: var(--font-mono);
}

.summary-pill .pill-value.green {
  color: var(--status-success);
}

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

/* Toolbar (Search, Warehouse Segment Switcher, Page Size) */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 12px;
}

/* Corporate Warehouse Filter Segment Control */
.warehouse-filter-pills {
  display: inline-flex;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
  align-items: center;
}

.wh-filter-btn {
  background: transparent;
  border: none;
  padding: 5px 12px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.wh-filter-btn:hover {
  color: var(--text-primary);
  background: rgba(15, 23, 42, 0.05);
}

[data-theme="dark"] .wh-filter-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.wh-filter-btn.active {
  background: var(--brand-primary);
  color: #ffffff;
  box-shadow: var(--shadow-xs);
}

.wh-filter-btn span {
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.08);
  padding: 1px 5px;
  border-radius: 3px;
}

.wh-filter-btn.active span {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 240px;
  max-width: 420px;
}

.search-input-wrapper svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  padding: 7px 10px 7px 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-family: var(--font-sans);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.select-control {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 0.8125rem;
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.select-control:focus {
  outline: none;
  border-color: var(--brand-accent);
}

/* Enterprise Financial Data Table */
.table-responsive-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  text-align: left;
  line-height: 1.4;
  white-space: nowrap;
}

.data-table thead tr {
  background: #0f172a;
  color: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
}

[data-theme="dark"] .data-table thead tr {
  background: #0b0f19;
}

.data-table th {
  padding: 10px 12px;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #e2e8f0;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.data-table th:last-child {
  border-right: none;
}

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

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

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

.data-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.012);
}

[data-theme="dark"] .data-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

.col-numeric {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.col-ean {
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.table-empty-state {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-muted);
}

.table-empty-state svg,
.table-empty-icon {
  width: 36px !important;
  height: 36px !important;
  max-width: 36px;
  max-height: 36px;
  color: var(--border-strong);
  margin: 0 auto 8px auto;
  display: block;
}

.table-empty-state h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 4px 0;
}

.table-empty-state p {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin: 0;
}

/* Pagination Bar */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  flex-wrap: wrap;
  gap: 10px;
}

.pagination-info {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.page-btn:hover:not(:disabled) {
  background: var(--bg-surface-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.page-btn.active {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #ffffff;
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Settings & Mapping Tab */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.settings-card {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}

.settings-card-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.mapping-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
}

.mapping-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.mapping-item.disabled {
  opacity: 0.45;
  background: var(--bg-surface-subtle);
}

.mapping-label-input {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  padding: 4px 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  border-radius: var(--radius-xs);
}

.mapping-label-input:focus {
  border-color: var(--brand-accent);
  background: var(--bg-surface);
  outline: none;
}

.mapping-key {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.mapping-key code {
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.04);
  padding: 1px 4px;
  border-radius: 3px;
}

/* Upload Progress Modal & High-Precision Pipeline Stepper */
.progress-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
  animation: modalOverlayFadeIn 0.22s ease-out;
}

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

.progress-modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.28);
  width: 100%;
  max-width: 520px;
  padding: 26px 28px;
  animation: modalCardPop 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

@keyframes modalCardPop {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.progress-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.progress-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--brand-accent-subtle);
  color: var(--brand-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.25s ease;
}

.progress-icon-badge.completed {
  background: var(--status-success-bg);
  color: var(--status-success);
}

.progress-icon-badge.error {
  background: var(--status-danger-bg);
  color: var(--status-danger);
}

.progress-spinner-svg {
  animation: progressSpin 1.1s linear infinite;
}

@keyframes progressSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.progress-header-text h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 3px 0;
}

.progress-header-text p {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 380px;
}

/* Progress Track and Bar */
.progress-track-wrapper {
  margin-bottom: 12px;
}

.progress-track {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

[data-theme="dark"] .progress-track {
  background: #334155;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #2563eb 0%, #3b82f6 50%, #60a5fa 100%);
  background-size: 200% 100%;
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  animation: progressGradientMove 2s ease infinite;
}

.progress-fill.completed {
  background: var(--status-success) !important;
}

.progress-fill.error {
  background: var(--status-danger) !important;
}

@keyframes progressGradientMove {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background-image: linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.25) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.25) 50%,
    rgba(255, 255, 255, 0.25) 75%,
    transparent 75%,
    transparent
  );
  background-size: 20px 20px;
  animation: progressStripeMove 1s linear infinite;
}

@keyframes progressStripeMove {
  0% { background-position: 0 0; }
  100% { background-position: 20px 0; }
}

/* Metrics Row */
.progress-metrics-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  font-size: 0.8125rem;
}

.progress-status-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-percent {
  font-weight: 700;
  color: var(--brand-accent);
  font-family: var(--font-mono);
  font-size: 0.9375rem;
}

.progress-stage-desc {
  color: var(--text-secondary);
  font-weight: 500;
}

.progress-time-info {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Visual Stages Stepper */
.progress-stages-stepper {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.progress-step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 5px;
  color: var(--text-muted);
  font-size: 0.65rem;
  line-height: 1.2;
  font-weight: 600;
  transition: all 0.2s ease;
}

.progress-step-item .step-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.progress-step-item.active {
  color: var(--brand-accent);
}

.progress-step-item.active .step-dot {
  background: var(--brand-accent-subtle);
  border-color: var(--brand-accent);
  color: var(--brand-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.progress-step-item.completed {
  color: var(--status-success);
}

.progress-step-item.completed .step-dot {
  background: var(--status-success-bg);
  border-color: var(--status-success);
  color: var(--status-success);
}

/* Progress Sanity & SKU Verification Result Strip */
.progress-sanity-box {
  margin-top: 18px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(5, 150, 105, 0.03));
  border: 1px solid rgba(16, 185, 129, 0.28);
  border-radius: var(--radius-md, 8px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: actionsFadeIn 0.25s ease-out;
}

.progress-sanity-box.warning {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.09), rgba(217, 119, 6, 0.03));
  border-color: rgba(245, 158, 11, 0.35);
}

.progress-sanity-box.danger {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.09), rgba(220, 38, 38, 0.03));
  border-color: rgba(239, 68, 68, 0.35);
}

.progress-sanity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.progress-sanity-left {
  display: flex;
  align-items: center;
  gap: 7px;
}

.progress-sanity-shield-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--status-success, #10b981);
}

.progress-sanity-box.warning .progress-sanity-shield-icon {
  color: var(--status-warning, #f59e0b);
}

.progress-sanity-box.danger .progress-sanity-shield-icon {
  color: var(--status-danger, #ef4444);
}

.progress-sanity-title {
  font-size: 0.83rem;
  font-weight: 650;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.progress-sanity-audit-link {
  font-size: 0.77rem;
  font-weight: 600;
  color: var(--brand-accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.progress-sanity-audit-link:hover {
  text-decoration: underline;
  background: rgba(37, 99, 235, 0.08);
}

.progress-sanity-pills-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.progress-sanity-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 12px;
  line-height: 1.4;
  transition: all 0.15s ease;
}

.progress-sanity-pill.passed {
  background: rgba(16, 185, 129, 0.13);
  color: #065f46;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

[data-theme="dark"] .progress-sanity-pill.passed {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.progress-sanity-pill.warning {
  background: rgba(245, 158, 11, 0.13);
  color: #92400e;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .progress-sanity-pill.warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.progress-sanity-pill.danger {
  background: rgba(239, 68, 68, 0.13);
  color: #991b1b;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .progress-sanity-pill.danger {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* Progress Modal Actions */
.progress-modal-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  animation: actionsFadeIn 0.22s ease-out;
}

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

.progress-ok-btn {
  min-width: 110px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 8px 20px;
  background: var(--brand-accent);
  color: #ffffff;
  border: 1px solid var(--brand-accent);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 5px rgba(37, 99, 235, 0.25);
  cursor: pointer;
  transition: all 0.18s ease;
}

.progress-ok-btn:hover {
  background: var(--brand-accent-hover, #1d4ed8);
  border-color: var(--brand-accent-hover, #1d4ed8);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

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

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: #0f172a;
  color: #ffffff;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 380px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

.toast.toast-success {
  border-left: 4px solid var(--status-success);
}

.toast.toast-error {
  border-left: 4px solid var(--status-danger);
}

.toast.toast-info {
  border-left: 4px solid var(--status-info);
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Responsive Overrides */
@media (max-width: 1024px) {
  .app-container {
    padding: 16px;
  }
  .navbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .tabs-nav {
    flex-direction: column;
    align-items: flex-start;
  }
  .tab-export-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

/* Pre-Export Discrepancy & Sanity Guard Modal */
.sanity-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  padding: 20px;
  animation: modalOverlayFadeIn 0.22s ease-out;
}

.sanity-modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35);
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px 28px;
  animation: modalCardPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.sanity-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
  position: relative;
}

.sanity-header-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.sanity-header-icon.passed {
  background: var(--status-success-bg);
  color: var(--status-success);
}

.sanity-header-icon.warning {
  background: #fef3c7;
  color: #d97706;
}

.sanity-header-icon.danger {
  background: var(--status-danger-bg);
  color: var(--status-danger);
}

.sanity-header-title-box {
  flex: 1;
}

.sanity-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.sanity-title-row h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.sanity-header-title-box p {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.sanity-close-x {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s ease;
}

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

/* Status Badges */
.sanity-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sanity-badge.passed {
  background: var(--status-success-bg);
  color: var(--status-success);
  border: 1px solid rgba(22, 163, 74, 0.25);
}

.sanity-badge.warning {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid rgba(217, 119, 6, 0.25);
}

.sanity-badge.danger {
  background: var(--status-danger-bg);
  color: var(--status-danger);
  border: 1px solid rgba(220, 38, 38, 0.25);
}

/* 4-Grid Audit Summary Cards */
.sanity-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (max-width: 640px) {
  .sanity-metrics-grid {
    grid-template-columns: 1fr;
  }
}

.sanity-metric-card {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: 4px solid var(--border-strong);
  transition: all 0.2s ease;
}

.sanity-metric-card.passed {
  border-left-color: var(--status-success);
  background: rgba(22, 163, 74, 0.03);
}

.sanity-metric-card.warning {
  border-left-color: #d97706;
  background: rgba(217, 119, 6, 0.03);
}

.sanity-metric-card.danger {
  border-left-color: var(--status-danger);
  background: rgba(220, 38, 38, 0.04);
}

.sanity-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.sanity-card-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.sanity-mini-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}

.sanity-metric-card.passed .sanity-mini-badge {
  background: var(--status-success-bg);
  color: var(--status-success);
}

.sanity-metric-card.warning .sanity-mini-badge {
  background: #fef3c7;
  color: #b45309;
}

.sanity-metric-card.danger .sanity-mini-badge {
  background: var(--status-danger-bg);
  color: var(--status-danger);
}

.sanity-card-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.sanity-card-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Discrepancies Container */
.sanity-discrepancies-container {
  background: #fff8f8;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
  animation: actionsFadeIn 0.2s ease;
}

[data-theme="dark"] .sanity-discrepancies-container {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.3);
}

.sanity-discrepancy-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--status-danger);
  margin-bottom: 10px;
}

.sanity-issues-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.sanity-issue-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--text-primary);
}

.sanity-issue-item.danger {
  color: #991b1b;
}

[data-theme="dark"] .sanity-issue-item.danger {
  color: #fca5a5;
}

.sanity-issue-item.warning {
  color: #92400e;
}

[data-theme="dark"] .sanity-issue-item.warning {
  color: #fcd34d;
}

.sanity-unmapped-table-wrapper {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
}

.sanity-unmapped-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.sanity-unmapped-table th {
  background: var(--bg-surface-subtle);
  padding: 6px 10px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 1;
}

.sanity-unmapped-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.sanity-unmapped-table tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

/* Modal Footer */
.sanity-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.pack-option-card:hover {
  border-color: #3b82f6 !important;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.08);
  transform: translateY(-1px);
}

