/* ==========================================================================
   ShoeMatch AI — Shared Design System & Dark Theme Tokens (Vanilla CSS)
   ========================================================================== */

:root {
  /* Typography Families (Enterprise Font System) */
  --font-heading: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: var(--font-sans);
  --font-mono: 'IBM Plex Mono', monospace;

  /* Primary Color System (Light Default) */
  --color-navy: #1B133C;
  --bg-canvas: #F8FAF9;
  --bg-surface: #FFFFFF;
  --bg-surface-glass: rgba(255, 255, 255, 0.85);
  --bg-surface-subtle: #F1F5F3;
  --bg-surface-hover: #ECEFF1;

  --bg-chrome: rgba(255, 255, 255, 0.88);
  --border-chrome: rgba(27, 19, 60, 0.1);

  --brand-primary: #1B133C;
  --brand-primary-hover: #2A1E5C;
  --brand-accent: #D97706;
  --brand-accent-hover: #B45309;
  --brand-accent-bg: rgba(217, 119, 6, 0.1);
  --brand-accent-border: rgba(217, 119, 6, 0.3);

  --border-subtle: rgba(27, 19, 60, 0.1);
  --border-strong: rgba(27, 19, 60, 0.2);
  --border-focus: #D97706;

  --text-primary: #1B133C;
  --text-secondary: rgba(27, 19, 60, 0.72);
  --text-muted: rgba(27, 19, 60, 0.45);
  --text-on-navy: #FFFFFF;

  /* Confidence & Status Identifiers */
  --status-success: #059669;
  --status-success-bg: #ECFDF5;
  --status-success-border: #A7F3D0;
  --status-success-text: #047857;

  --status-warning: #D97706;
  --status-warning-bg: #FFFBEB;
  --status-warning-border: #FDE68A;
  --status-warning-text: #B45309;

  --status-danger: #DC2626;
  --status-danger-bg: #FEF2F2;
  --status-danger-border: #FECACA;
  --status-danger-text: #B91C1C;

  /* Shelf Badge Light Mode */
  --shelf-badge-bg: #1B133C;
  --shelf-badge-text: #FBBF24;
  --shelf-badge-border: rgba(251, 191, 36, 0.3);

  /* Radii & Glass Shadows */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(27, 19, 60, 0.05);
  --shadow-md: 0 4px 12px rgba(27, 19, 60, 0.06), 0 1px 2px rgba(27, 19, 60, 0.04);
  --shadow-lg: 0 10px 25px rgba(27, 19, 60, 0.08), 0 4px 10px rgba(27, 19, 60, 0.03);
  --shadow-modal: 0 25px 50px -12px rgba(27, 19, 60, 0.25);

  --transition-fast: 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-theme: background-color 300ms ease, color 300ms ease, border-color 300ms ease;
}

html[data-theme="dark"] {
  /* Dark Theme Inversion (Brand Navy #130D2E Canvas) */
  --color-navy: #F8FAF9;
  --bg-canvas: #130D2E;
  --bg-surface: #1B133C;
  --bg-surface-glass: rgba(27, 19, 60, 0.88);
  --bg-surface-subtle: #251B4D;
  --bg-surface-hover: #2F235E;

  --bg-chrome: rgba(27, 19, 60, 0.92);
  --border-chrome: rgba(255, 255, 255, 0.12);

  --brand-primary: #F8FAF9;
  --brand-primary-hover: #CBD5E1;
  --brand-accent: #F59E0B;
  --brand-accent-hover: #FBBF24;
  --brand-accent-bg: rgba(245, 158, 11, 0.15);
  --brand-accent-border: rgba(245, 158, 11, 0.35);

  --border-subtle: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);
  --border-focus: #F59E0B;

  --text-primary: #F8FAF9;
  --text-secondary: rgba(248, 250, 249, 0.78);
  --text-muted: rgba(248, 250, 249, 0.48);
  --text-on-navy: #1B133C;

  --status-success-bg: rgba(5, 150, 105, 0.2);
  --status-success-border: rgba(5, 150, 105, 0.4);
  --status-success-text: #34D399;

  --status-warning-bg: rgba(245, 158, 11, 0.2);
  --status-warning-border: rgba(245, 158, 11, 0.4);
  --status-warning-text: #FBBF24;

  --status-danger-bg: rgba(220, 38, 38, 0.2);
  --status-danger-border: rgba(220, 38, 38, 0.4);
  --status-danger-text: #FCA5A5;

  /* Shelf Badge Dark Mode */
  --shelf-badge-bg: #281D54;
  --shelf-badge-text: #FBBF24;
  --shelf-badge-border: rgba(251, 191, 36, 0.4);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
  --shadow-modal: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
  transition: var(--transition-theme);
}

/* Global Focus Ring */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* App Layout Structure */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Sidebar Navigation (Glass Pill Style) */
.sidebar {
  width: 260px;
  min-width: 260px;
  background-color: var(--bg-chrome);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  flex-shrink: 0;
  z-index: 20;
  transition: width var(--transition-normal), min-width var(--transition-normal), padding var(--transition-normal), var(--transition-theme);
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 0 4px;
}

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

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--brand-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.brand-text h1 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.badge-ai {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  background: var(--brand-accent-bg);
  color: var(--brand-accent);
  border: 1px solid var(--brand-accent-border);
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

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

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

/* Nav Menu */
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: left;
  text-decoration: none;
  width: 100%;
}

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

.nav-item.active {
  background: var(--brand-accent-bg);
  color: var(--brand-accent-hover);
  border-color: var(--brand-accent-border);
  font-weight: 600;
}

.nav-item .pill-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-subtle);
  color: var(--text-muted);
}

.nav-item.active .pill-count {
  background: var(--brand-accent-bg);
  color: var(--brand-accent);
}

/* Collapsed Sidebar */
.sidebar.collapsed {
  width: 72px;
  min-width: 72px;
  padding: 20px 10px;
}

.sidebar.collapsed .brand-text {
  display: none;
}

.sidebar.collapsed .sidebar-top {
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
  padding: 0;
}

.sidebar.collapsed .nav-item span {
  display: none;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 12px 0;
}

/* Main Content Surface */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--bg-canvas);
  min-height: 100vh;
  transition: var(--transition-theme);
}

/* Top Bar Header */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  background-color: var(--bg-surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-theme);
}

.page-title-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-toggle-btn {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.page-title-area h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.page-description {
  font-size: 0.83rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Tab Panes */
.tab-pane {
  display: none;
  padding: 28px;
  flex: 1;
}

.tab-pane.active {
  display: block;
}

/* Cards & Glass Surfaces */
.card {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  padding: 24px;
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast), var(--transition-theme);
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
}

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

.card-title-group h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.card-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Match Studio Grid Layout */
.match-grid {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 28px;
  align-items: start;
}

/* Upload Dropzone */
.drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  background-color: var(--bg-surface-subtle);
  cursor: pointer;
  transition: var(--transition-fast), var(--transition-theme);
  position: relative;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--brand-accent);
  background-color: var(--brand-accent-bg);
}

.upload-icon-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--brand-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  box-shadow: var(--shadow-sm);
}

.drop-prompt h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

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

.query-preview-wrapper {
  position: relative;
  width: 100%;
  max-height: 320px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: #000;
}

.query-preview-wrapper img {
  width: 100%;
  height: 300px;
  object-fit: contain;
  display: block;
}

.preview-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 14px;
  background: linear-gradient(to top, rgba(19, 13, 46, 0.88), transparent);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.preview-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: #ffffff;
  background: rgba(19, 13, 46, 0.85);
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Action Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid transparent;
  text-decoration: none;
  user-select: none;
}

.btn-primary {
  background-color: var(--brand-accent);
  color: #ffffff;
  border-color: var(--brand-accent-hover);
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.2);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--brand-accent-hover);
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 6px 16px rgba(217, 119, 6, 0.3);
}

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

.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-surface-subtle);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 12px 22px;
  font-size: 0.95rem;
}

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

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Theme Toggle Button Styling (Nav Pill Consistent) */
.btn-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-fast), var(--transition-theme);
  box-shadow: var(--shadow-sm);
}

.btn-theme-toggle:hover {
  transform: scale(1.06);
  border-color: var(--brand-accent);
}

/* Confidence Threshold Legend */
.threshold-legend {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.legend-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.legend-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.legend-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

.legend-pill.green {
  background: var(--status-success-bg);
  color: var(--status-success-text);
  border: 1px solid var(--status-success-border);
}

.legend-pill.yellow {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
  border: 1px solid var(--status-warning-border);
}

.legend-pill.red {
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
  border: 1px solid var(--status-danger-border);
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

/* Pipeline Progress Loader Widget */
.results-loading {
  padding: 40px 24px;
  text-align: center;
}

.pipeline-progress-box {
  max-width: 440px;
  margin: 0 auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-md);
}

.pipeline-stage-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.pipeline-stage-item.active {
  color: var(--brand-accent);
  font-weight: 600;
}

.pipeline-stage-item.completed {
  color: var(--status-success-text);
}

.stage-icon-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--brand-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Top-3 Match Result Cards */
.matches-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.match-item-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), var(--transition-theme);
  cursor: pointer;
  position: relative;
}

.match-item-card:hover {
  transform: translateY(-2px) scale(1.005);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
}

.match-item-card.green-match {
  border-left: 4px solid var(--status-success);
}

.match-item-card.amber-match {
  border-left: 4px solid var(--status-warning);
}

.match-item-card.red-match {
  border-left: 4px solid var(--status-danger);
}

.match-img-box {
  position: relative;
  width: 140px;
  height: 130px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
}

.match-img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.match-angle-tag {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(19, 13, 46, 0.85);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
}

/* Match Details & Tactical Shelf Location Callout */
.match-details {
  display: flex;
  flex-direction: column;
}

.match-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.match-rank-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: var(--bg-surface-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

/* Precision Confidence Badge */
.precision-confidence-badge {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.precision-confidence-badge.high {
  background: var(--status-success-bg);
  color: var(--status-success-text);
  border: 1px solid var(--status-success-border);
}

.precision-confidence-badge.medium {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
  border: 1px solid var(--status-warning-border);
}

.precision-confidence-badge.low {
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
  border: 1px solid var(--status-danger-border);
}

.match-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.match-sku {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* Tactical Warehouse Shelf Callout Badge (High-Visibility Industrial Callout) */
.match-card-shelf-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--shelf-badge-bg);
  color: var(--shelf-badge-text);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--shelf-badge-border);
  margin-bottom: 10px;
  width: fit-content;
  box-shadow: var(--shadow-sm);
}

.angles-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.angle-thumb {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: var(--transition-fast);
}

.angle-thumb:hover, .angle-thumb.active {
  border-color: var(--brand-accent);
  transform: scale(1.1);
}

/* Feedback Row */
.match-feedback-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-subtle);
}

.btn-feedback {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

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

/* Design Catalog Grid */
.catalog-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 280px;
}

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

.search-box input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.88rem;
  transition: var(--transition-fast), var(--transition-theme);
}

.search-box input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--brand-accent-bg);
}

.filter-group select {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.88rem;
  cursor: pointer;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
}

.catalog-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast), var(--transition-theme);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.catalog-card:hover {
  transform: translateY(-3px) scale(1.005);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
}

.catalog-card-img {
  position: relative;
  width: 100%;
  height: 180px;
  background: var(--bg-surface-subtle);
}

.catalog-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.catalog-card-pill {
  position: absolute;
  top: 10px;
  left: 10px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.85);
  color: #ffffff;
  z-index: 2;
}

.catalog-card-count {
  position: absolute;
  bottom: 10px;
  right: 10px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
  z-index: 2;
}

.catalog-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.view-toggle-group button.btn-icon.active {
  background: var(--bg-surface) !important;
  color: var(--brand-primary) !important;
  box-shadow: var(--shadow-xs);
}

.catalog-location-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.catalog-status-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  z-index: 2;
}

.catalog-status-badge.active {
  background: var(--status-success-bg);
  color: var(--status-success-text);
  border: 1px solid var(--status-success-border);
}

.catalog-status-badge.deactivated {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
  border: 1px solid var(--status-warning-border);
}

.catalog-status-badge.archived {
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
  border: 1px solid var(--status-danger-border);
}

/* Audit Logs Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

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

.logs-table th {
  background: var(--bg-surface-subtle);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

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

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

.log-thumb-frame {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-subtle);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin: 0 auto;
}

.log-thumb-frame img,
img.log-thumb {
  width: 48px !important;
  height: 48px !important;
  max-width: 48px !important;
  max-height: 48px !important;
  object-fit: cover !important;
  display: block;
}

.log-status-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

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

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

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

/* Modals & Dialogs */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(19, 13, 46, 0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-dialog {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transition: var(--transition-theme);
}

.modal-dialog.modal-xl {
  max-width: 960px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface-subtle);
}

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text-primary);
}

.btn-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

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

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 18px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.88rem;
  transition: var(--transition-fast), var(--transition-theme);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--brand-accent-bg);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.success { background: var(--status-success); }
.toast.warning { background: var(--status-warning); }
.toast.error { background: var(--status-danger); }

/* Respect Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Responsive Viewports */
@media (max-width: 992px) {
  .match-grid {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: -260px;
  }
  .sidebar.mobile-open {
    left: 0;
  }
  .topbar-toggle-btn {
    display: flex;
  }
}

@media (max-width: 640px) {
  .tab-pane {
    padding: 16px;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .match-item-card {
    grid-template-columns: 1fr;
  }
  .match-img-box {
    width: 100%;
    height: 180px;
  }
}

/* ==========================================================================
   Shoe Inspection Modal (#detail-modal) Redesign & Visual Polish
   ========================================================================== */

@keyframes modalScaleIn {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.shoe-preview-modal {
  max-width: 920px;
  width: 92vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-modal);
  animation: modalScaleIn var(--transition-fast);
}

.shoe-preview-modal .modal-body {
  overflow-y: auto;
  max-height: calc(90vh - 80px);
  padding: 20px 24px;
}

.preview-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

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

/* Gallery & Viewer */
.preview-gallery-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.preview-main-viewer {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow var(--transition-fast);
}

.preview-main-viewer:hover {
  box-shadow: var(--shadow-md);
}

.preview-main-viewer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
  transition: transform var(--transition-normal);
}

.viewer-angle-pill {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  color: #f8fafc;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.viewer-toggle-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--brand-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.viewer-toggle-btn:hover {
  background: var(--brand-primary-hover);
  transform: translateY(-1px);
}

.preview-thumb-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.thumb-section-label {
  font-size: 0.7rem;
  font-family: var(--font-body);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.preview-thumbnails-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.preview-thumb-btn {
  position: relative;
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-subtle);
  background: var(--bg-surface-subtle);
  padding: 2px;
  cursor: pointer;
  overflow: hidden;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.preview-thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius-sm) - 2px);
}

.preview-thumb-btn:hover {
  transform: translateY(-2px);
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-sm);
}

.preview-thumb-btn.active {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px var(--brand-accent-bg);
}

.preview-thumb-tag {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.75);
  color: #ffffff;
  font-size: 0.58rem;
  font-family: var(--font-mono);
  padding: 1px 3px;
  border-radius: 3px;
}

/* Info Column */
.preview-info-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Match Confidence Banner — Primary Visual Anchor */
.preview-match-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface-subtle);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-fast);
}

.preview-match-banner.high,
.preview-match-banner.green {
  background: var(--status-success-bg);
  border-color: var(--status-success-border);
}

.preview-match-banner.moderate,
.preview-match-banner.yellow {
  background: var(--status-warning-bg);
  border-color: var(--status-warning-border);
}

.preview-match-banner.low,
.preview-match-banner.red {
  background: var(--status-danger-bg);
  border-color: var(--status-danger-border);
}

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

.preview-match-pill {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.preview-match-pill.high,
.preview-match-pill.green {
  background: var(--status-success);
  color: #ffffff;
}

.preview-match-pill.moderate,
.preview-match-pill.yellow {
  background: var(--status-warning);
  color: #ffffff;
}

.preview-match-pill.low,
.preview-match-pill.red {
  background: var(--status-danger);
  color: #ffffff;
}

.preview-cosine-tag {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Warehouse Locator Card — Primary Visual Anchor */
.warehouse-locator-card {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.warehouse-locator-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border-focus);
}

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

.locator-header-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--brand-primary);
}

.card-label {
  font-size: 0.7rem;
  font-family: var(--font-body);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.locator-status-badge {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--brand-accent-bg);
  color: var(--brand-accent-hover);
  border: 1px solid var(--brand-accent-border);
}

.shelf-coordinate-display {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 10px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.shelf-icon-box {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--brand-accent-bg);
  color: var(--brand-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.shelf-main-location {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.shelf-sub-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
}

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

.btn-tertiary {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.btn-tertiary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--brand-primary);
  transform: translateY(-1px);
}

.shelf-edit-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-subtle);
}

.edit-label {
  font-size: 0.72rem;
  color: var(--brand-accent);
  font-weight: 600;
}

.shelf-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

/* Factory Specs Card */
.factory-specs-card {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow var(--transition-fast);
}

.factory-specs-card:hover {
  box-shadow: var(--shadow-md);
}

.specs-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--brand-primary);
}

.specs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 14px;
}

.spec-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.spec-label {
  font-size: 0.68rem;
  font-family: var(--font-body);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.spec-val {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.spec-val.mono {
  font-family: var(--font-mono);
}

.spec-description-box {
  border-top: 1px solid var(--border-subtle);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.spec-desc-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Location Hierarchy Tree View */
.loc-tree-node {
  margin-bottom: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  overflow: hidden;
}

.loc-tree-node summary {
  padding: 10px 14px;
  background: var(--bg-surface-subtle);
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  list-style: none;
}

.loc-tree-node summary::-webkit-details-marker {
  display: none;
}

.loc-tree-node summary:hover {
  background: var(--border-subtle);
}

.loc-tree-children {
  padding: 10px 14px 10px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.loc-slot-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}

.slot-occupied-pill {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--status-success-bg);
  color: var(--status-success-text);
  border: 1px solid var(--status-success-border);
}

.slot-vacant-pill {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

/* Action Buttons Footer */
.preview-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 2px;
}

.btn-danger {
  background: var(--status-danger);
  color: #ffffff;
  border: none;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

/* Location Search Relevance & Matched Keyword Highlighting */
mark.search-highlight, span.search-highlight {
  background: rgba(217, 119, 6, 0.28);
  color: inherit;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  border-bottom: 2px solid var(--brand-accent, #D97706);
}
