/* 方展针织四套莫兰迪主题 */
html[data-theme="A"] {
  --theme-primary: #6B4F35; --theme-primary-dark: #4D3826; --theme-primary-deep: #3B2B1D;
  --theme-brand: #C8A96A; --theme-brand-deep: #A88648; --theme-brand-soft: #E6D3AF;
  --theme-aux: #D8CCB8; --theme-soft: #E5DDCF; --theme-page: #EFEADF; --theme-panel: #F8F4EB;
  --theme-btn: #B58958; --theme-btn-hi: #D2AD7A; --theme-btn-lo: #8D673D;
  --theme-text: #3E2E1F; --theme-muted: #7C6C59; --theme-light: #F5EAD7; --theme-line: #D8CCB9;
  --green: #6B4F35; --green-bg: #E8DCC9; --yellow: #A88648; --yellow-bg: #F2E5D0;
  --orange: #8A5A32; --orange-bg: #EAD2B8; --red: #4D3826; --red-bg: #DED0BA;
  --ink: #3E2E1F; --paper: #EFEADF; --card: #FFFFFF; --line: #D8CCB9; --muted: #7C6C59; --group: #F8F4EB;
}
html[data-theme="B"] {
  --theme-primary: #3A4A5C; --theme-primary-dark: #2B3948; --theme-primary-deep: #1F2B37;
  --theme-brand: #798DA3; --theme-brand-deep: #5D7289; --theme-brand-soft: #B6C4D2;
  --theme-aux: #B0B9C4; --theme-soft: #E6E9ED; --theme-page: #EDF1F4; --theme-panel: #F8FAFC;
  --theme-btn: #627790; --theme-btn-hi: #8499AE; --theme-btn-lo: #4B6078;
  --theme-text: #252F3A; --theme-muted: #687585; --theme-light: #E8EDF2; --theme-line: #D1D9E2;
  --green: #3A4A5C; --green-bg: #E1E7ED; --yellow: #657A90; --yellow-bg: #E5EAF0;
  --orange: #4E6178; --orange-bg: #D8E0E8; --red: #252F3A; --red-bg: #CDD6DF;
  --ink: #252F3A; --paper: #EDF1F4; --card: #FFFFFF; --line: #D1D9E2; --muted: #687585; --group: #F8FAFC;
}
html[data-theme="C"] {
  --theme-primary: #4A5F54; --theme-primary-dark: #394A40; --theme-primary-deep: #29372F;
  --theme-brand: #88A394; --theme-brand-deep: #6C8979; --theme-brand-soft: #B7CBBF;
  --theme-aux: #B9C7C0; --theme-soft: #E7ECE9; --theme-page: #EEF3EF; --theme-panel: #F8FAF8;
  --theme-btn: #708C7E; --theme-btn-hi: #91AA9D; --theme-btn-lo: #577265;
  --theme-text: #2C3A33; --theme-muted: #66766D; --theme-light: #E9F0EC; --theme-line: #D2DED6;
  --green: #4A5F54; --green-bg: #E3EBE6; --yellow: #7C9889; --yellow-bg: #E5EEE8;
  --orange: #657F70; --orange-bg: #D8E5DC; --red: #2C3A33; --red-bg: #CDDCD2;
  --ink: #2C3A33; --paper: #EEF3EF; --card: #FFFFFF; --line: #D2DED6; --muted: #66766D; --group: #F8FAF8;
}
html[data-theme="D"] {
  --theme-primary: #594C66; --theme-primary-dark: #453A51; --theme-primary-deep: #332A3D;
  --theme-brand: #9283A5; --theme-brand-deep: #75658A; --theme-brand-soft: #C3B5D2;
  --theme-aux: #C0B8C9; --theme-soft: #EAE7EE; --theme-page: #F1EEF4; --theme-panel: #FAF8FC;
  --theme-btn: #7A6B8C; --theme-btn-hi: #9B8BAD; --theme-btn-lo: #5E506F;
  --theme-text: #342C3C; --theme-muted: #70667A; --theme-light: #F0ECF5; --theme-line: #DCD5E2;
  --green: #594C66; --green-bg: #E8E2ED; --yellow: #8C7A9E; --yellow-bg: #E9E3EE;
  --orange: #6F5D7E; --orange-bg: #DDD4E4; --red: #342C3C; --red-bg: #D5CCDC;
  --ink: #342C3C; --paper: #F1EEF4; --card: #FFFFFF; --line: #DCD5E2; --muted: #70667A; --group: #FAF8FC;
}

html[data-theme] body { background: linear-gradient(180deg, color-mix(in srgb, var(--theme-page) 72%, white) 0%, var(--theme-page) 44%, color-mix(in srgb, var(--theme-page) 86%, var(--theme-aux)) 100%); color: var(--theme-text); }
html[data-theme] h1 { color: var(--theme-primary-deep); }
html[data-theme] .eyebrow { color: var(--theme-brand-deep); }
html[data-theme] .baseline,
html[data-theme] .page-sub,
html[data-theme] .date-note,
html[data-theme] .section-kicker,
html[data-theme] .panel-note { color: var(--theme-muted); }
html[data-theme] .section-kicker { color: var(--theme-brand-deep); }

/* 顶部导航变成主题深色栏 */
html[data-theme] .app-nav {
  background: linear-gradient(180deg, color-mix(in srgb, var(--theme-primary) 94%, white), var(--theme-primary) 52%, var(--theme-primary-dark));
  border-bottom-color: color-mix(in srgb, var(--theme-primary-deep) 75%, black);
  padding-left: 8px;
  padding-right: 8px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 2px 7px rgba(25, 22, 18, .12);
}
html[data-theme] .app-nav-link { color: color-mix(in srgb, var(--theme-light) 80%, transparent); }
html[data-theme] .app-nav-link:hover { background: rgba(255,255,255,.10); color: var(--theme-light); }
html[data-theme] .app-nav-link.is-active { background: var(--theme-brand); color: var(--theme-primary-deep); }
html[data-theme] .app-user { color: color-mix(in srgb, var(--theme-light) 82%, transparent); }
html[data-theme] .app-user-name { color: var(--theme-light); }
html[data-theme] .app-user-role { color: color-mix(in srgb, var(--theme-light) 82%, transparent); border-color: color-mix(in srgb, var(--theme-light) 30%, transparent); }
html[data-theme] .app-user-admin,
html[data-theme] .app-user-settings,
html[data-theme] .app-user-account,
html[data-theme] .app-user-logout { color: color-mix(in srgb, var(--theme-light) 78%, transparent); }
html[data-theme] .app-user-admin:hover,
html[data-theme] .app-user-settings:hover,
html[data-theme] .app-user-account:hover,
html[data-theme] .app-user-logout:hover { color: var(--theme-light); }

/* 按钮：哑光金属按键 */
html[data-theme] .btn-primary {
  border-color: color-mix(in srgb, var(--theme-btn) 82%, black);
  background: linear-gradient(180deg, var(--theme-btn-hi) 0%, var(--theme-btn) 48%, var(--theme-btn-lo) 100%);
  color: var(--theme-light);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.50), inset 0 -2px 2px rgba(0,0,0,.18), 0 2px 4px rgba(35,28,20,.16);
}
html[data-theme] .btn-primary:hover { filter: brightness(1.045); }
html[data-theme] .btn-outline,
html[data-theme] .btn-quiet {
  border-color: var(--theme-line);
  background: color-mix(in srgb, var(--theme-soft) 55%, white);
  color: var(--theme-primary);
}
html[data-theme] .btn-outline:hover,
html[data-theme] .btn-quiet:hover { border-color: var(--theme-brand); background: var(--theme-soft); }
html[data-theme] .app-back { background: var(--theme-primary); color: var(--theme-light); border-color: var(--theme-primary-dark); box-shadow: 0 8px 24px color-mix(in srgb, var(--theme-primary) 30%, transparent); }
html[data-theme] .app-back:hover { background: var(--theme-brand); color: var(--theme-primary-deep); }
html[data-theme] .app-home { background: var(--theme-soft); color: var(--theme-primary); border-color: var(--theme-line); box-shadow: 0 8px 24px color-mix(in srgb, var(--theme-primary) 18%, transparent); }
html[data-theme] .app-home:hover { background: var(--theme-primary); color: var(--theme-light); border-color: var(--theme-primary-dark); }
html[data-theme] a,
html[data-theme] .text-link { color: var(--theme-primary); }
html[data-theme] a:hover,
html[data-theme] .text-link:hover { color: var(--theme-brand-deep); }

/* 数据卡与模块 */
html[data-theme] .item-card,
html[data-theme] .machine-card,
html[data-theme] .panel,
html[data-theme] .side-card,
html[data-theme] .box-label,
html[data-theme] .table-panel {
  background: var(--card);
  border-color: var(--theme-line);
}
html[data-theme] .machine-card { box-shadow: inset 0 1px 0 rgba(255,255,255,.55); }
html[data-theme] .machine-card[data-level="绿"] { --level: var(--green) !important; --level-bg: var(--green-bg) !important; }
html[data-theme] .machine-card[data-level="黄"] { --level: var(--yellow) !important; --level-bg: var(--yellow-bg) !important; }
html[data-theme] .machine-card[data-level="橙"] { --level: var(--orange) !important; --level-bg: var(--orange-bg) !important; }
html[data-theme] .machine-card[data-level="红"] { --level: var(--red) !important; --level-bg: var(--red-bg) !important; }
html[data-theme] .panel-head { border-color: var(--theme-line); }
html[data-theme] .inventory-section-head { border-color: var(--theme-line); }
html[data-theme] .box-label { border-top-color: var(--theme-primary); }
html[data-theme] .box-label-action { border-color: var(--theme-line); color: var(--theme-primary); }
html[data-theme] .box-label-action:hover { border-color: var(--theme-brand); background: var(--theme-soft); }
html[data-theme] .box-label-action.is-danger { color: var(--theme-primary); border-color: var(--theme-aux); }
html[data-theme] .lot-table th { background: color-mix(in srgb, var(--theme-soft) 62%, white); color: var(--theme-primary-deep); border-color: var(--theme-line); }
html[data-theme] .lot-table td { border-color: color-mix(in srgb, var(--theme-line) 58%, white); }
html[data-theme] .lot-row:hover,
html[data-theme] .lot-row:focus-visible { background: color-mix(in srgb, var(--theme-brand) 10%, white); }
html[data-theme] .spec-tabs,
html[data-theme] .spec-tab { border-color: var(--theme-line); color: var(--theme-muted); }
html[data-theme] .spec-tab.is-active { background: var(--theme-primary); color: var(--theme-light); border-color: var(--theme-primary); }
html[data-theme] .chip,
html[data-theme] .inline-chip,
html[data-theme] .filter-chip,
html[data-theme] .pending-tag,
html[data-theme] .idle-tag {
  border-color: var(--theme-line);
  background: var(--theme-soft);
  color: var(--theme-primary);
}
html[data-theme] input:focus,
html[data-theme] select:focus,
html[data-theme] textarea:focus { outline-color: var(--theme-brand); border-color: var(--theme-brand); }
html[data-theme] .stock-alert { border-color: var(--theme-aux); background: var(--theme-soft); color: var(--theme-primary); }
html[data-theme] .stock-alert strong { color: var(--theme-primary-deep); }
html[data-theme] .inventory-summary,
html[data-theme] .statusline { border-color: var(--theme-line); }
html[data-theme] .modal { border-color: var(--theme-line); }
html[data-theme] .modal-head { border-color: var(--theme-line); }
html[data-theme] .toast { background: var(--theme-primary); color: var(--theme-light); }

/* 设置页主题选择器 */
.theme-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.theme-choice {
  min-width: 0; padding: 0; overflow: hidden; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: 5px; background: #fff;
  box-shadow: 0 2px 6px rgba(30, 26, 20, .05); font-family: inherit;
}
.theme-choice:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(30, 26, 20, .12); }
.theme-choice.is-active { border-color: var(--c1); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c1) 20%, transparent), 0 5px 14px rgba(30, 26, 20, .10); }
.theme-choice-top { height: 62px; padding: 9px 10px; background: linear-gradient(135deg, var(--c1), var(--c2)); display: flex; flex-direction: column; justify-content: space-between; }
.theme-choice-top b { color: var(--clight); font-size: 11px; font-weight: 800; }
.theme-choice-top span { color: color-mix(in srgb, var(--clight) 72%, transparent); font-size: 8.5px; }
.theme-choice-body { padding: 8px 10px 9px; }
.theme-choice-body strong { display: block; color: var(--c1); font-size: 11px; }
.theme-choice-body small { display: block; margin-top: 3px; color: #7a756c; font-size: 9px; line-height: 1.35; }
.theme-mini-swatches { display: flex; gap: 3px; margin-top: 7px; }
.theme-mini-swatches i { width: 13px; height: 9px; border-radius: 2px; display: block; }
.theme-choice .check { float: right; margin-top: -20px; color: var(--c1); font-size: 13px; visibility: hidden; }
.theme-choice.is-active .check { visibility: visible; }
@media (max-width: 900px) { .theme-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .theme-picker { grid-template-columns: 1fr; } }

/* 让旧版内联状态色也归入当前主题，保留文字语义 */
html[data-theme] .stat { --stat-color: var(--theme-primary) !important; --stat-tint: var(--theme-soft) !important; border-color: var(--theme-line) !important; }
html[data-theme] .stat-label,
html[data-theme] .stat-value strong,
html[data-theme] .stat-value span { color: var(--theme-primary) !important; }
html[data-theme] .mini { --mini-color: var(--theme-brand-deep) !important; --mini-tint: var(--theme-soft) !important; }
html[data-theme] .mini-value,
html[data-theme] .mini-value small { color: var(--theme-primary) !important; }
html[data-theme] .mini-label { color: var(--theme-muted) !important; }
html[data-theme] .status-pill { --status-color: var(--theme-primary) !important; --status-tint: var(--theme-soft) !important; }
html[data-theme] .status-pill i { background: currentColor !important; }
html[data-theme] .item-card { --item-color: var(--theme-primary) !important; }
html[data-theme] .legend strong { color: var(--theme-primary) !important; }
html[data-theme] .legend-caption { color: var(--theme-muted) !important; }

html[data-theme] .legend-dot { --dot: var(--theme-primary) !important; }


@media print { html[data-theme] body { background: #fff !important; } }



html[data-theme] .production-note { color: var(--theme-brand-deep); font-weight: 700; }


/* 生产确认接收记录 */
.production-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.production-kpi {
  padding: 12px 14px; border: 1px solid var(--line); border-top: 2px solid var(--theme-brand);
  border-radius: 3px; background: linear-gradient(145deg, color-mix(in srgb, var(--theme-soft) 55%, white), var(--theme-soft));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55);
}
.production-kpi span { display: block; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .04em; }
.production-kpi strong { display: block; margin-top: 5px; color: var(--theme-primary-deep); font-family: "Bahnschrift", "Segoe UI", sans-serif; font-size: 25px; line-height: 1; }
.production-kpi strong small { color: var(--muted); font-family: inherit; font-size: 10px; font-weight: 500; }
.production-kpi .small-value { font-size: 15px; line-height: 1.2; }
.production-kpi em { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; font-style: normal; }
.production-table td { vertical-align: middle; }
.push-slots, .push-machines { max-width: 250px; white-space: normal; line-height: 1.7; }
.machine-chip { display: inline-block; margin: 1px 3px 1px 0; padding: 1px 5px; border: 1px solid var(--theme-line); border-radius: 2px; color: var(--theme-primary); background: var(--theme-soft); font-size: 8.5px; font-weight: 700; }
.push-none { color: var(--theme-muted); font-size: 9px; }
.push-action { display: inline-block; padding: 2px 6px; border-radius: 2px; font-size: 8.5px; font-weight: 700; }
.push-action.is-sync { color: var(--theme-primary); background: var(--theme-soft); border: 1px solid var(--theme-line); }
.push-action.is-clear { color: var(--theme-muted); background: var(--theme-page); border: 1px solid var(--theme-line); }
.production-empty { padding: 34px 18px; text-align: center; border-top: 1px solid var(--line); }
.production-empty strong { display: block; color: var(--theme-primary); font-size: 13px; }
.production-empty span { display: block; margin-top: 6px; color: var(--theme-muted); font-size: 10px; }
@media (max-width: 760px) { .production-summary { grid-template-columns: 1fr; } }



/* 设置页账号操作 */
.settings-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.settings-link {
  display: block; padding: 12px 13px; border: 1px solid var(--theme-line); border-radius: 4px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--theme-soft) 45%, white), #fff);
  text-decoration: none; box-shadow: inset 0 1px 0 rgba(255,255,255,.55);
}
.settings-link b { display: block; color: var(--theme-primary); font-size: 12px; }
.settings-link span { display: block; margin-top: 4px; color: var(--theme-muted); font-size: 9px; line-height: 1.35; }
.settings-link:hover { border-color: var(--theme-brand); background: var(--theme-soft); }
.settings-link.is-danger b { color: var(--theme-primary-deep); }
@media (max-width: 700px) { .settings-links { grid-template-columns: 1fr; } }


/* 登录页深色品牌区：保持浅色标题 */
html[data-theme] .login-brand h1 { color: var(--theme-light); }
html[data-theme] .login-brand .eyebrow { color: color-mix(in srgb, var(--theme-light) 62%, transparent); }

/* 顶部快捷导航 + 手机底部操作条 */
html[data-theme] .app-nav-actions {
  border-right-color: color-mix(in srgb, var(--theme-light) 22%, transparent);
}
html[data-theme] .app-nav-action {
  color: color-mix(in srgb, var(--theme-light) 82%, transparent);
}
html[data-theme] .app-nav-action:hover {
  color: var(--theme-light);
  border-color: color-mix(in srgb, var(--theme-light) 24%, transparent);
  background: color-mix(in srgb, var(--theme-light) 12%, transparent);
}
html[data-theme] .app-mobile-dock {
  background: color-mix(in srgb, var(--theme-page) 94%, white);
  border-top-color: var(--theme-line);
}
html[data-theme] .app-mobile-action {
  color: var(--theme-primary);
}
html[data-theme] .app-mobile-action + .app-mobile-action {
  border-left-color: var(--theme-line);
}
html[data-theme] .app-mobile-action:active {
  background: var(--theme-soft);
}

.cell-version { color: var(--theme-muted); font-family: "Consolas", "Courier New", monospace; font-size: 8px; }
.push-action.is-stale { color: var(--theme-muted); background: var(--theme-page); border: 1px solid var(--theme-line); }
