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

:root {
  /* 背景色 - 深灰蓝 */
  --bg-primary: #1a1b2e;
  --bg-secondary: #16172b;
  --bg-gradient: linear-gradient(135deg, #1a1b2e 0%, #1e2040 50%, #1a1b2e 100%);

  /* 导航栏渐变 */
  --nav-gradient: linear-gradient(135deg, #1e3a8a 0%, #312e81 50%, #1e3a8a 100%);

  /* 卡片 */
  --card-bg: rgba(255, 255, 255, 0.04);
  --card-bg-hover: rgba(255, 255, 255, 0.07);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-border-hover: rgba(255, 255, 255, 0.15);

  /* 强调色 - 蓝色系 */
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-soft: rgba(59, 130, 246, 0.12);
  --accent-glow: rgba(59, 130, 246, 0.4);

  /* 金色/琥珀色 - 用于重点按钮 */
  --gold: #f59e0b;
  --gold-hover: #d97706;
  --gold-soft: rgba(245, 158, 11, 0.12);
  --gold-gradient: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);

  /* 文字 */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* 输入框 */
  --input-underline: rgba(255, 255, 255, 0.15);
  --input-focus: rgba(59, 130, 246, 0.6);
  --input-glow: 0 0 0 3px rgba(59, 130, 246, 0.15);

  /* 状态色 */
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.1);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.1);

  /* 毛利率色块 */
  --margin-high: #10b981;
  --margin-high-bg: rgba(16, 185, 129, 0.15);
  --margin-mid: #f59e0b;
  --margin-mid-bg: rgba(245, 158, 11, 0.15);
  --margin-low: #64748b;
  --margin-low-bg: rgba(100, 116, 139, 0.15);

  /* 圆角 */
  --radius-card: 20px;
  --radius-btn: 12px;
  --radius-tag: 20px;
  --radius-sm: 8px;

  /* 阴影 - 多层柔和 */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.15), 0 1px 4px rgba(0, 0, 0, 0.1);
  --shadow-card-hover: 0 8px 32px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.12);
  --shadow-btn: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-btn-hover: 0 4px 16px rgba(59, 130, 246, 0.3);
  --shadow-gold: 0 4px 16px rgba(245, 158, 11, 0.3);

  /* 过渡 */
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;

  /* 字体 */
  --font-sans: 'Noto Sans SC', system-ui, -apple-system, sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Consolas', 'Monaco', monospace;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  font-weight: 400;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

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

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

/* ===== Login Page ===== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-gradient);
  animation: fadeIn 0.3s ease;
}

.login-card {
  background: var(--card-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 48px 40px;
  width: 400px;
  max-width: 90vw;
  text-align: center;
  animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-card .brand-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: block;
  margin: 0 auto 20px;
  object-fit: contain;
}

.login-card h1 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.login-card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.login-input-group {
  margin-bottom: 16px;
}

.login-input-group input {
  width: 100%;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.login-input-group input:focus {
  border-color: var(--input-focus);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: var(--input-glow);
}

.login-input-group input::placeholder {
  color: var(--text-muted);
}

.login-error {
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 18px;
}

.login-btn {
  width: 100%;
  padding: 14px;
  background: var(--gold-gradient);
  color: #1a1b2e;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-gold);
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.login-btn:active {
  transform: translateY(0) scale(0.98);
}

/* ===== Main App ===== */
.app-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 20px 80px;
  animation: fadeIn 0.5s ease;
}

/* ===== Header - 渐变导航栏 ===== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: var(--nav-gradient);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.header-tagline {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  font-weight: 400;
}

.app-header .brand-icon-sm {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
  object-fit: contain;
}

.product-select {
  padding: 10px 40px 10px 16px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-btn);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23f1f5f9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  min-width: 200px;
}

.product-select:focus {
  border-color: rgba(255, 255, 255, 0.3);
  background-color: rgba(255, 255, 255, 0.15);
}

.product-select option {
  background: #1a1b2e;
  color: var(--text-primary);
}

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

/* ===== Glass Card ===== */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 28px;
  margin-bottom: 20px;
  animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transition: var(--transition);
}

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

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.01em;
}

.card-title .icon {
  font-size: 18px;
  opacity: 0.7;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-btn);
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  box-shadow: var(--shadow-btn);
}

.btn:hover {
  background: var(--card-bg-hover);
  border-color: var(--card-border-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card-hover);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

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

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

/* 金色按钮 - 用于重点操作 */
.btn-gold {
  background: var(--gold-gradient);
  border-color: var(--gold);
  color: #1a1b2e;
  font-weight: 600;
}

.btn-gold:hover {
  box-shadow: var(--shadow-gold);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
  box-shadow: none;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--text-primary);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

.btn-icon {
  font-size: 14px;
}

.btn-icon-svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ===== SKU Tabs ===== */
.sku-tabs-wrapper {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
  margin-bottom: 24px;
  padding: 0 2px 4px;
  align-items: center;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.sku-tabs-wrapper::-webkit-scrollbar {
  display: none !important;
}

.sku-tab {
  padding: 8px 18px;
  border-radius: var(--radius-tag);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.sku-tab:hover {
  background: var(--card-bg-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.sku-tab.active {
  background: var(--accent-soft);
  border-color: rgba(59, 130, 246, 0.4);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.sku-tab-name {
  display: inline-block;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.sku-tab-del {
  display: none !important;
  width: 18px;
  height: 18px;
  line-height: 16px;
  text-align: center;
  border-radius: 50%;
  font-size: 14px;
  color: var(--text-muted);
  transition: var(--transition);
  cursor: pointer;
  flex-shrink: 0;
}

.sku-tab:hover .sku-tab-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sku-tab-del:hover {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

/* 已录入成本标记 */
.sku-tab-filled {
  border-left: 3px solid var(--success);
  background: rgba(16, 185, 129, 0.08);
}
.sku-tab-filled .sku-tab-name {
  color: var(--success);
  font-weight: 600;
}
.sku-tab-filled:hover {
  background: rgba(16, 185, 129, 0.15);
}
.sku-tab-filled.active {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.5);
  border-left: 3px solid var(--success);
}
.sku-tab-filled.active .sku-tab-name {
  color: var(--success);
}

.sku-tab-add {
  border-style: dashed;
  color: var(--text-muted);
  font-size: 12px;
  padding: 7px 16px;
}

.sku-tab-add:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.sku-tab-add .add-icon {
  font-weight: 600;
  font-size: 13px;
}

/* ===== Cost Sections ===== */
.cost-section {
  margin-bottom: 32px;
}

.cost-section:last-of-type {
  margin-bottom: 0;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.section-header.collapsible {
  cursor: pointer;
  user-select: none;
  padding: 6px 0;
}

.section-header.collapsible:hover {
  opacity: 0.85;
}

.section-icon {
  font-size: 16px;
  opacity: 0.6;
}

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

.section-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 6px;
  font-weight: 400;
}

.collapse-arrow {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-left: auto;
}

.collapse-arrow.open {
  transform: rotate(180deg);
}

/* ===== Underline Input ===== */
.ul-input {
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--input-underline);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-mono);
  font-weight: 500;
  outline: none;
  padding: 8px 2px;
  width: 100%;
  transition: var(--transition);
  -moz-appearance: textfield;
}

.ul-input::-webkit-outer-spin-button,
.ul-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.ul-input:focus {
  border-bottom-color: var(--input-focus);
  box-shadow: var(--input-glow);
}

.ul-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.input-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.input-unit {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  font-weight: 500;
}

/* ===== Component List ===== */
.component-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.component-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  animation: slideDown 0.25s ease both;
  transition: all 0.2s ease;
}

.component-row:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

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

.component-name-input {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 14px;
  color: var(--text-primary);
  width: 100%;
  max-width: 200px;
  padding: 6px 0;
}

.component-name-input::placeholder {
  color: rgba(148, 163, 184, 0.35);
  font-weight: 400;
}
.component-name-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  outline: none;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  padding: 6px 0;
  width: 100%;
  max-width: 200px;
  transition: border-color 0.2s ease;
}
.component-name-input:focus {
  border-bottom-color: var(--accent);
  color: var(--text-primary);
}
  border-bottom: 1px solid rgba(255,255,255,0.15);
  outline: none;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  padding: 6px 0;
  width: 100%;
  max-width: 200px;
  transition: border-color 0.2s ease;
}
.component-name-input:focus {
  border-bottom-color: var(--accent);
  color: var(--text-primary);
}
  border-bottom: 1px solid rgba(255,255,255,0.15);
  outline: none;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  padding: 6px 0;
  width: 100%;
  max-width: 200px;
  transition: border-color 0.2s ease;
}
.component-name-input:focus {
  border-bottom-color: var(--accent);
  color: var(--text-primary);
}
  border-bottom: 1px solid rgba(255,255,255,0.15);
  outline: none;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  padding: 6px 0;
  width: 100%;
  max-width: 200px;
  transition: border-color 0.2s ease;
}
.component-name-input:focus {
  border-bottom-color: var(--accent);
  color: var(--text-primary);
}
}

.component-price {
  width: 120px;
  flex-shrink: 0;
  position: relative;
}

.component-price .ul-input {
  text-align: right;
  font-size: 15px;
  font-weight: 600;
  padding-right: 18px;
}

.component-price::after {
  content: '元';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  pointer-events: none;
}

.component-delete {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(239, 68, 68, 0.08);
  border: none;
  color: rgba(239, 68, 68, 0.5);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-size: 16px;
  flex-shrink: 0;
  opacity: 0;
}

.component-row:hover .component-delete {
  opacity: 1;
}

.component-delete:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.15);
}

.add-component-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(59, 130, 246, 0.06);
  border: 1px dashed rgba(59, 130, 246, 0.25);
  border-radius: 10px;
  color: var(--accent);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 4px;
}

.add-component-btn:hover {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.add-icon {
  font-size: 14px;
  font-weight: 600;
}

.component-total {
  font-size: 14px;
  color: var(--text-secondary);
  padding: 16px 16px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.component-total strong {
  color: var(--accent);
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 18px;
  letter-spacing: -0.5px;
}

/* ===== Logistics Grid ===== */
.logistics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px 28px;
}

.logistics-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.logistics-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ===== Fixed Costs ===== */
.fixed-body {
  border-top: 1px solid var(--card-border);
  padding-top: 20px;
  margin-top: 8px;
  animation: slideDown 0.3s ease;
}

.fixed-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px 28px;
}

.fixed-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fixed-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ===== Total Cost Bar ===== */
.total-cost-bar {
  margin-top: 28px;
  padding: 20px 24px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(59, 130, 246, 0.06) 100%);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.1);
}

.total-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
}

.total-amount {
  font-size: 26px;
  font-weight: 700;
  background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

/* ===== Result Table ===== */
.result-table-wrapper {
  overflow-x: auto;
  margin: 0 -6px;
  padding: 0 6px;
}

.result-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  min-width: 680px;
}

.result-table thead th {
  padding: 14px 12px;
  text-align: center;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--card-border);
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.02);
}

.result-table thead th:first-child {
  text-align: left;
  border-radius: 12px 0 0 0;
}

.result-table thead th:last-child {
  border-radius: 0 12px 0 0;
}

.th-sub {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  display: block;
  margin-top: 3px;
}

.result-table tbody td {
  padding: 12px 12px;
  text-align: right;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 13px;
  transition: var(--transition-fast);
}

.result-table tbody td:first-child {
  text-align: left;
  font-family: var(--font-sans);
  font-weight: 600;
}

.result-table tbody tr {
  transition: var(--transition);
}

.result-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.result-table tbody tr.recommended {
  background: var(--gold-soft);
}

.result-table tbody tr.recommended td {
  color: var(--text-primary);
}

.result-table tbody tr.recommended td:first-child {
  position: relative;
}

.result-table tbody tr.recommended td:first-child::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--gold);
  border-radius: 0 2px 2px 0;
}

/* 毛利率色块标注 */
.tier-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-sans);
}

.tier-badge.high {
  background: var(--margin-high-bg);
  color: var(--margin-high);
}

.tier-badge.mid {
  background: var(--margin-mid-bg);
  color: var(--margin-mid);
}

.tier-badge.low {
  background: var(--margin-low-bg);
  color: var(--margin-low);
}

.recommended-badge {
  font-size: 10px;
  padding: 2px 8px;
  background: rgba(245, 158, 11, 0.25);
  color: var(--gold);
  border-radius: 4px;
  font-weight: 600;
  font-family: var(--font-sans);
}

/* 数字颜色 */
.price-cell { color: var(--accent); font-weight: 600; }
.price-cell strong { font-weight: 700; font-size: 15px; }
.profit-cell { color: var(--success); }
.net-profit-cell { color: var(--success); font-weight: 700; }
.fee-cell { color: var(--text-secondary); }
.roi-cell { color: var(--text-primary); font-weight: 600; }
.golden-cell { color: var(--gold); font-weight: 600; }
.roi-high { color: var(--danger) !important; }

.result-note {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* Header Title Group */
.header-title {
  font-size: 13px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
  margin-left: 8px;
  font-weight: 400;
}

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

.modal-overlay.active {
  display: flex !important;
}

.modal-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  box-shadow: var(--shadow-card-hover);
  width: 90%;
  max-width: 420px;
  animation: modalIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(24px);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 0;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: var(--transition-fast);
  border-radius: 6px;
}

.modal-close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.modal-body {
  padding: 24px 28px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 0 28px 24px;
}

.form-group {
  margin-bottom: 0;
}

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

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.form-input:focus {
  border-color: var(--input-focus);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: var(--input-glow);
}

.form-input::placeholder {
  color: var(--text-muted);
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 24px 0;
  font-size: 14px;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 28px;
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  z-index: 2000;
  animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card);
}

.toast.info {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--accent);
}

.toast.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--success);
}

.toast.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

/* ===== Loading Spinner ===== */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

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

  .header-title {
    font-size: 12px;
  }

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



  .glass-card {
    padding: 20px 16px;
  }

  .app-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px 16px;
  }

  .header-left {
    flex-direction: row;
    align-items: center;
  }

  .product-select {
    min-width: auto;
    width: 100%;
  }

  .header-right {
    justify-content: flex-end;
  }

  .logistics-grid,
  .fixed-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .component-row {
    gap: 12px;
  }

  .component-price {
    width: 90px;
  }

  .total-cost-bar {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .result-table {
    min-width: 600px;
  }

  .sku-tabs-wrapper {
    gap: 8px;
  }

  .sku-tab {
    padding: 7px 14px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .login-card {
    padding: 36px 24px;
  }

  .glass-card {
    padding: 16px 14px;
    border-radius: 16px;
  }

  .card-title {
    font-size: 15px;
  }

  .btn {
    padding: 9px 14px;
    font-size: 13px;
  }

  .total-amount {
    font-size: 22px;
  }
}

/* ===== FAB 悬浮按钮 ===== */
.fab-btn {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
  transition: all 0.25s ease;
  z-index: 100;
}
.fab-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(59, 130, 246, 0.55);
}
.fab-btn:active {
  transform: scale(0.95);
}

/* ===== SKU输入行 ===== */
.sku-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.sku-input-row .ul-input {
  flex: 1;
  margin-bottom: 0;
}
.sku-remove-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.sku-remove-btn:hover {
  background: rgba(239, 68, 68, 0.3);
}
.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

/* ===== 计算公式板块 ===== */
.formula-section {
  margin-top: 24px;
}

.formula-block {
  margin-bottom: 24px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 1px solid var(--card-border);
}

.formula-block:last-child {
  margin-bottom: 0;
}

.formula-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.formula-title::before {
  content: '';
  width: 4px;
  height: 16px;
  background: var(--accent);
  border-radius: 2px;
}

.formula-content {
  padding-left: 12px;
}

.formula-main {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
  background: rgba(59, 130, 246, 0.08);
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 12px;
  border-left: 3px solid var(--accent);
  line-height: 1.6;
}

.formula-explain {
  list-style: none;
  padding: 0;
  margin: 0;
}

.formula-explain li {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 6px 0 6px 20px;
  position: relative;
  line-height: 1.6;
}

.formula-explain li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--text-muted);
  font-weight: bold;
}

.formula-explain li strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ===== FAB 悬浮按钮 ===== */
.fab-btn {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
  transition: all 0.25s ease;
  z-index: 100;
}
.fab-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(59, 130, 246, 0.55);
}
.fab-btn:active {
  transform: scale(0.95);
}

/* ===== FAB 悬浮按钮 ===== */
.fab-btn {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
  transition: all 0.25s ease;
  z-index: 100;
}
.fab-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(59, 130, 246, 0.55);
}
.fab-btn:active {
  transform: scale(0.95);
}

/* ===== FAB 悬浮按钮 ===== */
.fab-btn {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
  transition: all 0.25s ease;
  z-index: 100;
}
.fab-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(59, 130, 246, 0.55);
}
.fab-btn:active {
  transform: scale(0.95);
}
