/* ===== CSS Variables & Reset ===== */
:root {
  --sidebar-width: 260px;
  --header-height: 60px;
  --primary: #2563EB;
  --primary-light: #3B82F6;
  --primary-dark: #1D4ED8;
  --primary-bg: #EFF6FF;
  --bg: #F0F2F5;
  --surface: #FFFFFF;
  --text: #1E293B;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
  --radius: 10px;
  --radius-sm: 6px;
  --transition: 0.2s ease;
  --vacuum-color: #4A90D9;
  --control-color: #E8772E;
  --detection-color: #27AE60;
  --auxiliary-color: #9B59B6;
  --danger: #EF4444;
  --success: #22C55E;
  --warning: #F59E0B;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  user-select: none;
  -webkit-user-select: none;
}

input, textarea, [contenteditable] {
  user-select: text;
  -webkit-user-select: text;
}

/* ===== Layout ===== */
.app-container {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: linear-gradient(135deg, #1E293B 0%, #334155 100%);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
  cursor: pointer;
}

.header-logo-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  object-fit: contain;
}

.header-title {
  color: #FFFFFF;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.header-subtitle {
  color: #94A3B8;
  font-size: 11px;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid #475569;
}

.header-search {
  margin-left: auto;
  position: relative;
}

.header-search input {
  width: 360px; height: 34px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 17px;
  padding: 0 36px 0 36px;
  color: white; font-size: 13px;
  outline: none; transition: var(--transition);
}

.header-search input::placeholder { color: #94A3B8; }
.header-search input:focus {
  background: rgba(255,255,255,0.15);
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}

.header-search .search-icon {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  color: #94A3B8; font-size: 13px;
  pointer-events: none;
}

.search-clear-btn {
  position: absolute; right: 6px; top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.15);
  border: none;
  color: #CBD5E1;
  font-size: 12px;
  width: 22px; height: 22px;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: background 0.2s;
}
.search-clear-btn:hover {
  background: rgba(255,255,255,0.25);
  color: #fff;
}
.search-clear-btn.visible {
  display: flex;
}

.header-nav-btn {
  display: none;
  margin-left: 12px;
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.2s;
}
.header-nav-btn:hover {
  background: rgba(255,255,255,0.1);
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding-top: var(--header-height);
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 10px; }

.sidebar-section { padding: 8px 0; }

.sidebar-section-title {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  font-size: 14px; font-weight: 600;
  color: var(--text);
  cursor: pointer; transition: var(--transition);
  user-select: none;
}

.sidebar-section-title:hover { background: #F8FAFC; }

.sidebar-section-title .color-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}

.sidebar-section-title .arrow {
  margin-left: auto; font-size: 10px;
  color: var(--text-muted); transition: transform var(--transition);
}

.sidebar-section-title.active .arrow { transform: rotate(90deg); }

.sidebar-sub {
  overflow: hidden; max-height: 0;
  transition: max-height 0.35s ease;
}

.sidebar-sub.expanded { max-height: 2000px; }

.sidebar-sub-item {
  padding: 8px 16px 8px 36px;
  font-size: 12.5px; color: var(--text-secondary);
  cursor: pointer; transition: var(--transition);
  border-left: 3px solid transparent;
  display: flex; align-items: center; justify-content: space-between;
}

.sidebar-sub-item:hover { background: #F8FAFC; color: var(--primary); }
.sidebar-sub-item.active {
  background: var(--primary-bg); color: var(--primary);
  border-left-color: var(--primary); font-weight: 500;
}

.sidebar-sub-item .item-count {
  font-size: 10px; color: var(--text-muted);
  background: #F1F5F9; padding: 1px 7px; border-radius: 10px;
}

/* ===== Main Content ===== */
.main-content {
  flex: 1; padding-top: var(--header-height);
  overflow-y: auto;
}

.content-area { padding: 20px 24px; max-width: 1200px; }

/* Breadcrumb */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted); margin-bottom: 16px;
}
.breadcrumb span { cursor: pointer; transition: color var(--transition); }
.breadcrumb span:hover { color: var(--primary); }
.breadcrumb .current { color: var(--text); font-weight: 500; cursor: default; }
.breadcrumb .sep { font-size: 10px; }

/* Category Header */
.category-header {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 20px; padding-bottom: 16px;
  border-bottom: 2px solid var(--border);
}

.category-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: white; flex-shrink: 0;
}

.category-info h2 { font-size: 20px; font-weight: 700; color: var(--text); }
.category-info p { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* Subcategory Title */
.subcategory-title {
  font-size: 15px; font-weight: 600; color: var(--text);
  margin-bottom: 12px; padding-left: 10px;
  border-left: 4px solid var(--primary);
  display: flex; align-items: center; gap: 8px;
}

.subcategory-title .count-badge {
  font-size: 11px; font-weight: 400; color: var(--text-muted);
  background: var(--bg); padding: 2px 8px; border-radius: 10px;
}

/* ===== Product Row List ===== */
.product-list { margin-bottom: 28px; }

.product-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
  transition: all var(--transition);
  touch-action: pan-y;
}

.product-row:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow);
}

.product-row.expanded {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), var(--shadow);
}

.product-row-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  gap: 14px;
  user-select: none;
}

/* Product Image Area */
.product-row-img {
  width: 64px; height: 64px;
  border-radius: 8px;
  background: linear-gradient(135deg, #F8FAFC 0%, #E2E8F0 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; flex-shrink: 0;
  border: 1px solid var(--border-light);
}

/* Product Info */
.product-row-info {
  flex: 1; min-width: 0;
}

.product-row-name {
  font-size: 15px; font-weight: 600; color: var(--text);
  margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.product-row-desc {
  font-size: 12px; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.product-row-meta {
  font-size: 11px; color: var(--text-muted); margin-top: 3px;
}

/* Product Row Actions */
.product-row-actions {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}

.btn-manual {
  padding: 7px 16px;
  background: var(--primary);
  color: white; border: none;
  border-radius: 20px; font-size: 12px;
  cursor: pointer; transition: var(--transition);
  font-weight: 500; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 4px;
  text-decoration: none;
  line-height: 1.4;
}

.btn-manual:hover { background: var(--primary-dark); transform: scale(1.03); }

.btn-manual.outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-manual.outline:hover {
  background: var(--primary-bg);
}

.row-expand-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--text-muted);
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.product-row.expanded .row-expand-icon {
  transform: rotate(180deg);
  background: var(--primary-bg);
  color: var(--primary);
}

/* ===== Expanded Price Table ===== */
.price-table-wrapper {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
  background: #FAFBFC;
  border-top: 0 solid var(--border);
}

.product-row.expanded .price-table-wrapper {
  max-height: 1200px;
  overflow: auto;
  border-top-width: 1px;
}

.price-table-inner {
  padding: 12px 16px 16px;
}

/* Table Toolbar */
.table-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; flex-wrap: wrap; gap: 8px;
  user-select: none; -webkit-user-select: none;
}

.table-toolbar-left {
  display: flex; align-items: center; gap: 8px;
}

.table-toolbar-right {
  display: flex; align-items: center; gap: 6px;
}

.toolbar-btn {
  padding: 5px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px; color: var(--text-secondary);
  cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; gap: 4px;
}

.toolbar-btn:hover { border-color: var(--primary-light); color: var(--primary); }
.toolbar-btn.active { background: var(--primary-bg); border-color: var(--primary); color: var(--primary); }

.sort-select {
  padding: 5px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px; color: var(--text-secondary);
  cursor: pointer; outline: none;
}

.subseries-search-input {
  padding: 5px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  outline: none;
  width: 140px;
  transition: border-color var(--transition);
}

.subseries-search-input:focus {
  border-color: var(--primary);
}

/* Price Table */
.price-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

/* SubSeries Filter Bar */
.subseries-filter-wrapper {
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 8px;
}

.subseries-filter-bar {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  padding: 6px 0 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  cursor: grab;
  user-select: none; -webkit-user-select: none;
}

.subseries-filter-bar:active {
  cursor: grabbing;
}

.subseries-filter-bar::-webkit-scrollbar { height: 4px; }
.subseries-filter-bar::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 10px; }

.subseries-btn {
  padding: 4px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}

.subseries-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.subseries-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.price-table th {
  background: #F1F5F9;
  padding: 6px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
}

.price-table td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  user-select: none;
  -webkit-user-select: none;
}

.price-table tr:hover td { background: #F8FAFC; }

.price-table .price-cell {
  font-weight: 600; color: var(--danger);
}

.price-table .remark-cell {
  color: var(--text-muted); font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0;
}

/* Search Highlight */
.product-row.search-highlight {
  border-color: var(--warning) !important;
  box-shadow: 0 0 0 2px var(--warning), 0 0 20px rgba(245, 158, 11, 0.3) !important;
  animation: highlightPulse 0.6s ease 3;
}

@keyframes highlightPulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--warning), 0 0 20px rgba(245, 158, 11, 0.3); }
  50% { box-shadow: 0 0 0 4px var(--warning), 0 0 30px rgba(245, 158, 11, 0.5); }
}

.price-table tr.price-row-highlight td {
  background: #FEF3C7 !important;
  font-weight: 500;
}

.price-table .action-cell {
  text-align: right;
}

.price-table .action-cell button {
  padding: 3px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  margin-left: 4px;
}

.price-table .action-cell button:hover { border-color: var(--primary); color: var(--primary); }
.price-table .action-cell button.delete-btn:hover { border-color: var(--danger); color: var(--danger); }

/* Pagination */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--border-light);
}

.pagination-info {
  font-size: 11px; color: var(--text-muted);
  user-select: none;
  -webkit-user-select: none;
}

.pagination-btns {
  display: flex; gap: 4px;
}

.pagination-btns button {
  width: 28px; height: 28px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
  user-select: none;
  -webkit-user-select: none;
}

.pagination-btns button:hover:not(:disabled) {
  border-color: var(--primary); color: var(--primary);
}

.pagination-btns button.active {
  background: var(--primary); color: white; border-color: var(--primary);
}

.pagination-btns button:disabled {
  opacity: 0.4; cursor: not-allowed;
}

/* ===== Welcome Screen ===== */
.welcome-screen {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 55vh; text-align: center;
}

/* Welcome Carousel */
.welcome-carousel {
  width: 280px;
  height: 160px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: #F8FAFC;
}

.carousel-track {
  display: flex;
  transition: transform 0.5s ease;
  height: 100%;
}

.carousel-slide {
  min-width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-slide img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.carousel-dots {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}

.carousel-dots .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(0,0,0,0.2);
  cursor: pointer;
  transition: background 0.3s;
}

.carousel-dots .dot.active {
  background: var(--primary);
  width: 20px;
  border-radius: 4px;
}

.welcome-screen h2 { font-size: 24px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.welcome-screen p { font-size: 14px; color: var(--text-secondary); max-width: 460px; }

.welcome-stats {
  display: flex; gap: 28px; margin-top: 28px;
}

.welcome-stat { text-align: center; }
.welcome-stat .num { font-size: 28px; font-weight: 700; color: var(--primary); }
.welcome-stat .label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.category-cards {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px; margin-top: 32px; width: 100%; max-width: 800px;
}

.category-quick-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 24px 16px; text-align: center;
  cursor: pointer; transition: all var(--transition);
  border: 1px solid var(--border);
  position: relative; overflow: hidden;
}

.category-quick-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}

.category-quick-card[data-cat="vacuum"]::before { background: var(--vacuum-color); }
.category-quick-card[data-cat="control"]::before { background: var(--control-color); }
.category-quick-card[data-cat="detection"]::before { background: var(--detection-color); }
.category-quick-card[data-cat="auxiliary"]::before { background: var(--auxiliary-color); }

.category-quick-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.category-quick-card .cat-icon { font-size: 32px; margin-bottom: 10px; }
.category-quick-card .cat-name { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.category-quick-card .cat-count { font-size: 11px; color: var(--text-muted); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: all 0.25s ease;
}

.modal-overlay.show { opacity: 1; visibility: visible; }

.modal {
  background: var(--surface); border-radius: 14px;
  width: 92%; max-width: 520px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
  transform: scale(0.92) translateY(16px);
  transition: transform 0.25s ease;
  overflow: hidden;
  display: flex; flex-direction: column;
  max-height: 85vh;
}

.modal-overlay.show .modal { transform: scale(1) translateY(0); }

.modal-header {
  padding: 20px 24px 14px;
  display: flex; align-items: flex-start; justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.modal-header-info h3 { font-size: 18px; font-weight: 700; color: var(--text); }
.modal-header-info p { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }

.modal-close {
  width: 30px; height: 30px; border: none;
  background: #E2E8F0; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: #475569; transition: var(--transition);
  flex-shrink: 0;
}

.modal-close:hover { background: #CBD5E1; color: var(--text); }

.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }

.modal-product-visual {
  width: 100%; height: 160px;
  background: linear-gradient(135deg, #F8FAFC 0%, #E2E8F0 100%);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 56px; margin-bottom: 20px;
}

.modal-specs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}

.modal-spec-item {
  padding: 12px; background: #F8FAFC;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}

.modal-spec-label {
  font-size: 10px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px;
}

.modal-spec-value { font-size: 14px; font-weight: 600; color: var(--text); }
.modal-spec-value.price-value { color: var(--danger); font-size: 20px; }

.modal-footer {
  padding: 14px 24px 20px;
  display: flex; gap: 10px;
}

.modal-footer-btn {
  flex: 1; padding: 10px; border: none;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: var(--transition);
}

.modal-footer-btn.primary { background: var(--primary); color: white; }
.modal-footer-btn.primary:hover { background: var(--primary-dark); }
.modal-footer-btn.secondary { background: #F1F5F9; color: var(--text-secondary); }
.modal-footer-btn.secondary:hover { background: #E2E8F0; }

/* ===== Edit Modal ===== */
.edit-modal {
  max-width: 600px;
}

.edit-modal .modal-body { padding: 20px 24px; }

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 5px;
}

.form-group input, .form-group textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text);
  outline: none; transition: var(--transition);
  font-family: inherit;
}

.form-group input:focus, .form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-group textarea { resize: vertical; min-height: 60px; }

/* ===== Batch Upload Modal ===== */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 14px;
}

.upload-area:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.upload-area .upload-icon { font-size: 36px; margin-bottom: 8px; }
.upload-area p { font-size: 13px; color: var(--text-secondary); }
.upload-area .upload-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.upload-preview {
  max-height: 200px; overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}

.upload-preview table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}

.upload-preview th {
  background: #F1F5F9; padding: 6px 10px;
  text-align: left; font-weight: 600; color: var(--text-secondary);
  position: sticky; top: 0;
}

.upload-preview td {
  padding: 5px 10px; border-bottom: 1px solid var(--border-light);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .category-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .header-subtitle { display: none; }
  .header { padding: 0 10px; }
  .header-logo { gap: 6px; }
  .header-title { font-size: 14px; }
  .header-search input { width: 200px; font-size: 12px; padding: 0 32px 0 32px; height: 32px; }
  .header-search .search-icon { font-size: 12px; left: 10px; }
  .header-nav-btn { display: block; }
  .content-area { padding: 10px; }
  .modal-specs { grid-template-columns: 1fr; }
  
  /* Allow horizontal scroll for price table on mobile */
  .product-row {
    overflow-x: visible;
  }

  /* Modal: smaller on mobile */
  .modal {
    width: 85%;
    max-width: 360px;
    max-height: 70vh;
  }
  .modal-body {
    padding: 14px;
  }
  .modal-product-visual {
    display: none;
  }
  .modal-spec-item {
    padding: 8px;
  }
  .modal-spec-value {
    font-size: 13px;
  }
  .modal-spec-value.price-value {
    font-size: 16px;
  }
  .product-row-img { width: 50px; height: 50px; font-size: 22px; }

  /* Welcome: compact on mobile */
  .welcome-screen { min-height: auto; padding-bottom: 16px; }
  .welcome-carousel { width: 200px; height: 120px; margin-bottom: 12px; }
  .welcome-screen h2 { font-size: 18px; margin-bottom: 4px; }
  .welcome-screen p { font-size: 12px; line-height: 1.5; }
  .welcome-stats { gap: 16px; margin-top: 16px; }
  .welcome-stat .num { font-size: 22px; }
  .welcome-stat .label { font-size: 11px; }

  /* Category cards: smaller on mobile */
  .category-cards { gap: 8px; margin-top: 16px; }
  .category-quick-card { padding: 14px 8px; }
  .category-quick-card .cat-icon { font-size: 24px; margin-bottom: 6px; }
  .category-quick-card .cat-name { font-size: 13px; }
  .category-quick-card .cat-count { font-size: 10px; }

  /* Header logo: use image */
  .header-logo-icon {
    width: 28px; height: 28px;
  }

  /* Product row header: stack vertically on mobile */
  .product-row-header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
    touch-action: pan-y;
  }
  .product-row-info {
    order: 2;
    flex-basis: calc(100% - 62px);
    min-width: 0;
  }
  .product-row-actions {
    order: 3;
    flex-basis: 100%;
    justify-content: flex-end;
    margin-top: 2px;
  }
  .btn-manual {
    padding: 6px 12px;
    font-size: 11px;
  }
  .product-row-meta {
    font-size: 12px;
  }
  .th-currency {
    display: none;
  }

  /* Price table: horizontal scroll on mobile */
  .product-row.expanded .price-table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
  }
  .price-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: auto;
  }
  .price-table {
    table-layout: auto;
    width: auto;
    font-size: 12px;
  }
  .price-table th, .price-table td {
    white-space: nowrap;
  }
  .price-table .remark-cell {
    overflow: visible;
    text-overflow: clip;
    max-width: none;
  }

  /* Toolbar: search + sort on mobile, hide label */
  .table-toolbar {
    flex-wrap: nowrap !important;
    gap: 4px;
  }
  .table-toolbar-left {
    display: none;
  }
  .table-toolbar-right {
    order: 1;
    gap: 4px;
    flex-shrink: 0;
  }
  .subseries-search-input {
    width: 90px;
    font-size: 10px;
    padding: 3px 6px;
  }
  .sort-select {
    font-size: 10px;
    padding: 3px 6px;
  }

  /* SubSeries filter: smaller buttons on mobile */
  .subseries-btn {
    flex-shrink: 0;
    padding: 4px 10px;
    font-size: 11px;
  }

  /* Pagination: stack vertically on mobile */
  .pagination {
    flex-direction: column;
    gap: 6px;
    align-items: center;
  }

  /* Table toolbar: stack on mobile */
  .table-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .header-title { font-size: 13px; }
  .header-search input { width: 150px; font-size: 11px; }
  .product-row-header { padding: 8px 10px; }
  .product-row-img { width: 44px; height: 44px; font-size: 20px; }
  .product-row-name { font-size: 13px; }
  .product-row-desc { font-size: 11px; }
  .btn-manual { padding: 5px 10px; font-size: 10px; }
  .price-table { font-size: 11px; }
  .price-table th, .price-table td { padding: 5px 6px; }
  .welcome-carousel { width: 180px; height: 105px; }
  .welcome-screen h2 { font-size: 16px; }
  .welcome-screen p { font-size: 11px; }
  .welcome-stat .num { font-size: 20px; }
  .category-quick-card { padding: 12px 6px; }
  .category-quick-card .cat-icon { font-size: 20px; }
  .category-quick-card .cat-name { font-size: 12px; }
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.product-row { animation: fadeIn 0.3s ease forwards; opacity: 0; }
.product-row:nth-child(1) { animation-delay: 0.02s; }
.product-row:nth-child(2) { animation-delay: 0.04s; }
.product-row:nth-child(3) { animation-delay: 0.06s; }
.product-row:nth-child(4) { animation-delay: 0.08s; }
.product-row:nth-child(5) { animation-delay: 0.1s; }
.product-row:nth-child(6) { animation-delay: 0.12s; }
.product-row:nth-child(7) { animation-delay: 0.14s; }
.product-row:nth-child(8) { animation-delay: 0.16s; }

/* Scrollbar */
.main-content::-webkit-scrollbar { width: 5px; }
.main-content::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 10px; }
.main-content::-webkit-scrollbar-track { background: transparent; }

/* ===== Mobile Nav Popup ===== */
.mobile-nav-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
}
.mobile-nav-overlay.open {
  display: block;
}
.mobile-nav-panel {
  position: fixed;
  top: var(--header-height);
  right: 0;
  bottom: 0;
  width: 50vw;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 201;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}
.mobile-nav-overlay.open .mobile-nav-panel {
  transform: translateX(0);
}
.mobile-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mobile-nav-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
}
.mobile-nav-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.mobile-nav-body::-webkit-scrollbar { width: 4px; }
.mobile-nav-body::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 10px; }

