/* =============================================================================
   Glisse Core Components
   Global semantic component library. Tailwind has been removed: design tokens
   now live in tokens.css and every utility directive is now plain modern CSS.
   Served raw (#nobuild) alongside tokens.css and reset.css — three <link>s per
   page, in that order. See docs/webapp/design-system.md
   ============================================================================= */


/* =============================================================================
   Utility Classes (DRY optimizations)
   ============================================================================= */

/* Shadow utilities */
.shadow-xs { box-shadow: var(--shadow-xs); }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

/* Border radius utilities */
.rounded-xs { border-radius: var(--radius-xs); }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* Typography utilities */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }

/* Compatibility utilities — these single-purpose classes were previously emitted
   by Tailwind and are referenced from client JS (tree.js, app.js, product-audit.js,
   extraction-plans.js). Kept as faithful plain-CSS equivalents. */
.visible { visibility: visible; }
.me-1 { margin-inline-end: 0.25rem; }
.cursor-pointer { cursor: pointer; }
.text-right { text-align: right; }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }

/* Screen-reader-only: visually hidden but available to assistive tech.
   Used by form labels (e.g. daily-discovery-decay source filter). */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Common icon button base (used by font-resizer, column-toggle, etc.) */
.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: background-color var(--transition-normal);
}

.btn-icon-primary {
    background: var(--color-blue);
    color: white;
    border-radius: var(--radius-sm);
}

.btn-icon-primary:hover {
    background: var(--color-blue-hover);
}

.btn-icon-primary:active {
    background: var(--color-blue-active);
}

.btn-icon-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Common dropdown list item styles */
.dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid var(--color-border-light);
    transition: background-color var(--transition-normal);
}

.dropdown-item:hover {
    background: var(--color-gray-50);
    color: var(--color-blue);
}

.dropdown-item:last-child {
    border-bottom: none;
}

/* =============================================================================
   Semantic Component Classes
   ============================================================================= */

/* Layout Components */
.page-container {
  max-width: var(--container-6xl);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

/* Breadcrumb Navigation */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--color-gray-600);
    margin-bottom: 0.25rem;
}

.breadcrumb-section {
    color: var(--color-gray-600);
}

.breadcrumb-separator {
    font-size: 0.7em;
    color: var(--color-gray-500);
}

.breadcrumb-page {
    color: var(--color-primary);
    font-weight: 500;
}

/* Typography - Bootstrap 5 compatible */
h1 {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: rgb(73, 80, 87);
}

.page-title {
  margin-bottom: 0.5rem;
  font-size: var(--text-3xl);
  line-height: var(--text-3xl--line-height);
  font-weight: var(--font-weight-bold);
  color: var(--color-gray-700);
}

.page-subtitle {
  color: var(--color-gray-600);
}

.section-title {
  margin-bottom: 0.5rem;
  font-size: var(--text-2xl);
  line-height: var(--text-2xl--line-height);
  font-weight: var(--font-weight-semibold);
  color: var(--color-gray-700);
}

.card-title {
  margin-top: 0;
  margin-bottom: 1.25rem;
  font-size: var(--text-xl);
  line-height: var(--text-xl--line-height);
  font-weight: var(--font-weight-semibold);
  color: var(--color-gray-700);
}

.card-subtitle {
  margin-top: 0;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--color-gray-200);
  padding-bottom: 0.5rem;
  font-weight: var(--font-weight-semibold);
  color: var(--color-gray-700);
}

/* Card Components */
.section-card {
  margin-bottom: 2rem;
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius-lg);
  background-color: var(--color-white);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.inner-card {
  border-radius: var(--radius-md);
  background-color: var(--color-gray-50);
  padding: 1.25rem;
}

/* ==========================================================================
   Flash Messages (CakePHP-style alerts)
   Bootstrap 5-inspired flash/alert messages - inline banner style
   ========================================================================== */

.flash-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.flash-container:empty {
  display: none;
}

.flash-message {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid;
  border-radius: var(--radius-lg);
  padding-inline: 1rem;
  padding-block: 0.75rem;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.flash-message.flash-show {
  opacity: 1;
  transform: translateY(0);
}

.flash-message.flash-hiding {
  opacity: 0;
  transform: translateY(-10px);
}

.flash-icon {
  font-size: var(--text-lg);
  line-height: var(--text-lg--line-height);
  flex-shrink: 0;
}

.flash-text {
  flex-grow: 1;
  font-size: var(--text-sm);
  line-height: var(--text-sm--line-height);
  font-weight: var(--font-weight-medium);
}

.flash-close {
  flex-shrink: 0;
  padding: 0.25rem;
  border-radius: 0.25rem;
  opacity: 0.7;
  cursor: pointer;
  transition: opacity 0.15s var(--ease-in-out);
  background: transparent;
  border: none;
  color: inherit;
}

.flash-close:hover {
  opacity: 1;
}

/* Flash Message Color Variants */

.flash-success {
  border-color: var(--color-green-200);
  background-color: var(--color-green-50);
  color: var(--color-green-800);
}

.flash-success .flash-icon {
  color: var(--color-green-600);
}

.flash-info {
  border-color: var(--color-blue-200);
  background-color: var(--color-blue-50);
  color: var(--color-blue-800);
}

.flash-info .flash-icon {
  color: var(--color-blue-600);
}

.flash-warning {
  border-color: var(--color-yellow-200);
  background-color: var(--color-yellow-50);
  color: var(--color-yellow-800);
}

.flash-warning .flash-icon {
  color: var(--color-yellow-600);
}

.flash-danger {
  border-color: var(--color-red-200);
  background-color: var(--color-red-50);
  color: var(--color-red-800);
}

.flash-danger .flash-icon {
  color: var(--color-red-600);
}

/* ==========================================================================
   Stat Cards (KPI/Metric Cards)
   Bootstrap 5-inspired statistics cards with colored variants
   ========================================================================== */

.stat-card {
  position: relative;
  overflow: hidden;
  border: 1px solid;
  border-radius: var(--radius-lg);
  padding: 1rem;
  text-align: center;
  transition: all 0.2s var(--ease-in-out);
  background: linear-gradient(135deg, var(--stat-bg-from, var(--color-gray-50)) 0%, var(--stat-bg-to, var(--color-gray-100)) 100%);
  border-color: var(--stat-border, var(--color-gray-300));
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-card .stat-icon {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  opacity: 0.15;
  font-size: 2.5rem;
  color: var(--stat-accent, var(--color-gray-600));
}

.stat-number {
  margin-bottom: 0.25rem;
  font-size: var(--text-3xl);
  line-height: var(--text-3xl--line-height);
  font-weight: var(--font-weight-bold);
  color: var(--stat-number, var(--color-gray-900));
}

.stat-label {
  font-size: var(--text-sm);
  line-height: var(--text-sm--line-height);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--stat-label, var(--color-gray-600));
}

.stat-percentage {
  margin-top: 0.5rem;
  font-size: var(--text-xs);
  line-height: var(--text-xs--line-height);
  opacity: 0.75;
  color: var(--stat-label, var(--color-gray-600));
}

/* Stat Card Color Variants */

/* Primary - Blue (default for main metrics) */
.stat-card-primary {
  --stat-bg-from: var(--color-gray-100);
  --stat-bg-to: var(--color-primary-light);
  --stat-border: var(--color-primary);
  --stat-number: var(--color-primary);
  --stat-label: var(--color-primary-dark);
  --stat-accent: var(--color-primary);
}

/* Success - Green (for positive metrics like totals) */
.stat-card-success {
  --stat-bg-from: var(--color-gray-300);
  --stat-bg-to: var(--color-success-bg);
  --stat-border: var(--color-success);
  --stat-number: var(--color-success);
  --stat-label: var(--color-success-dark);
  --stat-accent: var(--color-success);
}

/* Info - Cyan (for informational data) */
.stat-card-info {
  --stat-bg-from: var(--color-info-bg);
  --stat-bg-to: var(--color-info-bg);
  --stat-border: var(--color-info-bg);
  --stat-number: var(--color-info);
  --stat-label: var(--color-gray-700);
  --stat-accent: var(--color-info);
}

/* Warning - Yellow/Orange (for attention items) */
.stat-card-warning {
  --stat-bg-from: var(--color-warning-bg);
  --stat-bg-to: var(--color-warning-bg);
  --stat-border: var(--color-warning-bg);
  --stat-number: var(--color-warning-dark);
  --stat-label: var(--color-warning-dark);
  --stat-accent: var(--color-warning);
}

/* Danger - Red (for critical metrics) */
.stat-card-danger {
  --stat-bg-from: var(--color-danger-bg);
  --stat-bg-to: var(--color-danger-bg);
  --stat-border: var(--color-danger);
  --stat-number: var(--color-danger-dark);
  --stat-label: var(--color-danger-dark);
  --stat-accent: var(--color-danger);
}

/* Secondary - Gray (for secondary metrics) */
.stat-card-secondary {
  --stat-bg-from: var(--color-gray-300);
  --stat-bg-to: var(--color-gray-400);
  --stat-border: var(--color-gray-400);
  --stat-number: var(--color-gray-700);
  --stat-label: var(--color-gray-700);
  --stat-accent: var(--color-gray-600);
}

/* Dark - Dark theme variant */
.stat-card-dark {
  --stat-bg-from: var(--color-gray-800);
  --stat-bg-to: var(--color-gray-900);
  --stat-border: var(--color-gray-700);
  --stat-number: var(--color-white);
  --stat-label: var(--color-gray-500);
  --stat-accent: var(--color-gray-600);
}

/* Light - Extra light variant */
.stat-card-light {
  --stat-bg-from: var(--color-white);
  --stat-bg-to: var(--color-gray-50);
  --stat-border: var(--color-gray-200);
  --stat-number: var(--color-gray-900);
  --stat-label: var(--color-gray-600);
  --stat-accent: var(--color-gray-500);
}

/* Purple - Additional accent color */
.stat-card-purple {
  --stat-bg-from: var(--color-purple-bg);
  --stat-bg-to: var(--color-purple-bg);
  --stat-border: var(--color-purple);
  --stat-number: var(--color-purple-dark);
  --stat-label: var(--color-purple-dark);
  --stat-accent: var(--color-purple);
}

/* Teal - Additional accent color */
.stat-card-teal {
  --stat-bg-from: var(--color-teal-bg);
  --stat-bg-to: var(--color-teal-bg);
  --stat-border: var(--color-teal-bg);
  --stat-number: var(--color-teal);
  --stat-label: var(--color-teal-dark);
  --stat-accent: var(--color-teal);
}

/* Bootstrap 5 Card */
.card {
  background-color: var(--color-white);
  border: 1px solid rgba(0, 0, 0, 0.175);
  border-radius: 0.375rem;
}

.card-body {
  padding: 1rem;
}

/* Bootstrap 5 Buttons */
.btn {
  display: inline-block;
  font-weight: 400;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  border-radius: 0.375rem;
  transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.btn-primary {
  color: var(--color-white);
  background-color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

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

.btn-primary:focus {
  color: var(--color-white);
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 0.25rem rgba(49, 132, 253, 0.5);
  outline: 0;
}

.btn-primary:active {
  color: var(--color-white);
  background-color: var(--color-primary);
  border-color: var(--color-primary-dark);
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  border-radius: 0.25rem;
}

/* Grid Layouts */
.stats-grid {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.stats-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  @media (min-width: 40rem) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  @media (min-width: 48rem) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* Quick Links Grid (Homepage) */
.quick-links-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  @media (min-width: 40rem) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  @media (min-width: 48rem) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

.quick-link-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-lg);
  background-color: var(--color-gray-50);
  padding: 1.5rem;
  text-decoration-line: none;
  transition: all 0.2s var(--ease-in-out);
}

.quick-link-card:hover {
  border-color: var(--color-gray-300);
  background-color: var(--color-gray-100);
  box-shadow: var(--shadow-sm);
  transform: translateY(-0.125rem);
}

.quick-link-card i {
  margin-bottom: 0.5rem;
  font-size: var(--text-3xl);
  line-height: var(--text-3xl--line-height);
  color: var(--color-gray-600);
}

.quick-link-card span {
  font-size: var(--text-sm);
  line-height: var(--text-sm--line-height);
  font-weight: var(--font-weight-medium);
  color: var(--color-gray-700);
}

.flex-row-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
}

.flex-card {
  flex: 1;
  min-width: 300px;
}

/* Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

.data-table th {
  position: sticky;
  top: 0;
  border-bottom: 1px solid var(--color-gray-300);
  background-color: var(--color-gray-200);
  padding-inline: 0.75rem;
  padding-block: 0.5rem;
  text-align: left;
  font-weight: var(--font-weight-semibold);
  color: var(--color-gray-700);
}

.data-table td {
  border-bottom: 1px solid var(--color-gray-300);
  padding-inline: 0.75rem;
  padding-block: 0.5rem;
}

.data-table tbody tr:hover {
  background-color: var(--color-gray-50);
}

.data-table .cell-label {
  font-weight: var(--font-weight-semibold);
  color: var(--color-gray-700);
}

.data-table .cell-value {
  text-align: center;
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
}

.data-table .cell-success {
  text-align: center;
  font-weight: var(--font-weight-semibold);
  color: var(--color-success);
}

.data-table .cell-total {
  background-color: var(--color-gray-200);
  text-align: center;
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
}

.data-table .row-total {
  border-top: 2px solid var(--color-gray-300);
  background-color: var(--color-gray-50);
}

.data-table .row-total td {
  font-weight: var(--font-weight-bold);
}

/* Venn Diagram Container */
.venn-container {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius-lg);
  background-color: var(--color-gray-50);
  min-height: 200px;
  padding: 1.25rem;
}

/* State Classes */
.is-hidden {
  display: none !important;
}

.is-visible {
  display: block;
}

/* Loading & Error States */
.loading-state {
  text-align: center;
  padding-block: 2.5rem;
  color: var(--color-gray-600);
}

.error-state {
  border: 1px solid var(--color-red-300);
  border-radius: var(--radius-lg);
  background-color: var(--color-red-50);
  padding: 1rem;
  color: var(--color-red-700);
}

.success-state {
  border: 1px solid var(--color-green-300);
  border-radius: var(--radius-lg);
  background-color: var(--color-green-50);
  padding: 1rem;
  color: var(--color-green-700);
}

/* Utility for scrollable containers */
.scroll-x {
  overflow-x: auto;
}

/* =============================================================================
   Legacy Styles (migrated from styles.css)
   ============================================================================= */

html {
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--color-gray-900);
    margin: 0;
    padding: 2em;
    padding-bottom: 0;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Main content wrapper - grows to push footer down */
body > *:not(.app-footer):not(script) {
    flex-shrink: 0;
}

/* Spacer to push footer to bottom on short pages */
body::after {
    content: '';
    flex-grow: 1;
}
#filters { margin-bottom: 1em; }
#pagination button { margin: 0 2px; }
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-white);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
th, td {
    padding: 0.75em 1em;
    border: 1px solid var(--color-gray-300);
    font-size: 0.88em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* URL shortening in data cells */
td a[href] {
    max-width: 200px;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}


/* Font resizer controls */
.table-header-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0.5em 0;
    margin-bottom: 0.5em;
}

.font-resizer {
    display: flex;
    align-items: center;
    gap: 0.5em;
    background: var(--color-gray-50);
    padding: 0.5em 1em;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-gray-300);
    box-shadow: var(--shadow-xs);
}

.font-resizer label {
    font-size: 0.9em;
    font-weight: 500;
    color: var(--color-gray-700);
    margin: 0;
}

/* Shared icon button styles for font-resizer and column-toggle */
.font-resizer button,
.column-toggle-btn {
    background: var(--color-blue);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    height: 32px;
    font-size: 1.2em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-normal);
}

.font-resizer button {
    width: 32px;
    font-weight: bold;
}

.font-resizer button:hover,
.column-toggle-btn:hover {
    background: var(--color-blue-hover);
}

.font-resizer button:active,
.column-toggle-btn:active {
    background: var(--color-blue-active);
}

.font-resizer button:disabled {
    background: var(--color-gray-600);
    cursor: not-allowed;
}

.font-resizer input[type="number"] {
    width: 60px;
    height: 32px;
    border: 1px solid var(--color-gray-400);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 0.9em;
    padding: 0.25em;
}

.font-resizer input[type="number"]:focus {
    outline: none;
    border-color: var(--color-blue);
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

/* Column control - additional styles (base shared with .font-resizer button) */
.column-toggle-btn {
    width: 40px;
    margin-left: 0.5em;
}

/* Export CSV button - needs higher specificity to override .font-resizer button */
.font-resizer .export-csv-btn {
    background: var(--color-success);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    width: auto;
    height: 32px;
    font-size: 0.85em;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all var(--transition-normal);
    margin-left: 0.75em;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.font-resizer .export-csv-btn:hover {
    background: var(--color-success);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.font-resizer .export-csv-btn:active {
    background: var(--color-success);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.font-resizer .export-csv-btn:disabled {
    background: var(--color-gray-600);
    cursor: not-allowed;
    box-shadow: none;
}

.font-resizer .export-csv-btn i {
    font-size: 1em;
}

.column-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 1em;
    min-width: 300px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 0.5em;
}

/* Make font-resizer container relative for dropdown positioning */
.font-resizer {
    position: relative;
}

.column-header-container {
    margin-bottom: 0.75em;
    border-bottom: 1px solid var(--color-gray-300);
    padding-bottom: 0.75em;
}

.column-header-container h4 {
    margin: 0 0 0.5em 0;
    font-size: 1em;
    color: var(--color-gray-700);
}

.column-select-buttons {
    display: flex;
    gap: 1em;
}

.font-resizer .column-select-btn {
    padding: 0;
    font-size: 0.85em;
    border: none;
    background: none;
    color: var(--color-blue);
    cursor: pointer;
    text-decoration: underline;
    width: auto;
    height: auto;
    display: inline;
}

.font-resizer .column-select-btn:hover {
    background: none;
    color: var(--color-blue-hover);
}

.font-resizer .column-select-btn:active {
    background: none;
    color: var(--color-blue-active);
}

.column-dropdown h4 {
    margin: 0 0 0.5em 0;
    font-size: 1em;
    color: var(--color-gray-700);
    border-bottom: 1px solid var(--color-gray-300);
    padding-bottom: 0.5em;
}

.column-checkbox-group {
    margin-bottom: 0.5em;
}

.column-checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.25em 0;
    cursor: pointer;
    font-size: 0.9em;
    color: var(--color-gray-700);
}

.column-checkbox-group label:hover {
    background: var(--color-gray-50);
    border-radius: var(--radius-sm);
    padding: 0.25em 0.5em;
    margin: 0 -0.5em;
}

.column-checkbox-group input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.column-checkbox-group input[type="checkbox"]:checked + span {
    font-weight: 500;
    color: var(--color-blue);
}
th {
    background: var(--color-gray-50);
    font-weight: 600;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 2;
}
tbody tr:nth-child(even) {
    background: var(--color-gray-50);
}
tbody tr:nth-child(odd) {
    background: var(--color-white);
}
tbody tr:hover {
    background: var(--color-gray-100);
    transition: background 0.2s;
}
td:last-child:not(.source-cell), th:last-child:not(.source-header) {
    text-align: right;
}
select {
    padding: 0.2em 0.5em;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-gray-400);
    background: var(--color-gray-50);
}
#pagination-controls, #pagination-controls-top {
    display: flex;
    align-items: center;
    gap: 1.5em;
    margin-top: 1em;
}

#pagination-controls-top {
    margin-bottom: 1em;
    margin-top: 0;
}



/* Database viewer style pagination controls */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 15px;
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
}

.pagination {
    display: flex;
    gap: 5px;
}

.pagination-btn {
    padding: 8px 12px;
    border: 1px solid var(--color-gray-300);
    background: white;
    color: var(--color-gray-700);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-normal);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--color-gray-200);
    border-color: var(--color-gray-500);
}

.pagination-btn:disabled {
    background: var(--color-gray-50);
    color: var(--color-gray-600);
    cursor: not-allowed;
}

.pagination-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.pagination-page-input {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--color-gray-700);
}

.pagination-page-input input {
    text-align: center;
}

.pagination-page-input button:hover {
    background: var(--color-gray-200);
    border-color: var(--color-gray-500);
}

.pagination-per-page {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-per-page select {
    padding: 6px 10px;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

/* Table controls in pagination */
.table-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
}

.table-controls .table-header-controls {
    margin: 0;
    padding: 0;
}

.table-controls .font-resizer {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}
.sort-icon {
    cursor: pointer;
    margin-left: 0.3em;
    color: var(--color-gray-600);
    font-size: 0.95em;
    user-select: none;
}
.sort-icon.active {
    color: var(--color-primary-dark);
    font-weight: bold;
}
.sort-icon.asc::after {
    content: '▲';
    margin-left: 0.1em;
}
.sort-icon.desc::after {
    content: '▼';
    margin-left: 0.1em;
}
.sort-order-indicator {
    margin-left: 0.3em;
    color: var(--color-primary-dark);
    font-weight: bold;
    font-size: 0.98em;
}
#tree-container ul {
    list-style: none;
    margin-left: 1.2em;
    padding-left: 0.5em;
    border-left: 1px solid var(--color-gray-300);
}
#tree-container li {
    margin: 0.2em 0;
    font-size: 0.96em;
}
.tree-toggle {
    font-weight: bold;
    margin-right: 0.2em;
    color: var(--color-primary-dark);
}

.tree-label {
    display: inline-block;
    padding: 2px 4px;
    border-radius: var(--radius-xs);
    transition: background-color 0.2s;
}

.tree-label:hover {
    background-color: var(--color-border-light);
}

.entity-prefix {
    color: var(--color-gray-500);
    font-weight: 500;
}

.entity-count {
    color: var(--color-gray-600);
    font-size: 0.9em;
    font-style: italic;
}

/* Dynamic tree loading styles */
.tree-root {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tree-children {
    margin-left: 20px;
}

.loading-indicator {
    color: var(--color-gray-600);
    font-style: italic;
    padding: 5px 10px;
    margin: 2px 0;
}

.tree-node {
    margin: 2px 0;
}

/* Product external link icon in tree */
.product-external-link {
    margin-left: 8px;
    color: var(--color-primary-dark);
    text-decoration: none;
    font-size: 0.85em;
    vertical-align: middle;
}

.product-external-link:hover {
    color: var(--color-primary);
}

.product-external-link i {
    vertical-align: middle;
}

/* Product URL link in details panel */
.product-url-link {
    color: var(--color-primary-dark);
    text-decoration: none;
    word-break: break-all;
}

.product-url-link:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.product-url-link i {
    margin-left: 4px;
    font-size: 0.85em;
}

.main-header {
    background: var(--color-gray-50);
    border-bottom: 1px solid var(--color-gray-300);
    padding: 0.7em 2rem;
    margin: -2rem -2rem 1.2em -2rem;
    width: calc(100% + 4rem);
    box-sizing: border-box;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    gap: 1em;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
    margin-right: 2em;
    text-decoration: none;
    color: inherit;
}

.logo-container:hover {
    text-decoration: none;
    opacity: 0.85;
}

.glisse-logo {
    font-family: 'Courier New', monospace;
    font-size: 0.8em;
    line-height: 1.2;
    margin: 0;
    color: var(--color-gray-800);
    white-space: pre;
    text-align: left;
    background: transparent;
    border: none;
    padding: 0;
}

.main-header .nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    flex: 1;
}

.main-header .nav-list {
    display: flex;
    flex-wrap: wrap;
    padding-left: 0;
    margin-bottom: 0;
    list-style: none;
    gap: 0.25rem;
}

.main-header .nav-item {
    display: flex;
    align-items: center;
}

.main-header .nav-link {
    display: block;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    color: var(--color-gray-700);
    text-decoration: none;
    background: none;
    border: 0;
    transition: color 0.15s ease-in-out;
}

.main-header .nav-link:hover,
.main-header .nav-link:focus {
    color: var(--color-primary);
    text-decoration: underline;
}

.main-header .nav-link.active {
    color: var(--color-primary);
    font-weight: 600;
}

/* Space Selector */
.main-header .space-selector {
    margin-left: auto;
    position: relative;
}

.space-selector-toggle {
    display: flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.35em 0.75em;
    font-size: 0.85em;
    font-weight: 500;
    color: var(--color-gray-600);
    background: var(--color-gray-100, var(--color-gray-100));
    border: 1px solid var(--color-gray-200, var(--color-gray-200));
    border-radius: var(--radius-md);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.space-selector-toggle:hover {
    background: var(--color-gray-200, var(--color-gray-200));
    border-color: var(--color-gray-300);
}

.space-selector-toggle .bi-grid {
    font-size: 1em;
    color: var(--color-gray-500);
}

.space-selector-toggle .space-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.space-selector-toggle .dropdown-chevron {
    font-size: 0.7em;
    transition: transform 0.2s ease;
    color: var(--color-gray-400);
}

.space-selector.show .dropdown-chevron {
    transform: rotate(180deg);
}

.space-selector-menu {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1000;
    display: none;
    min-width: 200px;
    padding: 0;
    margin-top: 0.5rem;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-lg);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.space-selector.show .space-selector-menu {
    display: block;
    animation: dropdownFadeIn 0.15s ease-out;
}

.space-menu-header {
    padding: 0.6rem 1rem;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-gray-500);
    background: var(--color-gray-50, var(--color-gray-50));
    border-bottom: 1px solid var(--color-gray-200, var(--color-gray-200));
}

.space-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.6rem 1rem;
    font-size: 0.9em;
    color: var(--color-gray-700);
    text-decoration: none;
    transition: background var(--transition-fast);
}

.space-menu-item:hover {
    background: var(--color-gray-50, var(--color-gray-50));
    color: var(--color-gray-700);
    text-decoration: none;
}

.space-menu-item.active {
    font-weight: 600;
    color: var(--color-primary);
}

.space-menu-item .bi-check-lg {
    font-size: 1.1em;
}

/* User Dropdown */
.main-header .user-dropdown {
    margin-left: 0.5em;
    position: relative;
}

.user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.5em;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    padding: 0.4em 0.8em;
    cursor: pointer;
    font-size: 1em;
    color: var(--color-gray-700);
    transition: all var(--transition-fast);
}

.user-dropdown-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: var(--color-gray-300);
}

.user-dropdown-toggle .bi-person-circle {
    font-size: 1.3em;
    color: var(--color-primary);
}

.user-dropdown-toggle .user-name {
    font-weight: 500;
}

.user-dropdown-toggle .dropdown-chevron {
    font-size: 0.75em;
    transition: transform 0.2s ease;
}

.user-dropdown.show .dropdown-chevron {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1000;
    display: none;
    min-width: 200px;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-lg);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.user-dropdown.show .user-dropdown-menu {
    display: block;
    animation: dropdownFadeIn 0.15s ease-out;
}

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

.dropdown-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
}

.dropdown-avatar {
    font-size: 2rem;
    color: var(--color-gray-600);
}

.dropdown-user-info {
    display: flex;
    flex-direction: column;
}

.dropdown-username {
    font-weight: 600;
    color: var(--color-gray-900);
}

.dropdown-email {
    font-size: 0.85em;
    color: var(--color-gray-600);
}

.dropdown-divider {
    height: 0;
    margin: 0.5rem 0;
    overflow: hidden;
    border-top: 1px solid var(--color-gray-200);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 1rem;
    color: var(--color-gray-900);
    text-decoration: none;
    font-size: 0.95em;
    transition: background 0.15s ease-in-out;
}

.dropdown-item:hover {
    background: var(--color-gray-50);
    text-decoration: none;
}

.dropdown-item i {
    font-size: 1.1em;
    width: 1.25em;
}

.dropdown-item-danger {
    color: var(--color-danger);
}

.dropdown-item-danger:hover {
    background: var(--color-danger-bg);
    color: var(--color-danger-dark);
}

/* Nav Dropdown Wrapper for active subitem display */
.nav-dropdown-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.nav-active-subitem {
    position: absolute;
    top: 85%;
    left: 0.75em;
    font-size: 0.7em;
    color: var(--color-primary);
    padding: 0;
    white-space: nowrap;
    line-height: 1;
}

.nav-active-subitem::before {
    content: "└ ";
}

/* Nav Dropdown (Admin menu) */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.35em;
    background: transparent;
    border: none;
    padding: 0.5em 0.75em;
    cursor: pointer;
    font-size: 0.95em;
    color: var(--color-gray-700);
    font-weight: 500;
    transition: all var(--transition-fast);
    border-radius: var(--radius-sm);
}

.nav-dropdown-toggle:hover {
    color: var(--color-primary);
    background: rgba(13, 110, 253, 0.08);
}

.nav-dropdown-toggle.active {
    color: var(--color-primary);
}

.nav-dropdown-toggle .dropdown-chevron {
    font-size: 0.7em;
    transition: transform 0.2s ease;
}

.nav-dropdown.show .nav-dropdown-toggle .dropdown-chevron {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    display: none;
    min-width: 180px;
    padding: 0.5rem 0;
    margin-top: 0.25rem;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-lg);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.nav-dropdown.show .nav-dropdown-menu {
    display: block;
    animation: dropdownFadeIn 0.15s ease-out;
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1rem;
    color: var(--color-gray-700);
    text-decoration: none;
    font-size: 0.9em;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.nav-dropdown-item:hover {
    background: var(--color-gray-50);
    color: var(--color-primary);
    text-decoration: none;
}

.nav-dropdown-item.active {
    background: rgba(13, 110, 253, 0.1);
    color: var(--color-primary);
}

.nav-dropdown-item i {
    font-size: 1em;
    width: 1.25em;
    text-align: center;
}

.database-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.database-selector label {
    color: var(--color-gray-700);
    font-weight: 500;
}

.database-selector select {
    padding: 4px 8px;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    background: white;
    font-size: 14px;
    cursor: pointer;
}

.database-selector select:hover {
    border-color: var(--color-gray-500);
}

.database-selector select:focus {
    outline: none;
    border-color: var(--color-blue);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.db-info-icon {
    margin-left: 8px;
    color: white;
    background-color: var(--color-blue);
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-normal);
    line-height: 1;
}

.db-info-icon:hover {
    background-color: var(--color-blue-hover);
}

.db-info-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.db-info-content {
    background: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.db-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-gray-200);
}

.db-info-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-gray-900);
    margin: 0;
}

.db-info-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--color-gray-600);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: background-color var(--transition-normal);
}

.db-info-close:hover {
    background-color: var(--color-gray-50);
    color: var(--color-gray-700);
}

.db-info-section {
    margin-bottom: 16px;
}

.db-info-label {
    font-weight: 600;
    color: var(--color-gray-700);
    margin-bottom: 4px;
    display: block;
}

.db-info-value {
    color: var(--color-gray-900);
    font-family: 'Courier New', monospace;
    background: var(--color-gray-50);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-gray-200);
    word-break: break-all;
    margin-bottom: 8px;
}

.db-info-engine {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-blue);
    margin-bottom: 16px;
    padding: 8px 12px;
    background: var(--color-gray-100);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--color-blue);
}

/* Database table styles */
.db-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: white;
}

.db-table-container {
    overflow-x: auto;
    max-width: 100%;
}

.db-table th,
.db-table td {
    border: 1px solid var(--color-gray-300);
    padding: 8px 12px;
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
}

.db-table th {
    background: var(--color-gray-50);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.db-table tbody tr:nth-child(even) {
    background: var(--color-gray-50);
}

.db-table tbody tr:hover {
    background: var(--color-gray-200);
}

.shortened {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fk-header .fk-icon {
    margin-left: 4px;
    color: var(--color-blue);
    font-size: 12px;
    cursor: help;
}

.fk-cell {
    cursor: pointer;
    color: var(--color-blue);
}

.fk-cell:hover {
    background-color: var(--color-gray-50);
    text-decoration: underline;
}

/* Ensure no icons are added to foreign key data cells */
.fk-cell::before,
.fk-cell::after {
    content: none !important;
}

/* Make foreign key cells clearly distinguishable */
.fk-cell {
    position: relative;
}

.fk-cell::before,
.fk-cell::after {
    content: none !important;
    display: none !important;
}

.url-icon {
    margin-left: 4px;
    color: var(--color-blue);
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}

.url-icon:hover {
    color: var(--color-blue-hover);
    transform: scale(1.1);
}

/* Ensure all database table columns use the same font */
.db-table th,
.db-table td {
    font-family: inherit !important;
}

/* Ensure datetime columns use the same font as other columns */
.datetime-cell {
    font-family: inherit;
}
#tree-layout {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 2.5em;
}
#tree-container {
    flex: 1 1 60%;
    min-width: 320px;
}
#trip-details, #product-details {
    flex: 1 1 35%;
    min-width: 260px;
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    padding: 1.2em 1.5em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    position: sticky;
    top: 80px; /* Account for sticky header height (~60px) + margin */
    align-self: flex-start;
    max-height: calc(100vh - 100px); /* Adjust for header + padding */
    overflow-y: auto;
}
#trip-details table, #product-details table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5em;
}
#trip-details th, #trip-details td, #product-details th, #product-details td {
    text-align: left;
    padding: 0.3em 0.6em;
    border-bottom: 1px solid var(--color-gray-300);
    font-size: 0.97em;
}
#trip-details th, #product-details th {
    background: var(--color-gray-50);
    font-weight: 600;
    width: 40%;
}
.selected-trip {
    background: var(--color-gray-100);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-primary);
}
#product-details h2 {
    font-weight: 700;
    font-size: 1.25em;
    color: var(--color-gray-900);
    margin-bottom: 0.75em;
}
#product-details h3 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--color-gray-800);
    border-bottom: 1px solid var(--color-gray-300);
    padding-bottom: 0.3em;
}
#product-details .observations-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5em;
    font-size: 0.9em;
}
#product-details .observations-table thead th {
    background: var(--color-gray-100);
    font-weight: 600;
    padding: 0.5em 0.6em;
    text-align: left;
    border-bottom: 2px solid var(--color-primary-light);
    width: auto;
}
#product-details .observations-table tbody td {
    padding: 0.4em 0.6em;
    border-bottom: 1px solid var(--color-gray-300);
}
#product-details .observations-table tbody tr:hover {
    background: var(--color-gray-50);
}
#product-details .error {
    color: var(--color-danger);
    font-style: italic;
}

/* Collect toggle switch for country details */
.collect-toggle-section {
    margin: 1.2em 0;
    padding: 0.8em 1em;
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
}

.collect-toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.collect-toggle-label input[type="checkbox"] {
    display: none;
}

.collect-toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--color-gray-400);
    border-radius: 24px;
    transition: background 0.25s ease;
    flex-shrink: 0;
}

.collect-toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.25s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.collect-toggle-label input[type="checkbox"]:checked + .collect-toggle-slider {
    background: var(--color-success);
}

.collect-toggle-label input[type="checkbox"]:checked + .collect-toggle-slider::before {
    transform: translateX(20px);
}

.collect-toggle-text {
    font-size: 0.95em;
    color: var(--color-gray-800);
}

.collect-toggle-label.loading {
    opacity: 0.6;
    pointer-events: none;
}

.collect-toggle-label.loading .collect-toggle-slider::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    top: 6px;
    left: 16px;
    border: 2px solid transparent;
    border-top-color: var(--color-white);
    border-radius: 50%;
    animation: toggle-spin 0.6s linear infinite;
}

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

/* =============================================================================
   Tree View - Mobile Responsive
   ============================================================================= */
@media (max-width: 768px) {
    /* Stack layout vertically */
    #tree-layout {
        flex-direction: column;
        gap: 0;
    }

    #tree-container {
        flex: none;
        width: 100%;
        min-width: unset;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Reduce tree indentation on mobile */
    #tree-container ul {
        margin-left: 0.6em;
        padding-left: 0.3em;
    }

    .tree-children {
        margin-left: 12px !important;
    }

    /* Slightly smaller font for deeper nesting */
    #tree-container li {
        font-size: 0.93em;
    }

    /* Details panel as bottom sheet overlay */
    #product-details {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        flex: none;
        min-width: unset;
        width: 100%;
        max-height: 75vh;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
        z-index: 500;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        padding: 0.8em 1em 1.5em;
        overflow-y: auto;
    }

    #product-details.mobile-sheet-visible {
        transform: translateY(0);
    }

    /* Sheet drag handle */
    #product-details::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: var(--color-gray-400);
        border-radius: 2px;
        margin: 0 auto 12px;
    }

    /* Close button for mobile sheet */
    .mobile-sheet-close {
        position: absolute;
        top: 12px;
        right: 12px;
        background: none;
        border: none;
        font-size: 20px;
        color: var(--color-gray-600);
        cursor: pointer;
        padding: 4px 8px;
        line-height: 1;
        z-index: 1;
    }

    .mobile-sheet-close:hover {
        color: var(--color-gray-800);
    }

    /* Sheet overlay backdrop */
    .mobile-sheet-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 499;
    }

    .mobile-sheet-overlay.show {
        display: block;
    }

    /* Compact detail tables on mobile */
    #product-details th {
        width: 35%;
        font-size: 0.85em;
        padding: 0.3em 0.4em;
    }

    #product-details td {
        font-size: 0.85em;
        padding: 0.3em 0.4em;
        word-break: break-word;
    }

    #product-details h2 {
        font-size: 1.1em;
        margin-bottom: 0.5em;
        padding-right: 30px; /* Space for close button */
    }

    #product-details h3 {
        font-size: 1em;
    }

    /* Observations table compact */
    #product-details .observations-table {
        font-size: 0.82em;
    }

    /* Toggle section compact */
    .collect-toggle-section {
        margin: 0.8em 0;
        padding: 0.6em 0.8em;
    }

    .collect-toggle-text {
        font-size: 0.88em;
    }
}

#filter-builder {
    margin-bottom: 1.2em;
    padding: 0.7em 1em;
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 0.7em;
}
.filter-chain {
    display: flex;
    gap: 1em;
    flex-wrap: wrap;
    align-items: center;
}
.filter-item {
    display: flex;
    align-items: center;
    gap: 0.3em;
    background: var(--color-white);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    padding: 0.3em 0.7em;
}
.filter-item select, .filter-item input {
    margin-left: 0.2em;
    padding: 0.1em 0.4em;
    border-radius: var(--radius-xs);
    border: 1px solid var(--color-gray-400);
}
.filter-item button {
    margin-left: 0.3em;
    background: none;
    border: none;
    color: var(--color-danger);
    font-size: 1.1em;
    cursor: pointer;
}
.filter-item button.move {
    color: var(--color-primary-dark);
    font-size: 1em;
    margin-left: 0.1em;
}
#add-filter-select {
    min-width: 140px;
    padding: 0.2em 0.5em;
    border-radius: var(--radius-xs);
    border: 1px solid var(--color-gray-400);
}
#sort-builder {
    margin-bottom: 1.2em;
    padding: 0.7em 1em;
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 0.7em;
}
.sort-chain {
    display: flex;
    gap: 1em;
    flex-wrap: wrap;
    align-items: center;
}
.sort-item {
    display: flex;
    align-items: center;
    gap: 0.3em;
    background: var(--color-white);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    padding: 0.3em 0.7em;
}
.sort-item select {
    margin-left: 0.2em;
    padding: 0.1em 0.4em;
    border-radius: var(--radius-xs);
    border: 1px solid var(--color-gray-400);
}
.sort-item button {
    margin-left: 0.3em;
    background: none;
    border: none;
    color: var(--color-danger);
    font-size: 1.1em;
    cursor: pointer;
}
.sort-item button.move {
    color: var(--color-primary-dark);
    font-size: 1em;
    margin-left: 0.1em;
}
#add-sort-select {
    min-width: 140px;
    padding: 0.2em 0.5em;
    border-radius: var(--radius-xs);
    border: 1px solid var(--color-gray-400);
}
.sort-dir-toggle {
    margin-left: 0.2em;
    cursor: pointer;
    color: var(--color-primary-dark);
    font-weight: bold;
    font-size: 1.05em;
    background: none;
    border: none;
}
/* Quick filters section */
#quick-filters {
    display: flex;
    gap: 1.5em;
    margin-bottom: 1em;
    padding: 0.75em 1em;
    background: var(--color-gray-100);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-primary-light);
}

.quick-filter-toggle {
    display: flex;
    align-items: center;
    gap: 0.5em;
    cursor: pointer;
    font-size: 0.9em;
    color: var(--color-primary-dark);
    user-select: none;
}

.quick-filter-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.quick-filter-toggle:hover {
    color: var(--color-primary);
}

#filter-sort-row {
    display: flex;
    flex-direction: row;
    gap: 2.5em;
    margin-bottom: 1.2em;
}
#filter-block, #sort-block, #column-block {
    flex: 1 1 33%;
    min-width: 220px;
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    padding: 1em 1.2em 1.2em 1.2em;
    box-sizing: border-box;
}
#column-builder {
    display: flex;
    flex-direction: column;
    gap: 0.6em;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
}
.column-item {
    display: flex;
    align-items: center;
    gap: 0.5em;
    background: var(--color-white);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    padding: 0.3em 0.7em;
}
.column-item label {
    flex: 1 1 auto;
    font-size: 1em;
}
.column-item button.move {
    color: var(--color-primary-dark);
    font-size: 1em;
    background: none;
    border: none;
    cursor: pointer;
    margin-left: 0.1em;
}
.block-header {
    font-size: 1.02em;
    font-weight: 600;
    color: var(--color-primary-dark);
    margin-bottom: 0.7em;
    letter-spacing: 0.01em;
}
.filter-chain, .sort-chain {
    display: flex;
    flex-direction: column;
    gap: 0.7em;
    align-items: flex-start;
}
.add-btn {
    margin-top: 0.7em;
    font-size: 1.2em;
    background: var(--color-primary-dark);
    color: var(--color-white);
    border: none;
    border-radius: 50%;
    width: 2em;
    height: 2em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(25, 118, 210, 0.08);
    transition: background 0.15s;
}
.add-btn:hover {
    background: var(--color-primary-dark);
}
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.add-list {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 16px rgba(0,0,0,0.13);
    padding: 1.2em 1.5em;
    min-width: 220px;
    list-style: none;
    margin: 0;
}
.add-list li {
    padding: 0.5em 0.2em;
    cursor: pointer;
    font-size: 1.02em;
    border-bottom: 1px solid var(--color-gray-300);
    transition: background 0.13s;
}
.add-list li:last-child { border-bottom: none; }
.add-list li:hover {
    background: var(--color-gray-100);
    color: var(--color-primary-dark);
}

/* Shared dropdown container styling */
.filter-dropdown,
.sort-dropdown {
    background: var(--color-white);
    border: 1px solid var(--color-gray-400);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    min-width: 150px;
}

.filter-dropdown-list,
.sort-dropdown-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.filter-dropdown-list li,
.sort-dropdown-list li {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid var(--color-border-light);
    transition: background-color var(--transition-normal);
}

.filter-dropdown-list li:last-child,
.sort-dropdown-list li:last-child {
    border-bottom: none;
}

.filter-dropdown-list li:hover,
.sort-dropdown-list li:hover {
    background: var(--color-gray-50);
    color: var(--color-blue);
}

/* New filter table styling */
.filter-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    margin-bottom: 15px;
    background: white;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.filter-table th {
    display: table-cell;
    background: var(--color-gray-50);
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid var(--color-gray-300);
    color: var(--color-gray-700);
}

.filter-table tr {
    display: table-row;
}

.filter-table thead,
.filter-table tbody {
    display: table-header-group;
}

.filter-table tbody {
    display: table-row-group;
}

/* Fixed column widths for filter table alignment */
.filter-table th:nth-child(1),
.filter-table td:nth-child(1) {
    width: 28%;
}

.filter-table th:nth-child(2),
.filter-table td:nth-child(2) {
    width: 22%;
}

.filter-table th:nth-child(3),
.filter-table td:nth-child(3) {
    width: 35%;
}

.filter-table th:nth-child(4),
.filter-table td:nth-child(4) {
    width: 15%;
    text-align: center;
}

.filter-table td {
    display: table-cell;
    padding: 8px;
    border-bottom: 1px solid var(--color-border-light);
    vertical-align: middle;
}

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

.filter-table tr:hover {
    background: var(--color-gray-50);
}

.filter-field-select,
.filter-operation-select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: white;
}

.filter-field-select:focus,
.filter-operation-select:focus {
    outline: none;
    border-color: var(--color-blue);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.filter-value-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-value-input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.filter-value-input:focus {
    outline: none;
    border-color: var(--color-blue);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.filter-value-placeholder,
.filter-value-info {
    color: var(--color-gray-600);
    font-style: italic;
    font-size: 13px;
}

.filter-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.remove-filter-btn,
.move-filter-btn {
    padding: 4px 8px;
    border: 1px solid var(--color-gray-300);
    background: white;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: 12px;
    transition: all var(--transition-normal);
}

.remove-filter-btn:hover {
    background: var(--color-danger);
    color: white;
    border-color: var(--color-danger);
}

.move-filter-btn:hover {
    background: var(--color-blue);
    color: white;
    border-color: var(--color-blue);
}

.add-filter-btn {
    padding: 8px 16px;
    background: var(--color-success);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color var(--transition-normal);
    width: fit-content;
}

.add-filter-btn:hover {
    background: var(--color-success);
}

/* Sort table styles - aligned with filter table */
.sort-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    margin-bottom: 15px;
    background: white;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.sort-table th {
    display: table-cell;
    background: var(--color-gray-50);
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid var(--color-gray-300);
    color: var(--color-gray-700);
}

.sort-table tr {
    display: table-row;
}

.sort-table thead,
.sort-table tbody {
    display: table-header-group;
}

.sort-table tbody {
    display: table-row-group;
}

/* Fixed column widths for sort table alignment */
.sort-table th:nth-child(1),
.sort-table td:nth-child(1) {
    width: 45%;
}

.sort-table th:nth-child(2),
.sort-table td:nth-child(2) {
    width: 35%;
}

.sort-table th:nth-child(3),
.sort-table td:nth-child(3) {
    width: 20%;
    text-align: center;
}

.sort-table td {
    display: table-cell;
    padding: 8px;
    border-bottom: 1px solid var(--color-border-light);
    vertical-align: middle;
}

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

.sort-table tr:hover {
    background: var(--color-gray-50);
}

.sort-field-select,
.sort-direction-select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: white;
}

.sort-field-select:focus,
.sort-direction-select:focus {
    outline: none;
    border-color: var(--color-blue);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.sort-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.remove-sort-btn,
.move-sort-btn {
    padding: 4px 8px;
    border: 1px solid var(--color-gray-300);
    background: white;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: 12px;
    transition: all var(--transition-normal);
}

.remove-sort-btn:hover {
    background: var(--color-danger);
    color: white;
    border-color: var(--color-danger);
}

.move-sort-btn:hover {
    background: var(--color-blue);
    color: white;
    border-color: var(--color-blue);
}

.add-sort-btn {
    padding: 8px 16px;
    background: var(--color-success);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color var(--transition-normal);
    width: fit-content;
}

.add-sort-btn:hover {
    background: var(--color-success);
}
.custom-multiselect {
    position: relative;
    min-width: 7em;
    background: var(--color-white);
    border: 1px solid var(--color-gray-400);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0.2em 0.5em;
    font-size: 1em;
}
.custom-multiselect .selected-values {
    min-height: 1.5em;
    display: flex;
    flex-wrap: wrap;
    gap: 0.2em;
}
.custom-multiselect .dropdown {
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 10;
    background: var(--color-white);
    border: 1px solid var(--color-gray-400);
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    min-width: 100%;
    max-height: 220px;
    overflow-y: auto;
    margin-top: 2px;
    padding: 0.3em 0.2em;
}
.custom-multiselect .dropdown label {
    display: flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.2em 0.5em;
    cursor: pointer;
    font-size: 0.98em;
}
.custom-multiselect .dropdown label:hover {
    background: var(--color-gray-100);
}
.custom-multiselect .dropdown input[type="checkbox"] {
    margin-right: 0.3em;
}
.custom-multiselect .dropdown {
    box-sizing: border-box;
}
/* Simple, clear styling for available cells */
.heatmap-cell-available {
    background: var(--color-success) !important;
    color: white !important;
    text-align: center !important;
    font-weight: bold !important;
}

/* Freshness-based cell colors */
.heatmap-cell-fresh {
    background: var(--color-success) !important; /* Green - updated within 48 hours */
    color: white !important;
    text-align: center !important;
    font-weight: bold !important;
    cursor: help;
}

.heatmap-cell-stale {
    background: var(--color-warning) !important; /* Yellow/Amber - between 48 hours and 1 week */
    color: var(--color-gray-800) !important;
    text-align: center !important;
    font-weight: bold !important;
    cursor: help;
}

.heatmap-cell-old {
    background: var(--color-danger) !important; /* Red - older than 1 week */
    color: white !important;
    text-align: center !important;
    font-weight: bold !important;
    cursor: help;
}

.heatmap-cell-unknown {
    background: var(--color-gray-500) !important; /* Gray - no timestamp available */
    color: white !important;
    text-align: center !important;
    font-weight: bold !important;
    cursor: help;
}

.heatmap-controls {
    margin-bottom: 20px;
    padding: 15px;
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 15px;
}

.heatmap-controls label {
    font-weight: 600;
    color: var(--color-gray-800);
}

.heatmap-controls select {
    padding: 8px 12px;
    border: 1px solid var(--color-gray-400);
    border-radius: var(--radius-sm);
    background: white;
    font-size: 14px;
    min-width: 150px;
}

.heatmap-controls select:focus {
    outline: none;
    border-color: var(--color-blue);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.heatmap-controls .toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    margin-left: 20px;
    padding: 6px 12px;
    border: 1px solid var(--color-gray-400);
    border-radius: var(--radius-sm);
    background: white;
}

.heatmap-controls .toggle-label:hover {
    background: var(--color-border-light);
}

.heatmap-controls .toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.heatmap-controls .toggle-label span {
    font-weight: normal;
}

/* Count display in heatmap cells */
.heatmap-cell-count {
    font-size: 12px;
}

/* Simple heatmap table styling */
.heatmap-table {
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    width: auto;
}

.heatmap-table th,
.heatmap-table td {
    border: 1px solid var(--color-gray-300);
    padding: 8px;
    text-align: center;
    vertical-align: middle;
}

/* Entity columns - flexible width with no wrapping */
.heatmap-table th.entity-column,
.heatmap-table td.entity-column {
    background: var(--color-gray-50);
    text-align: left;
    padding: 8px 12px;
    white-space: nowrap;
    width: auto;
    font-size: 14px;
    font-weight: 600;
}

/* Source columns - small fixed width for checkmarks only */
.heatmap-table th.source-header,
.heatmap-table td.source-cell {
    width: 45px;
    min-width: 45px;
    max-width: 45px;
    text-align: center;
}

/* Source header with vertical text */
.heatmap-table th.source-header {
    background: var(--color-gray-50);
    height: 120px;
    position: relative;
    width: 45px;
    min-width: 45px;
    max-width: 45px;
    vertical-align: bottom;
    padding: 0;
    overflow: visible;
}

.vertical-text {
    transform: rotate(-90deg);
    transform-origin: left bottom;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-gray-800);
    white-space: nowrap;
    position: absolute;
    bottom: 12px;
    left: 50%;
    margin-left: 8px;
}

/* Simple hover effects */
.heatmap-table tbody tr:hover {
    background: var(--color-gray-100);
}

/* Light green background for rows with full source coverage */
.heatmap-table tbody tr.heatmap-row-full-coverage {
    background: lightgreen !important;
}

/* Maintain hover effect for full coverage rows */
.heatmap-table tbody tr.heatmap-row-full-coverage:hover {
    background: var(--color-success-bg) !important;
}

/* Group header styles with soft blue color scheme */
.group-header-row {
    background: linear-gradient(90deg, var(--color-primary-dark) 0%, var(--color-primary) 50%, var(--color-primary) 100%);
    border-bottom: 3px solid var(--color-primary-dark);
}

.group-header {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
    font-weight: bold;
    text-align: left !important;
    padding: 8px 10px;
    border-right: 2px solid rgba(255, 255, 255, 0.3);
    position: relative;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 40px;
    line-height: 24px;
}

.group-header:last-child {
    border-right: none;
}

.group-header:nth-child(1) {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary-dark) 100%);
}

.group-header:nth-child(2) {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
}

.group-header:nth-child(3) {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary) 100%);
}

.group-header:nth-child(4) {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary) 100%);
}

.group-header:nth-child(5) {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary) 100%);
}

.group-header:nth-child(6) {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
}

.group-toggle-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 11px;
    cursor: pointer;
    padding: 3px 6px;
    margin-right: 6px;
    border-radius: var(--radius-sm);
    color: white;
    transition: all 0.3s ease;
    font-weight: bold;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}

.group-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.group-toggle-btn:active {
    background: rgba(255, 255, 255, 0.6);
    transform: scale(0.95);
}

/* Ensure group headers stay visible */
.group-header-row {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Make the main column header row sticky as well */
.group-header-row + tr {
    position: sticky;
    top: 40px; /* Height of the group header row */
    z-index: 9;
}

/* Ensure sticky column headers maintain their background */
.group-header-row + tr th[style*="position: sticky"] {
    background: var(--color-gray-50) !important;
    border-right: 2px solid var(--color-gray-400) !important;
}

/* Ensure sticky group headers maintain their background */
.group-header[style*="position: sticky"] {
    background: inherit !important;
}

/* Add some spacing between group header and main header */
.group-header-row + tr th {
    border-top: 2px solid var(--color-gray-700);
    background: var(--color-gray-50);
}
 
/* Sticky primary columns */
.sticky-primary {
    position: sticky !important;
    z-index: 5;
    background: white !important;
    border-right: 2px solid var(--color-gray-200);
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
}

/* Table container setup for full viewport width with internal horizontal scroll */
.table-container {
    width: calc(100vw - 4em);
    margin-left: calc(-50vw + 50% + 2em);
    overflow-x: auto;
    margin-bottom: 1em;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Ensure the table itself can expand beyond viewport width */
#trips-table {
    min-width: 100%;
    width: auto;
    margin: 0;
}

/* Custom scrollbar styling for the table container */
.table-container::-webkit-scrollbar {
    height: 12px;
}

.table-container::-webkit-scrollbar-track {
    background: var(--color-gray-100);
    border-radius: var(--radius-md);
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--color-gray-500);
    border-radius: var(--radius-md);
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: var(--color-gray-500);
}

/* Filter section styling */
.filter-section {
    margin: 20px 0;
    padding: 15px;
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-200);
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 200px;
}

.filter-group label {
    font-weight: bold;
    color: var(--color-gray-700);
    font-size: 14px;
}

.filter-section select {
    padding: 8px 12px;
    border: 1px solid var(--color-gray-400);
    border-radius: var(--radius-sm);
    background: white;
    font-size: 14px;
    min-width: 150px;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.filter-section button {
    padding: 8px 16px;
    border: 1px solid var(--color-blue);
    border-radius: var(--radius-sm);
    background: var(--color-blue);
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.filter-section button:hover {
    background: var(--color-blue-hover);
}

.filter-section button#clear-filter {
    background: var(--color-gray-600);
    border-color: var(--color-gray-600);
}

.filter-section button#clear-filter:hover {
    background: var(--color-gray-700);
}

/* Matching summary styling */
.matching-summary {
    margin: 15px 0;
    padding: 10px;
    background: var(--color-gray-100);
    border: 1px solid var(--color-primary-light);
    border-radius: var(--radius-sm);
    color: var(--color-primary-dark);
    font-weight: 500;
}

.matching-summary p {
    margin: 0;
}

/* Loading and error states */
.loading, .error, .no-data {
    padding: 20px;
    text-align: center;
    font-size: 16px;
    color: var(--color-gray-600);
}

.error {
    color: var(--color-danger);
}

.no-data {
    color: var(--color-gray-600);
    font-style: italic;
}

/* Match display styling */
.matches-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.match-item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 5px 8px;
    background: var(--color-gray-50);
    border-radius: var(--radius-sm);
    font-size: 12px;
    border-left: 3px solid var(--color-gray-300);
}

.match-source {
    font-weight: bold;
    color: var(--color-gray-700);
    min-width: 80px;
}

.match-confidence {
    color: var(--color-blue);
    font-weight: bold;
    min-width: 50px;
}

.match-status {
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.status-confirmed {
    background: var(--color-success-bg);
    color: var(--color-success-dark);
}

.status-rejected {
    background: var(--color-danger-bg);
    color: var(--color-danger-dark);
}

.status-pending {
    background: var(--color-warning-bg);
    color: var(--color-warning-dark);
}

.match-algorithm {
    color: var(--color-gray-600);
    font-size: 11px;
    font-style: italic;
}

.no-matches {
    color: var(--color-gray-600);
    font-style: italic;
}

.match-matched-value {
    color: var(--color-gray-800);
    font-style: italic;
    margin-left: 6px;
    margin-right: 6px;
    opacity: 0.85;
}

/* Add some spacing for sticky columns */
#trips-table tbody td.sticky-primary {
    background: var(--color-gray-50) !important;
}

#trips-table tbody tr:nth-child(even) td.sticky-primary {
    background: var(--color-gray-100) !important;
}

/* Ensure sticky columns have proper borders */
#trips-table tbody td.sticky-primary {
    border-right: 2px solid var(--color-gray-400);
}

/* Primary column styling with alternating light blue shades */
.primary-column {
    background: var(--color-gray-100) !important;
}

.primary-column-alt {
    background: var(--color-primary-light) !important;
}

/* Override existing sticky column styling for primary columns */
#trips-table tbody td.primary-column {
    background: var(--color-gray-100) !important;
}

#trips-table tbody td.primary-column-alt {
    background: var(--color-primary-light) !important;
}

#trips-table tbody tr:nth-child(even) td.primary-column {
    background: var(--color-gray-100) !important;
}

#trips-table tbody tr:nth-child(even) td.primary-column-alt {
    background: var(--color-primary-light) !important;
}

/* Semantic classes to replace inline styles */
.text-right {
    text-align: right !important;
}

.width-5em {
    width: 5em !important;
}

.width-3em {
    width: 3em !important;
}

.margin-left-07em {
    margin-left: 0.7em !important;
}

.margin-0-4px {
    margin: 0 4px !important;
}

.display-none {
    display: none !important;
}

.display-block {
    display: block !important;
}

.cursor-pointer {
    cursor: pointer !important;
}

.width-100 {
    width: 100% !important;
}

/* Sticky positioning classes */
.sticky-group-header {
    position: sticky !important;
    z-index: 15 !important;
}

.sticky-column-header {
    position: sticky !important;
    z-index: 12 !important;
    border-right: 2px solid var(--color-gray-400) !important;
}

.sticky-data-cell {
    position: sticky !important;
    z-index: 5 !important;
}

/* Primary column header colors */
.primary-header-light {
    background: var(--color-gray-100) !important;
}

.primary-header-dark {
    background: var(--color-primary-light) !important;
}

/* Matching2 specific styles */
.matching2-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    background: white;
    box-shadow: var(--shadow-sm);
}

.matching2-table th,
.matching2-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid var(--color-gray-300);
}

.matching2-table th {
    background: var(--color-gray-100);
    font-weight: 600;
    color: var(--color-gray-800);
    position: sticky;
    top: 0;
    z-index: 10;
}

.matching2-table tbody tr:hover {
    background: var(--color-gray-50);
}

.matching2-table tbody tr {
    cursor: pointer;
    transition: background-color var(--transition-normal);
}

.matching2-table tbody tr:active {
    background: var(--color-gray-200);
}

.match-row {
    transition: background-color var(--transition-normal);
}

/* Override general table row styles for status-specific backgrounds */
.matching2-table tbody tr.match-row.status-confirmed,
.matching2-table tbody tr:nth-child(even).match-row.status-confirmed,
.matching2-table tbody tr:nth-child(odd).match-row.status-confirmed {
    border-left: 4px solid var(--color-success) !important;
    background-color: var(--color-success-bg) !important;
}

.match-row.status-pending {
    border-left: 4px solid var(--color-warning);
}

.matching2-table tbody tr.match-row.status-rejected,
.matching2-table tbody tr:nth-child(even).match-row.status-rejected,
.matching2-table tbody tr:nth-child(odd).match-row.status-rejected {
    border-left: 4px solid var(--color-danger) !important;
    background-color: var(--color-danger-bg) !important;
}

.match-row.status-manual_review {
    border-left: 4px solid var(--color-info);
}

/* Temporary feedback styles for status updates */
.match-row.status-update-success {
    animation: statusUpdateSuccess 2s ease-in-out;
}

.match-row.status-update-reject {
    animation: statusUpdateReject 2s ease-in-out;
}

@keyframes statusUpdateSuccess {
    0%, 100% { background-color: var(--color-success-bg); }
    50% { background-color: var(--color-success-bg); }
}

@keyframes statusUpdateReject {
    0%, 100% { background-color: var(--color-danger-bg); }
    50% { background-color: var(--color-danger-bg); }
}

.entity-type-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    color: white;
}

.entity-type-badge.product {
    background: var(--color-blue);
}

.entity-type-badge.variant {
    background: var(--color-purple);
}

.entity-type-badge.trip {
    background: var(--color-orange);
}

.entity-type-badge.country {
    background: var(--color-success);
}

.entity-type-badge.region {
    background: var(--color-teal);
}

.entity-type-badge.destination {
    background: var(--color-info);
}

.source-entity,
.target-entity {
    max-width: 300px;
}

.entity-name {
    font-weight: bold;
    font-size: 14px;
    color: var(--color-gray-900);
    margin-bottom: 4px;
    border-bottom: 1px solid var(--color-gray-200);
    padding-bottom: 2px;
    position: relative;
    line-height: 1.2;
}

/* Compact table styling */
.matching2-table td {
    padding: 8px 6px;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.matching2-table .entity-comparison {
    max-width: 300px; /* Wider column for two entities */
}

.matching2-table .source-entity,
.matching2-table .target-entity {
    margin-bottom: 8px; /* Space between source and target */
}

.matching2-table .source-entity:last-child,
.matching2-table .target-entity:last-child {
    margin-bottom: 0; /* No margin for last element */
}

.matching2-table .entity-name {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
    font-size: 13px;
}

.entity-name {
    font-weight: bold;
    font-size: 14px;
    color: var(--color-gray-900);
    margin-bottom: 4px;
    border-bottom: 1px solid var(--color-gray-200);
    padding-bottom: 2px;
    position: relative;
}

.entity-id {
    font-weight: bold;
    color: var(--color-gray-700);
    margin-bottom: 2px;
    font-size: 11px;
}

.entity-table {
    color: var(--color-gray-600);
    font-size: 11px;
    margin-bottom: 4px;
}

.entity-details {
    color: var(--color-gray-800);
    font-size: 11px;
    line-height: 1.3;
}

.confidence-bar {
    position: relative;
    width: 100px;
    height: 20px;
    background: var(--color-gray-200);
    border-radius: 10px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-danger) 0%, var(--color-warning) 50%, var(--color-success) 100%);
    transition: width 0.3s ease;
}

.confidence-fill.exact-match {
    background: var(--color-success);
}

.confidence-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: bold;
    color: var(--color-gray-800);
    text-shadow: 0 0 2px rgba(255,255,255,0.8);
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.status-badge.confirmed {
    background: var(--color-success-bg);
    color: var(--color-success-dark);
}

.status-badge.pending {
    background: var(--color-warning-bg);
    color: var(--color-warning-dark);
}

.status-badge.rejected {
    background: var(--color-danger-bg);
    color: var(--color-danger-dark);
}

.status-badge.manual_review {
    background: var(--color-gray-200);
    color: var(--color-gray-700);
}

.summary-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.stat-item {
    background: white;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-gray-300);
    font-size: 14px;
}

.stat-item strong {
    color: var(--color-blue);
}

/* Row expansion styling */
.match-details-expansion {
    background: var(--color-gray-50);
    border-left: 4px solid var(--color-blue);
}

.match-details-expansion td {
    padding: 20px;
    border-top: none;
    border-bottom: 1px solid var(--color-gray-300);
}

.expansion-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    max-width: 100%;
}

.match-row.expanded {
    background: var(--color-gray-100);
    border-left: 4px solid var(--color-blue);
}

.match-row.expanded td {
    border-bottom: none;
}

.expand-indicator {
    display: inline-block;
    margin-right: 8px;
    color: var(--color-blue);
    font-size: 12px;
    transition: transform 0.3s ease;
}

.match-row.expanded .expand-indicator {
    transform: rotate(90deg);
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: var(--color-gray-700);
    border-bottom: 1px solid var(--color-gray-200);
    padding-bottom: 5px;
}

.detail-item {
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.4;
}

.detail-item:last-child {
    margin-bottom: 0;
}

.detail-item strong {
    color: var(--color-gray-700);
    margin-right: 5px;
}

/* Action buttons styling */
.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.action-btn {
    background: none;
    border: 2px solid var(--color-gray-300);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all var(--transition-normal);
    padding: 0;
}

.action-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-sm);
}

.approve-btn {
    background: var(--color-success);
    color: white;
    border-color: var(--color-success);
}

.approve-btn:hover {
    background: var(--color-success);
    border-color: var(--color-success);
}

.reject-btn {
    background: var(--color-danger);
    color: white;
    border-color: var(--color-danger);
}

.reject-btn:hover {
    background: var(--color-danger);
    border-color: var(--color-danger);
}

/* Ensure action buttons column has consistent width */
.matching2-table th:last-child,
.matching2-table td:last-child {
    width: 100px;
    text-align: center;
}

/* Source tag styling */
.source-tag {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--color-gray-600); /* fallback color, overridden by inline style */
    color: white;
    font-size: 7.5px;
    font-weight: bold;
    padding: 1.5px 4.5px;
    border-radius: 7.5px;
    text-transform: uppercase;
    letter-spacing: 0.375px;
}

/* Source colors are now applied via inline styles from database */

/* Database schema constraint indicators */
.pk-indicator {
    background: var(--color-danger);
    color: white;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    font-size: 10px;
    font-weight: bold;
    margin-right: 4px;
}

.fk-indicator {
    background: var(--color-blue);
    color: white;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    font-size: 10px;
    font-weight: bold;
    margin-right: 4px;
}

.unique-indicator {
    background: var(--color-orange);
    color: white;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    font-size: 10px;
    font-weight: bold;
    margin-right: 4px;
}

.idx-indicator {
    background: var(--color-gray-600);
    color: white;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    font-size: 10px;
    font-weight: bold;
    margin-right: 4px;
}

.constraint-indicator {
    background: var(--color-info);
    color: white;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    font-size: 10px;
    font-weight: bold;
    margin-right: 4px;
}
 
/* ============================================================================
   Footer Styles
   ============================================================================ */

.app-footer {
    background: var(--color-gray-50);
    border-top: 1px solid var(--color-gray-300);
    padding: 0.75rem 2rem;
    margin: 2rem -2rem 0 -2rem;
    font-size: 0.85rem;
    color: var(--color-gray-600);
    width: calc(100% + 4rem);
    box-sizing: border-box;
    text-align: left;
    flex-shrink: 0;
    order: 9999;
}

.footer-line {
    line-height: 1.5;
}

.footer-line-1 .app-name {
    font-weight: 600;
    color: var(--color-gray-700);
}

.footer-line-1 .app-version {
    color: var(--color-gray-700);
}

.footer-line-1 .version-date {
    color: var(--color-gray-600);
}

.footer-line-2 {
    color: var(--color-gray-600);
    font-size: 0.8rem;
}

/* ============================================================================
   Database Viewer Page Styles (db.html)
   ============================================================================ */

.db-container {
    display: flex;
    height: calc(100vh - 120px);
    margin: 0;
    padding: 0 20px 20px 20px;
}

.sidebar {
    width: 280px;
    background: var(--color-gray-50);
    border-right: 1px solid var(--color-gray-300);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.table-list {
    padding: 20px;
    flex: 1;
}

.table-list h2 {
    margin: 0 0 15px 0;
    color: var(--color-gray-700);
    font-size: 18px;
    font-weight: 600;
}

.table-order-controls {
    margin-bottom: 15px;
    padding: 12px;
    background: white;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
}

.table-order-controls label {
    display: block;
    margin: 6px 0;
    cursor: pointer;
    font-size: 14px;
    color: var(--color-gray-700);
}

.table-order-controls input[type="radio"] {
    margin-right: 8px;
}

.table-item {
    padding: 10px 12px;
    margin: 3px 0;
    background: white;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-size: 14px;
    color: var(--color-gray-700);
}

.table-item:hover {
    background: var(--color-gray-100);
    border-color: var(--color-primary);
    transform: translateX(2px);
}

.table-item.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary-dark);
    box-shadow: 0 2px 4px rgba(33, 150, 243, 0.3);
}

.table-content {
    flex: 1;
    padding: 20px;
    overflow: auto;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--color-gray-200);
}

.table-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--color-gray-900);
}

.table-stats {
    font-size: 14px;
    color: var(--color-gray-600);
    background: var(--color-gray-50);
    padding: 6px 12px;
    border-radius: 20px;
}

.table-tabs {
    display: flex;
    border-bottom: 1px solid var(--color-gray-300);
    margin-bottom: 20px;
}

.table-tab {
    padding: 12px 24px;
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-300);
    border-bottom: none;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-weight: 500;
    color: var(--color-gray-700);
}

.table-tab:first-child {
    border-top-left-radius: 6px;
}

.table-tab:last-child {
    border-top-right-radius: 6px;
}

.table-tab:hover {
    background: var(--color-gray-200);
}

.table-tab.active {
    background: white;
    color: var(--color-primary);
    border-color: var(--color-primary);
    border-bottom: 2px solid white;
    margin-bottom: -1px;
}

.db-table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    position: relative;
    -webkit-overflow-scrolling: touch;
}

.db-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.db-table th {
    background: var(--color-gray-50);
    padding: 12px 8px 8px 8px;
    text-align: left;
    border-bottom: 2px solid var(--color-gray-300);
    font-weight: 600;
    color: var(--color-gray-700);
    position: sticky;
    top: 0;
    z-index: 10;
    vertical-align: top;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.db-table th:hover {
    background: var(--color-gray-200);
    transition: background-color var(--transition-normal);
}

.db-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--color-gray-300);
    vertical-align: top;
}

.db-table tr:hover {
    background: var(--color-gray-50);
}

.db-table tbody tr {
    cursor: pointer;
    transition: background-color var(--transition-normal);
}

.db-table tbody tr:nth-child(even) {
    background: var(--color-gray-50);
}

.db-table tbody tr:nth-child(odd) {
    background: white;
}

.db-table tbody tr:hover {
    background: var(--color-gray-100) !important;
}

.db-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.db-table thead th {
    background: var(--color-gray-50);
    border-bottom: 2px solid var(--color-gray-300);
    box-shadow: var(--shadow-sm);
}

.db-table th,
.db-table td {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.fk-header {
    color: var(--color-success);
}

.fk-icon {
    font-size: 12px;
    margin-left: 4px;
}

/* Empty state for tables with no data */
.db-page .empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--color-gray-50);
    border: 1px dashed var(--color-gray-300);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.db-page .empty-state p {
    margin: 0 0 8px 0;
    color: var(--color-gray-600);
    font-size: 16px;
}

.db-page .empty-state p:first-child {
    font-weight: 500;
    color: var(--color-gray-700);
}

.url-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 300px;
}

.url-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--color-gray-800);
}

.db-page .url-icon {
    margin-left: 8px;
    cursor: pointer;
    color: var(--color-gray-600);
    font-size: 14px;
    padding: 2px;
    border-radius: var(--radius-xs);
    transition: background-color 0.2s;
}

.db-page .url-icon:hover {
    background: var(--color-gray-200);
    color: var(--color-primary);
}

.datetime-cell {
    white-space: nowrap;
    font-family: monospace;
}

/* Color cell styling */
.color-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-swatch {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-xs);
    border: 1px solid rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.color-text {
    font-family: monospace;
    font-size: 0.9em;
    color: var(--color-gray-700);
}

/* Column header styling */
.column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.column-name {
    flex: 1;
    min-width: 0;
}

/* Sort button styling */
.sort-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--radius-xs);
    color: var(--color-gray-600);
    font-size: 12px;
    transition: all var(--transition-normal);
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    pointer-events: auto;
    z-index: 5;
}

.sort-btn:hover {
    background: var(--color-gray-200);
    color: var(--color-gray-700);
    transform: scale(1.05);
}

.sort-btn.active {
    background: var(--color-primary);
    color: white;
}

.sort-btn.active:hover {
    background: var(--color-primary-dark);
}

.sort-btn:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.db-page .sort-icon {
    font-weight: bold;
    line-height: 1;
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    max-height: 90vh;
    width: 800px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    text-align: left;
}

.modal-header {
    padding: 20px 24px 16px 24px;
    border-bottom: 1px solid var(--color-gray-300);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-gray-50);
}

.modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--color-gray-700);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--color-gray-600);
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-normal);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--color-gray-200);
    color: var(--color-gray-700);
}

.modal-body {
    padding: 0;
    overflow-y: auto;
    flex: 1;
    max-height: calc(90vh - 80px);
}

.record-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    font-family: inherit;
    text-align: left;
}

.record-detail-table th {
    background: var(--color-gray-50);
    padding: 8px 12px;
    text-align: left !important;
    border-bottom: 1px solid var(--color-gray-300);
    font-weight: 600;
    color: var(--color-gray-700);
    width: 180px;
    vertical-align: top;
}

.record-detail-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-gray-300);
    vertical-align: top;
    word-break: break-word;
    max-width: 400px;
    text-align: left !important;
}

.record-detail-table tr:hover {
    background: var(--color-gray-50);
}

.record-detail-table tr:last-child td,
.record-detail-table tr:last-child th {
    border-bottom: none;
}

.record-value.null {
    color: var(--color-gray-600);
    font-style: italic;
}

.record-value.url {
    color: var(--color-primary);
    text-decoration: underline;
    cursor: pointer;
}

.record-value.url:hover {
    color: var(--color-primary-dark);
}

.record-value.fk {
    color: var(--color-success);
    cursor: pointer;
}

.record-value.fk:hover {
    color: var(--color-success);
}

.no-table-selected {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-gray-600);
    font-style: italic;
}

.no-table-selected h3 {
    margin-bottom: 10px;
    color: var(--color-gray-700);
}

.schema-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: var(--shadow-sm);
}

.schema-table th {
    background: var(--color-gray-50);
    padding: 12px 8px;
    text-align: left;
    border-bottom: 2px solid var(--color-gray-300);
    font-weight: 600;
    color: var(--color-gray-700);
}

.schema-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--color-gray-300);
    vertical-align: top;
}

.schema-table tr:hover {
    background: var(--color-gray-50);
}

.column-type {
    font-family: monospace;
    background: var(--color-gray-200);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.column-constraints {
    font-size: 12px;
    color: var(--color-gray-600);
}

.db-page .pk-indicator {
    background: var(--color-primary);
    color: white;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    font-size: 10px;
    font-weight: bold;
}

.db-page .fk-indicator {
    background: var(--color-success);
    color: white;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    font-size: 10px;
    font-weight: bold;
}

.db-page .unique-indicator {
    background: var(--color-orange);
    color: white;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    font-size: 10px;
    font-weight: bold;
}

.db-page .idx-indicator {
    background: var(--color-gray-600);
    color: white;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    font-size: 10px;
    font-weight: bold;
}

.db-page .constraint-indicator {
    background: var(--color-gray-600);
    color: white;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    font-size: 10px;
    font-weight: bold;
}

.constraint-ref {
    background: var(--color-info);
    color: white;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    font-size: 10px;
    font-weight: bold;
    margin-left: 4px;
}

.constraint-legend {
    margin-top: 20px;
    padding: 15px;
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
}

.constraint-legend h4 {
    margin: 0 0 10px 0;
    color: var(--color-gray-700);
    font-size: 16px;
}

.constraint-legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}

.constraint-legend-ref {
    background: var(--color-info);
    color: white;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    font-size: 10px;
    font-weight: bold;
    margin-right: 8px;
    min-width: 20px;
    text-align: center;
}

.constraint-legend-type {
    font-weight: bold;
    margin-right: 8px;
    min-width: 80px;
}

.constraint-legend-name {
    font-family: monospace;
    margin-right: 8px;
    color: var(--color-gray-700);
}

.constraint-legend-description {
    color: var(--color-gray-600);
    font-style: italic;
}

.filter-controls {
    margin-bottom: 20px;
    padding: 15px;
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
}

.filter-row {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 10px;
}

.filter-row:last-child {
    margin-bottom: 0;
}

.filter-label {
    font-weight: 500;
    color: var(--color-gray-700);
    min-width: 80px;
}

.filter-input {
    padding: 6px 10px;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.filter-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.25);
}

.filter-btn {
    padding: 6px 12px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.filter-btn:hover {
    background: var(--color-primary-dark);
}

.filter-btn:disabled {
    background: var(--color-gray-600);
    cursor: not-allowed;
}

.header-filter {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-filter input {
    flex: 1;
    padding: 4px 6px;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-xs);
    font-size: 12px;
    min-width: 60px;
}

.header-filter input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px rgba(33, 150, 243, 0.25);
}

.header-filter .clear-filter {
    background: var(--color-danger);
    color: white;
    border: none;
    border-radius: var(--radius-xs);
    padding: 2px 4px;
    font-size: 10px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.header-filter .clear-filter:hover {
    opacity: 1;
}

.header-filter .clear-filter:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.header-filter .filter-select {
    flex: 1;
    padding: 4px 6px;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-xs);
    font-size: 12px;
    min-width: 60px;
    background: white;
    cursor: pointer;
}

.header-filter .filter-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px rgba(33, 150, 243, 0.25);
}

.header-filter .filter-select option {
    padding: 4px 8px;
}

/* ============================================================================
   Report Page Styles (report.html)
   ============================================================================ */

.report-container {
    padding: 0 20px 20px 20px;
}

.report-header {
    margin-bottom: 20px;
}

.report-header p {
    color: var(--color-gray-600);
    margin: 0;
}

.report-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.report-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cache-timestamp {
    font-size: 0.8rem;
    color: var(--color-gray-600);
    white-space: nowrap;
}

.cache-timestamp i {
    margin-right: 0.3rem;
}

/* Spinning animation for refresh button */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.btn-glass.refreshing i {
    animation: spin 1s linear infinite;
}

.btn-glass.refreshing {
    pointer-events: none;
    opacity: 0.7;
}

.source-selector {
    background: var(--color-gray-50);
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-gray-300);
    margin-bottom: 30px;
}

.source-selector h3 {
    margin-bottom: 15px;
    color: var(--color-gray-700);
}

.source-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.source-control {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.source-control label {
    font-weight: 600;
    color: var(--color-gray-700);
    font-size: 14px;
}

.source-control select {
    padding: 8px 12px;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    min-width: 150px;
}

.generate-btn {
    padding: 10px 20px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.generate-btn:hover {
    background: var(--color-primary-dark);
}

.generate-btn:disabled {
    background: var(--color-gray-600);
    cursor: not-allowed;
}

.report-content {
    display: none;
}

.report-section {
    background: white;
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-gray-300);
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}

.report-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--color-gray-700);
}

.venn-diagrams {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.venn-diagram-container {
    flex: 1;
    min-width: 300px;
}

.venn-diagram {
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-lg);
    padding: 20px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.venn-circle {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 12px;
    text-align: center;
    margin: 10px;
}

.venn-overlap {
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-gray-800);
    font-weight: bold;
    font-size: 11px;
    text-align: center;
}

.totals-row {
    background-color: var(--color-gray-50);
    border-top: 2px solid var(--color-gray-300);
}

.total-cell {
    background-color: var(--color-gray-200);
    font-weight: bold;
}

.report-section h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--color-gray-700);
    border-bottom: 2px solid var(--color-gray-200);
    padding-bottom: 10px;
}

.stats-overview {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
}

.total-stats {
    background: var(--color-gray-50);
    padding: 20px;
    border-radius: var(--radius-md);
}

.source-breakdown {
    background: var(--color-gray-50);
    padding: 20px;
    border-radius: var(--radius-md);
}

.stats-table-container {
    overflow-x: auto;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.stats-table th,
.stats-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--color-gray-300);
}

.stats-table th {
    background: var(--color-gray-200);
    font-weight: 600;
    color: var(--color-gray-700);
    position: sticky;
    top: 0;
}

.stats-table tr:hover {
    background: var(--color-gray-50);
}

.stats-table .source-name {
    font-weight: 600;
    color: var(--color-gray-700);
}

.stats-table .count-cell {
    text-align: center;
    font-weight: 600;
    color: var(--color-primary);
}

.report-summary {
    background: white;
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-gray-300);
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}

.report-page .summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--color-gray-50);
    padding: 15px;
    border-radius: var(--radius-md);
    text-align: center;
}

.stat-number {
    font-size: 24px;
    font-weight: bold;
    color: var(--color-primary);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    color: var(--color-gray-600);
}

.comparison-tables {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.comparison-table {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-gray-300);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.report-page .table-header {
    background: var(--color-gray-50);
    padding: 15px 20px;
    border-bottom: 1px solid var(--color-gray-300);
}

.report-page .table-header h3 {
    margin: 0;
    color: var(--color-gray-700);
}

.report-page .table-content {
    padding: 0;
}

.coverage-table {
    width: 100%;
    border-collapse: collapse;
}

.coverage-table th,
.coverage-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--color-gray-300);
}

.coverage-table th {
    background: var(--color-gray-50);
    font-weight: 600;
    color: var(--color-gray-700);
}

.coverage-table tr:hover {
    background: var(--color-gray-50);
}

.coverage-count {
    font-weight: bold;
    color: var(--color-primary);
}

.coverage-percentage {
    color: var(--color-gray-600);
    font-size: 12px;
}

.missing-data {
    color: var(--color-danger);
}

.present-data {
    color: var(--color-success);
}

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

    .source-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-overview {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .stats-table-container {
        overflow-x: auto;
        font-size: 12px;
    }

    .stats-table th,
    .stats-table td {
        padding: 8px 6px;
    }
}

/* ============================================================================
   Price Grid Page Styles (price-grid.html)
   ============================================================================ */

.price-grid-container {
    padding: 0 20px 20px 20px;
}

.price-grid-header {
    margin-bottom: 20px;
}

.price-grid-header p {
    color: var(--color-gray-600);
    margin: 0;
}

.price-grid-controls {
    background: var(--color-gray-50);
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-gray-300);
    margin-bottom: 30px;
}

.price-grid-controls h3 {
    margin-bottom: 15px;
    color: var(--color-gray-700);
}

.controls-row {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.controls-row:last-child {
    margin-bottom: 0;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-group-button {
    margin-left: auto;
}

.control-group label {
    font-weight: 600;
    color: var(--color-gray-700);
    font-size: 14px;
}

.control-group select,
.control-group input {
    padding: 8px 12px;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    min-width: 150px;
}

.price-grid-content {
    display: none;
}

.price-grid-section {
    background: white;
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-gray-300);
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}

.price-grid-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--color-gray-700);
}

.pivot-table-container {
    overflow: auto;
    max-width: 100%;
    max-height: 600px;
    border: 1px solid var(--color-gray-300);
    -webkit-overflow-scrolling: touch;
}

.pivot-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    position: relative;
}

.pivot-table th,
.pivot-table td {
    border: 1px solid var(--color-gray-300);
    padding: 6px 8px;
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
}

.pivot-table th {
    background-color: var(--color-gray-50);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: var(--shadow-sm);
}

.pivot-table .row-header {
    background-color: var(--color-gray-200);
    font-weight: 600;
    position: sticky;
    left: 0;
    z-index: 5;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
    min-width: 200px;
    padding-left: 8px;
}

.row-header .hierarchy-item {
    display: block;
    margin-bottom: 2px;
}

.row-header .hierarchy-item:last-child {
    margin-bottom: 0;
}

.row-header .hierarchy-level-0 {
    padding-left: 0px;
}

.row-header .hierarchy-level-1 {
    padding-left: 8px;
}

.row-header .hierarchy-level-2 {
    padding-left: 16px;
}

.row-header .hierarchy-level-3 {
    padding-left: 24px;
}

.row-header .hierarchy-level-4 {
    padding-left: 32px;
}

.row-header .tree-hook {
    color: var(--color-gray-600);
    font-family: monospace;
    margin-right: 4px;
}

.row-header .tree-hook::before {
    content: "└─ ";
}

.row-header .hierarchy-level-0 .tree-hook::before {
    content: "";
}

.row-header .hierarchy-level-1 .tree-hook::before,
.row-header .hierarchy-level-2 .tree-hook::before,
.row-header .hierarchy-level-3 .tree-hook::before,
.row-header .hierarchy-level-4 .tree-hook::before {
    content: "└─ ";
}

.pivot-table .corner-cell {
    background-color: var(--color-gray-300);
    font-weight: bold;
    position: sticky;
    top: 0;
    left: 0;
    z-index: 15;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.pivot-table th,
.pivot-table .row-header,
.pivot-table .corner-cell {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.price-cell {
    text-align: right;
    font-family: monospace;
    position: relative;
    padding-right: 35px !important;
}

.price-cell .price-content {
    display: block;
    text-align: right;
}

.price-cell .source-label {
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 4px;
    border-radius: var(--radius-xs);
    color: white;
    font-family: Arial, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.price-cell.no-data {
    background-color: var(--color-gray-100);
    color: var(--color-gray-500);
    font-style: italic;
    padding-right: 8px !important;
}

.stats-info {
    background: var(--color-gray-200);
    color: var(--color-gray-700);
    padding: 15px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    border: 1px solid var(--color-teal-bg);
}

/* ============================================================================
   Unmatched Page Styles (unmatched.html)
   ============================================================================ */

.unmatched-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    color: var(--color-gray-700);
    margin-bottom: 10px;
}

.page-header p {
    color: var(--color-gray-600);
    font-size: 16px;
}

.filters-section {
    background: white;
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-gray-300);
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}

.unmatched-page .filter-row {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.unmatched-page .filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 150px;
}

.unmatched-page .filter-group label {
    font-weight: 600;
    color: var(--color-gray-700);
    font-size: 14px;
}

.unmatched-page .filter-group select {
    padding: 8px 12px;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: white;
}

.unmatched-page .filter-btn {
    padding: 10px 24px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    height: 38px;
}

.unmatched-page .filter-btn:hover {
    background: var(--color-primary-dark);
}

.unmatched-page .filter-btn:disabled {
    background: var(--color-gray-600);
    cursor: not-allowed;
}

.stats-section {
    background: white;
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-gray-300);
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}

.unmatched-page .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.unmatched-page .stat-card {
    background: var(--color-gray-50);
    padding: 15px;
    border-radius: var(--radius-md);
    text-align: center;
}

.unmatched-page .stat-number {
    font-size: 32px;
    font-weight: bold;
    color: var(--color-danger);
    margin-bottom: 5px;
}

.unmatched-page .stat-label {
    font-size: 14px;
    color: var(--color-gray-600);
}

.stat-percentage {
    font-size: 12px;
    color: var(--color-gray-600);
    margin-top: 5px;
}

.results-section {
    background: white;
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-gray-300);
    box-shadow: var(--shadow-sm);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--color-gray-300);
}

.results-header h3 {
    margin: 0;
    color: var(--color-gray-700);
}

.results-count {
    background: var(--color-danger);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.results-table-container {
    overflow-x: auto;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
}

.results-table th,
.results-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--color-gray-300);
}

.results-table th {
    background: var(--color-gray-50);
    font-weight: 600;
    color: var(--color-gray-700);
    position: sticky;
    top: 0;
    z-index: 10;
}

.results-table tr:hover {
    background: var(--color-gray-50);
}

.unmatched-page .entity-name {
    font-weight: 600;
    color: var(--color-primary);
}

.source-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.source-badge.chalet {
    background-color: var(--color-success);
}

.source-badge.chatelreservation {
    background-color: var(--color-danger);
}

.source-badge.summittravel {
    background-color: var(--color-orange);
}

.source-badge.sunweb {
    background-color: var(--color-primary);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-gray-600);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state h3 {
    color: var(--color-gray-700);
    margin-bottom: 10px;
}

.loading-spinner {
    border: 4px solid var(--color-gray-100);
    border-top: 4px solid var(--color-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

/* Snowflake spinner for report page */
.snowflake-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 16px;
}

.snowflake-spinner i {
    font-size: 48px;
    color: var(--color-info);
    animation: snowflake-spin 2s linear infinite;
    filter: drop-shadow(0 0 8px rgba(13, 202, 240, 0.4));
}

@keyframes snowflake-spin {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.1);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.loading-state.is-hidden {
    display: none;
}

.loading-text {
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 500;
}

.unmatched-page .pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--color-gray-300);
}

.unmatched-page .pagination button {
    padding: 8px 16px;
    border: 1px solid var(--color-gray-300);
    background: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
}

.unmatched-page .pagination button:hover:not(:disabled) {
    background: var(--color-gray-50);
}

.unmatched-page .pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.unmatched-page .pagination .page-info {
    color: var(--color-gray-600);
    font-size: 14px;
}

@media (max-width: 768px) {
    .unmatched-page .filter-row {
        flex-direction: column;
    }

    .unmatched-page .filter-group {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================================
   User Management Styles
   ============================================================================ */

.users-container {
    padding: 0 20px 20px 20px;
}

.users-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 1em;
}

.users-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
    align-items: flex-end;
    margin-bottom: 1.5em;
    padding: 1em;
    background: var(--color-gray-50);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-gray-300);
}

.users-filters .filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.3em;
}

.users-filters .filter-group label {
    font-size: 0.85em;
    font-weight: 500;
    color: var(--color-gray-700);
}

.users-filters .filter-group select,
.users-filters .filter-group input {
    padding: 0.5em 0.75em;
    border: 1px solid var(--color-gray-400);
    border-radius: var(--radius-sm);
    font-size: 0.9em;
    min-width: 150px;
}

.users-filters .filter-group input {
    min-width: 200px;
}

.users-table-container {
    overflow-x: auto;
    margin-bottom: 1em;
}

#users-table {
    width: 100%;
    border-collapse: collapse;
}

#users-table th {
    background: var(--color-gray-50);
    font-weight: 600;
    text-align: left;
    padding: 0.75em 1em;
    border-bottom: 2px solid var(--color-gray-300);
}

#users-table td {
    padding: 0.75em 1em;
    border-bottom: 1px solid var(--color-gray-200);
    vertical-align: middle;
}

#users-table tbody tr:hover {
    background: var(--color-gray-50);
}

.actions-cell {
    white-space: nowrap;
}

.actions-cell .btn {
    margin-right: 0.25em;
}

/* Event Log Page */
.event-log-container {
    padding: 0 20px 20px 20px;
}

.event-log-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 1em;
}

.event-log-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
    align-items: flex-end;
    margin-bottom: 1.5em;
    padding: 1em;
    background: var(--color-gray-50);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-gray-300);
}

.event-log-filters .filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25em;
}

.event-log-filters .filter-group label {
    font-size: 0.85em;
    font-weight: 500;
    color: var(--color-gray-700);
}

.event-log-filters .filter-group select,
.event-log-filters .filter-group input {
    padding: 0.5em 0.75em;
    border: 1px solid var(--color-gray-400);
    border-radius: var(--radius-sm);
    font-size: 0.9em;
}

.event-log-filters .filter-group input {
    min-width: 150px;
}

.event-log-table-container {
    overflow-x: auto;
    margin-bottom: 1em;
}

#event-log-table {
    width: 100%;
    border-collapse: collapse;
}

#event-log-table th {
    background: var(--color-gray-50);
    font-weight: 600;
    text-align: left;
    padding: 0.75em 1em;
    border-bottom: 2px solid var(--color-gray-300);
    white-space: nowrap;
}

#event-log-table td {
    padding: 0.75em 1em;
    border-bottom: 1px solid var(--color-gray-200);
    vertical-align: middle;
}

#event-log-table tbody tr:hover {
    background: var(--color-gray-50);
}

#event-log-table .user-agent {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.85em;
    color: var(--color-gray-600);
}

#event-log-table code {
    background: var(--color-gray-200);
    padding: 0.15em 0.4em;
    border-radius: var(--radius-xs);
    font-size: 0.85em;
}

/* ============================================================================
   Table Helper Styles
   Global styles for tables using TableHelper
   ============================================================================ */

/* Sortable headers */
.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.8em;
    transition: background-color 0.15s ease;
}

.data-table th.sortable:hover {
    background: var(--color-gray-200);
}

.data-table th.sortable .sort-indicator {
    position: absolute;
    right: 0.5em;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.4;
    font-size: 0.85em;
}

.data-table th.sortable.sorted .sort-indicator {
    opacity: 1;
    color: var(--color-primary);
}

.data-table th.sortable.sorted {
    background: var(--color-gray-100);
}

/* Table pagination (new style) */
.table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1em 0;
    flex-wrap: wrap;
    gap: 1em;
}

.table-pagination .pagination-info {
    font-size: 0.9em;
    color: var(--color-gray-600);
}

.table-pagination .pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5em;
    padding: 0;
}

.table-pagination .pagination-pages {
    display: flex;
    align-items: center;
    gap: 0.25em;
}

.table-pagination .pagination-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    padding: 0.4em 0.8em;
    font-size: 0.85em;
    font-weight: 500;
    color: var(--color-gray-700);
    background: var(--color-white);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.table-pagination .pagination-btn:hover:not([disabled]) {
    background: var(--color-gray-50);
    border-color: var(--color-gray-500);
}

.table-pagination .pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.table-pagination .pagination-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-white);
}

.table-pagination .pagination-btn.pagination-page {
    padding: 0.4em 0.7em;
    min-width: 2em;
    justify-content: center;
}

.table-pagination .pagination-ellipsis {
    padding: 0 0.3em;
    color: var(--color-gray-600);
}

/* Table state rows */
.table-state-row td {
    text-align: center;
    padding: 2em 1em;
    color: var(--color-gray-600);
}

.table-loading {
    color: var(--color-primary);
}

.table-loading i.spinning {
    display: inline-block;
    animation: spin 1s linear infinite;
    margin-right: 0.5em;
}

.table-error {
    color: var(--color-danger);
}

.table-error i {
    margin-right: 0.5em;
}

.table-empty {
    color: var(--color-gray-600);
    font-style: italic;
}

/* Badge default variant */
.badge-default {
    background: var(--color-gray-200);
    color: var(--color-gray-700);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25em 0.6em;
    font-size: 0.8em;
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-success {
    background: var(--color-success-bg);
    color: var(--color-success-dark);
}

.badge-info {
    background: var(--color-gray-200);
    color: var(--color-gray-700);
}

.badge-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning-dark);
}

.badge-danger {
    background: var(--color-danger-bg);
    color: var(--color-danger-dark);
}

.badge-download {
    background: var(--color-gray-300);
    color: var(--color-primary-dark);
}

/* Pagination */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1em 0;
}

.pagination-info {
    font-size: 0.9em;
    color: var(--color-gray-600);
}

.pagination-buttons {
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.page-info {
    font-size: 0.9em;
    color: var(--color-gray-600);
    padding: 0 0.5em;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5em 1em;
    font-size: 0.9em;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.15s, box-shadow 0.15s;
}

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

.btn-primary {
    background: var(--color-blue);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-blue-hover);
}

.btn-secondary {
    background: var(--color-gray-600);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-gray-700);
}

.btn-danger {
    background: var(--color-danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: var(--color-danger);
}

.btn-small {
    padding: 0.3em 0.6em;
    font-size: 0.8em;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25em 0.6em;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: var(--radius-xs);
}

.badge-admin {
    background: var(--color-purple);
    color: white;
}

.badge-user {
    background: var(--color-info);
    color: white;
}

.badge-viewer {
    background: var(--color-gray-600);
    color: white;
}

.badge-success {
    background: var(--color-success);
    color: white;
}

.badge-warning {
    background: var(--color-warning);
    color: var(--color-gray-900);
}

.badge-danger {
    background: var(--color-danger);
    color: white;
}

.badge-default {
    background: var(--color-gray-200);
    color: var(--color-gray-700);
}

/* Modal styles for user management */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-small {
    max-width: 400px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1em 1.25em;
    border-bottom: 1px solid var(--color-gray-200);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1em;
    color: var(--color-gray-800);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5em;
    color: var(--color-gray-600);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--color-gray-800);
}

.modal-body {
    padding: 1.25em;
}

/* Form styles */
.form-group {
    margin-bottom: 1em;
}

.form-group label {
    display: block;
    margin-bottom: 0.4em;
    font-weight: 500;
    font-size: 0.9em;
    color: var(--color-gray-800);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.6em 0.75em;
    border: 1px solid var(--color-gray-400);
    border-radius: var(--radius-sm);
    font-size: 0.95em;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--color-blue);
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.form-hint {
    display: block;
    margin-top: 0.3em;
    font-size: 0.8em;
    color: var(--color-gray-600);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5em;
    margin-top: 1.5em;
    padding-top: 1em;
    border-top: 1px solid var(--color-gray-200);
}

.warning-text {
    color: var(--color-danger);
    font-size: 0.9em;
}

/* Table states */
.loading,
.error,
.no-data {
    text-align: center;
    padding: 2em !important;
    color: var(--color-gray-600);
}

.error {
    color: var(--color-danger);
}

/* Pagination for users */
.pagination-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5em;
    margin-top: 1em;
}

.pagination-controls .btn {
    min-width: 2.5em;
}

.pagination-info {
    color: var(--color-gray-600);
    font-size: 0.9em;
    margin-left: 1em;
}

.pagination-ellipsis {
    color: var(--color-gray-600);
    padding: 0 0.25em;
}

/* Responsive adjustments for users page */
@media (max-width: 768px) {
    .users-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1em;
    }

    .users-filters {
        flex-direction: column;
    }

    .users-filters .filter-group select,
    .users-filters .filter-group input {
        width: 100%;
    }

    .modal-content {
        width: 95%;
        margin: 1em;
    }
}

/* ============================================
   Login Page Styles
   ============================================ */

.login-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--color-gray-50) 0%, var(--color-gray-200) 100%);
}

.login-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.login-logo .glisse-logo {
    font-size: 0.7em;
    color: var(--color-gray-700);
    display: inline-block;
    text-align: left;
}

.login-title {
    text-align: center;
    margin-bottom: 1.5rem;
}

.setup-description {
    text-align: center;
    color: var(--color-gray-600);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.login-error {
    margin-bottom: 1.5rem;
}

.login-success {
    margin-bottom: 1.5rem;
}

#login-form .form-group {
    margin-bottom: 1.25rem;
}

#login-form .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--color-gray-700);
}

#login-form .form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-gray-300);
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

#login-form .form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.15);
}

#login-form .form-group input::placeholder {
    color: var(--color-gray-500);
}

.login-actions {
    margin-top: 1.5rem;
    justify-content: center;
}

.btn-login {
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: 1.1rem;
}

.login-hint {
    text-align: center;
    margin-top: 1.25rem;
    color: var(--color-gray-600);
    font-size: 0.875rem;
}

.optional-label {
    color: var(--color-gray-600);
    font-weight: normal;
    font-size: 0.875em;
}

/* Magic Link Form - use same styles as login form */
#magic-link-form .form-group {
    margin-bottom: 1.25rem;
}

#magic-link-form .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--color-gray-700);
}

#magic-link-form .form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-gray-300);
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

#magic-link-form .form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.15);
}

#magic-link-form .form-group input::placeholder {
    color: var(--color-gray-500);
}

/* Login success message (for magic link sent confirmation) */
.login-success {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background-color: var(--color-success-bg);
    border: 1px solid var(--color-success-bg);
    border-radius: 0.375rem;
    color: var(--color-success-dark);
    margin-bottom: 1.5rem;
    font-size: 0.9375rem;
}

.login-success i {
    font-size: 1.25rem;
}

/* Login divider */
.login-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--color-gray-300);
}

.login-divider span {
    padding: 0 1rem;
    color: var(--color-gray-600);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Login alternative method link */
.login-alternative {
    text-align: center;
}

.login-alternative .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    background-color: var(--color-gray-50);
    border: 1px solid var(--color-gray-300);
    color: var(--color-gray-700);
    border-radius: 0.375rem;
    text-decoration: none;
    transition: background-color 0.15s, border-color 0.15s;
}

.login-alternative .btn-secondary:hover {
    background-color: var(--color-gray-200);
    border-color: var(--color-gray-400);
    color: var(--color-gray-900);
}

.login-alternative .btn-secondary i {
    font-size: 1.125rem;
}

/* Remember-me checkbox */
.remember-me-group {
    margin: 1rem 0 0.5rem;
}

.remember-me-group .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--color-gray-700);
    font-weight: normal;
}

.remember-me-group .checkbox-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--color-primary);
    cursor: pointer;
}

/* Passcode input */
.passcode-input {
    text-align: center !important;
    font-size: 1.75rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.5rem !important;
    font-family: 'Courier New', monospace !important;
    padding: 1rem !important;
}

.passcode-input::placeholder {
    font-weight: 400 !important;
    letter-spacing: 0.5rem !important;
    color: var(--color-gray-400) !important;
}

/* Passcode form - reuse login form styles */
#passcode-form .form-group {
    margin-bottom: 1.25rem;
}

#passcode-form .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--color-gray-700);
}

#passcode-form .form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-gray-300);
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

#passcode-form .form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.15);
}

/* Back to login link */
.login-back-link {
    text-align: center;
    margin-top: 1rem;
}

.login-back-link a {
    color: var(--color-gray-600);
    text-decoration: none;
    font-size: 0.875rem;
}

.login-back-link a:hover {
    color: var(--color-gray-800);
    text-decoration: underline;
}

.login-back-link a i {
    margin-right: 0.25rem;
}

/* ============================================
   Setup Page / Migration Steps
   ============================================ */

.setup-description {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--color-gray-700);
    font-size: 1rem;
}

.setup-step {
    margin-bottom: 1.5rem;
}

.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 600;
    background-color: var(--color-gray-200);
    color: var(--color-gray-600);
    flex-shrink: 0;
}

.step-number.active {
    background-color: var(--color-primary);
    color: var(--color-white);
}

.step-number.completed {
    background-color: var(--color-success);
    color: var(--color-white);
}

.step-label {
    font-size: 0.875rem;
    color: var(--color-gray-600);
    margin-right: 0.5rem;
}

.step-connector {
    width: 2rem;
    height: 2px;
    background-color: var(--color-gray-200);
    flex-shrink: 0;
}

.step-connector.completed {
    background-color: var(--color-success);
}

.migration-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem;
    background-color: var(--color-gray-50);
    border-radius: 0.375rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.migration-info i {
    font-size: 2.5rem;
    color: var(--color-primary);
}

.migration-info p {
    margin: 0;
    color: var(--color-gray-700);
    font-size: 0.9375rem;
}

.migration-output {
    margin-bottom: 1.5rem;
}

.migration-output details {
    background-color: var(--color-gray-50);
    border: 1px solid var(--color-gray-300);
    border-radius: 0.375rem;
    padding: 0.75rem 1rem;
}

.migration-output summary {
    cursor: pointer;
    color: var(--color-gray-700);
    font-size: 0.875rem;
    font-weight: 500;
}

.migration-output pre {
    margin: 0.75rem 0 0;
    padding: 0.75rem;
    background-color: var(--color-gray-900);
    color: var(--color-gray-50);
    border-radius: 0.25rem;
    font-size: 0.75rem;
    overflow-x: auto;
    max-height: 200px;
    white-space: pre-wrap;
    word-break: break-all;
}

#migrate-btn i {
    margin-right: 0.5rem;
}

/* ========================================
   Downloads Page
   ======================================== */

.downloads-container {
    padding: 1.25rem;
    max-width: 1200px;
    margin: 0 auto;
}

.downloads-card {
    background-color: var(--color-white);
    border: 1px solid rgba(0, 0, 0, 0.175);
    border-radius: 0.375rem;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.downloads-card .files-table {
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.downloads-card .empty-state {
    border: none;
    border-radius: 0;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.875rem;
}

.summary-card {
    background: var(--color-white);
    border: 1px solid rgba(0, 0, 0, 0.175);
    border-radius: 0.375rem;
    padding: 1.5rem;
    text-align: center;
}

.summary-card .value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-gray-900);
}

.summary-card:nth-child(1) .value { color: var(--color-primary); }
.summary-card:nth-child(2) .value { color: var(--color-success); }

.summary-card .label {
    font-size: 0.875rem;
    color: var(--color-gray-600);
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-dir-info {
    background: var(--color-gray-50);
    border: 1px solid rgba(0, 0, 0, 0.175);
    border-radius: 0.375rem;
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
}

.data-dir-info .label {
    color: var(--color-gray-600);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.data-dir-info .path {
    color: var(--color-primary);
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    word-break: break-all;
    background: var(--color-gray-200);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    display: inline-block;
}

.data-dir-info .source {
    color: var(--color-gray-600);
    font-size: 0.8125rem;
    margin-top: 0.5rem;
}

.files-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-white);
}

.files-table th,
.files-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-gray-300);
}

.files-table th {
    background: var(--color-gray-50);
    color: var(--color-gray-700);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

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

.files-table tbody tr:hover td {
    background: var(--color-gray-50);
}

.file-name {
    color: var(--color-gray-900);
    font-weight: 500;
}

.file-size {
    color: var(--color-success);
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.875rem;
}

.file-date {
    color: var(--color-gray-600);
    font-size: 0.875rem;
}

.loading {
    text-align: center;
    padding: 3.75rem 2.5rem;
    color: var(--color-gray-600);
    font-size: 1.1rem;
}

.empty-state {
    text-align: center;
    padding: 3.75rem 2.5rem;
    color: var(--color-gray-600);
    background: var(--color-gray-50);
    border-radius: 0.375rem;
    border: 1px solid rgba(0, 0, 0, 0.175);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--color-gray-500);
}

/* Bootstrap-like Alert Styles */
.alert {
    position: relative;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.375rem;
}

.alert i {
    margin-right: 0.5rem;
}

.alert-info {
    color: var(--color-gray-700);
    background-color: var(--color-info-bg);
    border-color: var(--color-info-bg);
}

.alert-success {
    color: var(--color-success-dark);
    background-color: var(--color-gray-300);
    border-color: var(--color-success-bg);
}

.alert-warning {
    color: var(--color-warning-dark);
    background-color: var(--color-warning-bg);
    border-color: var(--color-warning-bg);
}

.alert-danger {
    color: var(--color-danger-dark);
    background-color: var(--color-danger-bg);
    border-color: var(--color-danger-bg);
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--card-bg, var(--color-white));
    border: 1px solid var(--border-color, var(--color-gray-300));
    border-radius: var(--radius-lg);
    margin: 12px 0;
    flex-wrap: wrap;
    gap: 12px;
}

.page-size-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary, var(--color-gray-600));
}

.page-size-selector select {
    padding: 6px 10px;
    border: 1px solid var(--border-color, var(--color-gray-300));
    border-radius: var(--radius-sm);
    background: var(--input-bg, var(--color-white));
    color: var(--text-primary, var(--color-gray-800));
    font-size: 14px;
    cursor: pointer;
}

.page-size-selector select:hover {
    border-color: var(--primary-color, var(--color-primary));
}

.page-navigation {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border-color, var(--color-gray-300));
    border-radius: var(--radius-sm);
    background: var(--card-bg, var(--color-white));
    color: var(--text-primary, var(--color-gray-800));
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.page-btn:hover:not(:disabled) {
    background: var(--primary-color, var(--color-primary));
    border-color: var(--primary-color, var(--color-primary));
    color: var(--color-white);
}

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

.page-btn.active {
    background: var(--primary-color, var(--color-primary));
    border-color: var(--primary-color, var(--color-primary));
    color: var(--color-white);
    font-weight: 600;
}

.page-ellipsis {
    padding: 0 8px;
    color: var(--text-secondary, var(--color-gray-600));
}

.page-info {
    font-size: 14px;
    color: var(--text-secondary, var(--color-gray-600));
}

@media (max-width: 768px) {
    .pagination-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .page-size-selector,
    .page-navigation,
    .page-info {
        justify-content: center;
    }

    .page-navigation {
        flex-wrap: wrap;
    }
}

/* ==========================================================================
   Product Queue Page Styles
   ========================================================================== */

.page-description {
    color: var(--text-secondary, var(--color-gray-600));
    font-size: 14px;
    margin-bottom: 20px;
}

/* Queue Stats Grid */
.stats-container {
    margin-bottom: 24px;
}

.queue-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.queue-stat-card {
    background: var(--card-bg, var(--color-white));
    border: 1px solid var(--border-color, var(--color-gray-300));
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: box-shadow 0.2s ease;
}

.queue-stat-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.queue-stat-card .stat-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.queue-stat-card .stat-header-label {
    font-size: 12px;
    color: var(--text-secondary, var(--color-gray-600));
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.queue-stat-card .stat-header .source-tag,
.queue-table .source-tag {
    position: static;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
}

.queue-stat-card .stat-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.queue-stat-card .stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.queue-stat-card .stat-row.highlight {
    color: var(--success-color, var(--color-success));
    font-weight: 500;
}

.queue-stat-card .stat-row.cooldown {
    color: var(--warning-color, var(--color-orange));
}

.queue-stat-card .stat-label {
    color: var(--text-secondary, var(--color-gray-600));
}

.queue-stat-card .stat-value {
    font-weight: 500;
    color: var(--text-primary, var(--color-gray-800));
}

.queue-stat-card .stat-bar {
    margin-top: 12px;
    height: 6px;
    background: var(--border-color, var(--color-gray-300));
    border-radius: var(--radius-xs);
    overflow: hidden;
}

.queue-stat-card .stat-bar-fill {
    height: 100%;
    background: var(--success-color, var(--color-success));
    border-radius: var(--radius-xs);
    transition: width 0.3s ease;
}

/* Queue Summary */
.queue-summary {
    margin-bottom: 12px;
}

.queue-summary .summary-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 14px;
    color: var(--text-secondary, var(--color-gray-600));
}

/* Queue Table */
.queue-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg, var(--color-white));
    border: 1px solid var(--border-color, var(--color-gray-300));
    border-radius: var(--radius-lg);
    overflow: hidden;
    font-size: 14px;
}

.queue-table thead {
    background: var(--table-header-bg, var(--color-gray-50));
}

.queue-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary, var(--color-gray-800));
    border-bottom: 2px solid var(--border-color, var(--color-gray-300));
    white-space: nowrap;
}

.queue-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color, var(--color-gray-100));
    vertical-align: middle;
}

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

.queue-table tbody tr:hover {
    background: var(--table-hover-bg, var(--color-gray-50));
}

.queue-row.in-cooldown {
    background: rgba(245, 158, 11, 0.05);
}

/* Priority Badge */
.priority-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 24px;
    padding: 0 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.priority-badge.high {
    background: var(--success-color, var(--color-success));
    color: var(--color-white);
}

.priority-badge.medium {
    background: var(--primary-color, var(--color-primary));
    color: var(--color-white);
}

.priority-badge.low {
    background: var(--border-color, var(--color-gray-300));
    color: var(--text-secondary, var(--color-gray-600));
}

/* Product Name Cell */
.col-name .product-name {
    display: inline;
    font-weight: 500;
    color: var(--text-primary, var(--color-gray-800));
}

.col-name .product-url {
    margin-left: 6px;
    color: var(--primary-color, var(--color-primary));
    font-size: 12px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.col-name .product-url:hover {
    opacity: 1;
}

/* Location Text - uses available space, only truncates when truly necessary */
.col-location {
    min-width: 150px;
}

.location-text {
    color: var(--text-secondary, var(--color-gray-600));
    font-size: 13px;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Time Since */
.time-since {
    font-size: 13px;
    color: var(--text-secondary, var(--color-gray-600));
}

.time-since.never {
    color: var(--success-color, var(--color-success));
    font-weight: 500;
}

/* Cooldown Badge */
.cooldown-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 6px;
    background: var(--warning-color, var(--color-orange));
    color: var(--color-white);
    font-size: 10px;
    font-weight: 600;
    border-radius: var(--radius-xs);
    text-transform: uppercase;
}

/* Blocked Badge */
.blocked-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 6px;
    background: var(--danger-color, var(--color-danger));
    color: var(--color-white);
    font-size: 10px;
    font-weight: 600;
    border-radius: var(--radius-xs);
    text-transform: uppercase;
}

.queue-row.is-blocked {
    background: rgba(220, 53, 69, 0.05);
    opacity: 0.7;
}

.queue-row.is-blocked:hover {
    opacity: 1;
}

/* Status Badge for Queue */
.queue-table .status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.queue-table .status-badge.status-available {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success-color, var(--color-success));
}

.queue-table .status-badge.status-unavailable {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color, var(--color-danger));
}

.queue-table .status-badge.status-blocked {
    background: rgba(220, 53, 69, 0.15);
    color: var(--danger-color, var(--color-danger));
}

.queue-table .status-badge.status-in_run {
    background: rgba(0, 123, 255, 0.1);
    color: var(--primary-color, var(--color-blue));
}

.queue-table .status-badge.status-disabled {
    background: rgba(108, 117, 125, 0.1);
    color: var(--text-secondary, var(--color-gray-600));
}

/* Column Widths */
.col-priority {
    width: 60px;
}

.col-source {
    width: 100px;
}

.col-queued,
.col-scraped {
    width: 140px;
}

.col-status {
    width: 100px;
}

@media (max-width: 1024px) {
    .queue-table {
        font-size: 13px;
    }

    .queue-table th,
    .queue-table td {
        padding: 10px 12px;
    }

    .col-location {
        display: none;
    }
}

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

    .queue-table th,
    .queue-table td {
        padding: 8px;
    }

    .col-scraped {
        display: none;
    }
}

/* ============================================================================
   Fullscreen Button & Mode (shared across pages)
   ============================================================================ */
.fullscreen-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--color-blue);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 500;
    transition: background-color 0.2s, transform 0.1s;
    margin-left: auto;
}

.fullscreen-btn:hover {
    background: var(--color-blue-hover);
}

.fullscreen-btn:active {
    transform: scale(0.97);
}

/* ============================================================================
   Trip Searcher Fullscreen Mode
   ============================================================================ */
body.fullscreen-mode {
    overflow: hidden;
}

body.fullscreen-mode > .app-header,
body.fullscreen-mode > .main-header,
body.fullscreen-mode > .breadcrumb,
body.fullscreen-mode > h1,
body.fullscreen-mode > footer,
body.fullscreen-mode > .app-footer,
body.fullscreen-mode #filter-sort-row,
body.fullscreen-mode #filters,
body.fullscreen-mode #table-loading,
body.fullscreen-mode .query-debug-panel,
body.fullscreen-mode .trip-modal {
    display: none !important;
}

body.fullscreen-mode #quick-filters {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-radius: 0;
    margin: 0;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color, var(--color-gray-300));
}

body.fullscreen-mode .table-container {
    position: fixed;
    top: 44px;
    left: 0;
    right: 0;
    bottom: 44px;
    overflow: auto;
    z-index: 999;
    background: var(--bg-primary, var(--color-white));
}

body.fullscreen-mode .table-container thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-secondary, var(--color-gray-50));
    box-shadow: 0 1px 0 var(--border-color, var(--color-gray-300));
}

body.fullscreen-mode #pagination-controls-top {
    display: none !important;
}

body.fullscreen-mode #pagination-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-secondary, var(--color-gray-50));
    border-top: 1px solid var(--border-color, var(--color-gray-300));
    padding: 6px 16px;
    margin: 0;
}

body.fullscreen-mode .fullscreen-btn {
    background: var(--color-danger);
}

body.fullscreen-mode .fullscreen-btn:hover {
    background: var(--color-danger);
}

body.fullscreen-mode .fullscreen-btn i::before {
    content: "\F622"; /* bi-fullscreen-exit */
}

body.fullscreen-mode .fullscreen-label {
    display: none;
}

body.fullscreen-mode .fullscreen-btn::after {
    content: "Exit";
}

/* Trip status styling */
.trip-unavailable {
    text-decoration: line-through;
    opacity: 0.6;
}

.trip-stale {
    background-color: rgba(255, 193, 7, 0.08);
    border-left: 3px solid var(--color-warning);
}

.freshness-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--color-white);
    font-size: 0.8em;
    font-weight: 500;
    white-space: nowrap;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.15);
}

/* Trip Details Modal Styles */
.trip-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.trip-modal.show {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
}

.trip-modal-content {
    background-color: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 900px;
    width: 100%;
    max-height: calc(100vh - 80px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.trip-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--color-gray-300);
    background: var(--color-gray-50);
}

.trip-modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--color-gray-800);
}

.trip-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--color-gray-600);
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s;
}

.trip-modal-close:hover {
    background-color: var(--color-gray-300);
    color: var(--color-gray-800);
}

.trip-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.trip-detail-section {
    margin-bottom: 24px;
}

.trip-detail-section:last-child {
    margin-bottom: 0;
}

.trip-detail-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-gray-100);
}

.trip-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.trip-detail-item {
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    background: var(--color-gray-50);
    border-radius: var(--radius-sm);
}

.trip-detail-item.highlight {
    background: var(--color-gray-100);
    border: 1px solid var(--color-primary);
}

.trip-detail-label {
    font-size: 11px;
    color: var(--color-gray-600);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}

.trip-detail-value {
    font-size: 14px;
    color: var(--color-gray-800);
    word-break: break-word;
}

.trip-detail-value.price {
    font-weight: 600;
    font-size: 16px;
    color: var(--color-success);
}

.trip-detail-value.unavailable {
    color: var(--color-danger);
}

.trip-detail-value a {
    color: var(--color-primary-dark);
    text-decoration: none;
}

.trip-detail-value a:hover {
    text-decoration: underline;
}

.trip-modal-actions {
    display: flex;
    gap: 16px;
    padding-top: 16px;
    margin-top: 8px;
    border-top: 1px solid var(--color-gray-100);
}

.trip-action-link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-primary-dark);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    background: var(--color-gray-50);
    transition: background 0.15s;
}

.trip-action-link:hover {
    background: var(--color-gray-100);
    text-decoration: none;
}

@media (max-width: 768px) {
    .trip-modal.show {
        padding: 20px 10px;
    }

    .trip-modal-content {
        max-height: calc(100vh - 40px);
    }

    .trip-detail-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Frosted Glass Pill Button
   ============================================ */
.btn-glass {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    padding: 0.625em 1.5em;
    font-size: 0.9em;
    font-weight: 500;
    color: var(--color-gray-900);
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50px;
    cursor: pointer;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.6),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.btn-glass::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    transition: left 0.5s ease;
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.btn-glass:hover::before {
    left: 100%;
}

.btn-glass:active {
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.35);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05);
}

.btn-glass:focus-visible {
    outline: none;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.6),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05),
        0 0 0 3px rgba(66, 153, 225, 0.4);
}

.btn-glass:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-glass:disabled:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: none;
}

/* Glass button icon */
.btn-glass i,
.btn-glass .bi {
    font-size: 1.1em;
}

/* Glass button variants */
.btn-glass.btn-glass-primary {
    background: rgba(13, 110, 253, 0.2);
    border-color: rgba(13, 110, 253, 0.4);
    color: var(--color-primary);
}

.btn-glass.btn-glass-primary:hover {
    background: rgba(13, 110, 253, 0.35);
    border-color: rgba(13, 110, 253, 0.6);
}

.btn-glass.btn-glass-success {
    background: rgba(25, 135, 84, 0.2);
    border-color: rgba(25, 135, 84, 0.4);
    color: var(--color-success);
}

.btn-glass.btn-glass-success:hover {
    background: rgba(25, 135, 84, 0.35);
    border-color: rgba(25, 135, 84, 0.6);
}

.btn-glass.btn-glass-danger {
    background: rgba(220, 53, 69, 0.2);
    border-color: rgba(220, 53, 69, 0.4);
    color: var(--color-danger);
}

.btn-glass.btn-glass-danger:hover {
    background: rgba(220, 53, 69, 0.35);
    border-color: rgba(220, 53, 69, 0.6);
}

/* Dark variant for light backgrounds */
.btn-glass.btn-glass-dark {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.2);
    color: var(--color-gray-800);
}

.btn-glass.btn-glass-dark:hover {
    background: rgba(0, 0, 0, 0.18);
    border-color: rgba(0, 0, 0, 0.3);
}

/* Size variants */
.btn-glass.btn-glass-sm {
    padding: 0.4em 1em;
    font-size: 0.8em;
}

.btn-glass.btn-glass-lg {
    padding: 0.8em 2em;
    font-size: 1.1em;
}

/* Demo container for showcasing glass button */
.glass-demo-container {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-purple) 100%);
    padding: 2em;
    border-radius: 12px;
    margin: 1em 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
    align-items: center;
}

/* ============================================================================
   Debug Toolbar — light content, dark header bar
   ============================================================================ */

.debug-toolbar {
    position: fixed;
    bottom: 16px;
    left: 16px;
    z-index: 10000;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 13px;
}

.debug-toolbar-toggle {
    width: 42px; height: 42px; border-radius: 50%;
    background: var(--color-danger); color: var(--color-white); border: none;
    cursor: pointer; font-size: 18px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s; position: relative;
    display: flex; align-items: center; justify-content: center;
}
.debug-toolbar-toggle:hover { transform: scale(1.08); }
.debug-toolbar-toggle.open { background: var(--color-danger-dark); }

.debug-toolbar-badge {
    position: absolute; top: -5px; right: -5px;
    background: var(--color-danger); color: var(--color-white);
    font-size: 10px; font-weight: 700;
    min-width: 18px; height: 18px; border-radius: 9px;
    display: flex; align-items: center;
    justify-content: center; padding: 0 4px;
}

/* Panel: solid background — no page bleed-through */
.debug-toolbar-panel {
    position: absolute; bottom: 52px; left: 0;
    width: min(900px, calc(100vw - 32px));
    height: 50vh; min-width: 420px; min-height: 200px;
    background: var(--color-gray-50); color: var(--color-gray-800);
    border: 2px solid var(--color-gray-800); border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    display: flex; flex-direction: column;
    overflow: hidden;
}

/* Resize handle (top-right corner) */
.debug-resize-handle {
    position: absolute; top: 0; right: 0;
    width: 18px; height: 18px;
    cursor: ne-resize; z-index: 3;
}
.debug-resize-handle::after {
    content: ''; position: absolute;
    top: 4px; right: 4px;
    width: 8px; height: 8px;
    border-top: 2px solid var(--color-gray-500);
    border-right: 2px solid var(--color-gray-500);
}
.debug-resize-handle:hover::after {
    border-color: var(--color-danger);
}

/* Tab bar — dark strip */
.debug-toolbar-bar {
    display: flex; align-items: center;
    background: var(--color-gray-800); padding: 0 8px;
    gap: 2px; flex-shrink: 0;
}

.debug-tab {
    background: none; border: none;
    color: var(--color-gray-500); padding: 8px 12px;
    cursor: pointer; font-size: 12px;
    display: flex; align-items: center; gap: 6px;
    border-bottom: 2px solid transparent;
}
.debug-tab:hover { color: var(--color-white); }
.debug-tab.active {
    color: var(--color-white);
    border-bottom-color: var(--color-danger);
}

.debug-tab-badge {
    background: rgba(255, 255, 255, 0.15);
    color: var(--color-white); font-size: 10px;
    padding: 1px 6px; border-radius: 8px;
    font-weight: 600;
}
.debug-tab.active .debug-tab-badge {
    background: var(--color-danger); color: var(--color-white);
}

.debug-toolbar-actions {
    margin-left: auto; display: flex; gap: 4px;
}

.debug-action-btn {
    background: none; border: 1px solid var(--color-gray-600);
    color: var(--color-gray-500); width: 28px; height: 28px;
    border-radius: 4px; cursor: pointer;
    display: flex; align-items: center;
    justify-content: center; font-size: 13px;
}
.debug-action-btn:hover {
    color: var(--color-white); border-color: var(--color-gray-100);
    background: rgba(255, 255, 255, 0.1);
}

/* Tab content — solid light background */
.debug-tab-content {
    overflow: auto; flex: 1;
    background: var(--color-white);
    border-top: none;
}
.debug-tab-content:not(.active) { display: none; }

/* SQL summary header */
.debug-sql-header {
    padding: 8px 14px; font-size: 13px;
    color: var(--color-white); font-weight: 700;
    background: var(--color-gray-800); text-align: left;
    border: none;
    border-bottom: 1px solid var(--color-gray-700);
}

/* SQL table */
.debug-sql-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}
.debug-sql-table thead {
    position: sticky; top: 0; z-index: 2;
}
.debug-sql-table thead tr {
    background: var(--color-gray-700);
}
.debug-sql-table th {
    text-align: left; padding: 6px 10px;
    background: var(--color-gray-700); color: var(--color-white);
    font-size: 11px; font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    border-bottom: 1px solid var(--color-gray-800);
}
.debug-sql-table td {
    padding: 8px 10px; vertical-align: top;
    border-bottom: 1px solid var(--color-gray-100);
}
.debug-sql-row:hover td { background: var(--color-gray-50); }

.debug-col-num {
    width: 32px; color: var(--color-gray-600);
    font-size: 12px; font-weight: 600;
}
.debug-col-query { min-width: 280px; }
.debug-col-ms { width: 80px; text-align: center; }
.debug-col-actions {
    width: 42px; text-align: center;
    overflow: visible;
}
th.debug-col-explain,
td.debug-col-explain {
    min-width: 200px; font-size: 12px;
    text-align: left !important;
}

.debug-sql-label {
    color: var(--color-gray-800); font-size: 12px;
    font-weight: 700; margin-bottom: 3px;
}

.debug-sql-code {
    margin: 0; padding: 6px 8px;
    background: var(--color-gray-50); border-radius: 4px;
    color: var(--color-gray-800); font-size: 12px;
    line-height: 1.5;
    white-space: pre;
    overflow-x: auto;
    max-width: 480px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}
.debug-sql-keyword {
    color: var(--color-purple); font-weight: 700;
}

/* MS badge */
.debug-ms-badge {
    display: inline-block; padding: 3px 10px;
    border-radius: 4px; font-size: 12px;
    font-weight: 700; white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.debug-ms-slow { background: var(--color-danger); color: var(--color-white); }
.debug-ms-warn { background: var(--color-orange); color: var(--color-white); }
.debug-ms-ok { background: var(--color-success); color: var(--color-white); }

.debug-ms-sub {
    font-size: 9px; font-weight: 400;
    opacity: 0.85; margin-top: 1px;
}

/* Row action menu */
.debug-row-actions {
    position: relative; overflow: visible;
}
.debug-row-menu-btn {
    background: var(--color-gray-100); border: 1px solid var(--color-gray-500);
    color: var(--color-gray-700); cursor: pointer; font-size: 14px;
    padding: 2px 6px; border-radius: 4px;
    line-height: 1;
}
.debug-row-menu-btn:hover {
    background: var(--color-gray-300); color: var(--color-gray-800);
    border-color: var(--color-gray-500);
}
.debug-row-menu {
    position: absolute; right: 0; top: 100%;
    background: var(--color-white); border: 1px solid var(--color-gray-400);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 20; min-width: 150px; display: none;
}
.debug-row-menu.open { display: block; }
.debug-row-menu-item {
    display: flex; align-items: center; gap: 6px;
    width: 100%; padding: 7px 12px;
    background: none; border: none;
    color: var(--color-gray-800); font-size: 12px;
    cursor: pointer; text-align: left;
}
.debug-row-menu-item:hover {
    background: var(--color-border-light);
}

/* EXPLAIN badges */
.debug-explain-type {
    display: inline-block; padding: 2px 8px;
    border-radius: 3px; font-size: 10px;
    font-weight: 700; text-transform: uppercase;
}
.debug-explain-ALL { background: var(--color-danger); color: var(--color-white); }
.debug-explain-index { background: var(--color-orange); color: var(--color-white); }
.debug-explain-range { background: var(--color-success); color: var(--color-white); }
.debug-explain-ref { background: var(--color-success); color: var(--color-white); }
.debug-explain-const { background: var(--color-primary); color: var(--color-white); }
.debug-explain-eq_ref { background: var(--color-primary); color: var(--color-white); }
.debug-explain-unknown { background: var(--color-gray-500); color: var(--color-white); }

/* EXPLAIN type tooltip */
.debug-explain-type[title] {
    cursor: help;
    position: relative;
}

/* EXPLAIN key display */
.debug-explain-keys {
    margin-top: 6px;
}

.debug-explain-used-key {
    font-size: 12px; color: var(--color-gray-800);
    margin-bottom: 3px;
}

.debug-explain-used-key i { color: var(--color-orange); }

.debug-explain-no-key {
    font-size: 11px; color: var(--color-danger);
    font-style: italic;
}

.debug-explain-possible {
    margin-top: 4px; font-size: 11px;
    line-height: 1.8;
    /* Allow wrapping */
    word-break: break-word;
}

.debug-explain-possible-label {
    color: var(--color-gray-600); font-size: 10px;
    text-transform: uppercase;
}

.debug-explain-key-tag {
    display: inline-block;
    padding: 1px 5px; margin: 1px 2px;
    border-radius: 3px; font-size: 10px;
    background: var(--color-gray-100); color: var(--color-gray-700);
    font-family: monospace;
    word-break: break-all;
}

.debug-explain-key-tag.chosen {
    background: var(--color-success); color: var(--color-white);
    font-weight: 700;
}

.debug-explain-stats {
    margin-top: 4px; font-size: 11px;
    color: var(--color-gray-700);
}

.debug-explain-extra {
    margin-top: 3px; font-size: 11px;
    color: var(--color-gray-600); font-style: italic;
}

.debug-explain-none { color: var(--color-gray-400); }

/* Timing tab */
.debug-timing-summary {
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-gray-100);
    color: var(--color-gray-800); font-weight: 600;
}
.debug-timing-bars { padding: 8px 14px; }
.debug-timing-row {
    display: flex; align-items: center;
    gap: 8px; margin-bottom: 5px;
}
.debug-timing-label {
    width: 200px; font-size: 12px; color: var(--color-gray-700);
    overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; flex-shrink: 0;
}
.debug-timing-bar-wrap {
    flex: 1; height: 16px; background: var(--color-gray-100);
    border-radius: 3px; overflow: hidden;
}
.debug-timing-bar {
    height: 100%; border-radius: 3px;
}
.debug-bar-ok { background: var(--color-success); }
.debug-bar-warn { background: var(--color-orange); }
.debug-bar-slow { background: var(--color-danger); }
.debug-timing-ms {
    width: 55px; text-align: right;
    font-size: 12px; font-weight: 600;
    color: var(--color-gray-800); flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

body.fullscreen-mode .debug-toolbar {
    display: none !important;
}

