/* ============ 有福面包屋管理后台 样式 v2 ============ */

:root {
  /* 温暖烘焙风 · 主色系（焦糖棕） */
  --primary: #B8763E;
  --primary-dark: #8B5626;
  --primary-light: #FBF3EB;
  --primary-bg: #FBF3EB;
  --primary-gradient: linear-gradient(135deg, #B8763E 0%, #8B5626 100%);
  /* 辅助点缀（麦穗金 / 奶油白） */
  --gold: #E8B547;
  --gold-light: #FCF0D8;
  --cream: #FFF8F0;
  /* 背景与表面 */
  --bg: #FBF6F0;
  --bg-alt: #F3ECE3;
  --card-bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-hover: #FBF3EB;
  --surface-2: #FBF6F0;
  /* 文字 */
  --text: #2D2018;
  --text-primary: #2D2018;
  --text-secondary: #6B5D50;
  --text-tertiary: #9E9182;
  /* 边框 */
  --border: #E8DDD0;
  --border-light: #F0E8DE;
  /* 语义色 */
  --success: #5B9A6E;
  --success-light: #E8F5EC;
  --danger: #C44A4A;
  --danger-light: #FCEAEA;
  --warning: #D97742;
  --warning-light: #FCEEE6;
  --info: #4A7CAA;
  --info-light: #E8F0F8;
  /* 圆角 */
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  /* 阴影（焦糖棕色调） */
  --shadow: 0 1px 3px rgba(139,86,38,0.06);
  --shadow-md: 0 4px 12px rgba(139,86,38,0.10);
  --shadow-lg: 0 8px 24px rgba(139,86,38,0.14);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-w: 230px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ============ 登录页 ============ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #B8763E 0%, #8B5626 60%, #6E4220 100%);
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -10%;
  width: 500px;
  height: 500px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
  filter: blur(40px);
}
.login-card {
  background: white;
  padding: 44px 36px;
  border-radius: 20px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.18);
  text-align: center;
  width: 360px;
  position: relative;
  z-index: 1;
}
.login-brand { font-size: 52px; margin-bottom: 8px; }
.login-card h1 { font-size: 22px; margin-bottom: 4px; letter-spacing: 1px; }
.login-sub { color: var(--text-secondary); margin-bottom: 30px; font-size: 14px; }
#login-form { display: flex; flex-direction: column; gap: 14px; }
#login-form input {
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  transition: var(--transition);
}
#login-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(184,118,62,0.12);
}
#login-form button {
  padding: 13px;
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(184,118,62,0.3);
}
#login-form button:hover { opacity: 0.92; transform: translateY(-1px); }
.login-hint { margin-top: 22px; font-size: 12px; color: var(--text-tertiary); }
.login-hint p { margin: 3px 0; }

/* ============ 主布局 ============ */
.app-shell { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar {
  width: var(--sidebar-w);
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border-light);
}
.brand-mark { font-size: 26px; }
.brand strong { display: block; font-size: 15px; letter-spacing: 0.5px; }
.brand span { font-size: 11px; color: var(--text-tertiary); }

.nav-list {
  flex: 1;
  padding: 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.nav-group-title {
  padding: 14px 14px 6px;
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: 1px;
  font-weight: 600;
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  padding: 10px 14px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  transition: var(--transition);
  position: relative;
}
.nav-item:hover {
  background: var(--primary-light);
  color: var(--text);
}
.nav-item.active {
  background: var(--primary);
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(184,118,62,0.25);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-light);
}
.user-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.role-badge {
  font-size: 11px;
  color: var(--primary-dark);
  background: var(--primary-light);
  padding: 2px 10px;
  border-radius: 10px;
  width: fit-content;
}
.logout-btn {
  width: 100%;
  padding: 9px;
  border: 1px solid var(--border);
  background: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: var(--transition);
}
.logout-btn:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-light);
}

/* 主区域 */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar h1 { font-size: 20px; font-weight: 700; }
.date-display { font-size: 13px; color: var(--text-secondary); }
.content {
  flex: 1;
  overflow-y: auto;
  padding: 22px 28px;
  max-width: 100%;
}

/* ============ 视图切换 ============ */
.view { display: none; animation: fadeIn 0.3s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ============ 工具栏 ============ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-input {
  padding: 9px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  min-width: 220px;
  transition: var(--transition);
  background: var(--card-bg);
}
.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(184,118,62,0.1);
}
.filter-select {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--card-bg);
  cursor: pointer;
  transition: var(--transition);
}
.filter-select:focus { border-color: var(--primary); }

/* 按钮 */
.btn-primary {
  padding: 9px 18px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  box-shadow: 0 2px 6px rgba(184,118,62,0.2);
}
.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(184,118,62,0.25);
}
.btn-secondary {
  padding: 9px 18px;
  background: white;
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition);
}
.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--primary-light);
}
.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}
.btn-sm:hover { opacity: 0.85; }

/* ============ 表格 ============ */
.table-wrap {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
  border: 1px solid var(--border-light);
}
table { width: 100%; border-collapse: collapse; }
thead { background: var(--primary-bg); }
th {
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-hover); }

/* ============ 指标卡片 ============ */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.metric-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.metric-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.metric-icon {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.metric-icon.bg-primary { background: var(--primary-light); }
.metric-icon.bg-gold { background: var(--gold-light); }
.metric-icon.bg-success { background: var(--success-light); }
.metric-icon.bg-warning { background: var(--warning-light); }
.metric-icon.bg-danger { background: var(--danger-light); }
.metric-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.metric-value { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; }
.metric-sub { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.metric-card.highlight .metric-value { color: var(--primary); }
.metric-card.highlight { background: linear-gradient(135deg, #FFF9F2 0%, #FFFFFF 100%); }
.metric-card.danger .metric-value { color: var(--danger); }
.metric-card.danger { background: linear-gradient(135deg, #FFF5F5 0%, #FFFFFF 100%); }
.metric-card.success .metric-value { color: var(--success); }
.metric-card.success { background: linear-gradient(135deg, #F5FCF5 0%, #FFFFFF 100%); }

/* ============ 面板 ============ */
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.panel {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
}
.panel.span-2 { grid-column: 1 / -1; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.panel-head h2 { font-size: 15px; font-weight: 600; }
.chart-container { height: 200px; position: relative; }
.cost-badge {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
}

/* ============ 快捷操作 ============ */
.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.quick-action-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  background: var(--cream);
  border: 1px solid transparent;
}
.quick-action-item:hover {
  background: var(--primary-light);
  border-color: var(--border);
  transform: translateX(4px);
}
.quick-action-item .qa-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.quick-action-item .qa-text { flex: 1; }
.quick-action-item .qa-text .qa-title { font-size: 13px; font-weight: 600; color: var(--text); }
.quick-action-item .qa-text .qa-desc { font-size: 11px; color: var(--text-tertiary); }
.quick-action-item .qa-arrow { color: var(--text-tertiary); font-size: 14px; }

/* ============ 提醒列表 ============ */
.alert-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.alert-item:last-child { border-bottom: none; }
.alert-badge {
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.alert-badge.urgent { background: var(--danger-light); color: var(--danger); }
.alert-badge.warning { background: var(--warning-light); color: var(--warning); }
.alert-badge.info { background: var(--info-light); color: var(--info); }

/* ============ 状态标签 ============ */
.status-tag {
  padding: 3px 10px;
  border-radius: 5px;
  font-size: 12px;
  display: inline-block;
  font-weight: 500;
}
.status-tag.待采购 { background: var(--danger-light); color: var(--danger); }
.status-tag.已下单 { background: var(--warning-light); color: var(--warning); }
.status-tag.已到货 { background: var(--success-light); color: var(--success); }
.status-tag.已取消 { background: #F0F0F0; color: #999; }
.status-tag.未知 { background: var(--info-light); color: var(--info); }
.status-tag.active { background: var(--success-light); color: var(--success); }
.status-tag.inactive { background: #F0F0F0; color: #999; }

/* ============ 类型标签 ============ */
.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}
.tag-regular { background: var(--primary-bg); color: var(--primary-dark); }
.tag-rotating { background: var(--gold-light); color: #A8821E; }
.tag-low-profit { background: var(--warning-light); color: var(--warning); }
.tag-gold { background: var(--gold-light); color: #A8821E; }
.tag-soft { background: var(--bg-alt); color: var(--text-secondary); }

/* ============ 配方布局 ============ */
.recipe-layout { display: flex; gap: 14px; }
.product-list-panel {
  width: 280px;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  border: 1px solid var(--border-light);
}
.product-list-item {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  margin-bottom: 2px;
  transition: var(--transition);
}
.product-list-item:hover { background: var(--primary-light); }
.product-list-item.active {
  background: var(--primary);
  color: white;
  font-weight: 500;
}
.recipe-detail-panel {
  flex: 1;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
}
.recipe-section { margin-bottom: 20px; }
.recipe-section h3 {
  font-size: 14px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--primary-light);
}
.recipe-section h3 .section-cost { float: right; color: var(--primary-dark); font-weight: 600; }

/* ============ Tabs ============ */
.tabs { display: flex; gap: 4px; }
.tab {
  padding: 7px 16px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: var(--transition);
}
.tab:hover { background: var(--primary-light); color: var(--text); }
.tab.active {
  background: var(--primary);
  color: white;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(184,118,62,0.2);
}

/* ============ 采购分区 ============ */
.purchase-section { margin-bottom: 24px; }
.purchase-section h3 { font-size: 15px; margin-bottom: 10px; }
.purchase-filter-bar {
  display: grid;
  grid-template-columns: minmax(280px, 1.2fr) minmax(220px, 1fr) 180px auto;
  gap: 10px;
  align-items: center;
  margin: 0 0 14px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.purchase-date-scopes {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.purchase-date-scopes::-webkit-scrollbar {
  display: none;
}
.purchase-date-scopes button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.purchase-date-scopes button.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
}
.purchase-filter-bar input {
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--bg);
  color: var(--text);
}
.purchase-filter-bar input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}
.purchase-date-row td {
  background: #faf7f2;
  color: var(--primary-dark);
  font-weight: 800;
  padding: 9px 12px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.purchase-date-row span {
  margin-left: 10px;
  color: var(--text-light);
  font-size: 12px;
  font-weight: 600;
}

/* ============ 弹窗 ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}
.modal-card {
  background: white;
  border-radius: var(--radius-lg);
  border-top: 4px solid var(--gold);
  width: 540px;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-light);
}
.modal-head h2 { font-size: 17px; font-weight: 700; }
.modal-close {
  border: none;
  background: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-tertiary);
  transition: var(--transition);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: #F0F0F0; color: var(--text); }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border-light);
}

/* ============ 表单 ============ */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}
.form-group small { display: block; font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.form-input, .form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: var(--transition);
  background: white;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(184,118,62,0.1);
}
.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: rgba(45,42,38,0.92);
  color: white;
  padding: 11px 26px;
  border-radius: 22px;
  font-size: 14px;
  z-index: 2000;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ 出品计划 ============ */
.week-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  cursor: pointer;
  border: 1px solid var(--border-light);
  transition: var(--transition);
}
.week-card:hover { box-shadow: var(--shadow-md); }
.week-card.active { border: 2px solid var(--primary); }
.week-card h3 { font-size: 15px; margin-bottom: 8px; }
.week-stats { display: flex; gap: 20px; font-size: 13px; color: var(--text-secondary); }
.day-plan { margin-bottom: 16px; }
.day-plan h4 {
  font-size: 14px;
  margin-bottom: 8px;
  padding: 7px 14px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
}
.day-plan-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}
.plan-item {
  background: #FAF8F5;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  transition: var(--transition);
}
.plan-item:hover { background: var(--primary-light); }
.plan-item .qty { font-weight: 600; color: var(--primary-dark); }

/* ============ 物料需求结果 ============ */
.material-req-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.material-req-item {
  background: #FAF8F5;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
}
.material-req-item:hover { background: var(--primary-light); }
.material-req-item .need-buy { color: var(--danger); font-weight: 600; }

/* ============ 角色控制 ============ */
.manager-only { display: none; }
body.is-manager .manager-only { display: inline-flex; align-items: center; }

/* ============ 图表柱状 ============ */
.bar-chart { display: flex; align-items: flex-end; gap: 3px; height: 180px; padding: 10px 0; }
.bar {
  flex: 1;
  min-width: 4px;
  background: var(--primary-gradient);
  border-radius: 3px 3px 0 0;
  opacity: 0.75;
  transition: var(--transition);
  position: relative;
}
.bar:hover { opacity: 1; }
.bar-label {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ============ 成本核算 ============ */
.cost-summary-bar {
  display: flex;
  gap: 0;
  margin-bottom: 14px;
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--border-light);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.cost-stat {
  flex: 1;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-right: 1px solid var(--border-light);
  transition: var(--transition);
}
.cost-stat:hover { background: #FAF8F5; }
.cost-stat:last-child { border-right: none; }
.cost-stat-label { font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; }
.cost-stat-val { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.5px; }
.danger-text { color: var(--danger); }
.success-text { color: var(--success); }
.inactive { opacity: 0.45; }
.strong { font-weight: 600; }

.cost-detail { max-width: 680px; }
.cost-detail-summary {
  background: #FAF8F5;
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 18px;
  border: 1px solid var(--border-light);
}
.cds-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 7px 0;
  font-size: 14px;
}
.cds-row span { color: var(--text-secondary); }
.cds-row strong { font-size: 16px; color: var(--text); }
.cds-row small { color: var(--text-secondary); font-size: 11px; }
.cds-divider { height: 1px; background: var(--border); margin: 8px 0; }
.cds-total { font-size: 16px; }
.cds-total strong { font-size: 22px; }
.cds-profit { margin-top: 6px; }

.cost-detail-section { margin-bottom: 18px; }
.cost-detail-section h3 {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--primary-light);
}
.cost-detail-table { width: 100%; font-size: 13px; }
.cost-detail-table th {
  text-align: left;
  padding: 6px 8px;
  color: var(--text-secondary);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}
.cost-detail-table td { padding: 6px 8px; border-bottom: 1px solid var(--border-light); }
.cost-detail-total td { font-weight: 700; border-top: 2px solid var(--primary-light); }
.cost-warning {
  background: #FFF3CD;
  color: #856404;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-top: 12px;
}
.empty-hint { text-align: center; color: var(--text-secondary); padding: 28px; }

/* ============ 加载状态 ============ */
.loading-skeleton {
  background: linear-gradient(90deg, #F0EBE3 25%, #FAF8F5 50%, #F0EBE3 75%);
  background-size: 200% 100%;
  animation: skeleton 1.5s infinite;
  border-radius: 4px;
}
@keyframes skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 产品配方合并视图 ============ */
.product-master-table .expand-cell {
  text-align: center; cursor: pointer; color: var(--text-secondary); font-size: 11px;
  transition: transform 0.15s;
}
.product-row { cursor: pointer; transition: background 0.12s; }
.product-row:hover { background: var(--surface-hover); }
.product-row.expanded { background: var(--primary-light); }
.product-detail-row td { padding: 0 !important; background: var(--surface-2); }
.product-detail-content { padding: 12px 16px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-section { background: var(--bg); border-radius: 8px; padding: 12px; border: 1px solid var(--border); }
.detail-section h3 { font-size: 14px; margin: 0 0 8px; color: var(--text-primary); }
.detail-section h4 { font-size: 13px; margin: 8px 0 4px; color: var(--text-secondary); }
.detail-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.detail-table th { padding: 4px 8px; text-align: left; color: var(--text-tertiary); border-bottom: 1px solid var(--border); font-weight: 500; }
.detail-table td { padding: 4px 8px; border-bottom: 1px solid var(--border-light); }
.btn-xs {
  padding: 2px 8px; border: none; border-radius: 4px; cursor: pointer;
  font-size: 12px; background: var(--primary-light); color: var(--primary-dark);
  margin-right: 4px; transition: var(--transition);
}
.btn-xs:hover { opacity: 0.8; }
.btn-xs.danger { background: var(--danger-light); color: var(--danger); }
.btn-xs.add { background: var(--gold-light); color: var(--primary-dark); margin-top: 6px; }
.recipe-edit-table td { vertical-align: middle; }
.cell-input {
  width: 100%; padding: 3px 6px; border: 1px solid var(--border); border-radius: 4px;
  font-size: 12px; text-align: right; background: white; transition: var(--transition);
}
.cell-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(184,118,62,0.12); outline: none; }
.cell-material { cursor: pointer; }
.cell-material:hover { color: var(--primary); }
.cell-cost { text-align: right; color: var(--text-secondary); }
.cell-select { width: 100%; padding: 3px 6px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; }
.weight-inline-input {
  width: 64px; padding: 2px 6px; border: 1px dashed var(--primary); border-radius: 4px;
  font-size: 14px; text-align: center; background: white; color: var(--primary-dark); font-weight: 600;
}
.weight-inline-input:focus { border-style: solid; outline: none; box-shadow: 0 0 0 2px rgba(184,118,62,0.12); }
.search-select { position: relative; }
.search-select-input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; background: white; transition: var(--transition);
}
.search-select-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(184,118,62,0.12); outline: none; }
.search-select-dropdown {
  position: fixed; max-height: 260px; overflow-y: auto;
  background: white; border: 1px solid var(--border); border-radius: 6px;
  box-shadow: var(--shadow-md); z-index: 2500; display: none;
}
.search-select-dropdown.show { display: block; }
.search-select-option {
  padding: 8px 10px; cursor: pointer; font-size: 13px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.search-select-option:hover { background: var(--primary-light); }
.search-select-option.muted {
  color: var(--text-tertiary);
  cursor: default;
}
.search-select-option.muted:hover {
  background: #fff;
}
.search-select-option .ss-cat { color: var(--text-tertiary); font-size: 11px; flex-shrink: 0; }
.recipe-summary-row td {
  background: var(--cream); font-size: 12px; color: var(--text-secondary);
  padding: 6px 8px; border-bottom: none;
}
.recipe-summary-row strong { color: var(--primary-dark); }
.editable-weight {
  cursor: pointer; color: var(--primary); border-bottom: 1px dashed var(--primary);
  transition: var(--transition); padding: 1px 3px;
}
.editable-weight:hover { color: var(--primary-dark); background: var(--primary-light); border-radius: 3px; }
.batch-info {
  background: var(--cream); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 12px; color: var(--text-secondary); margin-bottom: 10px;
}
.batch-info strong { color: var(--primary-dark); font-size: 14px; }
.cost-detail-summary { background: var(--bg); border-radius: 8px; padding: 12px; border: 1px solid var(--border); }
.cds-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 13px; }
.cds-row strong { font-size: 14px; }
.cds-divider { height: 1px; background: var(--border); margin: 6px 0; }
.cds-total { font-size: 15px !important; }
.cds-profit { color: var(--success); }
.section-cost { font-size: 12px; color: var(--danger); margin-left: 8px; }
.cost-weight-bar {
  display: flex; gap: 8px; margin-bottom: 10px;
}
.cost-weight-bar span {
  flex: 1; background: var(--cream); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; text-align: center;
  font-size: 12px; color: var(--text-secondary);
}
.cost-weight-bar strong { display: block; font-size: 15px; color: var(--primary-dark); margin-top: 2px; }

/* ============ 产品配方高级档案 ============ */
.recipe-detail-shell {
  display: grid;
  gap: 14px;
}
.recipe-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid #dfe7f0;
  border-radius: 12px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fbff 58%, #fff7ed 100%);
}
.recipe-detail-head h3 {
  margin: 5px 0 3px;
  color: var(--text);
  font-size: 18px;
}
.recipe-detail-head p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
}
.recipe-lock-pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: #edf2f7;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
}
.recipe-detail-shell.editing .recipe-lock-pill {
  background: #fff7ed;
  color: #9a3412;
}
.recipe-modern-grid {
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, 0.82fr);
  align-items: start;
}
.recipe-panel,
.recipe-cost-panel {
  padding: 16px;
  border-color: #dde6ef;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.05);
}
.recipe-panel-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}
.recipe-panel-title span {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}
.recipe-panel-title small {
  color: var(--text-tertiary);
  font-size: 12px;
}
.recipe-type-card {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fbfdff;
}
.recipe-type-card.dough { border-left: 4px solid #2563eb; }
.recipe-type-card.filling { border-left: 4px solid #16a34a; }
.recipe-type-card.decoration { border-left: 4px solid #c2410c; }
.recipe-type-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.recipe-type-head strong {
  display: block;
  color: var(--text);
  font-size: 15px;
}
.recipe-type-head span {
  display: block;
  margin-top: 2px;
  color: var(--text-tertiary);
  font-size: 12px;
}
.recipe-type-cost {
  color: var(--primary-dark);
  font-size: 16px;
  font-weight: 900;
}
.recipe-type-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}
.recipe-type-metrics span {
  padding: 7px 8px;
  border: 1px solid #e5edf5;
  border-radius: 8px;
  background: #fff;
}
.recipe-type-metrics em,
.cost-weight-grid span,
.cost-digital-hero em,
.cost-price-strip em {
  display: block;
  font-style: normal;
  color: var(--text-tertiary);
  font-size: 11px;
}
.recipe-type-metrics b {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 13px;
}
.recipe-view-table th {
  background: transparent;
}
.recipe-material-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.recipe-material-line span {
  font-weight: 700;
  color: var(--text);
}
.recipe-qty-pill {
  display: inline-flex;
  min-width: 62px;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: #334155;
  font-weight: 800;
}
.recipe-link-btn {
  border: 1px solid #d7e1ec;
  background: #fff;
  color: var(--primary-dark);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.recipe-weight-input {
  min-width: 74px;
}
.recipe-add-line-btn,
.recipe-wide-action {
  width: 100%;
  min-height: 34px;
  margin-top: 9px;
  border-radius: 8px;
  font-weight: 800;
}
.recipe-add-line-btn {
  border: 1px dashed #d7a06f;
  background: #fffaf4;
  color: var(--primary-dark);
  cursor: pointer;
}
.recipe-empty-state {
  display: grid;
  gap: 5px;
  padding: 22px;
  border: 1px dashed #d7e1ec;
  border-radius: 10px;
  background: #f8fafc;
  color: var(--text-secondary);
}
.recipe-empty-state strong {
  color: var(--text);
}
.cost-digital-hero {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.cost-digital-hero div {
  padding: 12px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #eff6ff;
}
.cost-digital-hero strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 20px;
  line-height: 1;
}
.cost-weight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.cost-weight-grid div {
  padding: 9px 10px;
  border: 1px solid #e5edf5;
  border-radius: 9px;
  background: #fafcff;
}
.cost-weight-grid strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 15px;
}
.cost-stack-list {
  display: grid;
  gap: 9px;
}
.cost-stack-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.cost-stack-meta span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}
.cost-stack-meta strong {
  color: var(--text);
  font-size: 13px;
}
.cost-stack-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef5;
}
.cost-stack-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #2563eb;
}
.cost-stack-row.filling .cost-stack-bar i { background: #16a34a; }
.cost-stack-row.decoration .cost-stack-bar i { background: #c2410c; }
.cost-stack-row.loss .cost-stack-bar i { background: #dc2626; }
.cost-stack-row.packaging .cost-stack-bar i { background: #7c3aed; }
.cost-money-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}
.cost-money-card {
  position: relative;
  overflow: hidden;
  min-height: 78px;
  padding: 11px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.75);
}
.cost-money-card::after {
  content: '¥';
  position: absolute;
  right: 8px;
  bottom: -18px;
  color: rgba(15, 23, 42, 0.055);
  font-size: 58px;
  font-weight: 900;
  line-height: 1;
}
.cost-money-card.dough {
  border-color: #bfdbfe;
  background: linear-gradient(180deg, #fff 0%, #eff6ff 100%);
}
.cost-money-card.filling {
  border-color: #bbf7d0;
  background: linear-gradient(180deg, #fff 0%, #f0fdf4 100%);
}
.cost-money-card.decoration {
  border-color: #fed7aa;
  background: linear-gradient(180deg, #fff 0%, #fff7ed 100%);
}
.cost-money-card.loss {
  border-color: #fecaca;
  background: linear-gradient(180deg, #fff 0%, #fff1f2 100%);
}
.cost-money-card.packaging {
  border-color: #ddd6fe;
  background: linear-gradient(180deg, #fff 0%, #f5f3ff 100%);
}
.cost-money-label {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.cost-money-label span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
}
.cost-money-label em {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  color: var(--text-tertiary);
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
}
.cost-money-card strong {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 10px;
  color: #0f172a;
  font-size: 21px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.cost-price-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.cost-price-strip span {
  padding: 9px 10px;
  border-radius: 9px;
  background: #f8fafc;
  border: 1px solid #e5edf5;
}
.cost-price-strip strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
}
.np-product-modal {
  display: grid;
  gap: 12px;
}
.np-section {
  padding: 14px;
  border: 1px solid #e1e8f0;
  border-radius: 12px;
  background: #fff;
}
.np-section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.np-section-title span {
  color: var(--text);
  font-weight: 900;
}
.np-section-title small {
  color: var(--text-tertiary);
  font-size: 12px;
}

/* ============ 出品计划网格 ============ */
.prod-month-bar { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.prod-month-tab {
  padding: 8px 16px; border: 1px solid var(--border); background: var(--bg); border-radius: 20px;
  cursor: pointer; font-size: 14px; color: var(--text-secondary); transition: all 0.15s;
}
.prod-month-tab:hover { border-color: var(--primary); color: var(--primary); }
.prod-month-tab.active { background: var(--primary); color: white; border-color: var(--primary); font-weight: 600; }

.prod-week-bar { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.prod-week-tab {
  padding: 6px 14px; border: 1px solid var(--border); background: var(--bg); border-radius: 16px;
  cursor: pointer; font-size: 13px; color: var(--text-secondary); transition: all 0.15s;
}
.prod-week-tab:hover { border-color: var(--primary); color: var(--primary); }
.prod-week-tab.active { background: var(--primary-light); color: var(--primary); border-color: var(--primary); font-weight: 600; }

.prod-week-info {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 280px;
}
.prod-week-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid var(--border-light);
  border-radius: 7px;
  background: #fff;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}
.prod-week-chip em {
  font-style: normal;
  color: var(--text-tertiary);
}
.prod-week-chip strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}
.prod-week-chip.money {
  background: #f7fbff;
  border-color: #dbeafe;
}
.prod-week-chip.accent {
  background: #fff7ed;
  border-color: #fed7aa;
}
.prod-week-chip.muted {
  background: var(--surface-2);
}

.prod-grid-table { overflow-x: auto; }
.prod-grid-table table { min-width: 100%; }
.prod-name-col { min-width: 140px; text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 2; }
.prod-day-col { min-width: 96px; text-align: center; }
.prod-day-head { font-size: 13px; font-weight: 600; }
.prod-day-date { font-size: 11px; color: var(--text-tertiary); }
.prod-total-col { min-width: 126px; text-align: center; }
.prod-action-col { min-width: 92px; text-align: center; }
.prod-cost-col, .prod-value-col { min-width: 70px; text-align: right; }
.prod-name-cell { font-weight: 500; position: sticky; left: 0; background: var(--bg); z-index: 1; }
.prod-qty-cell { text-align: center; padding: 2px !important; }
.prod-qty-input {
  width: 50px; text-align: center; border: 1px solid transparent; border-radius: 4px;
  padding: 4px; font-size: 14px; background: transparent; transition: all 0.12s;
}
.prod-qty-input:hover { border-color: var(--border); background: var(--surface-hover); }
.prod-qty-input:focus { border-color: var(--primary); background: white; outline: none; box-shadow: 0 0 0 2px rgba(184,118,62,0.15); }
.prod-qty-input.empty { color: transparent; }
.prod-qty-input.empty::placeholder { color: var(--text-tertiary); font-size: 14px; }
.prod-qty-input.empty:hover { border-color: var(--primary); border-style: dashed; }
.prod-qty-input.empty:focus { color: var(--text); border-style: solid; }
.prod-total-row td {
  border-top: 2px solid var(--primary);
  background: #f8fafc !important;
  font-size: 14px;
  vertical-align: top;
}
.prod-total-label {
  min-width: 150px;
  color: var(--text);
}
.prod-total-label span,
.prod-total-label small {
  display: block;
}
.prod-total-label span {
  font-size: 15px;
  font-weight: 800;
}
.prod-total-label small {
  margin-top: 3px;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 500;
}
.prod-total-cell {
  padding: 8px 6px !important;
}
.prod-total-card {
  display: grid;
  gap: 6px;
  min-width: 92px;
}
.prod-total-qty {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  color: var(--text);
}
.prod-total-qty strong {
  font-size: 18px;
  line-height: 1;
}
.prod-total-qty span {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
}
.prod-total-meta {
  display: grid;
  gap: 4px;
}
.prod-total-meta span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 22px;
  padding: 3px 6px;
  border: 1px solid #dbeafe;
  border-radius: 6px;
  background: #eff6ff;
}
.prod-total-meta em {
  font-style: normal;
  color: #64748b;
  font-size: 10px;
  white-space: nowrap;
}
.prod-total-meta b {
  color: #0f172a;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.prod-total-meta .profit {
  border-color: #bbf7d0;
  background: #f0fdf4;
}
.prod-total-meta .profit b {
  color: #15803d;
}
.prod-total-cell.week .prod-total-card {
  padding: 7px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
}
.prod-total-cell.week .prod-total-qty strong {
  color: #9a3412;
}

/* 出品计划 - 分类分组与筛选 */
.prod-filter { padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-size: 13px; cursor: pointer; }
.prod-filter:focus { border-color: var(--primary); outline: none; }
.prod-cat-col { min-width: 90px; text-align: left; }
.prod-cat-tag { font-size: 11px; color: var(--text-secondary); background: var(--bg-alt); border-radius: 4px; padding: 2px 6px; white-space: nowrap; }
.prod-cat-row td { background: var(--primary-light); border-top: 2px solid var(--border); }
.prod-cat-cell { padding: 8px 12px !important; }
.prod-cat-badge { display: inline-block; background: var(--primary); color: #fff; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 12px; margin-right: 10px; }
.prod-cat-sub { font-size: 12px; color: var(--text-secondary); }
.prod-cell-sub { display: block; font-size: 10px; color: var(--text-tertiary); margin-top: 2px; line-height: 1.3; }
.prod-cell-delete {
  display: block;
  margin: 4px auto 0;
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 11px;
  cursor: pointer;
}
.prod-cell-delete:hover { text-decoration: underline; }
.prod-action-cell { text-align: center; }
.prod-row-delete {
  border: 1px solid var(--danger-light);
  background: var(--danger-light);
  color: var(--danger);
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 12px;
  cursor: pointer;
}
.prod-row-delete:hover {
  border-color: var(--danger);
  background: #fff;
}

/* ============ 响应式 ============ */
@media (max-width: 1200px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { width: 56px; }
  .brand strong, .brand span, .nav-item span, .sidebar-footer { display: none; }
  .nav-item { justify-content: center; padding: 12px; font-size: 18px; }
  .content { padding: 14px; }
  .search-input { min-width: 140px; }
  .recipe-layout { flex-direction: column; }
  .product-list-panel { width: 100%; max-height: 200px; }
}

/* ============ Design Refresh 2026 ============ */
:root {
  --bg: #f4f7fb;
  --bg-alt: #eef2f7;
  --card-bg: #ffffff;
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  --surface-2: #f7f9fc;
  --text: #1f2937;
  --text-primary: #1f2937;
  --text-secondary: #667085;
  --text-tertiary: #98a2b3;
  --border: #dbe3ec;
  --border-light: #e7edf4;
  --primary: #c98345;
  --primary-dark: #9f6231;
  --primary-light: #f7e7d6;
  --primary-bg: #fdf4eb;
  --primary-gradient: linear-gradient(135deg, #d08a49 0%, #9f6231 100%);
  --gold: #e4b44d;
  --gold-light: #fcf0d0;
  --cream: #fffaf5;
  --success: #2f7d58;
  --success-light: #e8f4ec;
  --danger: #c44a4a;
  --danger-light: #fceaea;
  --warning: #c98345;
  --warning-light: #fdf0df;
  --info: #3f6ea8;
  --info-light: #e8f0fa;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 14px 34px rgba(15, 23, 42, 0.09);
  --shadow-lg: 0 20px 42px rgba(15, 23, 42, 0.12);
}

body {
  background: linear-gradient(180deg, #f5f7fa 0%, #f2f4ef 100%);
  color: var(--text);
}

.app-shell {
  grid-template-columns: 264px minmax(0, 1fr);
}

.sidebar {
  background: linear-gradient(180deg, #171d25 0%, #1d2430 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 8px 0 30px rgba(15, 23, 42, 0.08);
}

.brand {
  padding-bottom: 6px;
}

.brand-mark {
  border-radius: 12px;
  background: linear-gradient(135deg, #efc06a 0%, #c98345 100%);
  box-shadow: 0 10px 18px rgba(201, 131, 69, 0.3);
}

.brand strong {
  font-size: 16px;
  letter-spacing: 0.2px;
}

.nav-group-title {
  color: rgba(255, 255, 255, 0.45);
}

.nav-item {
  color: rgba(255, 255, 255, 0.78);
  border-radius: 12px;
}

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

.nav-item.active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.sidebar-footer {
  padding-top: 16px;
}

.role-badge {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.logout-btn {
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.82);
  border-color: rgba(255, 255, 255, 0.12);
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.main {
  background: transparent;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  margin-bottom: 18px;
  padding: 18px 0 16px;
  background: linear-gradient(180deg, rgba(245, 247, 250, 0.98) 0%, rgba(245, 247, 250, 0.84) 100%);
  backdrop-filter: blur(14px);
}

.topbar h1 {
  font-size: 28px;
  letter-spacing: -0.02em;
}

.date-display {
  color: var(--text-secondary);
}

.content {
  padding-top: 8px;
}

.metric-grid {
  gap: 16px;
}

.metric-card,
.panel,
.table-wrap,
.product-list-panel {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 126px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #d08a49 0%, #efc06a 100%);
}

.metric-card:nth-child(2)::before {
  background: linear-gradient(90deg, #e4b44d 0%, #f5d484 100%);
}

.metric-card:nth-child(3)::before {
  background: linear-gradient(90deg, #3f6ea8 0%, #7ea4d4 100%);
}

.metric-card:nth-child(4)::before {
  background: linear-gradient(90deg, #2f7d58 0%, #77b08f 100%);
}

.metric-icon {
  border-radius: 12px;
}

.metric-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.metric-value {
  font-size: 28px;
}

.metric-sub {
  color: var(--text-secondary);
}

.dashboard-grid,
.content-grid {
  gap: 16px;
}

.panel-head h2 {
  font-size: 16px;
  letter-spacing: -0.01em;
}

.search-input,
.filter-select,
.search-box,
.toolbar select,
.prod-filter {
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.search-input,
.filter-select,
.prod-filter,
.search-box {
  border-radius: 10px;
}

.search-box {
  border: 1px solid var(--border);
}

.primary-button,
.btn-primary {
  background: var(--primary-gradient);
  box-shadow: 0 10px 18px rgba(159, 98, 49, 0.16);
  border-radius: 10px;
}

.primary-button:hover,
.btn-primary:hover {
  background: linear-gradient(135deg, #b9773d 0%, #8f5629 100%);
}

.ghost-button,
.btn-secondary,
.text-button,
.mini-button {
  border-radius: 10px;
}

.btn-secondary,
.ghost-button,
.text-button,
.mini-button {
  background: #fff;
  border: 1px solid var(--border);
}

.toolbar {
  margin-bottom: 18px;
}

.segmented {
  gap: 8px;
  padding: 4px;
  background: #eef2f7;
  border-radius: 999px;
}

.segmented button {
  border-radius: 999px;
  padding: 9px 14px;
  color: var(--text-secondary);
}

.segmented button.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}

table {
  width: 100%;
}

thead {
  background: #f7f9fc;
}

th {
  padding: 12px 14px;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  background: #f7f9fc;
}

td {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text);
}

tr:hover td {
  background: #fafcff;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef2f7;
  color: #405066;
  font-size: 12px;
  font-weight: 700;
}

.status-pill.warn {
  background: #fdf0df;
  color: #9c651e;
}

.status-pill.danger {
  background: #fde8e8;
  color: #b03d3d;
}

.status-pill.success {
  background: #e6f4ea;
  color: #2f7d58;
}

.alert-list,
.compact-list,
.recipe-items {
  display: grid;
  gap: 10px;
}

.alert-item,
.compact-item,
.picker-button,
.recipe-chip,
.quick-action-item {
  border-radius: 12px;
}

.alert-item {
  padding: 12px 0;
  color: var(--text);
}

.alert-item strong,
.compact-item strong {
  font-weight: 700;
}

.alert-item span,
.compact-item span {
  color: var(--text-secondary);
}

.compact-item {
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  background: #fafbfd;
}

.quick-action-item {
  border: 1px solid var(--border-light);
  background: linear-gradient(180deg, #fff 0%, #fbfcfe 100%);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.quick-action-item:hover {
  transform: translateX(4px);
  border-color: #d8e0ea;
  background: #f9fbfe;
}

.quick-action-item .qa-icon {
  background: #f5f7fb !important;
  color: var(--primary-dark);
}

.recipe-layout {
  display: grid;
  grid-template-columns: minmax(280px, 316px) minmax(0, 1fr);
  gap: 16px;
}

.product-picker {
  padding: 16px;
  max-height: calc(100vh - 150px);
  overflow: auto;
  position: sticky;
  top: 94px;
  background: linear-gradient(180deg, #fff 0%, #fafcff 100%);
}

.picker-button {
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--border-light);
  background: #fff;
  color: var(--text);
}

.picker-button.active {
  background: var(--primary-bg);
  border-color: #e8c8ab;
  color: var(--primary-dark);
  box-shadow: inset 0 0 0 1px rgba(201, 131, 69, 0.08);
}

.recipe-section {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-light);
}

.recipe-section h3 {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.recipe-chip {
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  background: #fafbfd;
}

.recipe-chip strong {
  display: block;
  margin-bottom: 3px;
}

.row-actions {
  gap: 6px;
}

.mini-button {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
}

.mini-button.danger {
  border-color: #f0c9c9;
  color: var(--danger);
  background: #fff7f7;
}

.detail-grid,
.recipe-edit-table,
.detail-table,
.cost-detail-table,
.product-master-table,
.prod-grid-table table {
  border-radius: 12px;
}

.form-group label {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
}

.form-input,
.form-group input,
.form-group select,
.form-group textarea,
dialog input,
dialog select,
dialog textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.02);
}

.form-input:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
dialog input:focus,
dialog select:focus,
dialog textarea:focus {
  border-color: #c98345;
  box-shadow: 0 0 0 3px rgba(201, 131, 69, 0.12);
}

.modal-overlay,
dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(6px);
}

.modal-card,
dialog {
  border-radius: 18px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
}

.modal-head,
.modal-footer,
dialog .modal-head,
dialog .modal-footer {
  border-color: var(--border-light);
}

.toast {
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
}

.loading-skeleton {
  background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 37%, #eef2f7 63%);
  background-size: 400% 100%;
}

@media (max-width: 1100px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .span-2 {
    grid-column: auto;
  }

  .recipe-layout {
    grid-template-columns: 1fr;
  }

  .product-picker {
    position: static;
    max-height: none;
  }
}

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

  .sidebar {
    position: relative;
    height: auto;
    padding: 18px 16px;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-item {
    justify-content: center;
    text-align: center;
  }

  .sidebar-note,
  .sidebar-footer {
    display: none;
  }

  .topbar {
    gap: 12px;
  }

  .topbar h1 {
    font-size: 24px;
  }

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

  .toolbar,
  .top-actions {
    align-items: stretch;
  }

  .search-box {
    min-width: 0;
    width: 100%;
  }

  .toolbar-actions {
    width: 100%;
  }

  .toolbar-actions .primary-button,
.toolbar-actions .btn-primary {
    width: 100%;
  }
}

.prod-page-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.section-kicker {
  font-size: 12px;
  color: var(--primary-dark);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.section-title {
  font-size: 24px;
  line-height: 1.2;
  margin: 0 0 8px;
}
.section-subtitle {
  max-width: 720px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.7;
}
.prod-page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.prod-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 16px;
  align-items: start;
}
.prod-main-column { min-width: 0; }
.prod-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.prod-summary-card,
.prod-summary-empty,
.prod-inspector-card,
.prod-inspector-empty {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.prod-summary-card {
  padding: 14px 15px;
  min-height: 92px;
}
.prod-summary-card span,
.prod-inspector-label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.prod-summary-card strong {
  display: block;
  font-size: 24px;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 6px;
}
.prod-summary-card small,
.prod-inspector-meta {
  color: var(--text-tertiary);
  font-size: 12px;
}
.prod-summary-card-accent strong { color: var(--primary-dark); }
.prod-summary-empty {
  grid-column: 1 / -1;
  padding: 18px 20px;
}
.prod-summary-empty-title,
.prod-inspector-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.prod-summary-empty-text,
.prod-inspector-empty p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.prod-inspector {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 12px;
}
.prod-inspector-card,
.prod-inspector-empty { padding: 14px; }
.prod-inspector-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.prod-status-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 600;
}
.prod-inspector-actions {
  display: grid;
  gap: 8px;
}
.prod-action-btn { width: 100%; justify-content: center; }
.prod-inspector-chips,
.prod-inspector-days {
  display: grid;
  gap: 8px;
}
.prod-inspector-chip,
.prod-inspector-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 10px;
}
.prod-inspector-chip strong,
.prod-inspector-row-value {
  font-weight: 700;
  color: var(--text);
}
.prod-inspector-empty-line {
  color: var(--text-tertiary);
  font-size: 12px;
}
.prod-inspector-row-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.prod-inspector-row-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.prod-grid-table {
  margin-bottom: 12px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.prod-month-bar { gap: 8px; margin-bottom: 12px; }
.prod-month-tab,
.prod-week-tab { box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset; }
.prod-week-bar { gap: 8px; margin-bottom: 12px; }
.toolbar {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.prod-filter { min-height: 34px; }
.prod-picker-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px 100px;
  gap: 10px;
  margin-bottom: 8px;
}
.prod-picker-search,
.prod-picker-filter,
.prod-picker-default {
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
}
.prod-picker-help {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.prod-picker-wrap {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: #fff;
}
.prod-picker-table {
  width: 100%;
  border-collapse: collapse;
}
.prod-picker-table th,
.prod-picker-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}
.prod-picker-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  color: var(--text-secondary);
  text-align: left;
}
.prod-picker-name {
  font-weight: 600;
  color: var(--text);
}
.prod-picker-qty {
  width: 76px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0 8px;
}
.prod-create-next-options {
  display: grid;
  gap: 8px;
  margin: 8px 0 12px;
}
.prod-create-next-options label {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
}
.prod-day-create-head {
  margin-bottom: 12px;
}
.prod-quick-dates {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: var(--surface-2);
}
.prod-today-btn {
  justify-self: start;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.prod-quick-date-group {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 8px;
  align-items: center;
}
.prod-quick-date-group > span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}
.prod-quick-date-buttons {
  display: grid;
  grid-template-columns: repeat(7, minmax(54px, 1fr));
  gap: 6px;
}
.prod-quick-date-buttons button {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  min-height: 42px;
  padding: 5px 4px;
  cursor: pointer;
  color: var(--text);
  transition: all 0.15s;
}
.prod-quick-date-buttons button:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
}
.prod-quick-date-buttons strong,
.prod-quick-date-buttons small {
  display: block;
  line-height: 1.2;
}
.prod-quick-date-buttons strong {
  font-size: 12px;
}
.prod-quick-date-buttons small {
  margin-top: 2px;
  color: var(--text-tertiary);
  font-size: 11px;
}

/* ============ 原料 / 盘点 / 财务升级 ============ */
.material-summary,
.finance-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.material-summary-card,
.finance-kpi,
.report-stat {
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: #fff;
  padding: 14px;
  box-shadow: var(--shadow);
}
.material-summary-card span,
.finance-kpi span,
.report-stat span {
  display: block;
  color: var(--text-secondary);
  font-size: 12px;
  margin-bottom: 8px;
}
.material-summary-card strong,
.finance-kpi strong,
.report-stat strong {
  display: block;
  color: var(--text);
  font-size: 22px;
  line-height: 1.1;
}
.material-summary-card small,
.finance-kpi small {
  display: block;
  color: var(--text-tertiary);
  font-size: 12px;
  margin-top: 7px;
}
.material-summary-card.primary { border-color: #BFD4E8; background: #F5FAFE; }
.material-summary-card.success,
.finance-kpi.success { border-color: #CFE6D6; background: #F4FBF6; }
.material-summary-card.danger,
.finance-kpi.danger,
.report-stat.danger { border-color: #F1CCCC; background: #FFF7F7; }
.material-category-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.material-category-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--shadow);
  color: inherit;
  cursor: pointer;
  font: inherit;
  transition: 0.18s ease;
}
.material-category-chip:hover,
.material-category-chip.active {
  border-color: #A7C2DD;
  background: #F2F8FD;
  box-shadow: 0 8px 18px rgba(54, 85, 113, 0.12);
  transform: translateY(-1px);
}
.material-category-chip b {
  font-size: 12px;
  color: var(--text);
}
.material-category-chip.active b {
  color: #2D668D;
}
.material-category-chip i {
  font-style: normal;
  font-size: 12px;
  color: var(--text-secondary);
}
.material-category-chip.active i {
  color: #3F7B9F;
}
.material-category-chip.empty {
  color: var(--text-tertiary);
}
.perm-summary {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
}
.perm-manager-note {
  padding: 12px 14px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #f8fbff;
  color: var(--text-secondary);
  font-size: 13px;
}
.perm-grid {
  display: grid;
  gap: 10px;
}
.perm-card {
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}
.perm-card-title {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}
.perm-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
}
.perm-item + .perm-item {
  border-top: 1px solid var(--border-light);
}
.perm-item input {
  margin-top: 3px;
}
.perm-item strong {
  display: block;
  font-size: 13px;
  color: var(--text);
}
.perm-item small {
  display: block;
  color: var(--text-tertiary);
  font-size: 11px;
  margin-top: 2px;
}
.users-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.inventory-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}
.user-summary-card {
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: #fff;
}
.inventory-summary-card {
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}
.user-summary-card span {
  display: block;
  color: var(--text-tertiary);
  font-size: 12px;
}
.inventory-summary-card span {
  display: block;
  color: var(--text-tertiary);
  font-size: 12px;
}
.user-summary-card strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 18px;
}
.inventory-summary-card strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 20px;
}
.user-summary-card small {
  display: block;
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 11px;
}
.inventory-summary-card small {
  display: block;
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 11px;
}
.inventory-summary-card.primary { border-color: #BFD4E8; background: #F5FAFE; }
.inventory-summary-card.success { border-color: #CFE6D6; background: #F4FBF6; }
.inventory-summary-card.danger { border-color: #F1CCCC; background: #FFF7F7; }
.inventory-summary-card.primary strong { color: #2D668D; }
.inventory-summary-card.success strong { color: var(--success); }
.inventory-summary-card.danger strong { color: var(--danger); }
.finance-kpi.amber { border-color: #F4D8AB; background: #FFF9EF; }
#view-inventory .toolbar,
#view-finance .tabs,
#view-users .toolbar {
  margin-bottom: 12px;
}
#view-inventory .table-wrap,
#view-finance .table-wrap,
#view-users .table-wrap {
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.material-name-cell,
.material-spec-cell {
  display: grid;
  gap: 4px;
}
.material-name-cell strong,
.material-spec-cell strong {
  font-size: 13px;
  color: var(--text);
}
.material-name-cell small,
.material-spec-cell small {
  color: var(--text-tertiary);
  font-size: 11px;
}
.material-cat,
.stock-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  background: var(--surface-2);
  color: var(--text-secondary);
}
.stock-pill {
  background: var(--success-light);
  color: var(--success);
  font-weight: 700;
}
.stock-pill.warn {
  background: var(--danger-light);
  color: var(--danger);
}
.inventory-modal-note,
.finance-form-note,
.m-form-tip {
  border: 1px solid #DDE8F2;
  background: #F6FAFD;
  color: #48627A;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin: 8px 0 12px;
}
.inventory-modal-list {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 8px;
  background: var(--surface-2);
}
.inv-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) repeat(4, minmax(86px, 0.7fr));
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: #fff;
  margin-bottom: 8px;
}
.inv-material {
  display: grid;
  gap: 4px;
}
.inv-material strong {
  color: var(--text);
  font-size: 13px;
}
.inv-material span,
.inv-row label span {
  color: var(--text-tertiary);
  font-size: 11px;
}
.inv-row label {
  display: grid;
  gap: 5px;
}
.inv-row input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 8px;
  background: #fff;
}
.finance-overview {
  margin: 12px 0;
}
.finance-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  border: 1px solid #D8E4EF;
  border-radius: 14px;
  background: linear-gradient(135deg, #F7FBFE 0%, #FFFFFF 55%, #FFF9EF 100%);
  padding: 18px;
  box-shadow: var(--shadow);
}
.finance-hero span,
.finance-hero small {
  display: block;
  color: var(--text-secondary);
  font-size: 13px;
}
.finance-hero strong {
  display: block;
  margin: 8px 0;
  color: var(--text);
  font-size: 32px;
  line-height: 1;
}
.finance-hero-meter {
  min-width: 132px;
  text-align: center;
  border: 1px solid #CFE6D6;
  border-radius: 12px;
  background: #F4FBF6;
  padding: 14px;
}
.finance-hero-meter b {
  display: block;
  color: var(--success);
  font-size: 24px;
}
.finance-action-toolbar {
  margin-bottom: 12px;
}
.report-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.3fr) minmax(220px, 0.75fr);
  gap: 12px;
}
.report-panel {
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: #fff;
  padding: 16px;
  box-shadow: var(--shadow);
}
.report-panel:last-child {
  grid-column: 1 / -1;
}
.report-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}
.report-panel-head span {
  color: var(--text-secondary);
  font-weight: 700;
}
.report-panel-head strong {
  color: var(--text);
  font-size: 22px;
}
.report-panel.compact {
  display: grid;
  gap: 10px;
}
.report-bars {
  display: grid;
  gap: 9px;
}
.report-bar-row {
  display: grid;
  grid-template-columns: 42px 1fr 80px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}
.report-bar-row span,
.report-bar-row b {
  color: var(--text-secondary);
  font-weight: 500;
}
.report-bar-row div {
  height: 9px;
  border-radius: 999px;
  background: #EEF4F8;
  overflow: hidden;
}
.report-bar-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4A7CAA, #5B9A6E);
}
.finance-insight-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.finance-insight-list div {
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 12px;
  background: var(--surface-2);
}
.finance-insight-list span {
  display: block;
  color: var(--text-tertiary);
  font-size: 12px;
  margin-bottom: 8px;
}
.finance-insight-list strong {
  color: var(--text);
}
.damage-upload {
  border: 1px dashed #BFD4E8;
  border-radius: 12px;
  padding: 12px;
  background: #F7FBFE;
  margin-bottom: 12px;
}
.damage-upload input {
  width: 100%;
}
.damage-upload img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  margin-top: 10px;
  border-radius: 8px;
  background: #fff;
}
.damage-preview {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.damage-preview-head,
.damage-preview-row {
  display: grid;
  grid-template-columns: 1fr 72px 92px;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
  font-size: 13px;
}
.damage-preview-head {
  background: #FFF9EF;
  border-color: #F4D8AB;
}
.damage-preview-row b,
.damage-preview-row em {
  text-align: right;
  font-style: normal;
}
.empty-hint {
  color: var(--text-tertiary);
  font-size: 13px;
  padding: 10px 0;
}
@media (max-width: 1200px) {
  .prod-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .prod-workbench { grid-template-columns: 1fr; }
  .prod-inspector { position: static; }
  .material-summary,
  .finance-kpi-grid,
  .finance-insight-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inv-row { grid-template-columns: 1fr 1fr; }
  .report-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .prod-page-head { flex-direction: column; }
  .prod-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prod-summary-card strong { font-size: 20px; }
  .prod-picker-tools { grid-template-columns: 1fr; }
  .prod-week-info { justify-content: flex-start; min-width: 0; width: 100%; }
  .prod-quick-date-group { grid-template-columns: 1fr; }
  .prod-quick-date-buttons { grid-template-columns: repeat(4, minmax(58px, 1fr)); }
  .purchase-filter-bar { grid-template-columns: 1fr; }
  .material-summary,
  .finance-kpi-grid,
  .finance-insight-list { grid-template-columns: 1fr; }
  .finance-hero { flex-direction: column; align-items: stretch; }
  .report-bar-row { grid-template-columns: 40px 1fr; }
  .report-bar-row b { grid-column: 2; text-align: right; }
}

/* ============ Prototype V3 visual alignment ============ */
:root {
  --sidebar-w: 236px;
  --proto-ink: #1b252e;
  --proto-muted: #71808b;
  --proto-paper: #f2f4f5;
  --proto-line: #dce2e5;
  --proto-nav: #172129;
  --proto-caramel: #bd7042;
  --proto-caramel-dark: #8f4d2d;
  --proto-soft: #fff0e6;
}

body {
  background:
    radial-gradient(circle at 92% 0, rgba(249, 228, 213, 0.88) 0, rgba(249, 228, 213, 0) 22%),
    var(--proto-paper);
  color: var(--proto-ink);
}

.login-page {
  background: linear-gradient(145deg, #142029 0%, #24343e 100%);
}

.login-card {
  width: min(440px, calc(100vw - 32px));
  padding: 36px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 28px;
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.42);
}

.login-brand {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--proto-caramel), var(--proto-caramel-dark));
  color: #fff;
  font-size: 23px;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(189, 112, 66, 0.27);
}

.login-card h1 {
  margin-bottom: 5px;
  font-size: 28px;
  letter-spacing: -0.02em;
}

.login-sub {
  margin-bottom: 26px;
  color: var(--proto-muted);
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--proto-nav) 0%, #111a21 100%);
  border-right: 0;
  box-shadow: 8px 0 30px rgba(15, 23, 42, 0.12);
}

.brand {
  gap: 11px;
  padding: 21px 20px 22px;
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #d28b61, var(--proto-caramel-dark));
  color: #fff;
  font-size: 19px;
  box-shadow: 0 10px 18px rgba(189, 112, 66, 0.25);
}

.brand strong {
  color: #fff;
  font-size: 15px;
}

.brand span {
  color: #94a2ab;
}

.nav-list {
  gap: 3px;
  padding: 10px 13px;
}

.nav-group-title {
  padding: 15px 11px 7px;
  color: #758792;
  font-size: 10px;
  letter-spacing: 0.16em;
}

.nav-item {
  min-height: 43px;
  gap: 11px;
  padding: 8px 11px;
  border-radius: 11px;
  color: #aebbc2;
}

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

.nav-item.active {
  background: linear-gradient(90deg, rgba(189, 112, 66, 0.18), rgba(255, 255, 255, 0.04));
  color: #fff;
  box-shadow: inset 3px 0 var(--proto-caramel);
}

.nav-item.active::before {
  display: none;
}

.sidebar-footer {
  padding: 15px 20px 18px;
  border-top-color: rgba(255, 255, 255, 0.08);
}

.role-badge {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.logout-btn {
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.82);
  border-color: rgba(255, 255, 255, 0.12);
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.topbar {
  height: 70px;
  margin-bottom: 0;
  padding: 0 27px;
  background: rgba(248, 250, 250, 0.88);
  border-bottom-color: rgba(220, 226, 229, 0.68);
}

.topbar h1 {
  font-size: 18px;
  letter-spacing: 0;
}

.content {
  max-width: 1540px;
  padding: 25px 27px 60px;
  margin: 0 auto;
}

#dashboard-hero {
  margin-bottom: 16px;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
  gap: 18px;
  min-height: 212px;
  padding: 24px;
  border: 1px solid rgba(220, 226, 229, 0.9);
  border-radius: 17px;
  background:
    radial-gradient(circle at 80% 10%, rgba(255, 240, 230, 0.92), transparent 32%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 250, 247, 0.92) 100%);
  box-shadow: 0 16px 44px rgba(20, 30, 38, 0.09);
}

.dashboard-hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.dashboard-hero-eyebrow {
  color: var(--proto-caramel-dark);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.dashboard-hero h2 {
  max-width: 650px;
  margin: 8px 0 8px;
  color: var(--proto-ink);
  font-size: clamp(22px, 2.3vw, 32px);
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.dashboard-hero p {
  max-width: 600px;
  margin: 0;
  color: var(--proto-muted);
  font-size: 13px;
  line-height: 1.7;
}

.dashboard-hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 18px;
}

.dashboard-hero-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--proto-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--proto-muted);
  font-size: 11px;
}

.dashboard-hero-chip strong {
  margin-left: 5px;
  color: var(--proto-ink);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
}

.dashboard-hero-panel {
  display: grid;
  align-content: center;
  gap: 9px;
}

.dashboard-hero-card {
  padding: 16px;
  border-radius: 15px;
  background: linear-gradient(145deg, #24313a 0%, #142029 100%);
  color: #fff;
  box-shadow: 0 14px 30px rgba(20, 32, 41, 0.22);
}

.dashboard-hero-card span,
.dashboard-hero-card small {
  display: block;
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
}

.dashboard-hero-card strong {
  display: block;
  margin: 8px 0 7px;
  color: #fff;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 30px;
  line-height: 1;
}

.dashboard-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.dashboard-hero-mini {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--proto-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
}

.dashboard-hero-mini span {
  display: block;
  overflow: hidden;
  color: var(--proto-muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-hero-mini strong {
  display: block;
  margin-top: 5px;
  color: var(--proto-ink);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 15px;
}

.dashboard-hero-loading {
  display: block;
  min-height: 172px;
  padding: 24px;
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  min-height: 124px;
  padding: 18px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 30px rgba(20, 30, 38, 0.06);
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(20, 30, 38, 0.1);
}

.metric-value {
  font-family: Consolas, "SFMono-Regular", monospace;
  letter-spacing: -0.03em;
}

.metric-sub {
  color: var(--proto-muted);
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 14px;
  margin-top: 14px;
}

.panel {
  padding: 17px;
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 16px 44px rgba(20, 30, 38, 0.07);
  backdrop-filter: blur(10px);
}

.panel-head {
  margin-bottom: 15px;
}

.panel-head h2 {
  font-size: 15px;
}

.quick-action-item {
  min-height: 61px;
  padding: 11px 12px;
  border-color: var(--proto-line);
  background: rgba(255, 255, 255, 0.76);
}

.quick-action-item .qa-title {
  color: var(--proto-ink);
}

.quick-action-item .qa-desc {
  color: var(--proto-muted);
}

.table-wrap {
  border-radius: 15px;
  box-shadow: 0 12px 30px rgba(20, 30, 38, 0.06);
}

thead {
  background: #f5f7f8;
}

th {
  padding: 11px 13px;
  background: #f5f7f8;
  color: #687780;
  font-size: 11px;
  letter-spacing: 0.04em;
}

td {
  padding: 12px 13px;
  border-bottom-color: var(--proto-line);
}

tr:hover td {
  background: #fffaf7;
}

.toolbar {
  gap: 9px;
  margin-bottom: 13px;
}

.search-input,
.filter-select,
.toolbar select,
.prod-filter {
  min-height: 40px;
  border-radius: 11px;
}

.btn-primary,
.btn-secondary {
  min-height: 40px;
  border-radius: 11px;
}

.btn-primary {
  background: linear-gradient(145deg, var(--proto-caramel), var(--proto-caramel-dark));
}

.btn-secondary {
  background: #fff;
}

.tabs {
  gap: 6px;
}

.tab {
  border: 1px solid var(--proto-line);
  border-radius: 999px;
  padding: 8px 13px;
}

.tab.active {
  background: var(--proto-ink);
  box-shadow: none;
}

.prod-month-bar,
.prod-week-bar {
  margin-bottom: 12px;
}

@media (max-width: 1100px) {
  .dashboard-hero {
    grid-template-columns: 1fr;
  }
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .topbar {
    padding: 0 14px;
  }
  .content {
    padding: 18px 14px 40px;
  }
  .dashboard-hero {
    padding: 18px;
  }
  .dashboard-hero h2 {
    font-size: 24px;
  }
  .dashboard-hero-stats {
    grid-template-columns: 1fr;
  }
}

/* ============ Layout normalization ============ */
.content {
  width: min(100%, 1540px);
  margin: 0 auto;
  padding: 24px 28px 56px;
}

.view {
  width: 100%;
  min-width: 0;
}

.view:not(.active) {
  display: none !important;
}

#view-dashboard,
#view-products,
#view-materials,
#view-production,
#view-inventory,
#view-purchases,
#view-finance,
#view-users {
  width: 100%;
  min-width: 0;
}

#view-dashboard.active,
#view-products.active,
#view-materials.active,
#view-production.active,
#view-inventory.active,
#view-purchases.active,
#view-finance.active,
#view-users.active {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#view-dashboard > *,
#view-products > *,
#view-materials > *,
#view-production > *,
#view-inventory > *,
#view-purchases > *,
#view-finance > *,
#view-users > * {
  width: 100%;
  min-width: 0;
}

.dashboard-grid,
.content-grid,
.report-grid,
.metric-grid,
.users-summary,
.inventory-summary,
.finance-overview {
  width: 100%;
}

.panel,
.table-wrap,
.metric-card,
.user-summary-card,
.inventory-summary-card {
  width: 100%;
  min-width: 0;
}

#view-inventory .toolbar,
#view-finance .tabs,
#view-users .toolbar,
#view-products .toolbar,
#view-materials .toolbar,
#view-purchases .toolbar {
  width: 100%;
}

#view-finance .finance-tab-content,
#view-purchases .purchase-section {
  width: 100%;
  min-width: 0;
}

#view-finance .table-wrap,
#view-inventory .table-wrap,
#view-users .table-wrap,
#view-purchases .table-wrap {
  overflow-x: auto;
}

.panel-head,
.toolbar {
  width: 100%;
}
