/* ==========================================================================
   theme.css — MTG 门店 ERP 设计系统覆盖层
   说明：本文件应在 style.css 与 workspace.css 之后加载。
   分节：变量 / 基础 / 按钮与图标 / 登录页 / 侧边栏 / 页面骨架 /
        统计卡片 / 表格与标签 / 表单控件 / 弹窗 / 新组件 / 响应式
   ========================================================================== */

/* ==================== 1. 设计变量 ==================== */
:root {
  --c-bg: #f4f3ee;
  --c-panel: #fff;
  --c-panel-2: #faf9f5;
  --c-ink: #202622;
  --c-muted: #68736c;
  --c-line: #d8ddd6;
  --c-green: #173c2c;
  --c-green-2: #2f6b4f;
  --c-amber: #a86413;
  --c-red: #b42318;
  --c-blue: #2b5c8a;

  --r-sm: 4px;
  --r-md: 6px;
  --r-pill: 999px;

  --font-sans:
    "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", system-ui,
    -apple-system, "Segoe UI", sans-serif;

  /* 旧变量映射到新色板 */
  --green: var(--c-green);
  --mint: #e6efe9;
  --lime: #d9e3d4;
  --bg: var(--c-bg);
  --ink: var(--c-ink);
  --muted: var(--c-muted);
  --line: var(--c-line);
  --red: var(--c-red);

  /* workspace.css 中使用的变量 */
  --focus: var(--c-green-2);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* ==================== 2. 基础 ==================== */
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--c-ink);
  background: var(--c-bg);
}

button,
input,
select,
textarea {
  font-family: inherit;
}

td,
.stat strong,
.pill,
.price,
.amount,
.money,
.total,
.document-total strong,
.ck-price,
.ck-pop-price,
.delta {
  font-variant-numeric: tabular-nums;
}

:focus-visible {
  outline: 2px solid var(--c-green-2);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--c-green-2);
  outline-offset: 2px;
}

/* ==================== 3. 按钮与图标 ==================== */
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: var(--c-panel);
  color: var(--c-ink);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition:
    background-color 0.12s,
    border-color 0.12s,
    color 0.12s;
}

button:hover,
.button:hover {
  background: var(--c-panel-2);
  border-color: #b9c2b9;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button svg.icon,
.button svg.icon {
  width: 16px;
  height: 16px;
}

.primary,
button.primary,
.button.primary {
  background: var(--c-green);
  border-color: var(--c-green);
  color: #fff;
}

.primary:hover,
button.primary:hover,
.button.primary:hover {
  background: var(--c-green-2);
  border-color: var(--c-green-2);
  color: #fff;
}

.dark,
button.dark,
.button.dark {
  background: var(--c-panel);
  border-color: var(--c-line);
  color: var(--c-green);
}

.dark:hover,
button.dark:hover,
.button.dark:hover {
  background: var(--c-panel-2);
  border-color: #b9c2b9;
  color: var(--c-green);
}

.link,
button.link,
.button.link {
  height: 32px;
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--c-green-2);
}

.link:hover,
button.link:hover,
.button.link:hover {
  background: var(--c-panel-2);
  border-color: transparent;
  color: var(--c-green);
}

.danger,
button.danger,
.button.danger {
  background: var(--c-panel);
  border-color: var(--c-line);
  color: var(--c-red);
}

.danger:hover,
button.danger:hover,
.button.danger:hover {
  background: var(--c-panel-2);
  border-color: var(--c-line);
  color: var(--c-red);
}

.icon-button,
.dialog-heading button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--c-muted);
  font-size: 20px;
  line-height: 1;
}

.icon-button:hover,
.dialog-heading button:hover {
  background: var(--c-panel-2);
  border-color: transparent;
  color: var(--c-ink);
}

.icon-button svg.icon,
.dialog-heading button svg.icon {
  width: 16px;
  height: 16px;
}

.toolbar-actions button {
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.toolbar-actions .icon-button {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
}

dialog form > button[type="submit"],
dialog form > button.primary {
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

/* Lucide 图标 */
svg.icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* ==================== 4. 登录页 ==================== */
.auth {
  background: var(--c-bg);
}

.auth-card {
  width: 420px;
  max-width: 100%;
  padding: 32px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: var(--c-panel);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.auth-card h1 {
  margin: 16px 0 8px;
  font-size: 20px;
  font-weight: 600;
}

.auth-brand {
  gap: 12px;
  margin-bottom: 24px;
  font-size: 16px;
}

.auth-brand small {
  margin-top: 4px;
  font-size: 12px;
  color: var(--c-muted);
}

.auth-foot {
  margin-top: 24px;
  font-size: 12px;
  color: var(--c-muted);
}

.eyebrow {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--c-muted);
  text-transform: uppercase;
}

.mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  background: var(--c-green);
  color: #fff;
  font-size: 20px;
  font-weight: 600;
}

/* ==================== 5. 侧边栏 ==================== */
.sidebar {
  padding: 24px 16px;
  background: var(--c-green);
  color: rgba(255, 255, 255, 0.72);
}

.logo {
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
}

.logo small {
  margin-top: 2px;
  font-size: 12px;
  letter-spacing: 0;
  color: rgba(255, 255, 255, 0.55);
}

.nav-label {
  margin: 24px 12px 8px;
  font-size: 12px;
  letter-spacing: 0;
  color: rgba(255, 255, 255, 0.5);
}

nav {
  gap: 4px;
}

.sidebar nav button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 36px;
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  text-align: left;
}

.sidebar nav button span {
  font-size: 14px;
}

.sidebar nav button svg.icon {
  width: 16px;
  height: 16px;
  stroke-width: 1.75;
}

.sidebar nav button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
}

.sidebar nav button.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: none;
}

.sidebar nav button.active:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.connection,
.sidebar-bottom p {
  font-size: 12px;
}

.sidebar-bottom button {
  height: 28px;
  min-height: 28px;
  padding: 0 8px;
  border-color: rgba(255, 255, 255, 0.2);
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.sidebar-bottom button:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.28);
}

/* ==================== 6. 页面骨架 / 标题 / 工具栏 / 面板 ==================== */
header h1 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
}

header .eyebrow {
  margin: 0 0 4px;
}

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

.toolbar {
  gap: 12px;
  margin: 8px 0 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--c-line);
}

.toolbar > p {
  font-size: 12px;
  line-height: 1.7;
}

.toolbar-actions {
  gap: 8px;
}

.panel {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: var(--c-panel);
  box-shadow: none;
}

.panel-heading {
  margin-bottom: 12px;
}

.panel-heading h2,
.section-label h2 {
  font-size: 16px;
  font-weight: 600;
}

/* ==================== 7. 统计卡片 ==================== */
.stats {
  gap: 12px;
}

.stat,
.stat:first-child,
.finance-stats .stat {
  padding: 16px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: var(--c-panel);
  color: var(--c-ink);
  box-shadow: none;
}

.stat p,
.stat:first-child p,
.finance-stats .stat p {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--c-muted);
}

.stat strong,
.finance-stats .stat strong {
  display: block;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.stat small,
.stat:first-child small,
.finance-stats .stat small {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--c-muted);
}

.stat .unit {
  margin-left: 4px;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
}

/* ==================== 8. 表格 / 标签 ==================== */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

th {
  padding: 8px 10px;
  border-bottom: 1px solid var(--c-line);
  background: var(--c-panel-2);
  color: var(--c-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}

td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--c-line);
  font-size: 13px;
  line-height: 1.5;
  vertical-align: middle;
}

tbody tr:hover {
  background: var(--c-panel-2);
}

td small {
  display: block;
  font-size: 12px;
  line-height: 1.5;
  color: var(--c-muted);
}

td button,
td .button {
  height: 28px;
  min-height: 28px;
  padding: 0 8px;
  margin: 0;
  font-size: 12px;
  border-radius: var(--r-md);
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: #eef1ec;
  color: var(--c-muted);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pill.green {
  background: #e6efe9;
  color: var(--c-green);
}

.pill.orange {
  background: #fbf0df;
  color: var(--c-amber);
}

.pill.red {
  background: #fbe9e7;
  color: var(--c-red);
}

.pill.blue {
  background: #e8eff6;
  color: var(--c-blue);
}

/* ==================== 9. 表单控件 ==================== */
input:not([type="checkbox"]):not([type="radio"]),
select {
  height: 36px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: var(--c-panel);
  color: var(--c-ink);
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus {
  outline: 2px solid var(--c-green-2);
  outline-offset: 1px;
  border-color: var(--c-green-2);
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  height: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--c-green);
}

.check input {
  min-height: 0;
  accent-color: var(--c-green);
}

/* ==================== 10. Dialog ==================== */
dialog {
  padding: 20px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: var(--c-panel);
  color: var(--c-ink);
  box-shadow: 0 8px 24px rgba(20, 28, 24, 0.16);
}

dialog::backdrop {
  background: rgba(20, 28, 24, 0.45);
}

.dialog-heading {
  position: sticky;
  top: -20px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding: 8px 0 10px;
  border-bottom: 1px solid var(--c-line);
  background: var(--c-panel);
}

.dialog-heading h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

/* ==================== 11. 商品库存操作列 ==================== */
td[data-col="actions"] {
  width: 150px;
  white-space: normal;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.row-actions-primary {
  display: inline-flex;
  align-items: center;
}

.row-actions-primary .primary,
.row-actions .primary {
  height: 28px;
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.row-more-trigger {
  height: 28px;
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.row-more-menu {
  position: fixed;
  z-index: 50;
  min-width: 148px;
  max-width: calc(100vw - 16px);
  padding: 4px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: var(--c-panel);
  box-shadow: 0 8px 24px rgba(20, 28, 24, 0.12);
}

.row-more-menu[hidden] {
  display: none;
}

.row-more-menu button[role="menuitem"] {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  height: 32px;
  min-height: 32px;
  padding: 0 10px;
  margin: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--c-ink);
  font-size: 13px;
  font-weight: 400;
  line-height: 1;
  text-align: left;
  white-space: nowrap;
}

.row-more-menu button[role="menuitem"]:hover,
.row-more-menu button[role="menuitem"]:focus {
  background: var(--c-panel-2);
  outline: none;
}

.row-more-menu button[role="menuitem"]:focus {
  box-shadow: inset 0 0 0 2px var(--c-green-2);
}

.row-more-menu button[role="menuitem"] svg.icon {
  width: 16px;
  height: 16px;
}

/* ==================== 12. CK 参考价单元格 ==================== */
td[data-col="ck"] {
  width: 110px;
}

.ck-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  width: 100%;
  height: auto;
  min-height: 0;
  padding: 4px 6px;
  margin: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--c-ink);
  text-align: left;
  white-space: normal;
}

.ck-cell:hover {
  background: var(--c-panel-2);
  border-color: transparent;
}

.ck-price {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--c-ink);
  font-variant-numeric: tabular-nums;
}

.ck-sub {
  font-size: 12px;
  line-height: 1.3;
  color: var(--c-muted);
}

.ck-badge {
  display: inline-block;
  margin-left: 3px;
  padding: 1px 4px;
  border-radius: var(--r-sm);
  color: var(--c-muted);
  background: var(--c-panel-2);
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
}

.ck-badges {
  margin: -2px 0 4px;
}

.ck-state-unmatched,
.ck-state-unmatched .ck-price,
.ck-state-unmatched .ck-sub {
  color: var(--c-muted);
}

.ck-state-ambiguous,
.ck-state-ambiguous .ck-price,
.ck-state-ambiguous .ck-sub {
  color: var(--c-amber);
}

.ck-state-nodata,
.ck-state-nodata .ck-price,
.ck-state-nodata .ck-sub {
  color: var(--c-muted);
}

.ck-state-error,
.ck-state-error .ck-price,
.ck-state-error .ck-sub {
  color: var(--c-red);
}

.ck-skeleton {
  display: inline-block;
  width: 56px;
  height: 14px;
  border-radius: var(--r-sm);
  background: var(--c-line);
  animation: ck-pulse 1.2s ease-in-out infinite;
}

@keyframes ck-pulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

.ck-none {
  color: var(--c-muted);
}

/* ==================== 13. CK 详情弹层 ==================== */
.ck-popover {
  position: fixed;
  z-index: 60;
  width: 420px;
  max-width: calc(100vw - 24px);
  padding: 16px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: var(--c-panel);
  color: var(--c-ink);
  box-shadow: 0 12px 32px rgba(20, 28, 24, 0.16);
  box-sizing: border-box;
}

.ck-popover[hidden] {
  display: none;
}

.ck-pop-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ck-pop-head h2,
.ck-pop-head h3,
.ck-pop-head .ck-pop-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.ck-pop-head small,
.ck-pop-head .ck-pop-subtitle {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--c-muted);
}

.ck-pop-head .icon-button {
  flex: none;
  margin: -4px -4px 0 0;
}

.ck-seg {
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: var(--c-panel);
}

.ck-seg button {
  height: 28px;
  min-height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--c-ink);
  font-size: 12px;
  line-height: 1;
}

.ck-seg button + button {
  border-left: 1px solid var(--c-line);
}

.ck-seg button:hover {
  background: var(--c-panel-2);
}

.ck-seg button[aria-pressed="true"] {
  background: var(--c-green);
  color: #fff;
}

.ck-seg button[aria-pressed="true"]:hover {
  background: var(--c-green);
  color: #fff;
}

.ck-pop-price {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--c-ink);
  font-variant-numeric: tabular-nums;
}

.ck-pop-meta {
  font-size: 12px;
  line-height: 1.5;
  color: var(--c-muted);
}

.ck-chart,
.ck-chart svg {
  display: block;
  width: 100%;
  height: 180px;
}

.ck-chart {
  position: relative;
  overflow: visible;
}

.ck-chart .ck-grid-line,
.ck-chart .ck-grid {
  stroke: var(--c-line);
  stroke-width: 1;
}

.ck-chart .ck-line,
.ck-chart .ck-series {
  fill: none;
  stroke: var(--c-blue);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ck-chart .ck-dot,
.ck-chart .ck-point {
  fill: var(--c-panel);
  stroke: var(--c-blue);
  stroke-width: 1.75;
}

.ck-chart .ck-crosshair,
.ck-chart .ck-xhair {
  stroke: var(--c-muted);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.ck-tip {
  position: absolute;
  z-index: 2;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  background: var(--c-ink);
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.ck-pop-foot {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--c-line);
  font-size: 12px;
  line-height: 1.5;
  color: var(--c-muted);
}

.ck-note {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--c-amber);
}

.ck-sync-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--c-muted);
}

/* ==================== 14. 响应式与可访问性 ==================== */
@media (max-width: 720px) {
  td[data-col="actions"],
  td[data-col="ck"] {
    width: auto;
  }

  .row-actions {
    justify-content: flex-end;
  }

  .row-more-menu {
    max-width: calc(100vw - 16px);
  }

  .ck-popover {
    width: calc(100vw - 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ck-skeleton {
    animation: none;
  }
}

/* ==================== 15. 集成修正（Oki 审查后补充） ==================== */
/* 卡图缩略按钮不受通用按钮高度约束 */
.art-thumb,
td .art-thumb {
  height: auto;
  min-height: 80px;
  padding: 3px;
  border-radius: var(--r-sm);
  background: var(--c-panel-2);
  color: var(--c-muted);
  font-size: 12px;
  white-space: normal;
}
/* 侧边栏品牌方块：深绿底上用浅色半透明块 */
.sidebar .mark {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
/* 多行按钮（如 .full 提交按钮、长文案）允许自动高度 */
button.full,
.button.full {
  height: auto;
  min-height: 36px;
  padding: 8px 12px;
  line-height: 1.4;
  white-space: normal;
}
/* 表头里 CK 列标题不换行 */
th[data-col="ck"] {
  white-space: nowrap;
}
/* CK 弹层：与 ck-column.js 实际类名对齐 */
.ck-pop-close {
  flex: none;
  width: 32px;
  height: 32px;
  min-height: 32px;
  margin: -6px -6px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--c-muted);
}
.ck-pop-close:hover {
  background: var(--c-panel-2);
  color: var(--c-ink);
}
.ck-pop-sub {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--c-muted);
}
.ck-seg {
  margin-bottom: 12px;
}
.ck-seg button:disabled {
  color: var(--c-muted);
  background: transparent;
  opacity: 0.45;
}
.ck-pop-body {
  min-height: 60px;
}
.ck-chart {
  margin-top: 8px;
}
.ck-chart .ck-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.ck-chart .ck-axis {
  fill: var(--c-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.ck-chart .ck-cross {
  stroke: var(--c-muted);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.ck-tip {
  z-index: 70;
}
.ck-tip-price {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ck-explain,
.ck-empty,
.ck-loading {
  margin: 8px 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--c-muted);
}
.ck-pop-foot .ck-state-error,
.ck-pop-body .ck-state-error,
.ck-sync-status.ck-state-error {
  color: var(--c-red);
}
/* CK 列：状态文字不折成三行 */
td[data-col="ck"] {
  min-width: 112px;
}
.ck-cell .ck-sub {
  white-space: normal;
}
/* 品相对照已确认：改为普通说明色 */
.ck-note {
  color: var(--c-muted);
}

/* 成本核对：紧凑单元格（摘要行 + 展开明细；悬停 title 显示全部） */
td[data-col="cost"] {
  width: 150px;
  min-width: 150px;
  vertical-align: top;
  overflow: visible;
}

.cost-details {
  font-size: 12px;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}

.cost-details > summary {
  position: relative;
  display: block;
  list-style: none;
  padding-left: 12px;
  margin: 0;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.cost-details > summary::-webkit-details-marker {
  display: none;
}

.cost-details > summary::before {
  content: "▸";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--c-muted);
  font-size: 10px;
  line-height: 1.55;
}

.cost-details[open] > summary::before {
  content: "▾";
}

.cost-main,
.cost-all-line {
  display: block;
  overflow: visible;
  white-space: normal;
}

.cost-all-line {
  color: var(--c-muted);
  font-size: 10px;
  line-height: 1.3;
}

.cost-breakdown {
  margin: 2px 0 0 12px;
  font-size: 12px;
  color: var(--c-muted);
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  overflow: visible;
}

.cost-line {
  white-space: normal;
  overflow: visible;
  font-variant-numeric: tabular-nums;
}

.cost-total {
  margin-top: 2px;
  padding-top: 2px;
  border-top: 1px dashed var(--c-line);
  color: var(--c-ink);
}

/* 对话框与提示块：统一旧浅绿底色为暖白 + 中性描边（Oki） */
.selection-info,
.detail-info,
.getting-started,
.badge {
  background: var(--c-panel-2);
  border-color: var(--c-line);
  color: var(--c-ink);
}
.selection-info,
.detail-info,
.getting-started {
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
}
.getting-started {
  color: var(--c-ink);
}
.line-stock-hint {
  color: var(--c-green-2) !important;
}

/* 商品与库存工具栏下拉（toolbar-menu.js），复用 .row-more-menu 外观 */
.toolbar-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.toolbar-menu-trigger svg.icon:last-child {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}
.toolbar-menu-trigger[aria-expanded="true"] svg.icon:last-child {
  transform: rotate(180deg);
}
.toolbar-menu {
  min-width: 200px;
}
.row-more-menu a[role="menuitem"] {
  display: flex;
  align-items: center;
  width: 100%;
  height: 32px;
  min-height: 32px;
  padding: 0 10px;
  margin: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--c-ink);
  font-size: 13px;
  font-weight: 400;
  text-decoration: none;
  white-space: normal;
  box-shadow: none;
}
.row-more-menu a[role="menuitem"]:hover,
.row-more-menu a[role="menuitem"]:focus {
  background: var(--c-panel-2);
  outline: none;
}
.row-more-menu a[role="menuitem"]:focus {
  box-shadow: inset 0 0 0 2px var(--c-green-2);
}
.row-more-menu [role="menuitem"][hidden] {
  display: none;
}
.row-more-menu a[role="menuitem"] {
  justify-content: flex-start;
  text-align: left;
}
/* 展开后的成本明细允许换行，避免再次被截断 */
.cost-breakdown .cost-line {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

/* 库存表允许文字换行；单个金额保持完整，表格滚动由现有 table-wrap 承担。 */
#inventory-table td { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
#inventory-table .row-actions, #inventory-table .row-actions-primary { flex-wrap: wrap; }
#inventory-table .ck-cell { min-width: 0; box-sizing: border-box; }
#inventory-table .ck-price, #inventory-table .cost-amount { white-space: nowrap; overflow-wrap: normal; word-break: normal; }
#inventory-table .cost-amount, #inventory-table .cost-line > span { display: block; }
#inventory-table .inventory-amount { white-space: nowrap; overflow-wrap: normal; }
#art-dialog #art-locations { overflow-wrap: anywhere; margin: 16px 0; }
#art-dialog #art-locations p { margin: 6px 0; }

#inventory-table [data-col="stock"] .pill { white-space: nowrap; overflow-wrap: normal; }
/* Match review follows the inventory dialog and keeps actions beside their status. */
#card-match-dialog .match-row {
  padding: 16px 0;
  border-top: 1px solid var(--line, #d4d9de);
  overflow-wrap: anywhere;
}
#card-match-dialog .match-row h3 { margin: 0 0 4px; }
#card-match-dialog .match-row p { margin: 4px 0; }
#card-match-dialog .match-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
#card-match-dialog .match-columns button { margin-top: 6px; }
#card-match-dialog .match-detail:not(:empty) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
#card-match-dialog select { max-width: 100%; }
#card-match-dialog .match-detail > * { min-width: 0; max-width: 100%; }
@media (max-width: 560px) {
  #card-match-dialog .match-columns { grid-template-columns: 1fr; }
}
