﻿/* IMPI Foods Manager - Application Styles */

:root {
  --primary-color: #007749;
  --primary-dark: #005C38;
  --secondary-color: #333333;
  --accent-color: #D4AF37;
  --success-color: #4CAF50;
  --warning-color: #FF9800;
  --error-color: #F44336;
  --background-color: #f5f5f5;
  --card-background: #ffffff;
  --text-color: #212121;
  --text-secondary: #757575;
  --border-color: #e0e0e0;
  --shadow: 0 2px 4px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
  --border-radius: 8px;
  --transition: all 0.2s ease;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
}

/* Auto-Update Banner */
.update-banner {
  background: linear-gradient(135deg, #007749 0%, #005C38 100%);
  color: white;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  animation: slideDown 0.3s ease-out;
  z-index: 200;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

.update-icon {
  font-size: 24px;
  animation: spin 2s linear infinite;
}

.update-message {
  font-size: 14px;
}

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

.update-banner .btn {
  padding: 6px 12px;
  font-size: 13px;
}

.update-banner .btn-primary {
  background: white;
  color: #007749;
}

.update-banner .btn-primary:hover {
  background: #f0f0f0;
}

.update-banner .btn-secondary {
  background: rgba(255,255,255,0.2);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
}

.update-banner .btn-secondary:hover {
  background: rgba(255,255,255,0.3);
}

/* Layout */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  background: var(--primary-color);
  color: white;
  padding: 0 24px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 24px;
}

.header-content h1,
.header-content .logo h1 {
  font-size: 1.5rem;
  font-weight: 500;
  margin: 0;
}

.header-content .logo {
  color: white;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 600;
  white-space: nowrap;
}

.nav-logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 6px;
}

.main-nav {
  display: flex;
  gap: 8px;
  flex: 1;
  justify-content: center;
}

.main-nav a,
.main-nav .nav-link {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: var(--border-radius);
  transition: var(--transition);
  font-weight: 500;
}

.main-nav a:hover,
.main-nav .nav-link:hover {
  background: rgba(255,255,255,0.15);
  color: #D4AF37;
}

.main-nav a.active,
.main-nav .nav-link.active {
  background: rgba(255,255,255,0.2);
  color: white;
}

/* Hamburger button - hidden on desktop */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-left: auto;
}

.hamburger-icon {
  display: block;
  width: 24px;
  height: 2px;
  background: white;
  position: relative;
  transition: var(--transition);
}

.hamburger-icon::before,
.hamburger-icon::after {
  content: '';
  display: block;
  width: 24px;
  height: 2px;
  background: white;
  position: absolute;
  left: 0;
  transition: var(--transition);
}

.hamburger-icon::before { top: -7px; }
.hamburger-icon::after { top: 7px; }

/* Mobile nav overlay */
.nav-overlay {
  display: none;
}

.app-main {
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  width: 100%;
}

.app-footer {
  background: var(--card-background);
  border-top: 1px solid var(--border-color);
  padding: 16px 24px;
  text-align: center;
  color: var(--text-secondary);
}

/* Page Headers */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 1.75rem;
  font-weight: 500;
}

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

.back-link {
  color: var(--primary-color);
  text-decoration: none;
  margin-right: 16px;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

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

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

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--secondary-color);
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background: #616161;
}

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

.btn-block {
  width: 100%;
}

.btn-link {
  background: transparent;
  color: var(--primary-color);
  padding: 8px;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--text-color);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 16px;
  transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 119, 73, 0.1);
}

.form-group small {
  display: block;
  margin-top: 4px;
  color: var(--text-secondary);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 4px;
}

.search-box input {
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  min-width: 300px;
}

.search-mode-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border-color);
  cursor: pointer;
  transition: all 0.15s ease;
}

.search-mode-fuzzy {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

.search-mode-exact {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.search-mode-btn:hover {
  opacity: 0.85;
  transform: scale(1.08);
}

/* Alerts */
.alert {
  padding: 16px;
  border-radius: var(--border-radius);
  margin-bottom: 16px;
}

.alert-error {
  background: #ffebee;
  color: var(--error-color);
  border: 1px solid #ffcdd2;
}

.alert-success {
  background: #e8f5e9;
  color: var(--success-color);
  border: 1px solid #c8e6c9;
}

.alert-info {
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #90caf9;
}

/* Cards */
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.status-card {
  background: var(--card-background);
  border-radius: var(--border-radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--border-color);
}

.status-card h4 {
  margin-bottom: 12px;
  font-weight: 500;
}

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

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border-color);
}

.status-connected {
  border-left-color: var(--success-color);
}

.status-connected .status-dot {
  background: var(--success-color);
}

.status-error {
  border-left-color: var(--error-color);
}

.status-error .status-dot {
  background: var(--error-color);
}

.status-checking .status-dot {
  background: var(--warning-color);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--card-background);
  border-radius: var(--border-radius);
  padding: 20px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: var(--transition);
}

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

.product-header {
  margin-bottom: 12px;
}

.product-name {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 4px;
}

.product-sku {
  color: var(--text-secondary);
  font-family: monospace;
}

.product-sources {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.source-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.source-badge.linked {
  background: #e8f5e9;
  color: var(--success-color);
}

.source-badge.unlinked {
  background: #fafafa;
  color: var(--text-secondary);
}

/* Login Page */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
}

.login-container {
  background: var(--card-background);
  padding: 40px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
}

.login-container h1 {
  text-align: center;
  color: var(--primary-color);
  margin-bottom: 8px;
}

.login-logo {
  display: block;
  max-width: 220px;
  height: auto;
  margin: 0 auto 16px auto;
}

.login-container h2 {
  text-align: center;
  color: var(--text-secondary);
  font-weight: 400;
  margin-bottom: 32px;
}

/* MSA Login Button */
.login-info {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}

.msa-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #2f2f2f;
  color: white;
  padding: 14px 24px;
  font-size: 15px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.msa-login-btn:hover {
  background: #1a1a1a;
  color: white;
}

.msa-logo {
  width: 21px;
  height: 21px;
}

/* Settings Page */
.settings-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 32px;
}

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

.settings-nav {
  background: var(--card-background);
  border-radius: var(--border-radius);
  padding: 12px;
  box-shadow: var(--shadow);
  height: fit-content;
}

.nav-item {
  display: block;
  width: 100%;
  padding: 12px 20px;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: var(--transition);
}

.nav-item:hover {
  background: var(--background-color);
}

.nav-item.active {
  background: var(--primary-color);
  color: white;
}

.settings-content {
  background: var(--card-background);
  border-radius: var(--border-radius);
  padding: 32px 36px;
  box-shadow: var(--shadow);
}

.settings-section h3 {
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.settings-section h4 {
  margin: 28px 0 14px 0;
}

.connection-card {
  background: var(--background-color);
  border-radius: var(--border-radius);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.connection-status {
  font-weight: 500;
}

.connection-status.connected {
  color: var(--success-color);
}

/* ── About Page ─────────────────────────── */
.about-section {
  line-height: 1.7;
}

.about-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.about-header img {
  width: 56px;
  height: 56px;
  border-radius: 12px;
}

.about-header h3 {
  margin: 0;
  border: none;
  padding: 0;
}

.about-header .about-tagline {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 2px;
}

.about-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.about-info-card {
  background: var(--background-color);
  border-radius: var(--border-radius);
  padding: 16px 20px;
}

.about-info-card .info-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.about-info-card .info-value {
  font-weight: 600;
  font-size: 0.95rem;
}

.about-integrations {
  margin-top: 8px;
}

.about-integrations h4 {
  margin: 0 0 12px 0;
  font-size: 0.95rem;
}

.integration-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.integration-list li {
  background: var(--background-color);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.about-footer {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ── Settings Section Spacing ───────────── */
.settings-section p {
  line-height: 1.65;
  margin-bottom: 12px;
}

.settings-section .text-muted {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.settings-form {
  max-width: 560px;
}

/* Sync Progress Panel */
.sync-progress-panel {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.sync-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 0.95rem;
}

.sync-progress-elapsed {
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

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

.sync-source-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--bg-secondary);
  font-size: 0.9rem;
  transition: background 0.2s;
}

.sync-source-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.sync-source-name {
  font-weight: 500;
  min-width: 140px;
  flex-shrink: 0;
}

.sync-source-status {
  color: var(--text-secondary);
  flex: 1;
}

.sync-status-waiting {
  opacity: 0.6;
}

.sync-status-fetching .sync-source-icon {
  animation: spin 1s linear infinite;
}

.sync-status-fetching .sync-source-status {
  color: var(--primary);
}

.sync-status-saving .sync-source-status {
  color: var(--primary);
}

.sync-status-done {
  background: rgba(0, 128, 0, 0.06);
}

.sync-status-done .sync-source-status {
  color: #2e7d32;
}

.sync-status-error {
  background: rgba(220, 53, 69, 0.06);
}

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

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

.qbo-instructions {
  margin-bottom: 20px;
}

.qbo-instructions ol {
  padding-left: 1.3rem;
  line-height: 1.8;
}

.logout-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

/* Tabs */
.tab-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.tab {
  padding: 12px 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}

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

.tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

/* Loading States */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: inline-block;
}

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

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 48px;
  color: var(--text-secondary);
}

.empty-state p {
  margin-bottom: 16px;
}

/* Actions Grid */
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}

.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  background: var(--card-background);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text-color);
  transition: var(--transition);
}

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

.action-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.action-label {
  font-weight: 500;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--card-background);
  border-radius: var(--border-radius);
  padding: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 600;
  color: var(--primary-color);
}

.stat-label {
  color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
  .app-main {
    padding: 16px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .header-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .search-box input {
    min-width: 100%;
    flex: 1;
  }

  .search-box {
    width: 100%;
  }

  /* Show hamburger button on mobile */
  .hamburger-btn {
    display: block;
  }

  /* Mobile nav: slide-down menu */
  .main-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--primary-color);
    flex-direction: column;
    gap: 0;
    padding: 8px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 200;
  }

  .main-nav.mobile-open {
    display: flex;
  }

  .main-nav a,
  .main-nav .nav-link {
    padding: 14px 24px;
    border-radius: 0;
    font-size: 1.05rem;
  }

  .main-nav a:hover,
  .main-nav .nav-link:hover {
    background: rgba(255,255,255,0.1);
  }

  .main-nav a.active,
  .main-nav .nav-link.active {
    background: rgba(255,255,255,0.15);
    border-left: 3px solid white;
  }

  /* Overlay behind mobile nav */
  .nav-overlay {
    display: block;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 199;
  }
}

/* Product List View */
.product-list-view {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-list-view .product-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin-bottom: 0;
}

.product-list-view .product-header {
  margin-bottom: 0;
  flex: 1;
}

.product-list-view .product-sources {
  margin-bottom: 0;
  margin-right: 16px;
}

.product-list-view .product-meta {
  margin-left: 16px;
  min-width: 100px;
  text-align: right;
  color: var(--text-secondary);
  font-size: 0.9em;
}

/* Filter Controls */
.filter-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.filter-controls .form-select {
  padding: 8px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  min-width: 150px;
}

.btn-icon {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

.btn-icon:hover {
  background: rgba(0,0,0,0.05);
  color: var(--text-color);
}

/* Modal Styles */

/* When a modal is open the content wrapper gets the HTML "inert" attribute
   which the browser enforces (no clicks, focus, hover, selection).
   We just add a subtle visual dim so the user can tell it's inactive. */
.commission-page-content[inert] {
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

/* Lock body scroll when any modal overlay is present — prevents background
   scrolling while the user interacts with the modal content. */
body:has(.modal-overlay) {
  overflow: hidden;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  isolation: isolate;
}

.modal-content {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  width: 90%;
  max-width: 960px;
  height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.modal-nav-group {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.modal-header-title {
  min-width: 0;
  flex: 1;
  text-align: center;
}

.btn-nav {
  background: none;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1.5rem;
  line-height: 1;
  width: 36px;
  height: 36px;
  cursor: pointer;
  color: #555;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.btn-nav:hover:not(:disabled) {
  background: #f0f0f0;
  border-color: #bbb;
  color: #333;
}

.btn-nav:disabled,
.btn-nav-disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

.modal-header-title h3,
.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-hint {
  font-size: 0.8rem;
  color: #999;
  white-space: nowrap;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
  line-height: 1;
}

.btn-close:hover {
  color: #333;
}


/* Sync Detail Styles */
.sync-content {
  padding: 1rem;
}

.sync-comparison {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.field-source-card {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}

.field-source-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.source-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 0.5rem;
}

.source-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: #666;
  letter-spacing: 0.5px;
}

.source-value {
  font-size: 1.25rem;
  color: #333;
  font-weight: 500;
  word-break: break-all;
}

.badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-linked {
  background-color: #e8f5e9;
  color: #2e7d32;
}

.badge-missing {
  background-color: #fafafa;
  color: #9e9e9e;
  border: 1px solid #eee;
}

.sync-actions {
  background: #f8f9fa;
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.sync-actions p {
  margin-top: 0;
  margin-bottom: 1rem;
  color: #555;
  font-weight: 500;
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}

.action-buttons-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

/* Commission assigned cell */
.commission-table td.assigned-cell {
  white-space: nowrap;
  width: 1%;
}

.action-btn-group {
  display: flex;
  gap: 6px;
}

/* Modal tweaks */
.modal-content {
  animation: slideUp 0.3s ease;
}

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


/* Static Header Styles */
.product-static-header {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #eee;
  margin-bottom: 1.5rem;
}

.header-info {
  margin-bottom: 1rem;
}

.product-title {
  margin: 0 0 0.25rem 0;
  font-size: 1.5rem;
  color: #333;
}

.product-title.name-mismatch {
  color: #d32f2f;
}

/* Secondary retail name in header */
.product-retail-name {
  font-size: 0.95rem;
  color: #888;
  margin: 0.15rem 0 0.4rem 0;
  font-weight: 400;
}

.product-retail-name.name-mismatch {
  color: #d32f2f;
}

/* Name mismatch diff detail */
.name-mismatch-detail {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  margin: 0.25rem 0 0.4rem 0;
  font-size: 0.8rem;
}

.mismatch-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.15rem 0;
}

.mismatch-label {
  display: inline-block;
  min-width: 3.2rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
  flex-shrink: 0;
}

.mismatch-label.qbo {
  background: #e0f2e8;
  color: #007749;
}

.mismatch-label.ws {
  background: #f3e5f5;
  color: #7b1fa2;
}

.mismatch-label.retail {
  background: #e8f5e9;
  color: #2e7d32;
}

.mismatch-label.ncr {
  background: #fff3e0;
  color: #e65100;
}

.mismatch-name {
  color: #333;
}

.name-diff-highlight {
  background: #ffecb3;
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  font-weight: 600;
  border-bottom: 2px solid #ffa000;
}

/* Product list card - secondary name */
.product-secondary-name {
  font-size: 0.8rem;
  color: #999;
  margin-top: 2px;
  font-weight: 400;
}

.sku-badge {
  display: inline-block;
  background-color: #f0f0f0;
  color: #666;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9rem;
}

.source-status-bar {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Compact source indicators (badges) in product header */
.source-indicators {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.source-badge {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: all 0.15s;
}

.source-badge.unlinked {
  background: #f0f0f0;
  color: #999;
}

.source-badge.linked {
  background: #e8f5e9;
  color: #2e7d32;
  padding-right: 0.3rem;
}

.source-badge .badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
  flex-shrink: 0;
}

.source-badge .badge-dot.present {
  background: #4caf50;
}

.source-badge .badge-label {
  line-height: 1;
}

.source-badge .badge-delete {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  padding: 0 0.2rem;
  margin-left: 0.1rem;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.source-badge .badge-delete:hover {
  color: #fff;
  background: #d32f2f;
}

.source-status-card {
  flex: 1;
  min-width: 120px;
  background: #f8f9fa;
  padding: 0.75rem;
  border-radius: 6px;
  border: 1px solid #e9ecef;
}

.source-status-card h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.75rem;
  color: #666;
  text-transform: uppercase;
}

.source-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.source-actions .btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

.status-linked, .status-unlinked {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.status-linked {
  color: #2e7d32;
}

.status-unlinked {
  color: #757575;
}

/* NCR Variations Section */
.ncr-variations-section {
  margin-top: 1rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

.variations-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.variations-header h4 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-color);
}

.variation-count {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.ncr-refresh-spinner {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  color: var(--text-secondary);
}

.variations-header .btn-xs {
  margin-left: auto;
}

.variations-table {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.875rem;
}

.variations-header-row {
  display: flex;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

.variations-row {
  display: flex;
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
}

.variations-row:last-child {
  border-bottom: none;
}

.var-col {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.var-col.var-name {
  flex: 2;
}

.var-col.var-sku {
  flex: 1.5;
  font-family: monospace;
  font-size: 0.8rem;
}

.var-col.var-mapped {
  flex: 2;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mapped-product-name {
  color: var(--primary-color);
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mapped-this-product {
  color: var(--text-secondary);
  font-style: italic;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mapped-not-mapped {
  color: var(--text-secondary);
  font-style: italic;
  opacity: 0.7;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.var-toggle-btn {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  flex-shrink: 0;
}

/* Variation External ID mismatch warning */
.var-sku-mismatch {
  flex-direction: column;
  align-items: flex-start;
  white-space: normal;
  overflow: visible;
}

.var-sku-mismatch .var-sku-value {
  color: var(--danger-color, #dc3545);
  font-weight: 600;
}

.var-sku-mismatch .var-sku-expected {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-family: inherit;
}

.var-fix-btn {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  margin-top: 0.15rem;
}

.var-col.var-price,
.var-col.var-stock {
  flex: 0.75;
  text-align: right;
}

/* Child variation compact info bar */
.ncr-child-variation {
  background: #f0f7ff;
  border-color: #b8d4f0;
}

.variation-row-current,
.variations-row[data-current="true"] {
  background: #e8f4fd;
  border-left: 3px solid var(--primary-color);
}

.child-variation-info {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  padding: 0.25rem 0;
  flex-wrap: wrap;
}

.child-variation-arrow {
  font-size: 1.2em;
  color: var(--primary-color);
  font-weight: 600;
}

.child-variation-stats {
  color: var(--text-secondary);
}

/* Header Actions */
.header-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: #e3f2fd;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition);
}

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

.btn-link svg {
  flex-shrink: 0;
}

.link-count {
  font-size: 0.85em;
  opacity: 0.9;
}

/* Link Badge (in product card) */
.link-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: #e8f5e9;
  color: #2e7d32;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
}

.link-badge svg {
  flex-shrink: 0;
}

/* Link Modal Overlay */
.link-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

/* Link Modal */
.link-modal {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.link-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.link-modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--text-color);
}

.link-modal-header .close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.link-modal-header .close-btn:hover {
  color: var(--text-color);
}

.link-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.link-info {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.current-sku-info {
  background: #f5f5f5;
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.current-sku-info strong {
  font-family: monospace;
  color: var(--primary-color);
}

.link-search {
  margin-bottom: 1.5rem;
}

.link-search .search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
}

.link-search .search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(0, 119, 73, 0.1);
}

/* Linked Section */
.linked-section {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: var(--border-radius);
}

.linked-section h4 {
  margin: 0 0 0.75rem 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.linked-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.linked-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: white;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.linked-sku {
  font-family: monospace;
  color: var(--text-color);
}

/* Search Results Section */
.search-results-section h4 {
  margin: 0 0 0.75rem 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.search-result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #f8f9fa;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

.result-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.result-name {
  font-weight: 500;
  color: var(--text-color);
}

.result-sku {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.already-linked {
  font-size: 0.85rem;
  color: var(--success-color);
  font-weight: 500;
}

/* Link Loading */
.link-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem;
  color: var(--text-secondary);
}

/* Link Modal Footer */
.link-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: #f8f9fa;
}

/* Button variants for link modal */
.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

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

.btn-danger:hover {
  background: #d32f2f;
}

/* Selection Mode Styles */
.selection-action-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--primary-color), #007749);
  color: white;
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  animation: slideDown 0.2s ease;
}

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

.selection-count {
  font-weight: 500;
  flex: 1;
}

.selection-action-bar .btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
}

.selection-action-bar .btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.selection-action-bar .btn-primary {
  background: white;
  color: var(--primary-color);
  font-weight: 500;
}

.selection-action-bar .btn-primary:hover {
  background: #f0f0f0;
}

.selection-action-bar .btn-primary:disabled {
  background: rgba(255, 255, 255, 0.5);
  color: rgba(0, 0, 0, 0.3);
  cursor: not-allowed;
}

/* Product card in selection mode */
.product-card.selected {
  border: 2px solid var(--primary-color);
  background: rgba(33, 150, 243, 0.05);
}

.product-card.selected:hover {
  border-color: var(--primary-color);
}

/* All-mapped product card — dimmed appearance */
.product-card.all-mapped {
  opacity: 0.55;
  border-left: 3px solid #999;
}

.product-card.all-mapped:hover {
  opacity: 0.85;
}

.all-mapped-badge {
  background: #999 !important;
  color: #fff !important;
  font-size: 0.7rem;
}

/* NCR External ID mismatch — red highlight */
.product-card.ncr-mismatch {
  border-left: 3px solid #dc2626;
  background: #fef2f2;
}

.product-card.ncr-mismatch:hover {
  background: #fee2e2;
}

.ncr-mismatch-badge {
  background: #dc2626 !important;
  color: #fff !important;
  font-size: 0.7rem;
  font-weight: 600;
}

/* Selection checkbox */
.selection-checkbox {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 10;
}

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

/* Make product card relative for checkbox positioning */
.product-card {
  position: relative;
}

/* Adjust padding when in selection mode */
.product-card .selection-checkbox + .product-header {
  padding-left: 32px;
}

/* Button outline style */
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-color);
}

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

/* Button warning style */
.btn-warning {
  background: #ff9800;
  color: white;
  border: none;
}

.btn-warning:hover {
  background: #f57c00;
}

/* SKU Selection Modal */
.sku-select-modal {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.sku-select-modal .modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sku-select-modal .modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: #333;
}

.sku-select-modal .modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
  line-height: 1;
  padding: 0;
}

.sku-select-modal .modal-close:hover {
  color: #333;
}

.sku-select-modal .modal-body {
  padding: 1.5rem;
}

.sku-select-modal .modal-description {
  margin: 0 0 1.25rem 0;
  color: #666;
  font-size: 0.95rem;
  line-height: 1.5;
}

.sku-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sku-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.sku-option:hover {
  border-color: var(--primary-color);
  background: #f8f9ff;
}

.sku-option-content {
  flex: 1;
  padding: 1rem 1.25rem;
  cursor: pointer;
}

.sku-option-content:hover {
  transform: translateX(4px);
}

.sku-copy-btn {
  padding: 0.5rem 0.75rem;
  margin-right: 0.5rem;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.sku-copy-btn:hover {
  background: #e0e0e0;
  border-color: #ccc;
}

.sku-copy-btn:active {
  background: #d0d0d0;
}

.sku-option-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.sku-option-main strong {
  font-size: 1.05rem;
  color: #333;
}

.sku-source {
  font-size: 0.85rem;
  color: #888;
}

.sku-option-name {
  font-size: 0.9rem;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-sku-section {
  margin-top: 1rem;
}

.custom-sku-section hr {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 0.75rem 0;
}

.custom-sku-label {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.custom-sku-input-row {
  display: flex;
  gap: 0.5rem;
}

.custom-sku-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
}

.custom-sku-input:focus {
  outline: none;
  border-color: #4a90a4;
  box-shadow: 0 0 0 2px rgba(74, 144, 164, 0.2);
}

.custom-sku-input-row .btn {
  white-space: nowrap;
}

.sku-select-modal .modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: flex-end;
}

/* Linked Products Display */
.linked-product {
  border-left: 3px solid #4CAF50;
}

.product-skus {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.product-sku.primary {
  font-weight: 500;
  color: #555;
}

.product-sku.no-sku {
  font-style: italic;
  color: #aaa;
  font-weight: 400;
}

.linked-skus {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
}

.product-sku.linked {
  font-size: 0.8rem;
  color: #888;
  background: #f0f7f0;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}

.link-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: #4CAF50;
  font-size: 0.85rem;
  font-weight: 500;
}

/* ===============================
   Enhanced Product Detail Styles
   =============================== */

/* Success/Error alerts with close button */
.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.alert-success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
  padding: 0 0.5rem;
}

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

/* Sync description */
.sync-description {
  color: #666;
  margin-bottom: 1.5rem;
}

/* Edit mode styles */
.edit-mode {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.edit-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 2px solid #007bff;
  border-radius: 4px;
  font-size: 1rem;
  outline: none;
}

.edit-input:focus {
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

.edit-input:disabled {
  background: #f5f5f5;
  border-color: #ddd;
}

.edit-actions {
  display: flex;
  gap: 0.5rem;
}

/* Display mode with actions */
.display-mode {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #f0f0f0;
  margin-top: 0.5rem;
}

.btn-outline {
  background: transparent;
  border: 1px solid #ddd;
  color: #666;
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.2s;
}

.btn-outline:hover {
  background: #f5f5f5;
  border-color: #ccc;
  color: #333;
}

.btn-outline svg {
  flex-shrink: 0;
  pointer-events: none;
}

/* Ensure SVG icons in all buttons don't capture clicks */
.btn svg {
  pointer-events: none;
}

/* Small buttons */
.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

/* Image styles */
.source-image-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.product-image {
  max-width: 150px;
  max-height: 150px;
  border-radius: 4px;
  object-fit: contain;
  border: 1px solid #eee;
}

.image-actions {
  display: flex;
  gap: 0.5rem;
}

.no-image {
  color: #999;
  font-style: italic;
  padding: 2rem 0;
  text-align: center;
}

/* Sync Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  isolation: isolate;
}

.modal {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 400px;
  animation: slideUp 0.2s ease;
}

.sync-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #eee;
}

.sync-modal .modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.sync-modal .modal-body {
  padding: 1.25rem;
}

.sync-modal .modal-body p {
  margin-top: 0;
  margin-bottom: 1rem;
  color: #666;
}

.sync-modal .modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid #eee;
  background: #f9f9f9;
  border-radius: 0 0 8px 8px;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
  padding: 0;
  line-height: 1;
}

.close-btn:hover {
  color: #333;
}

/* Sync targets */
.sync-targets {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sync-target {
  display: flex;
  align-items: center;
}

.sync-target label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 500;
}

.sync-target input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.sync-target.disabled {
  opacity: 0.5;
}

.sync-target.disabled label {
  cursor: not-allowed;
}

/* Spinner small */
.spinner-sm {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 0.8s linear infinite;
}

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

/* ── Markup Factor Section ─────────────────── */
.markup-section {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: #f8f9fa;
  border-radius: 10px;
  border: 1px solid #e0e0e0;
}

.markup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.markup-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #333;
}

.markup-assigned {
  background: #fff;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid #d0e8ff;
}

.markup-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.markup-factor-name {
  font-weight: 600;
  font-size: 1rem;
  color: #007749;
}

.markup-factor-value {
  font-size: 0.9rem;
  color: #666;
  font-family: monospace;
}

.markup-calculation {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.8rem;
  background: #e8f5e9;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}

.calc-formula {
  font-size: 0.85rem;
  color: #555;
  font-family: monospace;
}

.calc-result {
  font-size: 1rem;
  font-weight: 700;
  color: #2e7d32;
  font-family: monospace;
}

.markup-no-cost {
  padding: 0.6rem 0.8rem;
  background: #fff3e0;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  color: #e65100;
  font-size: 0.85rem;
}

.markup-actions {
  display: flex;
  gap: 0.5rem;
}

.markup-assign {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.markup-assign > span {
  font-size: 0.85rem;
  color: #666;
}

.markup-choice {
  font-size: 0.8rem !important;
}

.markup-empty {
  color: #999;
  font-size: 0.85rem;
  font-style: italic;
}

/* ── Wholesale Mark-up Suggestion (inline price edit) ─── */
.markup-suggestion {
  margin: 0.35rem 0;
}

.markup-use-btn {
  font-size: 0.8rem !important;
  color: #6f42c1 !important;
  border-color: #6f42c1 !important;
  padding: 0.2rem 0.6rem !important;
}

.markup-use-btn:hover {
  background: #6f42c1 !important;
  color: #fff !important;
}

.markup-indicator {
  font-size: 0.75rem;
  margin-left: 0.4rem;
}

.markup-match {
  color: #2e7d32;
}

.markup-mismatch {
  color: #b26a00;
}

.markup-manage-modal .modal-body {
  max-height: 50vh;
  overflow-y: auto;
}

.factors-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.factor-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.8rem;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  gap: 0.5rem;
}

.factor-row-editing {
  background: #f0f9f5;
  border-color: #007749;
}

.factor-row .factor-name {
  font-weight: 600;
  color: #333;
  flex: 1;
}

.factor-row .factor-value {
  font-family: monospace;
  color: #666;
  font-size: 0.85rem;
}

.factor-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.new-factor-form {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #e0e0e0;
}

.new-factor-form h4 {
  margin: 0 0 0.75rem 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #555;
}

.form-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.form-input {
  padding: 0.45rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.85rem;
  flex: 1;
}

.form-input:focus {
  outline: none;
  border-color: #007749;
  box-shadow: 0 0 0 2px rgba(0, 119, 73, 0.15);
}

.factor-input {
  max-width: 120px;
  flex: 0 0 auto;
}

/* ── Delete from Source Button ─────────────── */
.btn-delete-source {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}

.btn-delete-source:hover {
  color: #d32f2f;
  background: rgba(211, 47, 47, 0.08);
}

/* ── Delete Confirmation Modal ─────────────── */
.delete-confirm-modal {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  width: 90%;
  max-width: 440px;
  overflow: hidden;
}

.delete-confirm-modal .modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.delete-confirm-modal .modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #d32f2f;
}

.delete-confirm-modal .modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: #999;
  line-height: 1;
  padding: 0;
}

.delete-confirm-modal .modal-close:hover {
  color: #333;
}

.delete-confirm-modal .modal-body {
  padding: 1.25rem;
}

.delete-confirm-modal .modal-body p {
  margin: 0.75rem 0 0 0;
  color: #666;
  font-size: 0.9rem;
}

.delete-confirm-modal .modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid #eee;
  background: #f9f9f9;
  border-radius: 0 0 10px 10px;
}

.alert-warning {
  background-color: #fff3e0;
  border: 1px solid #ffcc80;
  color: #e65100;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* New Item Modal */
.new-item-modal {
  max-width: 520px;
  width: 90%;
}

.new-item-modal .form-group {
  margin-bottom: 1rem;
}

.new-item-modal .form-row {
  display: flex;
  gap: 1rem;
}

.new-item-modal .form-group.half {
  flex: 1;
}

.new-item-modal textarea.form-control {
  resize: vertical;
  min-height: 60px;
}

.provider-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.provider-checkbox label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.provider-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

/* Add to Provider section in product detail header */
.add-to-provider-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #eee;
}

.add-to-label {
  font-size: 0.8rem;
  color: #888;
  font-weight: 500;
}

.add-to-btn {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  border: 1px dashed #4CAF50;
  color: #4CAF50;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.add-to-btn:hover {
  background: #4CAF50;
  color: white;
  border-style: solid;
}

.add-to-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Add to Provider modal */
.add-provider-modal {
  max-width: 420px;
  width: 90%;
  height: auto;
}

.add-provider-modal .modal-body {
  padding: 1rem 1.5rem;
}

.add-provider-desc {
  margin: 0 0 1rem 0;
  color: #6b7280;
  font-size: 0.88rem;
  line-height: 1.5;
}

.apc-product-summary {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.apc-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: #111827;
  line-height: 1.45;
}

.apc-sku {
  display: inline-block;
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  letter-spacing: 0.02em;
}

.apc-stats-inline {
  display: flex;
  gap: 1.25rem;
  padding: 0.6rem 0;
  border-top: 1px solid #f0f0f0;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 0.75rem;
}

.apc-inline-stat {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.apc-inline-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
  font-weight: 500;
}

.apc-inline-value {
  font-size: 0.88rem;
  font-weight: 600;
  color: #111827;
}

.apc-ncr-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  font-size: 0.82rem;
}

.apc-ncr-link-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #16a34a;
  font-weight: 600;
  white-space: nowrap;
}

.apc-ncr-link-value {
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  font-weight: 500;
  color: #166534;
}

/* ── NCR Sync Settings (WooNCR Plugin) ───────────── */
.ncr-sync-section {
  margin-top: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: #fafbfc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.ncr-sync-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.ncr-sync-header h4 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: #374151;
}

.ncr-sync-unlinked {
  font-size: 0.82rem;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ncr-sync-body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.ncr-sync-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.2rem 0;
  min-height: 1.6rem;
}

.ncr-sync-row.ncr-sync-sub {
  padding-left: 1rem;
  opacity: 0.85;
}

.ncr-sync-key {
  font-size: 0.78rem;
  color: #6b7280;
  font-weight: 500;
}

.ncr-sync-val {
  font-size: 0.82rem;
  font-weight: 500;
  color: #111827;
}

.ncr-sync-mono {
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.76rem;
  background: #f3f4f6;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  border: 1px solid #e5e7eb;
}

.ncr-sync-mismatch {
  background: #fef2f2 !important;
  border-color: #fca5a5 !important;
  color: #dc2626 !important;
}

.ncr-sync-mismatch-warning {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 0.45rem 0.6rem;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  margin: 0.15rem 0;
}

.ncr-sync-mismatch-icon {
  font-size: 0.85rem;
  line-height: 1.3;
  flex-shrink: 0;
}

.ncr-sync-mismatch-details {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}

.ncr-sync-mismatch-text {
  font-size: 0.75rem;
  color: #991b1b;
  line-height: 1.35;
}

.ncr-sync-mismatch-text strong {
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.73rem;
}

.btn-danger-outline {
  color: #dc2626;
  border: 1px solid #dc2626;
  background: #fff;
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-danger-outline:hover {
  background: #dc2626;
  color: #fff;
}

.btn-danger-outline:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ncr-sync-toggle {
  display: flex;
  align-items: center;
}

.toggle-sm {
  transform: scale(0.8);
  transform-origin: right center;
}

/* ── Commission Page ─────────────────── */
.commission-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
}

.commission-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #e0e0e0;
}

.commission-tab {
  padding: 0.75rem 1.5rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 1rem;
  color: #666;
  transition: all 0.2s;
}

.commission-tab:hover {
  color: #333;
  background: #f5f5f5;
}

.commission-tab.active {
  color: #4a90d9;
  border-bottom-color: #4a90d9;
  font-weight: 600;
}

.commission-filters {
  display: flex;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.filter-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #666;
}

.filter-group select,
.filter-group input[type="date"] {
  padding: 0.4rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.9rem;
}

.search-group {
  flex: 1;
  min-width: 180px;
}

.search-group input[type="text"] {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.9rem;
}

.btn-icon {
  padding: 0.4rem 0.6rem;
  font-size: 1rem;
  line-height: 1;
  border-radius: 6px;
  min-width: auto;
}

.assign-select {
  padding: 4px 6px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.78rem;
  width: auto;
  max-width: 130px;
  background: white;
  color: #333;
  cursor: pointer;
  transition: border-color 0.15s;
  text-overflow: ellipsis;
}

.assign-select:hover {
  border-color: #999;
}

.assign-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(74,144,217,0.15);
}

/* Commission action buttons — icon-only compact style */
.btn-icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.btn-icon-action span {
  line-height: 1;
}

.btn-calc {
  background: #f0f4f8;
  color: #4a6785;
  border: 1px solid #d0dae5;
}

.btn-calc:hover {
  background: #e1e9f1;
  border-color: #b8c8d8;
  transform: scale(1.1);
}

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

.btn-lock:hover {
  background: var(--primary-dark);
  transform: scale(1.1);
}

.btn-unlock {
  background: #f8f0e0;
  color: #8a6d3b;
  border: 1px solid #e0d0b0;
}

.btn-unlock:hover {
  background: #f0e4cc;
  border-color: #d4c09a;
  transform: scale(1.1);
}

.amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.commission-amount {
  color: #2d8f2d;
  font-weight: 600;
}

/* Sortable table headers */
.sortable-header {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background 0.15s;
}

.sortable-header:hover {
  background: #e8ecf0;
}

.sortable-header.active {
  color: #4a90d9;
}

/* Commission table spacing */
.commission-table th,
.commission-table td {
  padding: 0.5rem 0.6rem;
  vertical-align: middle;
}

.commission-table td.actions {
  white-space: nowrap;
  width: 1%; /* shrink-to-fit */
}

.commission-table tbody tr:hover {
  background: #f5f8ff;
}

/* Table info bar */
.table-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  padding: 0 0.25rem;
}

.result-count {
  font-size: 0.85rem;
  color: #888;
}

.no-data {
  text-align: center;
  padding: 2rem;
  color: #999;
  font-style: italic;
}

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
}

.status-open {
  background: #fff3cd;
  color: #856404;
}

.status-paid {
  background: #d4edda;
  color: #155724;
}

.status-active {
  background: #d4edda;
  color: #155724;
}

.status-inactive {
  background: #f8d7da;
  color: #721c24;
}

/* Employee Form / Cards */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.employee-form {
  margin-bottom: 1.5rem;
  padding: 1.5rem;
}

.employee-form .form-group {
  margin-bottom: 1rem;
}

.employee-form .form-group label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.employee-form .form-group input[type="text"],
.employee-form .form-group input[type="email"] {
  width: 100%;
  max-width: 400px;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 6px;
}

.tier-section {
  margin-top: 1rem;
  padding: 1rem;
  background: #f0f4ff;
  border-radius: 8px;
}

.tier-section h5 {
  margin: 0 0 0.25rem 0;
}

.tier-help {
  font-size: 0.85rem;
  color: #666;
  margin: 0 0 1rem 0;
}

.tier-section .tier-row {
  display: flex;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.tier-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.tier-field label {
  font-size: 0.8rem;
  color: #666;
}

.tier-field input {
  width: 120px;
  padding: 0.4rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.form-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
}

.employee-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.employee-card {
  padding: 1rem;
}

.employee-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.employee-header h4 {
  margin: 0;
}

.employee-email {
  color: #666;
  font-size: 0.9rem;
  margin: 0.25rem 0;
}

.employee-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Summary */
.summary-totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.summary-card {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 1.25rem;
  text-align: center;
  border: 1px solid #e9ecef;
}

.summary-label {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-value {
  font-size: 1.5rem;
  font-weight: 700;
}

/* Summary detail table */
.summary-table-container {
  margin-top: 0.5rem;
}

.summary-detail-table {
  border-collapse: separate;
  border-spacing: 0;
}

.summary-detail-table thead th {
  background: #f1f5f9;
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #475569;
  border-bottom: 2px solid #cbd5e1;
}

.summary-detail-table tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.summary-detail-table tbody tr:hover {
  background: #f8fafc;
}

.summary-detail-table .locked-at-cell {
  color: #64748b;
  font-size: 0.85rem;
}

.summary-total-row {
  background: #f0f4ff !important;
}

.summary-total-row td {
  padding: 0.85rem 1rem;
  border-top: 2px solid #4a90d9;
  font-weight: 600;
}

/* Calc Modal */
.modal-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  width: 90%;
  max-width: 850px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: contain;
}

.modal-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  overscroll-behavior: contain;
}

.calc-header {
  margin-bottom: 1rem;
  display: flex;
  gap: 2rem;
}

.calc-header p {
  margin: 0.25rem 0;
}

.total-row {
  background: #f0f4ff;
  font-weight: 600;
}

.total-row td {
  border-top: 2px solid #4a90d9;
}

.calc-actions {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid #e0e0e0;
  justify-content: flex-end;
  flex-shrink: 0;
  background: #fafafa;
}

/* Excluded line items */
.line-excluded td {
  color: #999;
  text-decoration: line-through;
}

.line-excluded td.excluded-badge-cell {
  text-decoration: none;
}

.excluded-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  background: #fff3cd;
  color: #856404;
  border-radius: 3px;
  font-weight: 500;
  white-space: nowrap;
}

/* Exclusion Rules */
.exclusion-rules-section {
  margin-top: 2rem;
  padding: 1.5rem;
  background: #fff8f0;
  border-radius: 10px;
  border: 1px solid #fde0c0;
}

/* Tier Breakdown */
.tier-breakdown {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: #f0f7ff;
  border-radius: 8px;
  border: 1px solid #d0e3f7;
}

.tier-breakdown-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: #2c5282;
}

.tier-icon {
  font-size: 1rem;
}

.tier-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.tier-table th {
  text-align: left;
  padding: 0.3rem 0.5rem;
  color: #4a6fa5;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid #d0e3f7;
}

.tier-table td {
  padding: 0.35rem 0.5rem;
  color: #333;
}

.tier-table .amount {
  text-align: right;
}

.tier-table .tier-row {
  opacity: 0.5;
}

.tier-table .tier-row.tier-active {
  opacity: 1;
  background: #e2effc;
  border-radius: 4px;
}

.tier-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #d0e3f7;
  color: #2c5282;
  white-space: nowrap;
}

.tier-active .tier-badge {
  background: #3182ce;
  color: #fff;
}

.tier-table .commission-amount {
  color: #16a34a;
  font-weight: 600;
}

.exclusion-rules-section h4 {
  margin: 0 0 0.5rem 0;
}

.exclusion-help {
  font-size: 0.85rem;
  color: #666;
  margin: 0 0 1rem 0;
}

.exclusion-rule-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.exclusion-rule-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: white;
  border-radius: 6px;
  border: 1px solid #eee;
}

.exclusion-rule-item .rule-text {
  flex: 1;
  font-size: 0.9rem;
}

.exclusion-rule-item .rule-field {
  font-weight: 600;
  color: #333;
}

.exclusion-rule-item .rule-op {
  color: #888;
  font-style: italic;
}

.exclusion-rule-item .rule-value {
  color: #c05621;
  font-weight: 500;
}

.add-rule-form {
  display: flex;
  gap: 0.5rem;
  align-items: end;
  flex-wrap: wrap;
}

.add-rule-form select,
.add-rule-form input {
  padding: 0.4rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.85rem;
}

.add-rule-form input {
  flex: 1;
  min-width: 150px;
}

/* ── Pay Periods ────────────────────────── */
.commission-payperiods {
  padding-bottom: 2rem;
}

.payperiod-help {
  font-size: 0.9rem;
  color: #666;
  margin: 0 0 1.5rem 0;
}

.payperiod-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.payperiod-card {
  padding: 1rem 1.25rem;
}

.payperiod-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.payperiod-header h4 {
  margin: 0;
  font-size: 1rem;
}

.payperiod-count-badge {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  background: #e8f5e9;
  color: #2e7d32;
  font-weight: 600;
}

.payperiod-details {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.payperiod-info,
.payperiod-deadline {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.payperiod-label {
  font-weight: 600;
  color: #555;
}

.payperiod-deadline.deadline-passed {
  color: #999;
  text-decoration: line-through;
}

.payperiod-deadline.deadline-today {
  color: #c62828;
  font-weight: 700;
}

.payperiod-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

/* ── Payroll completion ──── */
.payroll-completed {
  border-left: 4px solid #2e7d32;
  background: linear-gradient(135deg, #f1f8e9 0%, #ffffff 100%);
}

.payroll-completed .payperiod-header h4 {
  color: #2e7d32;
}

.completion-info {
  color: #2e7d32;
  font-style: italic;
}

.btn-success {
  background: #2e7d32;
  color: white;
  border: none;
}

.btn-success:hover {
  background: #1b5e20;
}

.btn-warning {
  background: #f57c00;
  color: white;
  border: none;
}

.btn-warning:hover {
  background: #e65100;
}

.btn-danger {
  background: #c62828;
  color: white;
  border: none;
}

.btn-danger:hover {
  background: #b71c1c;
}

.warning-box {
  background: #fff3e0;
  border: 1px solid #ff9800;
  border-radius: 8px;
  padding: 1rem;
}

.warning-box p {
  margin: 0.25rem 0;
}

.modal-sm .modal-container,
.modal-container.modal-sm {
  max-width: 500px;
}

.btn-unlock-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Payday assignment in locked detail ──── */
.payday-assign-section {
  margin-top: 1.5rem;
  padding: 1rem;
  background: #f7fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.payday-select {
  min-width: 250px;
}

.payday-select-sm {
  font-size: 0.8rem;
  padding: 4px 6px;
  min-width: 140px;
  max-width: 180px;
}

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

/* ── Progress bars ──────────────────────── */
.progress-bar-container {
  display: inline-block;
  width: 140px;
  height: 12px;
  background: #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
  vertical-align: middle;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3182ce, #38a169);
  border-radius: 5px;
  transition: width 0.3s ease;
}

.progress-pct {
  font-size: 0.75rem;
  color: #666;
  margin-left: 0.5rem;
}

/* ── Tier progress on employee cards ────── */
.employee-tier-progress {
  margin: 0.75rem 0;
  padding: 0.75rem;
  background: #f7fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.tier-progress-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.tier-progress-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  font-size: 0.8rem;
}

.tier-progress-current {
  font-weight: 600;
}

.tier-progress-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 180px;
}

.tier-range-text {
  color: #888;
  font-size: 0.75rem;
}

.tier-remaining-text {
  font-size: 0.75rem;
  color: #e65100;
}

.tier-progress-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.tier-progress-table th,
.tier-progress-table td {
  padding: 0.65rem 1rem;
  vertical-align: middle;
  white-space: nowrap;
}

.tier-progress-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #555;
  border-bottom: 2px solid #e2e8f0;
}

.tier-progress-table td:nth-child(4),
.tier-progress-table td:nth-child(6),
.tier-progress-table th:nth-child(4),
.tier-progress-table th:nth-child(6) {
  text-align: right;
}

.tier-progress-table td:nth-child(5) {
  min-width: 180px;
}

.tier-progress-table .tier-current-row {
  background: #e8f5e9;
  font-weight: 600;
}

.tier-progress-table .tier-current-row td {
  border-top: 1px solid #c8e6c9;
  border-bottom: 1px solid #c8e6c9;
}

.current-tier-badge {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  background: #38a169;
  color: #fff;
  margin-left: 0.3rem;
  vertical-align: middle;
}

/* ── Commission Statement ───────────────── */
.statement-modal {
  max-width: 900px;
  max-height: 90vh;
}

.statement-body {
  overflow-y: auto;
  max-height: calc(90vh - 120px);
}

.statement-content {
  padding: 1rem;
}

.statement-header {
  text-align: center;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #333;
  padding-bottom: 1rem;
}

.statement-header h2 {
  margin: 0 0 0.75rem 0;
  font-size: 1.4rem;
}

.statement-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  justify-content: center;
  font-size: 0.9rem;
}

.statement-meta-item {
  white-space: nowrap;
}

.statement-totals {
  margin-bottom: 1.5rem;
}

.statement-section {
  margin-bottom: 1.5rem;
}

.statement-section h4 {
  margin: 0 0 0.75rem 0;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid #ddd;
}

.statement-invoice {
  margin-bottom: 1.25rem;
}

.statement-invoice h5 {
  margin: 0 0 0.5rem 0;
  color: #2c5282;
}

.statement-line-table {
  font-size: 0.85rem;
}

.statement-grand-total {
  text-align: right;
  font-size: 1.3rem;
  padding: 1rem;
  background: #f0fff4;
  border-radius: 8px;
  border: 2px solid #38a169;
  margin-top: 1rem;
}

.grand-total-amount {
  font-size: 1.5rem;
  font-weight: 700;
}

/* ── Print styles ───────────────────────── */
@media print {
  body * {
    visibility: hidden;
  }
  .statement-modal,
  .statement-modal * {
    visibility: visible;
  }
  .statement-modal {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    max-width: 100%;
    max-height: none;
    box-shadow: none;
    border: none;
    border-radius: 0;
  }
  .no-print {
    display: none !important;
  }
  .modal-overlay {
    position: absolute;
    background: white;
  }
  .statement-body {
    max-height: none;
    overflow: visible;
  }
  .progress-bar-fill {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .tier-progress-table .tier-current-row,
  .current-tier-badge,
  .tier-badge,
  .tier-active .tier-badge,
  .summary-card,
  .statement-grand-total,
  .commission-amount {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

.error-message, .success-message {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  animation: fadeIn 0.3s ease;
}

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

.error-message {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.success-message {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

/* ── Price List Toggle & Badge ──────────────────────────────────── */

/* Price list badge in product list */
.source-badge.price-list {
  background: #F0F7F3;
  color: #007749;
  border: 1px solid #007749;
}

/* Toggle container in product detail header */
.price-list-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.price-list-toggle .toggle-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  user-select: none;
}

.price-list-toggle.active .toggle-label {
  color: #007749;
  font-weight: 600;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  cursor: pointer;
}

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

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  border-radius: 22px;
  transition: background-color 0.25s ease;
}

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

.toggle-switch input:checked + .toggle-slider {
  background-color: #007749;
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

/* ── Price List Management Page ──────────────────────────────────── */

.price-list-page {
  padding: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.price-list-page h2 {
  margin: 0 0 1.5rem 0;
  color: var(--text-primary);
}

.price-list-actions {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.btn-price-list {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-price-list.generate {
  background: linear-gradient(135deg, #005C38, #007749);
  color: white;
}

.btn-price-list.generate:hover {
  background: linear-gradient(135deg, #007749, #005C38);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,119,73,0.3);
}

.btn-price-list.validate {
  background: linear-gradient(135deg, #D4AF37, #e0c060);
  color: #231F20;
}

.btn-price-list.validate:hover {
  background: linear-gradient(135deg, #e0c060, #D4AF37);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(212,175,55,0.3);
}

.btn-price-list:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Validation results */
.validation-results {
  margin-top: 1rem;
}

.validation-summary {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  margin-bottom: 1rem;
}

.validation-summary.valid {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.validation-summary.invalid {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.validation-issue {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.25rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.validation-issue.error {
  background: #fff5f5;
  border-left: 3px solid #e53e3e;
}

.validation-issue.warning {
  background: #fffbf0;
  border-left: 3px solid #dd6b20;
}

.validation-issue .issue-severity {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.validation-issue.error .issue-severity {
  background: #fed7d7;
  color: #c53030;
}

.validation-issue.warning .issue-severity {
  background: #feebc8;
  color: #c05621;
}

.validation-issue .issue-product {
  font-weight: 600;
  min-width: 120px;
}

.validation-issue .issue-message {
  flex: 1;
  color: #555;
}

/* Price list product table */
.price-list-products {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.price-list-products th {
  background: #007749;
  color: white;
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.price-list-products th.sortable-header {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background 0.15s;
}

.price-list-products th.sortable-header:hover {
  background: #005C38;
}

.price-list-products th.sortable-header.active {
  background: #005C38;
  color: #D4AF37;
}

.price-list-products td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #eee;
  font-size: 0.85rem;
}

.price-list-products tr:nth-child(even) td {
  background: #f5f7fa;
}

.price-list-products .remove-btn {
  background: none;
  border: none;
  color: #e53e3e;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.price-list-products .remove-btn:hover {
  background: #fff5f5;
}

.price-list-product-link {
  color: #007749;
  text-decoration: none;
  cursor: pointer;
}
.price-list-product-link:hover {
  text-decoration: underline;
  color: #005C38;
}

/* Price list warning rows */
.price-list-products tr.price-below-markup td {
  background: #fff0f0 !important;
  border-bottom-color: #f5c6c6;
}
.price-list-products tr.price-below-markup:hover td {
  background: #ffe0e0 !important;
}

/* Warning badges next to product names */
.pl-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
  white-space: nowrap;
  cursor: help;
}
.pl-badge-markup {
  background: #e53e3e;
  color: #fff;
}
.pl-badge-mismatch {
  background: #ed8936;
  color: #fff;
}

.price-list-count {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.price-list-empty {
  text-align: center;
  padding: 3rem 2rem;
  color: #999;
  font-style: italic;
  background: #f9f9f9;
  border-radius: 8px;
  border: 1px dashed #ddd;
}

/* Pagination */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

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

.page-size-select {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-size-select label {
  font-size: 0.85rem;
  color: #888;
  white-space: nowrap;
}

.form-select-sm {
  padding: 4px 8px;
  font-size: 0.85rem;
  border-radius: 6px;
  min-width: 70px;
}

.page-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 2px 8px;
  font-size: 0.85rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

@media (max-width: 768px) {
  .pagination-bar {
    flex-direction: column;
    align-items: flex-start;
  }
  .pagination-controls {
    width: 100%;
    justify-content: space-between;
  }
}

/* ── Header Toggles (price list + case size side by side) ────────────── */
.header-toggles {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Editable SKU Badge ──────────────────────────────────────────────── */
.sku-badge-editable {
  display: inline-block;
  background-color: #f0f0f0;
  color: #666;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.15s;
}
.sku-badge-editable:hover {
  background-color: #e0e0e0;
}

.sku-edit-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.sku-edit-input {
  font-family: monospace;
  font-size: 0.9rem;
  padding: 0.2rem 0.4rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  width: 140px;
}
.sku-edit-input:focus {
  outline: none;
  border-color: var(--primary-color, #4a90d9);
  box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.15);
}

/* ── Case Size Editor ────────────────────────────────────────────────── */
.case-size-editor {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: #555;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  transition: background-color 0.15s;
}
.case-size-editor:hover {
  background-color: #f5f5f5;
}
.case-size-label {
  font-weight: 500;
  white-space: nowrap;
}
.case-size-value {
  font-weight: 600;
  color: #333;
}
.case-size-input {
  width: 50px;
  font-size: 0.85rem;
  padding: 0.15rem 0.3rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  text-align: center;
}
.case-size-input:focus {
  outline: none;
  border-color: var(--primary-color, #4a90d9);
  box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.15);
}
.case-size-edit-icon {
  opacity: 0;
  transition: opacity 0.15s;
  color: #999;
}
.case-size-editor:hover .case-size-edit-icon {
  opacity: 1;
}

/* ── Name Edit (List-based Sync Tab) ─────────────────────────────────── */
.name-edit-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.name-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: #fafafa;
  border-radius: 6px;
  border: 1px solid #eee;
}
.name-row-unlinked {
  opacity: 0.6;
}
.name-row-editing {
  background: #f0f6ff;
  border-color: #c4d9f2;
}

.name-row-label {
  min-width: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #666;
  padding-top: 0.25rem;
  flex-shrink: 0;
}

.name-row-value {
  flex: 1;
  min-width: 0;
}
.name-row-text {
  word-wrap: break-word;
  overflow-wrap: break-word;
  font-size: 0.9rem;
  line-height: 1.4;
  color: #333;
}

.name-row-actions {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
  padding-top: 0.1rem;
}

.name-row-edit {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.name-edit-textarea {
  width: 100%;
  font-size: 0.9rem;
  line-height: 1.4;
  padding: 0.35rem 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  resize: vertical;
  font-family: inherit;
}
.name-edit-textarea:focus {
  outline: none;
  border-color: var(--primary-color, #4a90d9);
  box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.15);
}

.name-edit-actions {
  display: flex;
  gap: 0.3rem;
  justify-content: flex-end;
}

/* ── Field Edit Input (Price/Cost/Stock rows) ────────────────────────── */
.name-edit-input {
  width: 100%;
  max-width: 160px;
  font-size: 0.9rem;
  line-height: 1.4;
  padding: 0.35rem 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: inherit;
}
.name-edit-input:focus {
  outline: none;
  border-color: var(--primary-color, #4a90d9);
  box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.15);
}

/* ── Category Tab ────────────────────────────────────────────────────────── */

.category-content {
  padding: 1rem;
}

.category-content h3 {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.category-sections {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.category-section {
  background: #f8f9fa;
  border-radius: 10px;
  border: 1px solid #e0e0e0;
  padding: 1rem 1.25rem;
}

.category-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.category-source-label {
  font-weight: 600;
  font-size: 0.95rem;
  color: #333;
}

.category-not-linked {
  color: #999;
  font-style: italic;
  font-size: 0.9rem;
}

.category-not-supported {
  color: #888;
  font-style: italic;
  font-size: 0.9rem;
}

.category-type-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.category-type-label {
  font-size: 0.9rem;
  color: #666;
}

.category-type-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: #007749;
  background: #e0f2e8;
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
}

.category-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.category-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #e8f5e9;
  color: #2e7d32;
  padding: 0.25rem 0.65rem;
  border-radius: 16px;
  font-size: 0.85rem;
  font-weight: 500;
}

.category-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  background: rgba(0,0,0,0.1);
  color: #c62828;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1;
  padding: 0;
}
.category-remove:hover {
  background: #c62828;
  color: #fff;
}

.category-none {
  font-style: italic;
  color: #999;
  font-size: 0.9rem;
}

.category-saving {
  font-size: 0.85rem;
  color: #007749;
  font-style: italic;
}

.category-add-btn {
  padding: 0.3rem 0.75rem;
  border: 1px dashed #aaa;
  background: transparent;
  color: #555;
  border-radius: 16px;
  cursor: pointer;
  font-size: 0.82rem;
}
.category-add-btn:hover {
  background: #f0f0f0;
  border-color: #666;
  color: #333;
}

.category-picker {
  margin-top: 0.75rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  max-height: 280px;
  overflow-y: auto;
}

.category-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #eee;
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
}

.category-picker-close {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  color: #999;
  padding: 0 0.25rem;
}
.category-picker-close:hover {
  color: #333;
}

.category-picker-loading,
.category-picker-empty {
  display: block;
  padding: 0.75rem;
  font-size: 0.85rem;
  color: #999;
  text-align: center;
}

.category-picker-list {
  padding: 0.25rem 0;
}

.category-picker-option {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.88rem;
  color: #333;
  white-space: pre; /* preserve indent spaces for hierarchy */
  font-family: inherit;
}
.category-picker-option:hover {
  background: #e3f2fd;
}

/* Disabled remove button for last category */
.category-remove-disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Create new category section at bottom of picker */
.category-create-section {
  border-top: 1px solid #eee;
  padding: 0.5rem 0.75rem;
}

.category-create-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.category-parent-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.82rem;
}

.category-parent-label {
  color: #888;
  white-space: nowrap;
}

.category-parent-select {
  flex: 1;
  padding: 0.25rem 0.4rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.82rem;
  min-width: 0;
  background: #fff;
  white-space: pre; /* preserve indentation */
}

.category-parent-select:focus {
  outline: none;
  border-color: #007749;
  box-shadow: 0 0 0 2px rgba(0,119,73,0.15);
}

.category-create-input {
  flex: 1;
  padding: 0.3rem 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.85rem;
  min-width: 0;
}

.category-create-input:focus {
  outline: none;
  border-color: #007749;
  box-shadow: 0 0 0 2px rgba(0,119,73,0.15);
}

.category-create-btn {
  padding: 0.3rem 0.6rem;
  background: #007749;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
}

.category-create-btn:hover:not(:disabled) {
  background: #005c38;
}

.category-create-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Category Management Panel ── */
.category-action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.category-manage-btn {
  background: none;
  border: 1px dashed #999;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.82rem;
  color: #666;
  cursor: pointer;
  white-space: nowrap;
}
.category-manage-btn:hover {
  border-color: #007a4d;
  color: #007a4d;
}

.category-manage-panel {
  background: #fff;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  margin-top: 8px;
  overflow: hidden;
}

.category-manage-list {
  max-height: 240px;
  overflow-y: auto;
}

.category-manage-row {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  border-bottom: 1px solid #f0f0f0;
  gap: 6px;
}
.category-manage-row:last-child {
  border-bottom: none;
}

.category-manage-name {
  flex: 1;
  font-size: 0.88rem;
  white-space: pre;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-manage-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.category-action-rename,
.category-action-delete,
.category-action-save,
.category-action-cancel {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 5px;
  border-radius: 4px;
  line-height: 1;
}
.category-action-rename:hover { background: #e8f5e9; }
.category-action-delete:hover { background: #fde8e8; color: #c0392b; }
.category-action-save { color: #007a4d; }
.category-action-save:hover { background: #e8f5e9; }
.category-action-save:disabled { opacity: 0.4; cursor: not-allowed; }
.category-action-cancel { color: #888; }
.category-action-cancel:hover { background: #f5f5f5; }

.category-rename-input {
  flex: 1;
  padding: 3px 6px;
  border: 1px solid #007a4d;
  border-radius: 4px;
  font-size: 0.85rem;
  outline: none;
}
.category-rename-input:focus {
  box-shadow: 0 0 0 2px rgba(0,122,77,0.15);
}

.category-merge-section {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid #e5e8eb;
  flex-wrap: wrap;
}

.category-merge-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #444;
}

.category-merge-select {
  padding: 3px 6px;
  border: 1px solid #d0d7de;
  border-radius: 4px;
  font-size: 0.82rem;
  max-width: 140px;
  white-space: pre;
}
.category-merge-select:focus {
  border-color: #007a4d;
  outline: none;
  box-shadow: 0 0 0 2px rgba(0,122,77,0.15);
}

.category-merge-arrow {
  font-size: 0.9rem;
  color: #888;
}

.category-merge-btn {
  background: #007a4d;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 0.82rem;
  cursor: pointer;
}
.category-merge-btn:hover:not(:disabled) {
  background: #005c38;
}
.category-merge-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Variation SKU Modal ── */
.variation-sku-overlay {
  z-index: 2000;
}

.variation-sku-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  max-width: 500px;
  width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease-out;
}

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

.variation-sku-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #eee;
}

.variation-sku-modal-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.variation-sku-modal-body {
  padding: 1.25rem;
}

.variation-sku-section {
  margin-bottom: 0.75rem;
}

.variation-sku-section-highlight {
  background: #f0faf4;
  border: 1px solid #c3e6d1;
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.variation-sku-this-product {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  gap: 12px;
}

.variation-sku-section h4 {
  margin: 0 0 0.25rem 0;
  font-size: 0.92rem;
  color: #333;
}

.variation-sku-hint {
  margin: 0 0 0.5rem 0;
  font-size: 0.82rem;
  color: #888;
}

.variation-sku-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.variation-sku-input {
  flex: 1;
  padding: 0.45rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.88rem;
}

.variation-sku-input:focus {
  outline: none;
  border-color: #007749;
  box-shadow: 0 0 0 2px rgba(0,119,73,0.15);
}

.variation-sku-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 0;
  color: #aaa;
  font-size: 0.82rem;
}

.variation-sku-results {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #eee;
  border-radius: 6px;
  margin-top: 0.5rem;
}

.variation-sku-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #f0f0f0;
  gap: 8px;
}

.variation-sku-result:last-child {
  border-bottom: none;
}

.variation-sku-result:hover {
  background: #f8fdf9;
}

.variation-sku-result-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.variation-sku-result-name {
  font-size: 0.88rem;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.variation-sku-result-sku {
  font-size: 0.78rem;
  color: #888;
  font-family: monospace;
}

.variation-sku-no-results {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: #999;
  font-style: italic;
}

/* ── Variation SKU Confirmation ── */
.variation-sku-confirm-body {
  text-align: center;
  padding: 2rem 1.5rem !important;
}

.variation-sku-confirm-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.variation-sku-confirm-text {
  font-size: 1rem;
  color: #333;
  margin-bottom: 1.25rem;
  font-weight: 500;
}

.variation-sku-confirm-details {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  text-align: left;
}

.variation-sku-confirm-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0;
}

.variation-sku-confirm-label {
  font-size: 0.85rem;
  color: #888;
  min-width: 60px;
}

.variation-sku-confirm-value {
  font-size: 0.95rem;
  color: #333;
  font-weight: 500;
}

.variation-sku-confirm-sku {
  font-family: monospace;
  background: #e8f0fe;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  color: #1a73e8;
}

.variation-sku-confirm-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

/* ── Backup Section ───────────────────────────────────── */

.backup-status-card {
  background: var(--background-color);
  border-radius: var(--border-radius);
  padding: 16px;
  margin-bottom: 20px;
}

.backup-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.backup-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.backup-stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.backup-stat-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-color);
}

.backup-stat-value.status-ok {
  color: var(--success-color);
}

.backup-stat-value.status-off {
  color: var(--text-secondary);
}

.backup-stat-value.status-error {
  color: var(--danger-color);
}

.backup-error {
  margin-top: 12px;
  font-size: 0.85rem;
}

.backup-actions {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.backup-config {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  max-width: 600px;
}

.backup-config .form-group {
  margin-bottom: 12px;
}

.backup-config label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text-color);
}

.backup-config small {
  display: block;
  margin-top: 2px;
  font-size: 0.75rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: normal !important;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary-color);
}

.backup-list-section {
  margin-top: 4px;
}

.backup-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.backup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  gap: 8px;
}

.backup-row-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.backup-row-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #333;
}

.backup-row-meta {
  font-size: 0.78rem;
  color: #888;
}

.backup-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .backup-status-grid {
    grid-template-columns: 1fr 1fr;
  }
  .backup-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .backup-row-actions {
    align-self: flex-end;
  }
}

/* ── OneDrive Folder Picker ─────────────────────────────────────────────── */

.folder-picker-modal {
  max-height: 80vh;
  height: auto !important;
  display: flex;
  flex-direction: column;
}

.folder-picker-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  flex-shrink: 0;
}

.folder-picker-modal .modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.folder-picker-modal .modal-body {
  overflow-y: auto;
  flex: 1;
}

.folder-picker-breadcrumb {
  background: var(--bg-secondary, #f7fafc);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.folder-picker-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
}

.folder-picker-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  gap: 10px;
  transition: background 0.15s;
}

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

.folder-picker-item:hover {
  background: var(--bg-secondary, #f7fafc);
}

.folder-picker-item .folder-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.folder-picker-item .folder-name {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 500;
}

.folder-picker-item .folder-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ── Collapsible Section Toggle ── */
.btn-collapsible-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.4rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: #374151;
  border-radius: 4px;
  width: 100%;
  text-align: left;
}

.btn-collapsible-toggle:hover {
  background: rgba(0,0,0,0.04);
}

.toggle-chevron {
  font-size: 0.75rem;
  color: #9ca3af;
  width: 0.9em;
  text-align: center;
  flex-shrink: 0;
}

.toggle-text {
  flex: 1;
}

.ncr-section-collapsed {
  padding: 0.35rem 0.6rem;
}

.ncr-section-expanded .btn-collapsible-toggle {
  margin-bottom: 0.5rem;
}

.ncr-section-has-errors .btn-collapsible-toggle {
  color: #dc2626;
}

.ncr-section-has-errors .toggle-chevron {
  color: #dc2626;
}

/* ── Inline Edit for NCR Sync Settings ── */
.ncr-sync-inline-edit {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.ncr-sync-prefix {
  font-size: 0.78rem;
  color: #6b7280;
  font-weight: 500;
}

.ncr-sync-input {
  width: 5rem;
  padding: 0.15rem 0.35rem;
  font-size: 0.78rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: white;
  color: #111827;
  text-align: right;
}

.ncr-sync-input:focus {
  outline: none;
  border-color: var(--primary-color, #2563eb);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.ncr-sync-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Settings toggle row ── */
.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.toggle-row .toggle-label {
  font-weight: 500;
  font-size: 0.9rem;
}

.toggle-row .toggle-hint {
  display: block;
  font-size: 0.78rem;
  color: #6b7280;
  margin-top: 0.15rem;
}

.settings-subsection {
  border-top: 1px solid #e5e7eb;
  padding-top: 1rem;
}

/* ── Read-Only Badge (Navbar) ─────────── */
.ro-badge {
  display: inline-block;
  background: #f59e0b;
  color: #000;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
}

/* ── Role Badges ──────────────────────── */
.role-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
  text-transform: capitalize;
}

.role-badge.role-admin {
  background: #dbeafe;
  color: #1d4ed8;
}

.role-badge.role-readonly {
  background: #fef3c7;
  color: #92400e;
}

.role-display {
  margin: 8px 0 12px;
}

/* ── User Management ──────────────────── */
.user-list-section {
  margin-bottom: 24px;
}

.user-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.user-email {
  flex: 1;
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-role-select {
  font-size: 0.85rem;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.add-user-section {
  margin-top: 20px;
}

.add-user-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-top: 12px;
}

.add-user-form .form-group {
  min-width: 180px;
  flex: 1;
  margin-bottom: 0;
}

.role-explanation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 12px;
}

.role-card {
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
}

.role-card p {
  font-size: 0.85rem;
  margin-top: 8px;
  color: var(--text-secondary);
}

@media (max-width: 600px) {
  .role-explanation {
    grid-template-columns: 1fr;
  }
  .user-row {
    flex-wrap: wrap;
  }
  .add-user-form {
    flex-direction: column;
  }
}

