/* Polaris Design Tokens + Custom App Styles */
:root {
  /* Polaris Colors */
  --p-color-bg: #f6f6f7;
  --p-color-bg-surface: #ffffff;
  --p-color-bg-surface-hover: #f6f6f7;
  --p-color-bg-surface-active: #f1f2f3;
  --p-color-bg-surface-secondary: #fafbfb;
  --p-color-bg-surface-tertiary: #f6f6f7;
  --p-color-bg-fill: #ffffff;
  --p-color-bg-fill-hover: #f6f6f7;
  --p-color-bg-fill-active: #f1f2f3;
  --p-color-bg-fill-secondary: #fafbfb;
  --p-color-bg-fill-tertiary: #f6f6f7;
  --p-color-bg-fill-critical: #fed3d1;
  --p-color-bg-fill-critical-hover: #fecdc9;
  --p-color-bg-fill-critical-active: #fcb3af;
  --p-color-bg-fill-critical-secondary: #fff4f4;
  --p-color-bg-fill-warning: #ffe6b0;
  --p-color-bg-fill-warning-hover: #ffdc9f;
  --p-color-bg-fill-warning-active: #ffce85;
  --p-color-bg-fill-warning-secondary: #fff5ea;
  --p-color-bg-fill-success: #aee9d1;
  --p-color-bg-fill-success-hover: #86e0bb;
  --p-color-bg-fill-success-active: #5dd6a7;
  --p-color-bg-fill-success-secondary: #e3f8ee;
  --p-color-bg-fill-info: #a4e8f2;
  --p-color-bg-fill-info-hover: #79dbeb;
  --p-color-bg-fill-info-active: #4fd0e5;
  --p-color-bg-fill-info-secondary: #eef9fc;
  --p-color-bg-fill-brand: #95bf47;
  --p-color-bg-fill-brand-hover: #86ac3f;
  --p-color-bg-fill-brand-active: #769937;

  --p-color-text: #202223;
  --p-color-text-secondary: #6d7175;
  --p-color-text-disabled: #8c9196;
  --p-color-text-link: #006fbb;
  --p-color-text-critical: #d72c0d;
  --p-color-text-warning: #ffc453;
  --p-color-text-success: #008060;
  --p-color-text-info: #006fbb;
  --p-color-text-brand: #95bf47;
  --p-color-text-inverse: #ffffff;

  --p-color-border: #e1e3e5;
  --p-color-border-hover: #c9cccf;
  --p-color-border-critical: #fd5749;
  --p-color-border-warning: #ffc453;
  --p-color-border-success: #008060;
  --p-color-border-info: #a4e8f2;

  --p-color-icon: #5c5f62;
  --p-color-icon-hover: #1a1c1d;
  --p-color-icon-active: #000000;
  --p-color-icon-critical: #d72c0d;
  --p-color-icon-warning: #ffc453;
  --p-color-icon-success: #008060;
  --p-color-icon-info: #006fbb;
  --p-color-icon-brand: #95bf47;

  /* Polaris Spacing */
  --p-space-0: 0;
  --p-space-025: 1px;
  --p-space-05: 2px;
  --p-space-1: 4px;
  --p-space-2: 8px;
  --p-space-3: 12px;
  --p-space-4: 16px;
  --p-space-5: 20px;
  --p-space-6: 24px;
  --p-space-8: 32px;
  --p-space-10: 40px;
  --p-space-12: 48px;
  --p-space-16: 64px;

  /* Polaris Typography */
  --p-font-size-75: 12px;
  --p-font-size-100: 14px;
  --p-font-size-200: 16px;
  --p-font-size-300: 20px;
  --p-font-size-400: 24px;
  --p-font-size-500: 28px;
  --p-font-size-600: 32px;

  --p-font-weight-regular: 400;
  --p-font-weight-medium: 500;
  --p-font-weight-semibold: 600;
  --p-font-weight-bold: 700;

  --p-line-height-1: 16px;
  --p-line-height-2: 20px;
  --p-line-height-3: 24px;
  --p-line-height-4: 28px;
  --p-line-height-5: 32px;
  --p-line-height-6: 40px;

  /* Polaris Borders */
  --p-border-radius-1: 4px;
  --p-border-radius-2: 8px;
  --p-border-radius-3: 12px;
  --p-border-radius-4: 16px;
  --p-border-radius-full: 50%;

  --p-border-width-1: 1px;
  --p-border-width-2: 2px;
  --p-border-width-3: 3px;
  --p-border-width-4: 4px;

  /* Polaris Shadows */
  --p-shadow-sm: 0 1px 0 rgba(0, 0, 0, 0.05);
  --p-shadow-md: 0 2px 4px rgba(0, 0, 0, 0.06), 0 0 1px rgba(0, 0, 0, 0.1);
  --p-shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
  --p-shadow-xl: 0 16px 32px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);

  /* Z-index */
  --p-z-1: 1;
  --p-z-2: 2;
  --p-z-3: 3;
  --p-z-4: 4;
  --p-z-5: 5;
  --p-z-6: 6;
  --p-z-7: 7;
  --p-z-8: 8;
  --p-z-9: 9;
  --p-z-10: 10;
  --p-z-max: 9999;
}

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

html {
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'San Francisco', 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--p-color-bg);
  color: var(--p-color-text);
  min-height: 100vh;
}

/* Polaris App Wrapper */
.app-wrapper {
  min-height: 100vh;
  background: var(--p-color-bg);
  display: flex;
  flex-direction: column;
}

/* Top Bar */
.topbar {
  background: var(--p-color-bg-surface);
  border-bottom: 1px solid var(--p-color-border);
  padding: 0 var(--p-space-5);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: var(--p-z-5);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: var(--p-space-2);
}

.topbar-brand h1 {
  font-size: var(--p-font-size-300);
  font-weight: var(--p-font-weight-semibold);
  color: var(--p-color-text);
  margin: 0;
}

.topbar-brand .topbar-logo {
  height: 28px;
  max-width: 120px;
  border-radius: var(--p-border-radius-2);
  object-fit: contain;
  vertical-align: middle;
}

.topbar-brand .logo-icon {
  width: 28px;
  height: 28px;
  background: var(--p-color-text-brand);
  border-radius: var(--p-border-radius-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
}

.topbar-store {
  font-size: var(--p-font-size-100);
  color: var(--p-color-text-secondary);
}

/* Navigation - Sticky */
.nav {
  background: var(--p-color-bg-surface);
  border-bottom: 1px solid var(--p-color-border);
  padding: 0 var(--p-space-5);
  display: flex;
  gap: 0;
  overflow-x: visible;
  position: sticky;
  top: 56px;
  z-index: var(--p-z-4);
}

.nav-btn {
  background: none;
  border: none;
  padding: var(--p-space-4) var(--p-space-5);
  cursor: pointer;
  font-size: var(--p-font-size-100);
  font-weight: var(--p-font-weight-medium);
  color: var(--p-color-text-secondary);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.nav-btn:hover {
  color: var(--p-color-text);
}

.nav-btn.active {
  color: var(--p-color-text);
  border-bottom-color: var(--p-color-bg-fill-brand);
}

/* Dropdown Navigation */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: #fff;
  border: 1px solid #e1e3e5;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 180px;
  z-index: 9999;
  padding: 4px 0;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 20px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  color: #303030;
  transition: background 0.15s ease;
  font-family: inherit;
  box-sizing: border-box;
}

.nav-dropdown-item:hover {
  background: #f6f6f7;
  color: #303030;
}

/* Main Content */
.main-content {
  flex: 1 0 auto;
  max-width: 1200px;
  width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
  padding: var(--p-space-6) var(--p-space-5);
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--p-space-6);
}

.page-title {
  font-size: var(--p-font-size-500);
  font-weight: var(--p-font-weight-bold);
  color: var(--p-color-text);
}

.page-subtitle {
  font-size: var(--p-font-size-100);
  color: var(--p-color-text-secondary);
  margin-top: var(--p-space-1);
}

/* Cards */
.card {
  background: var(--p-color-bg-surface);
  border: 1px solid var(--p-color-border);
  border-radius: var(--p-border-radius-2);
  box-shadow: var(--p-shadow-sm);
  margin-bottom: var(--p-space-5);
  overflow: hidden;
}

.card-header {
  padding: var(--p-space-4) var(--p-space-5);
  border-bottom: 1px solid var(--p-color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-size: var(--p-font-size-200);
  font-weight: var(--p-font-weight-semibold);
  color: var(--p-color-text);
}

.card-body {
  padding: var(--p-space-5);
}

/* Stat Card */
.stat-card {
  background: var(--p-color-bg-surface);
  border: 1px solid var(--p-color-border);
  border-radius: var(--p-border-radius-2);
  padding: var(--p-space-5);
  box-shadow: var(--p-shadow-sm);
}

.stat-label {
  font-size: var(--p-font-size-75);
  color: var(--p-color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--p-space-2);
}

.stat-value {
  font-size: var(--p-font-size-600);
  font-weight: var(--p-font-weight-bold);
  color: var(--p-color-text);
}

.stat-value.critical { color: var(--p-color-text-critical); }
.stat-value.success { color: var(--p-color-text-success); }
.stat-value.warning { color: var(--p-color-text-warning); }

/* Grid */
.grid {
  display: grid;
  gap: var(--p-space-5);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-auto { grid-template-columns: repeat(2, 1fr); }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--p-space-2);
  padding: var(--p-space-3) var(--p-space-4);
  border-radius: var(--p-border-radius-2);
  font-size: var(--p-font-size-100);
  font-weight: var(--p-font-weight-medium);
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--p-color-text);
  color: var(--p-color-text-inverse);
}

.btn-primary:hover { background: #000; }

.btn-secondary {
  background: var(--p-color-bg-surface);
  color: var(--p-color-text);
  border: 1px solid var(--p-color-border);
}

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

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

.btn-danger {
  background: var(--p-color-text-critical);
  color: white;
}

.btn-sm {
  padding: var(--p-space-2) var(--p-space-3);
  font-size: var(--p-font-size-75);
}

.btn-lg {
  padding: var(--p-space-4) var(--p-space-6);
  font-size: var(--p-font-size-200);
}

/* Badges */
.badge {
  display: inline-block;
  padding: var(--p-space-1) var(--p-space-2);
  border-radius: var(--p-border-radius-4);
  font-size: var(--p-font-size-75);
  font-weight: var(--p-font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-critical { background: var(--p-color-bg-fill-critical-secondary); color: var(--p-color-text-critical); }
.badge-low { background: var(--p-color-bg-fill-warning-secondary); color: #8c6700; }
.badge-healthy { background: var(--p-color-bg-fill-success-secondary); color: var(--p-color-text-success); }
.badge-stockout { background: var(--p-color-bg-fill-critical-secondary); color: var(--p-color-text-critical); }
.badge-pending { background: var(--p-color-bg-fill-tertiary); color: var(--p-color-text-secondary); }
.badge-secondary { background: var(--p-color-bg-fill-tertiary); color: var(--p-color-text-secondary); }
.badge-ordered { background: var(--p-color-bg-fill-success-secondary); color: var(--p-color-text-success); }

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  padding: var(--p-space-3) var(--p-space-4);
  font-size: var(--p-font-size-75);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--p-color-text-secondary);
  font-weight: var(--p-font-weight-semibold);
  border-bottom: 1px solid var(--p-color-border);
  background: var(--p-color-bg-surface-secondary);
}

.table td {
  padding: var(--p-space-3) var(--p-space-4);
  border-bottom: 1px solid var(--p-color-border);
  font-size: var(--p-font-size-100);
  vertical-align: middle;
}

.table tr:hover { background: var(--p-color-bg-surface-hover); }
.table tr:last-child td { border-bottom: none; }

/* Progress Bar */
.progress-bar {
  height: 6px;
  background: var(--p-color-bg-fill-tertiary);
  border-radius: var(--p-border-radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--p-border-radius-full);
  transition: width 0.3s ease;
}

.progress-fill.critical { background: var(--p-color-bg-fill-critical); }
.progress-fill.low { background: var(--p-color-bg-fill-warning); }
.progress-fill.healthy { background: var(--p-color-bg-fill-success); }

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: var(--p-space-3);
  align-items: center;
  margin-bottom: var(--p-space-5);
  flex-wrap: wrap;
}

.filter-bar select,
.filter-bar input {
  padding: var(--p-space-3) var(--p-space-4);
  border: 1px solid var(--p-color-border);
  border-radius: var(--p-border-radius-2);
  font-size: var(--p-font-size-100);
  background: var(--p-color-bg-surface);
  color: var(--p-color-text);
}

.filter-bar select:focus,
.filter-bar input:focus {
  outline: none;
  border-color: var(--p-color-text-brand);
  box-shadow: 0 0 0 2px rgba(149, 191, 71, 0.1);
}

.search-box {
  flex: 1;
  min-width: 200px;
}

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

/* Recommendation Card */
.recommendation {
  border: 1px solid var(--p-color-border);
  border-radius: var(--p-border-radius-2);
  padding: var(--p-space-4) var(--p-space-5);
  margin-bottom: var(--p-space-3);
  display: flex;
  align-items: center;
  gap: var(--p-space-4);
  background: var(--p-color-bg-surface);
  transition: box-shadow 0.15s ease;
}

.recommendation:hover {
  box-shadow: var(--p-shadow-md);
}

.rec-urgency {
  width: 44px;
  height: 44px;
  border-radius: var(--p-border-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--p-font-weight-bold);
  font-size: var(--p-font-size-200);
  flex-shrink: 0;
}

.rec-urgency.high { background: var(--p-color-bg-fill-critical-secondary); color: var(--p-color-text-critical); }
.rec-urgency.medium { background: var(--p-color-bg-fill-warning-secondary); color: #8c6700; }
.rec-urgency.low { background: var(--p-color-bg-fill-success-secondary); color: var(--p-color-text-success); }

.rec-details { flex: 1; min-width: 0; }
.rec-title { font-weight: var(--p-font-weight-semibold); color: var(--p-color-text); }
.rec-meta { font-size: var(--p-font-size-75); color: var(--p-color-text-secondary); }
.rec-reason { margin-top: var(--p-space-1); font-size: var(--p-font-size-100); color: var(--p-color-text-secondary); }

.rec-qty { text-align: right; }
.rec-qty .amount { font-size: var(--p-font-size-400); font-weight: var(--p-font-weight-bold); }
.rec-qty .label { font-size: var(--p-font-size-75); color: var(--p-color-text-secondary); text-transform: uppercase; }

.rec-actions { display: flex; gap: var(--p-space-2); }

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--p-z-max);
  padding: var(--p-space-4);
  box-sizing: border-box;
  animation: modalOverlayFadeIn 0.15s ease-out;
}

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

.modal {
  background: var(--p-color-bg-surface);
  border-radius: var(--p-border-radius-3);
  padding: var(--p-space-6);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
  animation: modalScaleIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

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

.modal-xs { max-width: 380px; }
.modal-sm { max-width: 460px; }
.modal-md { max-width: 580px; }
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 900px; }
.modal-fit { width: max-content; max-width: min(94vw, 720px); }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: var(--p-space-5);
  padding-bottom: var(--p-space-3);
  border-bottom: 1px solid var(--p-color-border-subdued);
  flex-shrink: 0;
}

.modal-header-content {
  flex: 1;
  min-width: 0;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
  color: var(--p-color-text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--p-color-text-secondary);
  margin-top: 4px;
  line-height: 1.4;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--p-color-text-subdued);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
  margin-top: -2px;
  margin-right: -4px;
}

.modal-close:hover {
  background: var(--p-color-bg-subdued);
  color: var(--p-color-text);
}

.modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.modal-row {
  margin-bottom: var(--p-space-4);
}

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

.modal-row label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--p-color-text);
  line-height: 1.4;
}

.modal input:not([type="checkbox"]):not([type="radio"]),
.modal select,
.modal textarea,
.modal-row input,
.modal-row select,
.modal-row textarea,
.transfer-product,
.transfer-qty,
.po-product,
.po-qty,
.po-cost,
.component-product,
.component-qty {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--p-color-border);
  border-radius: var(--p-border-radius-2);
  font-family: inherit;
  font-size: 13px;
  background: var(--p-color-bg-surface);
  color: var(--p-color-text);
  box-sizing: border-box;
  line-height: 1.4;
  height: 38px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.modal textarea,
.modal-row textarea {
  height: auto;
  min-height: 74px;
  resize: vertical;
  line-height: 1.45;
}

.modal select,
.modal-row select,
.transfer-product,
.po-product,
.component-product {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235c5f62' d='M6 7.4L0.6 2 2 0.6 6 4.6 10 0.6 11.4 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.modal input:focus,
.modal select:focus,
.modal textarea:focus,
.modal-row input:focus,
.modal-row select:focus,
.modal-row textarea:focus,
.transfer-product:focus,
.transfer-qty:focus,
.po-product:focus,
.po-qty:focus,
.component-product:focus,
.component-qty:focus {
  outline: none;
  border-color: #008060;
  box-shadow: 0 0 0 2px rgba(0, 128, 96, 0.15);
}

.modal input::placeholder,
.modal textarea::placeholder,
.modal-row input::placeholder,
.modal-row textarea::placeholder {
  color: var(--p-color-text-subdued);
  opacity: 0.8;
}

/* Transfer & Multi-Item Rows */
.transfer-items-container {
  border: 1px solid var(--p-color-border-subdued);
  border-radius: var(--p-border-radius-2);
  background: var(--p-color-bg-subdued);
  padding: 12px;
  margin-top: 6px;
}

.transfer-items-header {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  padding: 0 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--p-color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.transfer-item-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
  background: var(--p-color-bg-surface);
  padding: 10px 12px;
  border: 1px solid var(--p-color-border-subdued);
  border-radius: var(--p-border-radius-2);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.transfer-item-row:hover {
  border-color: var(--p-color-border);
}

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

.transfer-item-product-col {
  flex: 1;
  min-width: 0;
}

.transfer-item-qty-col {
  width: 100px;
  flex-shrink: 0;
}

.transfer-item-action-col {
  width: 38px;
  flex-shrink: 0;
}

.transfer-stock-hint {
  font-size: 12px;
  color: var(--p-color-text-secondary);
  margin-top: 5px;
  line-height: 1.35;
}

.btn-remove-item {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--p-color-border);
  background: var(--p-color-bg-surface);
  color: var(--p-color-text-critical);
  border-radius: var(--p-border-radius-2);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  transition: all 0.15s ease;
}

.btn-remove-item:hover {
  background: #fff4f4;
  border-color: var(--p-color-text-critical);
  color: var(--p-color-text-critical);
}

.modal-search-input {
  width: 100%;
  padding: 7px 10px;
  font-size: 12px;
  border: 1px solid var(--p-color-border);
  border-radius: var(--p-border-radius-2);
  background: var(--p-color-bg-subdued);
  color: var(--p-color-text);
  box-sizing: border-box;
  margin-bottom: 6px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.modal-search-input:focus {
  outline: none;
  background: var(--p-color-bg-surface);
  border-color: #008060;
  box-shadow: 0 0 0 2px rgba(0, 128, 96, 0.12);
}

.modal-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

@media (max-width: 520px) {
  .modal-grid-2,
  .modal-grid-3 {
    grid-template-columns: 1fr;
  }
}

.modal-helper,
.modal-row .helper-text {
  font-size: 12px;
  color: var(--p-color-text-secondary);
  margin-top: 4px;
  line-height: 1.4;
}

.modal-row label:has(input[type="checkbox"]),
.modal-row.checkbox-row label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 400;
  padding: 4px 0;
  margin-bottom: 0;
  cursor: pointer;
  user-select: none;
}

.modal-row label:has(input[type="checkbox"]) input[type="checkbox"],
.modal-row.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #008060;
  cursor: pointer;
}

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

.settings-table thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 2px solid var(--p-color-border);
  background: var(--p-color-bg-subdued);
}

.settings-table tbody td {
  padding: 0;
  vertical-align: top;
  border-bottom: 1px solid var(--p-color-border);
}

.setting-row {
  padding: 12px 16px;
}

.setting-row label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--p-color-text);
}

.setting-row input,
.setting-row select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--p-color-border);
  border-radius: 6px;
  font-size: 13px;
}

.setting-row input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
}

.modal-actions {
  display: flex;
  gap: var(--p-space-3);
  justify-content: flex-end;
  align-items: center;
  margin-top: var(--p-space-5);
  padding-top: var(--p-space-4);
  border-top: 1px solid var(--p-color-border-subdued);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.modal-actions .btn {
  min-width: 80px;
  text-align: center;
  justify-content: center;
}

/* Toast */
.toast {
  position: fixed;
  top: var(--p-space-5);
  right: var(--p-space-5);
  padding: var(--p-space-4) var(--p-space-5);
  border-radius: var(--p-border-radius-2);
  color: white;
  font-weight: var(--p-font-weight-medium);
  z-index: var(--p-z-max);
  box-shadow: var(--p-shadow-lg);
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.success { background: var(--p-color-text-success); }
.toast.error { background: var(--p-color-text-critical); }
.toast.info { background: var(--p-color-text-info); }

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--p-space-10) var(--p-space-5);
  color: var(--p-color-text-secondary);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--p-space-4);
}

.empty-state h3 {
  font-size: var(--p-font-size-200);
  font-weight: var(--p-font-weight-semibold);
  color: var(--p-color-text);
  margin-bottom: var(--p-space-2);
}

/* Detail Grid */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--p-space-4);
}

.detail-item {
  padding: var(--p-space-3) 0;
  border-bottom: 1px solid var(--p-color-border);
}

.detail-label {
  font-size: var(--p-font-size-75);
  color: var(--p-color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.detail-value {
  font-weight: var(--p-font-weight-semibold);
  color: var(--p-color-text);
  margin-top: var(--p-space-1);
}

/* Spacing Utilities */
.mt-1 { margin-top: var(--p-space-1); }
.mt-2 { margin-top: var(--p-space-2); }
.mt-3 { margin-top: var(--p-space-3); }
.mt-4 { margin-top: var(--p-space-4); }
.mt-5 { margin-top: var(--p-space-5); }

.mb-1 { margin-bottom: var(--p-space-1); }
.mb-2 { margin-bottom: var(--p-space-2); }
.mb-3 { margin-bottom: var(--p-space-3); }
.mb-4 { margin-bottom: var(--p-space-4); }
.mb-5 { margin-bottom: var(--p-space-5); }

.p-3 { padding: var(--p-space-3); }
.p-4 { padding: var(--p-space-4); }
.p-5 { padding: var(--p-space-5); }

/* Text Utilities */
.text-secondary { color: var(--p-color-text-secondary); }
.text-critical { color: var(--p-color-text-critical); }
.text-success { color: var(--p-color-text-success); }
.text-warning { color: var(--p-color-text-warning); }

.text-sm { font-size: var(--p-font-size-75); }
.text-md { font-size: var(--p-font-size-100); }
.text-lg { font-size: var(--p-font-size-200); }
.text-xl { font-size: var(--p-font-size-300); }

.font-medium { font-weight: var(--p-font-weight-medium); }
.font-semibold { font-weight: var(--p-font-weight-semibold); }
.font-bold { font-weight: var(--p-font-weight-bold); }

/* Flex Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--p-space-2); }
.gap-3 { gap: var(--p-space-3); }
.gap-4 { gap: var(--p-space-4); }

/* Hidden */
.hidden { display: none !important; }

/* Responsive */
@media (max-width: 640px) {
  .topbar { padding: 0 var(--p-space-4); }
  .nav { padding: 0 var(--p-space-4); }
  .main-content { padding: var(--p-space-5) var(--p-space-4); }
  .page-header { flex-direction: column; gap: var(--p-space-3); }
  .recommendation { flex-wrap: wrap; }
  .rec-qty { text-align: left; }
  .detail-grid { grid-template-columns: 1fr; }
}

/* Sync Progress */
.sync-progress {
  background: var(--p-color-bg-surface);
  border: 1px solid var(--p-color-border);
  border-radius: var(--p-border-radius-2);
  padding: var(--p-space-3) var(--p-space-4);
  margin-bottom: var(--p-space-4);
  position: relative;
  overflow: hidden;
}

.sync-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: var(--p-color-bg-fill-brand);
  opacity: 0.2;
  width: 100%;
  animation: syncPulse 1.5s ease-in-out infinite;
}

@keyframes syncPulse {
  0%, 100% { width: 0%; opacity: 0.1; }
  50% { width: 100%; opacity: 0.3; }
}

.sync-progress-text {
  position: relative;
  z-index: 1;
  font-size: var(--p-font-size-100);
  font-weight: var(--p-font-weight-medium);
  color: var(--p-color-text);
}

.sync-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.sync-error {
  background: var(--p-color-bg-fill-critical-secondary);
  border: 1px solid var(--p-color-border-critical);
  border-radius: var(--p-border-radius-2);
  padding: var(--p-space-3) var(--p-space-4);
  margin-bottom: var(--p-space-4);
  font-size: var(--p-font-size-100);
  color: var(--p-color-text-critical);
}

/* Sync History Table */
.sync-history-row td {
  vertical-align: middle;
}

/* Expand Icon */
.expand-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  text-align: center;
  line-height: 18px;
  border-radius: 4px;
  background: var(--p-color-bg-fill-secondary);
  font-size: 12px;
  font-weight: bold;
  color: var(--p-color-text-secondary);
  cursor: pointer;
  user-select: none;
}

.expand-icon:hover {
  background: var(--p-color-bg-fill-hover);
}

/* Charts */
.chart-container {
  position: relative;
  width: 100%;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 160px;
  padding: 20px 0 0;
}

.chart-bar {
  flex: 1;
  background: var(--p-color-bg-fill-brand);
  border-radius: 4px 4px 0 0;
  position: relative;
  min-height: 8px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.chart-bar:hover {
  opacity: 0.8;
}

.chart-bar.critical { background: var(--p-color-bg-fill-critical); }
.chart-bar.low { background: var(--p-color-bg-fill-warning); }
.chart-bar.healthy { background: var(--p-color-bg-fill-success); }

.chart-bar-label {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--p-color-text-secondary);
  white-space: nowrap;
}

.chart-bar-value {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 600;
  color: var(--p-color-text);
  white-space: nowrap;
}

/* Donut Chart */
.donut-chart {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  position: relative;
  margin: 0 auto;
}

.donut-hole {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: var(--p-color-bg-surface);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.donut-hole-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--p-color-text);
}

.donut-hole-label {
  font-size: 10px;
  color: var(--p-color-text-secondary);
}

.donut-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.donut-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* Sortable Table Headers */
.table th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 24px;
}

.table th.sortable:hover {
  color: var(--p-color-text);
  background: var(--p-color-bg-surface-active);
}

.table th.sortable::after {
  content: '↕';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  opacity: 0.4;
}

.table th.sortable.asc::after {
  content: '↑';
  opacity: 1;
  color: var(--p-color-text-brand);
}

.table th.sortable.desc::after {
  content: '↓';
  opacity: 1;
  color: var(--p-color-text-brand);
}

/* Column Reorder */
.table th.draggable {
  cursor: grab;
}

.table th.draggable:active {
  cursor: grabbing;
}

.table th.drag-over {
  background: var(--p-color-bg-fill-info-secondary);
  border-left: 2px solid var(--p-color-text-info);
}

/* Job Detail Modal */
.job-detail-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.job-detail-stat {
  text-align: center;
  padding: 12px;
  background: var(--p-color-bg-fill-secondary);
  border-radius: 8px;
}

.job-detail-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--p-color-text);
}

.job-detail-stat-label {
  font-size: 11px;
  color: var(--p-color-text-secondary);
  text-transform: uppercase;
  margin-top: 4px;
}

.job-items-table {
  margin-top: 16px;
}

.job-items-table th {
  font-size: 11px;
}

.job-items-table td {
  font-size: 12px;
}

/* ===== PRODUCT DETAIL PAGE ===== */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.breadcrumb a {
  color: var(--p-color-text-link);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb-separator {
  color: var(--p-color-text-secondary);
}

/* Product Header */
.product-header {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
  align-items: flex-start;
}

.product-thumbnail {
  width: 120px;
  height: 120px;
  border-radius: 12px;
  border: 1px solid var(--p-color-border);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--p-color-bg-surface);
}

.product-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumbnail-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  background: var(--p-color-bg-fill-secondary);
}

.product-header-info {
  flex: 1;
}

.product-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px;
}

.product-meta {
  font-size: 14px;
  color: var(--p-color-text-secondary);
  margin: 8px 0 16px;
}

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

/* Alert Banner */
.alert-banner {
  display: flex;
  gap: 16px;
  padding: 16px 20px;
  border-radius: 12px;
  margin-bottom: 24px;
  border: 1px solid;
}

.alert-banner-critical {
  background: var(--p-color-bg-fill-critical-secondary);
  border-color: var(--p-color-border-critical);
}

.alert-banner-warning {
  background: var(--p-color-bg-fill-warning-secondary);
  border-color: var(--p-color-border-warning);
}

.alert-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 4px;
}

.alert-body {
  font-size: 14px;
  color: var(--p-color-text-secondary);
}

/* Metric Grid */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.metric-item {
  text-align: center;
}

.metric-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--p-color-text);
}

.metric-value.text-critical {
  color: var(--p-color-text-critical);
}

.metric-label {
  font-size: 11px;
  color: var(--p-color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* Supplier Card */
.supplier-card {
  border-bottom: 1px solid var(--p-color-border);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.supplier-secondary {
  padding: 12px 0;
  border-bottom: 1px solid var(--p-color-border);
}

.supplier-secondary:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* AI Insight Card */
.card-insight {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-color: #bbf7d0;
}

.insight-header {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 8px;
}

.insight-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--p-color-text);
}

/* Trend Chart */
.trend-chart {
  padding: 20px 0 0;
}

.trend-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 160px;
}

.trend-bar {
  flex: 1;
  background: linear-gradient(180deg, var(--p-color-bg-fill-brand) 0%, rgba(149, 191, 71, 0.3) 100%);
  border-radius: 6px 6px 0 0;
  min-height: 4px;
  transition: all 0.2s ease;
}

.trend-label {
  text-align: center;
  font-size: 12px;
  color: var(--p-color-text-secondary);
  margin-top: 12px;
}

/* SKU Row Highlighted */
.sku-row-highlighted {
  background: var(--p-color-bg-surface-secondary) !important;
}

.sku-row-highlighted td {
  font-weight: 500;
}

/* ===== PRODUCT DETAIL PAGE ===== */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 14px;
}

.breadcrumb a {
  color: var(--p-color-text-link);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb-separator {
  color: var(--p-color-text-secondary);
}

/* Product Header */
.product-header {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
  align-items: flex-start;
  padding: 24px;
  background: var(--p-color-bg-surface);
  border-radius: 12px;
  border: 1px solid var(--p-color-border);
}

.product-thumbnail {
  width: 100px;
  height: 100px;
  border-radius: 8px;
  border: 1px solid var(--p-color-border);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--p-color-bg-surface-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumbnail-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-header-info {
  flex: 1;
  min-width: 0;
}

.product-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.product-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  color: var(--p-color-text);
}

.product-meta {
  font-size: 13px;
  color: var(--p-color-text-secondary);
  margin-bottom: 16px;
}

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

/* Alert Banner */
.alert-banner {
  display: flex;
  gap: 16px;
  padding: 16px 20px;
  border-radius: 8px;
  margin-bottom: 24px;
  border: 1px solid;
}

.alert-banner-critical {
  background: var(--p-color-bg-fill-critical-secondary);
  border-color: var(--p-color-border-critical);
}

.alert-banner-warning {
  background: var(--p-color-bg-fill-warning-secondary);
  border-color: var(--p-color-border-warning);
}

.alert-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.alert-body {
  font-size: 13px;
  color: var(--p-color-text-secondary);
}

/* Metric Row */
.metric-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--p-color-bg-surface);
  border: 1px solid var(--p-color-border);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.metric-icon {
  font-size: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  flex-shrink: 0;
}

.metric-icon.stock { background: #eef9fc; }
.metric-icon.velocity { background: #f0fdf4; }
.metric-icon.alert { background: #fff5ea; }
.metric-icon.revenue { background: #f0fdf4; }
.metric-icon.value { background: #eef9fc; }
.metric-icon.days { background: #fff5ea; }

.metric-content {
  min-width: 0;
}

.metric-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--p-color-text);
  line-height: 1.2;
}

.metric-value.critical { color: var(--p-color-text-critical); }
.metric-value.warning { color: var(--p-color-text-warning); }

.metric-label {
  font-size: 11px;
  color: var(--p-color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Detail Grid */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

.detail-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 120px;
}

/* Supplier Cards */
.supplier-primary {
  margin-bottom: 16px;
}

.supplier-name {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 2px;
}

.supplier-meta {
  font-size: 13px;
  color: var(--p-color-text-secondary);
  margin-bottom: 12px;
}

.supplier-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.supplier-detail {
  padding: 8px 12px;
  background: var(--p-color-bg-surface-secondary);
  border-radius: 6px;
}

.supplier-detail-label {
  display: block;
  font-size: 10px;
  color: var(--p-color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.supplier-detail-value {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-top: 2px;
}

.supplier-secondary-list {
  border-top: 1px solid var(--p-color-border);
  padding-top: 12px;
}

.supplier-secondary-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--p-color-text-secondary);
  letter-spacing: 0.3px;
  margin-bottom: 8px;
}

.supplier-secondary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--p-color-border);
  font-size: 13px;
}

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

.empty-suppliers {
  text-align: center;
  padding: 24px;
}

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

.empty-suppliers p {
  color: var(--p-color-text-secondary);
  margin-bottom: 12px;
}

/* Table Row Actions */
.row-actions {
  display: flex;
  gap: 4px;
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid var(--p-color-border-critical);
  color: var(--p-color-text-critical);
}

.btn-danger-outline:hover {
  background: var(--p-color-bg-fill-critical-secondary);
}

.sku-row-active {
  background: var(--p-color-bg-surface-secondary) !important;
}

.sku-row-active td {
  font-weight: 500;
}

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

.empty-state-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--p-color-text);
  margin-bottom: 4px;
}

.empty-cell {
  text-align: center;
  padding: 32px !important;
  color: var(--p-color-text-secondary);
}


/* Table Responsive */
.table-responsive {
  overflow-x: auto;
}

table code {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 12px;
  background: var(--p-color-bg-surface-secondary);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Responsive */
@media (max-width: 1024px) {
  .metric-row {
    grid-template-columns: repeat(3, 1fr);
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .detail-sidebar {
    position: static;
  }
}

@media (max-width: 768px) {
  .metric-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .product-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .product-thumbnail {
    width: 80px;
    height: 80px;
  }
  .product-title-row {
    justify-content: center;
  }
  .product-actions {
    justify-content: center;
  }
}

/* Plans Page */
.plans-page {
  max-width: 1200px;
  margin: 0 auto;
}

.plans-header {
  text-align: center;
  margin-bottom: 32px;
}

.plans-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px 0;
}

.plans-subtitle {
  color: #6d7175;
  font-size: 15px;
  margin: 0;
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 48px;
}

.plan-card {
  background: #fff;
  border: 1px solid #e1e3e5;
  border-radius: 12px;
  padding: 24px;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s;
}

.plan-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.plan-popular {
  border-color: #303030;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.plan-current {
  opacity: 0.7;
}

.plan-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: #303030;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 12px;
  white-space: nowrap;
}

.plan-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.plan-price {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 4px;
}

.plan-period {
  font-size: 14px;
  font-weight: 400;
  color: #6d7175;
}

.plan-description {
  color: #6d7175;
  font-size: 13px;
  margin-bottom: 16px;
  flex: 1;
}

.plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
  flex: 1;
}

.plan-features li {
  font-size: 13px;
  padding: 4px 0;
  color: #303030;
}

.plan-cta {
  width: 100%;
  text-align: center;
}

.plans-faq {
  max-width: 700px;
  margin: 0 auto;
}

.plans-faq h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 20px 0;
}

.faq-item {
  margin-bottom: 20px;
}

.faq-item h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px 0;
}

.faq-item p {
  font-size: 13px;
  color: #6d7175;
  margin: 0;
}

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

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

/* Global App Footer */
.app-footer {
  flex-shrink: 0;
  margin-top: auto;
  padding: 24px 16px 32px;
  text-align: center;
  font-size: 13px;
  color: var(--p-color-text-secondary, #6d7175);
}

.app-footer a {
  color: var(--p-color-primary, #008060);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.app-footer a:hover {
  text-decoration: underline;
  color: var(--p-color-primary-hover, #004c3f);
}

