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

:root {
  --sidebar-bg: #14532d;
  --sidebar-width: 200px;
  --content-bg: #f4f6fb;
  --card-bg: #ffffff;
  --primary: #16a34a;
  --primary-hover: #15803d;
  --primary-light: #f0fdf4;
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --text-primary: #152033;
  --text-secondary: #637089;
  --border-color: #E6EAF2;
  --font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "Roboto Mono", "SF Mono", "Fira Code", monospace;
  --radius: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
  --transition: 150ms ease;
}

html {
  font-size: 14px;
  line-height: 1.6;
}

body {
  font-family: var(--font-family);
  color: var(--text-primary);
  background: var(--content-bg);
  display: flex;
  min-height: 100vh;
}

.container {
  flex: 1;
  width: 100%;
  min-width: 0;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  color: #bbf7d0;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header h1 {
  font-size: 15px;
  font-weight: 600;
  color: #f8fafc;
  letter-spacing: 0.3px;
}

.sidebar-header .subtitle {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  margin-top: 4px;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-section {
  padding: 0 10px;
  margin-bottom: 6px;
}

.nav-section-title {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 8px 10px 4px;
  font-weight: 500;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 400;
  color: rgba(255,255,255,0.65);
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.nav-item.active {
  background: transparent;
  color: #ffffff;
  font-weight: 500;
  border-left-color: #4ade80;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-item .badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 10px;
  color: rgba(255,255,255,0.3);
}

/* ===== Main Content ===== */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  padding: 0;
  background: var(--content-bg);
}

.page-header {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: #14532d;
}

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

.page-body {
  padding: 0 24px 24px;
  animation: fadeIn 300ms ease;
}

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

/* ===== Cards ===== */
.card {
  background: var(--card-bg);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

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

.card-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.card-body {
  padding: 14px 16px;
}

/* ===== Stat Cards ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  padding: 14px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-card .stat-label svg {
  width: 14px;
  height: 14px;
}

.stat-card .stat-value {
  font-size: 26px;
  font-weight: 700;
  color: #14532d;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-card .stat-change {
  font-size: 12px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }
.stat-change.neutral { color: var(--text-secondary); }

.stat-note {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ===== Grid Layouts ===== */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

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

.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #14532d;
  background: #f0fdf4;
  border-bottom: 2px solid #16a34a;
}

.data-table td {
  padding: 10px 12px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

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

.data-table tr:hover td {
  background: #f0fdf4;
}

/* ===== Status Badges ===== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}

.status-badge.completed { background: var(--success-light); color: var(--success); }
.status-badge.pending { background: var(--warning-light); color: var(--warning); }
.status-badge.shipped { background: var(--primary-light); color: var(--primary); }
.status-badge.refunded { background: var(--danger-light); color: var(--danger); }
.status-badge.high { background: var(--danger-light); color: var(--danger); }
.status-badge.medium { background: var(--warning-light); color: var(--warning); }
.status-badge.low { background: #f0f9ff; color: #0ea5e9; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-family);
}

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

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

.btn-secondary {
  background: #f1f5f9;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
}

.btn svg {
  width: 14px;
  height: 14px;
}

/* ===== Period Selector ===== */
.period-selector {
  display: flex;
  gap: 6px;
  padding: 0;
  background: transparent;
  border-radius: 0;
}

.period-btn {
  padding: 5px 14px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 20px;
  transition: all 0.15s ease;
  font-family: var(--font-family);
}

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

.period-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: none;
}

/* ===== Chart Container ===== */
.chart-container {
  position: relative;
  width: 100%;
  height: 300px;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ===== Filter Bar ===== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-bar select,
.filter-bar input {
  padding: 7px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--font-family);
  color: var(--text-primary);
  background: var(--card-bg);
  outline: none;
  transition: border-color var(--transition);
}

.filter-bar select:focus,
.filter-bar input:focus {
  border-color: var(--primary);
}

.filter-bar input {
  min-width: 200px;
}

/* ===== Todo Specific ===== */
.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition);
}

.todo-item:hover {
  background: #f8fafc;
}

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

.todo-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.todo-checkbox.checked {
  background: var(--success);
  border-color: var(--success);
}

.todo-checkbox.checked::after {
  content: '';
  width: 5px;
  height: 8px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translateY(-1px);
}

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

.todo-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.todo-item.completed .todo-title {
  color: var(--text-secondary);
  text-decoration: line-through;
}

.todo-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.todo-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary);
}

.todo-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
}

.todo-item:hover .todo-actions {
  opacity: 1;
}

.todo-action-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.todo-action-btn:hover {
  background: #f1f5f9;
  color: var(--text-primary);
}

.todo-action-btn.delete:hover {
  background: var(--danger-light);
  color: var(--danger);
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 200ms ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--card-bg);
  border-radius: 12px;
  width: 480px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
  transform: translateY(10px);
  transition: transform 200ms ease;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.modal-close:hover {
  background: #f1f5f9;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ===== Form ===== */
.form-group {
  margin-bottom: 16px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--font-family);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

/* ===== Suggestion Cards ===== */
.suggestion-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  margin-bottom: 12px;
  transition: all var(--transition);
}

.suggestion-card:hover {
  box-shadow: var(--shadow-sm);
}

.suggestion-card.warning { border-left: 3px solid var(--warning); }
.suggestion-card.positive { border-left: 3px solid var(--success); }
.suggestion-card.action { border-left: 3px solid var(--primary); }
.suggestion-card.info { border-left: 3px solid #8b5cf6; }

.suggestion-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.suggestion-card.warning .suggestion-icon { background: var(--warning-light); color: var(--warning); }
.suggestion-card.positive .suggestion-icon { background: var(--success-light); color: var(--success); }
.suggestion-card.action .suggestion-icon { background: var(--primary-light); color: var(--primary); }
.suggestion-card.info .suggestion-icon { background: #f5f3ff; color: #8b5cf6; }

.suggestion-icon svg {
  width: 18px;
  height: 18px;
}

.suggestion-content h4 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}

.suggestion-content p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ===== Mobile Menu Toggle ===== */
.mobile-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  width: 40px;
  height: 40px;
  background: var(--sidebar-bg);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.mobile-toggle svg {
  width: 20px;
  height: 20px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .mobile-toggle {
    display: flex;
  }

  .page-header {
    padding: 16px 20px;
    padding-left: 64px;
  }

  .page-body {
    padding: 16px 20px;
  }

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

  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
}

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

/* ===== Loading Skeleton ===== */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

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

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 14px;
}

/* ===== Sync Status Bar ===== */
.sync-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  border-radius: 6px;
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  display: inline-block;
}

.sync-dot.syncing {
  background: var(--warning);
  animation: pulse 1s infinite;
}

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

/* ===== Content Section ===== */
.content-section {
  background: var(--card-bg);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ===== Sync Status Banner ===== */
.sync-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid;
}

.sync-banner svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.sync-banner strong {
  display: block;
  margin-bottom: 2px;
  font-size: 13px;
}

.sync-banner p {
  font-size: 12px;
  margin: 0;
  opacity: 0.85;
}

.sync-banner .btn {
  margin-left: auto;
  flex-shrink: 0;
  align-self: center;
}

.sync-banner.warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.sync-banner.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.sync-banner.success {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.sync-banner.info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}

/* ===== Two-col / Four-col stat grid ===== */
.stat-grid.two-col {
  grid-template-columns: repeat(2, 1fr);
}

.stat-grid.four-col {
  grid-template-columns: repeat(4, 1fr);
}

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

@media (max-width: 640px) {
  .stat-grid.two-col,
  .stat-grid.four-col {
    grid-template-columns: 1fr;
  }
}

/* ===== Stat value text (for store name etc.) ===== */
.stat-value-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Product cell with thumbnail ===== */
.product-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.product-thumb-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: var(--content-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.product-thumb-placeholder svg {
  width: 20px;
  height: 20px;
}

.product-info {
  min-width: 0;
}

.product-title {
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.product-category {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ===== Product name in top products table ===== */
.product-name {
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Period badge ===== */
.period-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--primary-light);
  color: var(--primary);
  margin-left: 6px;
  vertical-align: middle;
}

/* ===== Three-col stat grid ===== */
.stat-grid.three-col {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 768px) {
  .stat-grid.three-col {
    grid-template-columns: 1fr;
  }
}

/* ===== Period indicator ===== */
.period-indicator {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* ===== SVG Size Constraints ===== */
.nav-icon svg, .stat-icon svg, .btn-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.stat-icon svg {
  width: 20px;
  height: 20px;
}

.sidebar svg, .stat-card svg {
  max-width: 24px;
  max-height: 24px;
}

/* ===== Stat Icon Container ===== */
.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--primary-light);
  color: var(--primary);
}

/* ===== Period Selector Capsule (removed - see Period Selector above) ===== */

/* ===== Period Badge Refined ===== */
.period-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  margin-left: 8px;
  vertical-align: middle;
  letter-spacing: 0.3px;
}

/* ===== Period Indicator Refined ===== */
.period-indicator {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-weight: 400;
}

/* ===== Button Refinements ===== */
.btn-outline {
  border: 1px solid var(--primary);
  color: var(--primary);
  background: transparent;
  transition: all 0.15s ease;
}

.btn-outline:hover {
  background: var(--primary);
  color: #fff;
}

/* ===== Card Refinements ===== */
.stat-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ===== Section Spacing ===== */
section {
  margin-bottom: 24px;
}

/* ===== Table Refinements ===== */
.table-card {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.table-card table {
  width: 100%;
  table-layout: fixed;
}

.table-card th {
  background: #f0fdf4;
  font-weight: 700;
  font-size: 12px;
  color: #14532d;
  text-transform: none;
  letter-spacing: 0;
  padding: 10px 12px;
  border-bottom: 2px solid #16a34a;
}

.table-card td {
  padding: 10px 12px;
  vertical-align: middle;
  font-size: 13.5px;
}

.table-card tr {
  height: 44px;
  transition: background 0.15s ease;
}

.table-card tbody tr:hover {
  background: #f0fdf4;
}

/* ===== Top Products Table Columns ===== */
.table-card col.col-name { width: auto; }
.table-card col.col-qty { width: 100px; }
.table-card col.col-revenue { width: 120px; }
.table-card col.col-orders { width: 100px; }

/* ===== Product Name in Table ===== */
.product-name {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

/* ===== Visual Refresh v1.1 ===== */

/* 1. stat-card hover 微交互 */
.stat-card {
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* 2. content-section / card 统一圆角和阴影 */
.content-section,
.card {
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* 3. btn 统一圆角和hover亮度 */
.btn {
  border-radius: var(--radius);
  transition: filter 150ms ease, transform 150ms ease;
}
.btn:hover {
  filter: brightness(1.05);
}
.btn:active {
  transform: scale(0.98);
}

/* 4. page-header h2 统一样式 */
.page-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

/* 5. period-indicator 统一灰色小字 */
.period-indicator {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 400;
}

/* 6. 表格行hover背景色 */
.data-table tbody tr:hover {
  background: var(--primary-light);
}

/* 7. 输入框/select 统一圆角和focus边框 */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="search"],
select,
textarea {
  border-radius: var(--radius);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

/* 8. badge 样式统一 */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 4px;
  line-height: 1.4;
}

/* 9. 空状态统一居中 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}
.empty-state svg {
  width: 28px;
  height: 28px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  opacity: 0.6;
}
.empty-state p {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0;
}

/* 10. 模态框统一圆角和阴影 */
.modal {
  border-radius: calc(var(--radius) * 1.5);
  box-shadow: var(--shadow-lg);
}

/* 11. 导航disabled状态 */
.nav-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.nav-item.disabled:hover {
  background: transparent;
}
.nav-item .badge-soon {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

/* 12. Toast动画 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes fadeOut {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* 13. 设置页面状态项样式 */
.status-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}
.status-item:last-child {
  border-bottom: none;
}
.status-item .label {
  color: var(--text-secondary);
  font-size: 13px;
}
.status-item .value {
  font-weight: 500;
  font-size: 14px;
}
.status-item .value.ok {
  color: var(--success);
}
.status-item .value.warning {
  color: var(--warning);
}
.status-item .value.error {
  color: var(--danger);
}

/* ===== Sidebar Environment Badge ===== */
.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.env-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
  line-height: 1.4;
}
.env-prod {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}
.env-dev {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}
