/* 店簿 · UI-D1b 全业务壳（与 /app.js 共用同一套业务逻辑）
 *
 * 约束：
 *  - 手机优先：375 起不横向溢出；>=768 收为左侧栏；底部导航只在手机固定。
 *  - 颜色/间距/圆角集中为变量；正文 16px 系统字栈，数字 tabular-nums。
 *  - 触控目标 >= 44px；focus 用 2px ring + 2px offset；支持 reduced-motion。
 *  - 只覆盖旧界面生成的业务类名（card / price-list / item-card / form-error…），
 *    不引入外部字体、不内联样式、不改业务逻辑。
 *  - 本文件只被 /ui2/ui2.css 引用；页面不加载 ui2.js。
 */

:root {
  color-scheme: light;
  --color-bg: #ffffff;
  --color-text: #0f172a;
  --color-muted-bg: #f1f5f9;
  --color-muted-text: #475569;
  --color-border: #e2e8f0;
  --color-input: #64748b;
  --color-ring: #2563eb;
  --color-accent: #2f5fd0;
  --color-page: #f4f5f7;
  --color-sale: var(--color-accent);
  --color-fx: var(--color-accent);
  --color-pending-bg: #fef3c7;
  --color-pending-text: #92400e;
  --color-error: #b91c1c;
  --color-success: #15803d;
  --radius: 0.625rem;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --nav-height: 64px;
  /* 顶栏高度：>=768 固定为可测常量，侧栏 sticky top 与锚点滚动都基于它；
     手机端顶栏可换行、且导航在底部固定，因此不依赖该常量。无 JS 时也不重叠。 */
  --header-h: 56px;
  --glass-bg: rgba(255, 255, 255, 0.86);
  --glass-blur: 8px;
  --font-body: 1rem/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang HK", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC",
    sans-serif;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-pop: 0 10px 24px rgba(15, 23, 42, 0.18);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  /* 锚点/焦点滚动时给固定顶栏留出空间；页面只有文档主滚动，无内部滚动容器。 */
  scroll-padding-top: calc(var(--header-h) + var(--space-4));
}

body {
  margin: 0;
  min-width: 0;
  padding-bottom: calc(var(--nav-height) + var(--space-4) + env(safe-area-inset-bottom));
  background: var(--color-bg);
  color: var(--color-text);
  font: var(--font-body);
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--color-ring);
}

:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -100px;
  z-index: 40;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  background: var(--color-sale);
  color: #ffffff;
  text-decoration: none;
}

.skip-link:focus {
  top: var(--space-2);
}

/* ---------------------------------------------------------------- 按钮 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 1rem;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.btn-primary {
  border-color: var(--color-sale);
  background: var(--color-sale);
  color: #ffffff;
}

.btn-ghost {
  border-color: var(--color-border);
  background: var(--color-muted-bg);
  color: var(--color-text);
}

.btn-danger {
  border-color: var(--color-error);
  background: var(--color-error);
  color: #ffffff;
}

.btn-sm {
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  font-size: 0.9375rem;
}

.btn-block {
  width: 100%;
}

.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---------------------------------------------------------------- 页头 */

.app-header {
  position: sticky;
  top: 0;
  /* 顶栏必须高于侧栏：侧栏 sticky 从顶栏下沿开始，滚动时不得盖住页头。 */
  z-index: 30;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}

.app-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  max-width: 80rem;
  min-height: var(--header-h);
  margin: 0 auto;
  padding: var(--space-3) var(--space-4);
}

.brand-block {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2);
  min-width: 0;
}

.brand-mark {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-sub {
  color: var(--color-muted-text);
  font-size: 0.9375rem;
}

.session-block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-muted-bg);
  color: var(--color-muted-text);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.badge-soft {
  border-color: var(--color-border);
  background: var(--color-muted-bg);
  color: var(--color-muted-text);
}

/* ---------------------------------------------------------------- 外壳 */

.main {
  min-width: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  max-width: 80rem;
  margin: 0 auto;
  padding: var(--space-4);
}

.view-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.view {
  min-width: 0;
}

.view-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.view-title {
  margin: 0;
  font-size: 1.375rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.view-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.hint,
.muted {
  color: var(--color-muted-text);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

.muted {
  margin: 0;
}

.hint {
  margin: var(--space-2) 0;
}

/* ---------------------------------------------------------------- 导航 */

.app-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: stretch;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3) calc(var(--space-2) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
}

.nav-title {
  display: none;
}

.nav-primary {
  display: flex;
  flex: 1 1 auto;
  gap: var(--space-2);
  min-width: 0;
}

.nav-more {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: stretch;
}

.nav-item {
  display: inline-flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-muted-bg);
  color: var(--color-text);
  font-size: 0.9375rem;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.nav-item.is-active {
  border-color: var(--color-sale);
  background: var(--color-sale);
  color: #ffffff;
}

/* 结汇用 violet，售出/主操作沿用 teal。 */
.nav-item[data-view="fx"].is-active {
  border-color: var(--color-fx);
  background: var(--color-fx);
  color: #ffffff;
}

.fx-accent {
  color: var(--color-fx);
}

.nav-summary {
  flex: 0 0 auto;
  list-style: none;
  white-space: nowrap;
}

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

.nav-summary:focus-visible,
.nav-summary:hover {
  border-color: var(--color-ring);
}

.nav-more:has(.nav-item.is-active) > .nav-summary {
  border-color: var(--color-ring);
}

.nav-more-list {
  position: absolute;
  right: 0;
  bottom: calc(100% + var(--space-2));
  min-width: 9rem;
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  box-shadow: var(--shadow-pop);
}

/* 关闭时由浏览器原生隐藏，不覆盖 UA 的 details 收起行为。 */
.nav-more[open] > .nav-more-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* ---------------------------------------------------------------- 搜索 */

.search-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-3) 0;
}

.search-row > input {
  flex: 1 1 12rem;
  min-width: 0;
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-input);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
}

/* ---------------------------------------------------------------- 面板与卡片 */

.panel {
  min-width: 0;
  margin: var(--space-4) 0 0;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
}

.panel-title {
  margin: 0 0 var(--space-2);
  font-size: 1.0625rem;
  line-height: 1.35;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.card {
  min-width: 0;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  box-shadow: var(--shadow-card);
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.card-title {
  min-width: 0;
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- 库存 */

.inventory-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  margin: var(--space-4) 0 0;
}

.item-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.item-media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-muted-bg);
}

.item-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-media-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: var(--space-2);
  color: var(--color-muted-text);
  font-size: 0.9375rem;
  text-align: center;
}

.item-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-3);
}

.item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.item-code {
  min-width: 0;
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

/* ---------------------------------------------------------------- 金额行 */

.price-list {
  display: grid;
  grid-template-columns: minmax(0, 7em) minmax(0, 1fr);
  gap: var(--space-1) var(--space-3);
  container-type: inline-size;
  container-name: price-values;
  margin: 0;
}

.price-key {
  min-width: 0;
  color: var(--color-muted-text);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

.price-value {
  min-width: 0;
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* TEXT200： 文本空间不足时让标签与值纵向排列；普通文本仍可在
 * 任意位置换行，只有显式标记为金额的行才保持数字整段并允许本地滚动。 */
@container price-values (max-width: 19em) {
  .price-list > .price-key,
  .price-list > .price-value {
    grid-column: 1 / -1;
  }

  .price-list > .price-value {
    text-align: left;
    margin-bottom: var(--space-2);
  }
}

.price-value.money-value {
  overflow-wrap: normal;
  word-break: normal;
  overflow-x: auto;
}

.price-value.money-value:focus-visible {
  outline-offset: -2px;
}

.num {
  font-variant-numeric: tabular-nums;
}

.is-unknown {
  color: var(--color-muted-text);
  font-style: italic;
}

/* ---------------------------------------------------------------- 状态与提示 */

.state {
  margin: var(--space-4) 0 0;
  padding: var(--space-4);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  background: var(--color-muted-bg);
  color: var(--color-muted-text);
  overflow-wrap: anywhere;
}

.state-loading {
  color: var(--color-muted-text);
}

.state-empty {
  color: var(--color-muted-text);
}

.state-error {
  border-style: solid;
  border-color: var(--color-error);
  background: var(--color-bg);
  color: var(--color-error);
}

.flash {
  position: fixed;
  top: var(--space-3);
  left: var(--space-3);
  right: var(--space-3);
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0 auto;
  max-width: 48rem;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  box-shadow: var(--shadow-pop);
  overflow-wrap: anywhere;
}

.flash-ok {
  border-color: var(--color-success);
  color: var(--color-success);
}

.flash-error {
  border-color: var(--color-error);
  color: var(--color-error);
}

/* ---------------------------------------------------------------- 表单 */

.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.field label {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.field input,
.field select,
.field textarea,
.search-row input,
.filter-grid input,
.filter-grid select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-input);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 1rem;
}

.field textarea {
  min-height: 5rem;
  resize: vertical;
}

.field input[readonly] {
  background: var(--color-muted-bg);
  color: var(--color-muted-text);
}

.field-check {
  flex-direction: row;
  align-items: center;
  gap: var(--space-2);
}

.field-check input {
  width: 1.25rem;
  min-height: 1.25rem;
  flex: 0 0 auto;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2);
}

.filter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2);
  margin: var(--space-3) 0;
}

.filter-actions,
.form-actions,
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.range-actions {
  align-items: center;
}

.cost-fieldset,
.cap-fieldset {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  margin: 0;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.cost-fieldset legend,
.cap-fieldset legend {
  padding: 0 var(--space-1);
  color: var(--color-muted-text);
  font-weight: 600;
}

.form-error {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-error);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-error);
  overflow-wrap: anywhere;
}

.error-text {
  margin: 0;
  color: var(--color-error);
  overflow-wrap: anywhere;
}

[aria-invalid="true"] {
  border-color: var(--color-error);
  box-shadow: 0 0 0 1px var(--color-error);
}

/* 错误区可编程聚焦（tabindex=-1），但不改变键盘 Tab 顺序。 */
.form-error[tabindex="-1"]:focus {
  outline: 2px solid var(--color-error);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- 对话框 */

.dialog {
  width: min(calc(100% - 2 * var(--space-4)), 40rem);
  max-height: 90dvh;
  margin: auto;
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  box-shadow: var(--shadow-pop);
  overflow: auto;
}

.dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.dialog-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.dialog-title {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

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

/* ---------------------------------------------------------------- 照片 */

.photo-current,
.photo-preview {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  margin: var(--space-3) 0 0;
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-muted-bg);
}

.photo-current-img,
.photo-preview-img {
  width: auto;
  max-width: 100%;
  max-height: 12rem;
  border-radius: var(--radius);
  object-fit: contain;
  align-self: center;
}

/* ---------------------------------------------------------------- 统计 */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  margin: 0;
}

.stat {
  min-width: 0;
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-muted-bg);
}

.stat dt {
  color: var(--color-muted-text);
  font-size: 0.875rem;
}

.stat dd {
  margin: 0;
  font-size: 1.0625rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- 待补录 */

.pending-card {
  padding: var(--space-3);
}

.pending-card .field {
  margin-top: var(--space-2);
}

.pending-body {
  min-width: 0;
}

/* ---------------------------------------------------------------- 登录 */

.login-view {
  display: flex;
  justify-content: center;
  padding: var(--space-6) var(--space-4);
}

.login-card {
  width: 100%;
  max-width: 26rem;
  min-width: 0;
  padding: var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  box-shadow: var(--shadow-card);
}

.login-title {
  margin: 0;
  font-size: 1.375rem;
}

.app-footer {
  margin-top: var(--space-8);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

/* ---------------------------------------------------------------- 骨架 */

.skeleton-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.skeleton-card {
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
}

.skeleton-media {
  aspect-ratio: 4 / 3;
  background: var(--color-muted-bg);
}

.skeleton-lines {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
}

.skeleton-line {
  height: 12px;
  border-radius: 62.5rem;
  background: var(--color-muted-bg);
}

.skeleton-line.is-short {
  width: 60%;
}

.skeleton-media,
.skeleton-line {
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}

@keyframes skeleton-pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.55;
  }
}

/* ---------------------------------------------------------------- 平板/桌面 */

@media (min-width: 768px) {
  body {
    padding-bottom: var(--space-4);
  }

  /* 固定高度的可测顶栏：内容单行 + 省略号，不换行、不撑高；
     侧栏 top = 顶栏高度 + 间距，因此滚动时不会被 z-index 更高的侧栏盖住。 */
  .app-header {
    height: var(--header-h);
  }

  .app-header-inner {
    flex-wrap: nowrap;
    height: 100%;
    min-height: 0;
  }

  .brand-block,
  .session-block {
    flex: 0 1 auto;
    min-width: 0;
  }

  .session-block {
    flex-wrap: nowrap;
    justify-content: flex-end;
  }

  .brand-block {
    flex-wrap: nowrap;
    overflow: hidden;
  }

  .brand-sub {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .session-block .badge {
    min-width: 0;
    max-width: 32rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-shell {
    grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
    align-items: start;
    padding: var(--space-4) var(--space-6);
  }

  .app-nav {
    position: sticky;
    top: calc(var(--header-h) + var(--space-4));
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
    /* 长菜单只让侧栏自身在必要时滚动，页面仍是单一文档滚动。 */
    max-height: calc(100vh - var(--header-h) - (2 * var(--space-4)));
    max-height: calc(100dvh - var(--header-h) - (2 * var(--space-4)));
    padding: var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-muted-bg);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .nav-title {
    display: block;
    margin: 0;
    color: var(--color-muted-text);
    font-size: 0.875rem;
    font-weight: 600;
  }

  .nav-primary {
    flex-direction: column;
  }

  .nav-more {
    display: block;
  }

  .nav-item {
    justify-content: flex-start;
    background: var(--color-bg);
  }

  .nav-item.is-active {
    background: var(--color-sale);
  }

  .nav-summary {
    display: flex;
    width: 100%;
  }

  .nav-more-list {
    position: static;
    min-width: 0;
    margin-top: var(--space-2);
    padding: var(--space-2);
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .inventory-grid,
  .skeleton-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  }

  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
  }

  .filter-actions,
  .filter-grid .form-error {
    grid-column: 1 / -1;
  }

  .field-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
  }

  .stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dialog {
    max-height: 88dvh;
  }
}

@media (min-width: 1200px) {
  .inventory-grid,
  .skeleton-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  }
}

/* 很窄屏幕（<352px）让操作按钮占满整行，避免挤压；375 不触发。 */
@media (max-width: 22rem) {
  .btn,
  .nav-summary {
    width: 100%;
  }

  .range-actions,
  .filter-actions,
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------------------------------------------------------------- 资金账户工具
 *
 * 仅服务 view-funds 内新增的“新增资金账户 / 同币种内部转账”面板；沿用
 * 已有 .panel / .form / .field / .form-error 与 44px 触控规范，不改旧页面。
 */

#funds-tools {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: var(--space-3) 0 0;
}

#funds-tools .panel {
  margin: 0;
  padding: var(--space-3);
}

#funds-tools .form-actions {
  margin-top: var(--space-1);
}

#funds-tools .field-check {
  min-height: 44px;
  cursor: pointer;
}

#funds-tools .field-check label {
  cursor: pointer;
}

#funds-readonly-note {
  margin: var(--space-3) 0 0;
}

/* ---------------------------------------------------------------- Liquid glass 顶栏/导航
 *
 * 只有页头与导航工具条使用 >= .86 的浅背景 + 轻微模糊；正文、金额与卡片保持
 * 实底，避免全页玻璃与昂贵动画。浏览器不支持 backdrop-filter、用户要求降低
 * 透明度或更高对比度时，全部退回实底并保留可见边框。
 */

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .app-header,
  .app-nav {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
  }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .app-header,
  .app-nav {
    background: var(--color-bg);
  }
}

@media (prefers-reduced-transparency: reduce) {
  .app-header,
  .app-nav {
    background: var(--color-bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  .app-header,
  .app-nav {
    background: var(--color-bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-color: var(--color-text);
  }

  .card,
  .panel,
  .btn,
  .collection-mode,
  .collection-toolbar,
  .search-row input,
  .field input,
  .field select,
  .field textarea {
    border-color: var(--color-text);
  }

  .collection-mode[aria-pressed="true"] {
    border-color: var(--color-text);
    color: var(--color-text);
  }
}

/* ---------------------------------------------------------------- collection 三模式 */

.collection-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-3) 0 0;
}

.collection-toolbar-title {
  color: var(--color-muted-text);
  font-size: 0.875rem;
}

.collection-mode-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  min-width: 0;
}

.collection-mode {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 0.9375rem;
  cursor: pointer;
}

.collection-mode:hover {
  border-color: var(--color-input);
}

.collection-mode[aria-pressed="true"],
.collection-mode.is-active {
  border-color: var(--color-sale);
  background: var(--color-muted-bg);
  color: var(--color-sale);
  font-weight: 700;
}

.collection-view {
  min-width: 0;
  margin: var(--space-3) 0 0;
}

/* 默认紧凑 grid：网格图最大 160px，卡片只放摘要。 */
.collection-view[data-collection-mode="grid"] {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
  gap: var(--space-4);
}

/* icons：小图标 72px，信息与动作仍然完整可用。 */
.collection-view[data-collection-mode="icons"] {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: var(--space-3);
}

/* list：单列行，40px 缩略图，动作按钮仍保持 44px 触控目标。 */
.collection-view[data-collection-mode="list"] {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.collection-view .collection-card {
  min-width: 0;
  padding: var(--space-3);
}

.collection-view .collection-card .item-body {
  flex: 1 1 auto;
  padding: 0;
  gap: var(--space-2);
}

/* 折叠详情完整展开，不能被卡片 overflow 裁掉。 */
.collection-view .item-card,
.collection-view .sale-card {
  overflow: visible;
}

.collection-media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-height: 160px;
  aspect-ratio: 4 / 3;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-muted-bg);
}

.collection-view[data-collection-mode="icons"] .collection-card,
.collection-view[data-collection-mode="list"] .collection-card {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: var(--space-3);
}

.collection-view[data-collection-mode="icons"] .collection-media {
  width: 72px;
  height: 72px;
  max-height: 72px;
  flex: 0 0 72px;
  aspect-ratio: auto;
}

.collection-view[data-collection-mode="list"] .collection-media {
  width: 44px;
  height: 44px;
  max-height: 44px;
  flex: 0 0 44px;
  padding: 1px;
  aspect-ratio: auto;
}

.collection-view[data-collection-mode="icons"] .collection-media .item-photo,
.collection-view[data-collection-mode="list"] .collection-media .item-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.collection-view[data-collection-mode="icons"] .collection-media .item-media-label,
.collection-view[data-collection-mode="list"] .collection-media .item-media-label {
  width: 100%;
  height: 100%;
  padding: 0;
  font-size: 0.75rem;
  line-height: 1.1;
}

/* 已售默认 compact：72px 缩略图，不产生 4:3 大空图；单卡高度远低于 360px。 */
.collection-view .sale-card .collection-media {
  width: 72px;
  height: 72px;
  max-height: 72px;
  aspect-ratio: auto;
}

.collection-view[data-collection-mode="list"] .sale-card .collection-media {
  width: 44px;
  height: 44px;
  max-height: 44px;
  padding: 1px;
}

/* 售出列表模式按设计不渲染图片；名称限定单行省略，完整名称仍由 title/
 * aria-label 与既有折叠详情保留。不裁切编号、金额或日期，不缩小 44px 触控目标。 */
#sales-list[data-collection-mode="list"] .item-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-view[data-collection-mode="grid"] .sale-card .collection-media {
  margin-bottom: var(--space-2);
}

.card-summary {
  margin: var(--space-2) 0 0;
}

.card-date {
  color: var(--color-muted-text);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.card-details {
  margin-top: var(--space-2);
  border-top: 1px solid var(--color-border);
}

/* 已批准的售出列表专用间距：移除摘要与详情各自 8px 的上外边距（重复 8+8），
 * 每张卡片恰好矮 16px；不改 gap、字号、内边距或 44px 最小高度。 */
.collection-view[data-collection-mode="list"] .sale-card .card-summary,
.collection-view[data-collection-mode="list"] .sale-card .card-details {
  margin-top: 0;
}

.card-details-summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  color: var(--color-muted-text);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.card-details-summary::before {
  content: "▸";
  flex: 0 0 auto;
}

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

.card-details[open] > .card-details-summary {
  color: var(--color-text);
  font-weight: 600;
}

.card-details > .price-list {  margin: var(--space-2) 0 0;
}

/* 售出筛选：编号搜索 + 真实经营日范围；日期不可用时由 JS 禁用并说明。 */
.sales-filter {
  align-items: flex-end;
}

.sales-date-field {
  flex: 0 1 auto;
  min-width: min(100%, 9.5rem);
  max-width: 100%;
}

.sales-filter input[type="search"] {
  flex: 1 1 10rem;
  min-width: 0;
  max-width: 100%;
}

/* 嵌套 field 为纵向 flex：不能继承搜索行 input 的横向 12rem basis。 */
.sales-date-field input {
  flex: 0 0 auto;
  width: 100%;
  height: 44px;
  min-height: 44px;
}

.sales-filter .field label {
  color: var(--color-muted-text);
  font-size: 0.875rem;
  font-weight: 500;
}

/* 筛选区按实际剩余宽度自然换行，平板侧栏旁不挤窄按钮文字。 */
.sales-filter {
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------- B4 财务/审计视图
 *
 * 只服务总览、店铺台账、操作审计、资金账户流水、结汇已结汇 tab；沿用已有
 * 颜色/间距/44px 触控与安全文本规范。所有宽度用 minmax/百分比，375 不横向溢出。
 */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-3) 0;
}

.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 1rem;
  cursor: pointer;
}

.tab.is-active,
.tab[aria-selected="true"] {
  border-color: var(--color-fx);
  background: var(--color-muted-bg);
  color: var(--color-fx);
  font-weight: 700;
}

.tab-panel {
  min-width: 0;
}

.badge-warn {
  border-color: var(--color-pending-text);
  background: var(--color-pending-bg);
  color: var(--color-pending-text);
  font-weight: 600;
}

.pagination {
  margin: var(--space-3) 0;
  min-width: 0;
}

.pagination .filter-actions {
  margin-top: var(--space-2);
}

.dashboard-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.dashboard-card dd {
  overflow-wrap: anywhere;
}

.dashboard-card .hint {
  margin: 0;
  font-size: 0.9375rem;
}

.settle-details {
  margin-top: var(--space-4);
}

.settle-details > summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  margin: 0;
  cursor: pointer;
  list-style-position: inside;
}

.store-event-card,
.audit-card,
.settlement-card,
.funds-entry-card,
.store-unrecorded-card {
  min-width: 0;
}

/* 日期输入保持固定 44px，避免移动端浏览器把 type=date 撑到 192px 高。 */
.filter-grid input[type="date"],
.search-row input[type="date"],
.field input[type="date"] {
  height: 44px;
  min-height: 44px;
}

/* 桌面侧栏：更多菜单常开，隐藏“更多”summary，入口全部平铺且保持 44px。 */
@media (min-width: 768px) {
  .nav-summary {
    display: flex;
  }

  .nav-more[data-nav-static] > .nav-summary {
    display: none;
  }

  .nav-more[data-nav-static] > .nav-more-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    position: static;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .nav-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 0;
    padding: var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-muted-bg);
  }

  .nav-group-title {
    margin: 0;
    color: var(--color-muted-text);
    font-size: 0.875rem;
    font-weight: 600;
  }

  .nav-group .nav-item {
    width: 100%;
  }

  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
  }

  .filter-grid .filter-actions,
  .filter-grid .form-error,
  .filter-grid .hint {
    grid-column: 1 / -1;
  }

  /* 平板/桌面筛选按钮横向换行，绝不竖排成一条窄列。 */
  .filter-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
}

/* ---------------------------------------------------------------- B4 体验修正
 *
 * 首屏优先：日期区间/币种/mock 标记是一行短文本；快捷范围按钮 44px；自定义
 * 日期与口径/来源说明都进 details（默认收起）。金额卡片标题 >= 14px、金额
 * 更突出，并始终保留一行口径。所有宽度用 rem/百分比，375 不横向溢出。
 */

.dashboard-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  margin: var(--space-2) 0 0;
  color: var(--color-muted-text);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

.dashboard-meta-range {
  color: var(--color-text);
  font-weight: 600;
}

.dashboard-filter {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: var(--space-2) 0;
}

.dashboard-ranges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.dashboard-ranges .btn {
  min-width: 44px;
  min-height: 44px;
}

.dashboard-custom {
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-muted-bg);
}

.dashboard-custom-summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--color-muted-text);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.dashboard-custom[open] > .dashboard-custom-summary {
  color: var(--color-text);
  font-weight: 600;
}

.dashboard-custom .filter-grid {
  margin: var(--space-2) 0 var(--space-3);
}

.dashboard-details {
  padding: var(--space-3);
}

.dashboard-details > summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  list-style-position: inside;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.dashboard-details > section {
  margin-top: var(--space-3);
}

.stat-title {
  font-size: 0.875rem;
}

/* 金额突出：1.375rem（22px），同时远高于 14px 的标题下限。 */
.stat dd.stat-amount {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* 始终可见的一行口径；长说明/免责声明放在折叠 details。 */
.basis-line {
  margin: 0;
  color: var(--color-muted-text);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

.dashboard-card-details {
  margin-top: var(--space-1);
}

.dashboard-card-details .hint {
  font-size: 0.875rem;
}

.funds-tool-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

#funds-tools h2 {
  margin-top: 0;
}

.inventory-filter-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-2) 0 0;
}

.store-subtotals .card-details {
  margin-top: var(--space-2);
}

.store-event-meta {
  margin: 0 0 var(--space-1);
}

.ledger-legacy > summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  list-style-position: inside;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.ledger-legacy[open] > summary {
  color: var(--color-text);
  font-weight: 600;
}

@media (max-width: 767px) {
  .nav-more-list {
    max-height: calc(100vh - var(--nav-height) - var(--space-8));
    max-height: calc(100dvh - var(--nav-height) - var(--space-8));
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .nav-more-list .nav-item {
    flex: 0 0 auto;
    width: 100%;
  }

  .nav-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 0;
  }

  .nav-group-title {
    margin: 0;
    padding: 0 var(--space-2);
    color: var(--color-muted-text);
    font-size: 0.875rem;
    font-weight: 600;
  }
}

/* B6 财务写表单：对话框/面板共用实底卡片，金额与口径仍可换行，不横向溢出。 */
.dialog .hint,
.panel .hint {
  margin: var(--space-2) 0;
  color: var(--color-muted-text);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.dialog .field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: var(--space-3);
}

.dialog .dialog-actions {
  flex-wrap: wrap;
  gap: var(--space-2);
}

.fund-adjustment-hint {
  border-left: 3px solid var(--color-sale);
  padding-left: var(--space-2);
}

.writeoff-summary,
.transfer-reverse-summary,
.voucher-reverse-summary {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  background: var(--color-muted-bg);
  overflow-wrap: anywhere;
}

.receipt-chain {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  align-items: center;
  margin: var(--space-2) 0;
}

.receipt-chain .badge {
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* 非经营口径徽标用实底弱色，与正文金额一致保持可读。 */
.badge-nonoperating {
  border: 1px solid var(--color-border);
  background: var(--color-muted-bg);
  color: var(--color-muted-text);
}

/* 写表单在手机 375 宽保持单列；按钮换行而非压缩触控目标。 */
@media (max-width: 480px) {
  .dialog .dialog-actions .btn {
    flex: 1 1 auto;
  }

  .funds-tool-buttons .btn {
    flex: 1 1 auto;
  }
}

/* ------------------------------------------------------------ 可选货品名称
 *
 * 名称在上、编号在下；状态/日期固定在编号行右侧，不覆盖照片。名称最多两行，
 * 完整文本由 title/aria-label 与 UI2 折叠详情保留；编号保持正常字号、自然换行，
 * 不截断/不缩小/不横向溢出（375/768/1440 均适用）。
 */
.item-name {
  display: -webkit-box;
  flex: 1 1 100%;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
}

.item-code-row {
  display: flex;
  flex: 1 1 100%;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1) var(--space-2);
  min-width: 0;
}

.item-code-row > .item-code,
.item-code-row > .card-title {
  flex: 1 1 12ch;
  min-width: 0;
  margin: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.item-code-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-1) var(--space-2);
  margin-left: auto;
  min-width: 0;
}

.item-code-row .badge {
  flex: 0 0 auto;
}


/* 名称是正文，金额仍保持原来的右对齐。 */
.item-name-value { text-align: left; overflow-wrap: anywhere; }

/* 窄卡片详情：名称值另起一行占满整行（标签在上、值全宽），不再被金额列挤成
 * 约 4 个汉字宽的瘦长列；金额行仍保持原右对齐两列布局。 */
.inventory-grid .card-details .price-list > .item-name-value {
  grid-column: 1 / -1;
}

/* 库存分组下拉与“归档只隐藏”固定提示：44px 触控目标，窄屏不横向溢出。 */
.search-row select {
  flex: 0 1 auto;
  min-width: 8.5rem;
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-input);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 1rem;
}

.inventory-archive-notice {
  margin: var(--space-2) 0 0;
}

/* 归档/取消归档：折叠详情内的入口始终可用（44px）；前排入口在窄屏隐藏，
 * 375 不额外挤压既有业务按钮；桌面列表操作区仍显示。 */
.card-details-actions {
  margin-top: var(--space-2);
}

.card-details-actions .btn,
.item-actions .archive-front-action {
  min-height: 44px;
}

@media (max-width: 767px) {
  .item-actions .archive-front-action {
    display: none;
  }
}

/* DISPLAY-1: measured chrome height and adaptive complete navigation labels. */
.app-header { height: auto; }
.app-header-inner { height: auto; min-height: 56px; flex-wrap: wrap; }
.brand-block, .session-block { flex-wrap: wrap; }
.session-block .badge { max-width: 100%; white-space: normal; overflow: visible; }
.session-block .btn { white-space: nowrap; }
html[data-ui-compact] body { padding-bottom: calc(var(--nav-height) + var(--space-4)); }
html[data-ui-compact] .app-header { position: static; }
html[data-ui-compact] .app-header-inner { gap: var(--space-2); }
html[data-ui-compact] .brand-sub { display: none; }
html[data-ui-compact] .app-shell { grid-template-columns: minmax(0,1fr); padding: var(--space-4); }
html[data-ui-compact] .app-nav {
  position: fixed; top: auto; bottom: 0; left: 0; right: 0;
  display: grid; grid-template-columns: repeat(auto-fit,minmax(max(44px,3.25em),1fr));
  max-height: none; overflow: visible; gap: var(--space-2);
  padding: var(--space-2) var(--space-3) calc(var(--space-2) + env(safe-area-inset-bottom));
  border: 0; border-top: 1px solid var(--color-border); border-radius: 0;
  background: var(--color-bg);
}
html[data-ui-compact] .nav-title { display: none; }
html[data-ui-compact] .nav-primary { display: contents; }
html[data-ui-compact] .nav-primary .nav-item { white-space: nowrap; overflow-wrap: normal; justify-content: center; padding-inline: var(--space-1); }
html[data-ui-compact] .nav-more { display: block; position: relative; min-width: 0; }
html[data-ui-compact] .nav-summary { display: flex; justify-content: center; height: 100%; padding-inline: var(--space-1); }
html[data-ui-compact] .nav-more-list {
  position: fixed; inset: auto var(--space-3) calc(var(--nav-height) + var(--space-2));
  width: auto; min-width: 0; max-height: 55dvh; overflow-y: auto;
  margin: 0; padding: var(--space-2); border: 1px solid var(--color-border);
  border-radius: var(--radius); background: var(--color-bg); box-shadow: var(--shadow-pop);
}
html[data-nav-flow] body { padding-bottom: var(--space-4); }
html[data-nav-flow] .app-nav { position: static; }
html[data-nav-flow] .nav-more-list { position: static; grid-column: 1 / -1; max-height: none; }
html[data-nav-flow] .nav-more[open] { grid-column: 1 / -1; }
#display-settings-dialog { max-width: calc(100% - 2 * var(--space-4)); }
#display-settings-dialog .field { margin-block: var(--space-4); }

/* 整体缩放后仍让所有弹窗完整留在实际视口内。 */
.dialog { max-height: calc(90dvh / var(--ui-zoom, 1)); }
/* 浏览器视口单位不会随 body zoom 缩小，侧栏和上拉菜单显式换算可用高度。 */
html:not([data-ui-compact]) .app-nav {
  max-height: calc(100dvh / var(--ui-zoom, 1) - var(--header-h) - 2 * var(--space-4));
}
html[data-ui-compact] .nav-more-list {
  max-height: min(55dvh, calc(100dvh / var(--ui-zoom, 1) - var(--nav-height) - 2 * var(--space-3)));
}
html[data-nav-flow] .nav-more-list { max-height: none; }
html:not([data-ui-compact]) { scroll-padding-top: calc((var(--header-h) + var(--space-4)) * var(--ui-zoom, 1)); }

/* NAV-1: shared outline icons; labels remain the accessible navigation names. */
.nav-icon { width: 1.25em; height: 1.25em; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.nav-item > span { min-width: 0; }
html[data-ui-compact] .nav-primary > .nav-item,
html[data-ui-compact] .nav-summary { flex-direction: column; gap: 0.2em; }
html[data-ui-compact] .nav-more-list .nav-item { justify-content: flex-start; text-align: left; }

/* SELECT-1: selection is beside the code, never on the image. */
.item-select { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin: 0; cursor: pointer; }
.item-select input[type="checkbox"] { width: 1.25em; height: 1.25em; min-height: 0; margin: 0; accent-color: var(--color-sale); }
.inventory-selection { flex-wrap: wrap; }
.inventory-selection .hint { flex-basis: 100%; }
#inventory-selected-only[aria-pressed="true"] { border-color: var(--color-sale); background: var(--color-sale); color: white; }

.photo-gallery { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,120px),1fr)); gap: 12px; }
.photo-choice { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--color-border); border-radius: var(--radius); min-width: 0; cursor: pointer; }
.photo-choice-img { width: 100%; height: 120px; object-fit: contain; }
.photo-choice input[type="radio"] { width: 24px; height: 44px; min-height: 44px; margin: 0; }
.photo-choice span { overflow-wrap: anywhere; }

/* FLOW-1: financial direction, independent of success/error semantics. */
:root { --flow-in: #166534; --flow-out: #b91c1c; }
:root[data-flow-colors="reverse"] { --flow-in: #b91c1c; --flow-out: #166534; }
.flow-in { color: var(--flow-in); }
.flow-out { color: var(--flow-out); }

/* CHART-1: responsive chart, readable disclosure at enlarged text sizes. */
.income-chart { width: 100%; min-width: 0; }
.income-chart svg { display: block; width: 100%; height: auto; }
#reports-income-chart label { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
#reports-income-chart select { max-width: 100%; }

.income-chart-dates { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1rem; font-size: .875rem; overflow-wrap: anywhere; }
#reports-income-chart select { font: inherit; min-height: 2.75rem; padding: .375rem .625rem; border: 1px solid currentColor; border-radius: .5rem; background: transparent; color: inherit; }
#reports-income-chart summary { min-height: 2.75rem; padding-block: .5rem; overflow-wrap: anywhere; }

/* FLOW-2: classified financial statistics, not balances or pending counts. */
.dashboard-card .stat-amount.flow-in, .dashboard-card .stat-amount .flow-in { color: var(--flow-in); }
.dashboard-card .stat-amount.flow-out, .dashboard-card .stat-amount .flow-out { color: var(--flow-out); }

#reports-panel .flow-in { color: var(--flow-in); }
#reports-panel .flow-out { color: var(--flow-out); }

.item-read-content { min-width: 0; overflow-wrap: anywhere; }
.item-read-photo img { display: block; max-width: 100%; max-height: 45vh; object-fit: contain; margin-inline: auto; }
.item-media[role="button"] { cursor: pointer; }
.item-media[role="button"]:focus-visible { outline: 3px solid var(--color-text); outline-offset: 2px; }
.item-read-content dd { overflow-wrap: anywhere; white-space: normal; }

.recovery-confirm-description { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Inventory range controls wrap at narrow widths and large text sizes. */
#inventory-search { flex-wrap: wrap; align-items: end; }
#inventory-search > .field { flex: 1 1 12rem; min-width: 0; }
#inventory-range-error { flex-basis: 100%; }

#reports-contribution-progress progress { width:100%; max-width:100%; }
.account-rate-panel:empty { display:none; }
.account-rate-panel form { display:grid; gap:12px; margin-top:12px; }

.expense-meter { width: 100%; }

.report-tabs { display:flex; flex-wrap:wrap; gap:.25rem; }
.report-tabs .tab { flex:1 1 6rem; min-width:0; white-space:normal; overflow-wrap:anywhere; }
.report-tabs .tab[aria-selected="true"] { border-bottom:3px solid var(--accent, #147d78); font-weight:700; }

/* B1: readable HTML ticks; SVG data geometry remains independent of font scaling. */
.report-bar-frame { display: grid; grid-template-columns: auto minmax(0,1fr); gap: .5rem; align-items: stretch; }
.report-bar-ticks { display: flex; flex-direction: column; justify-content: space-between; padding-block: .25rem; font-size: .875rem; min-width: 0; overflow-wrap: anywhere; }
.report-bar-dates { font-size: .875rem; }

/* B2: same-range sales facts and a keyboard-reachable local table scroller. */
.report-sales-metrics { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,10rem),1fr)); gap:1rem; margin:0; }
.report-sales-metrics dd { margin: .25rem 0 0; font-size:1.25rem; font-weight:700; overflow-wrap:anywhere; }
.report-period-scroll { max-width:100%; overflow-x:auto; margin-top:1rem; }
.report-period-scroll:focus-visible { outline:2px solid var(--color-ring); outline-offset:2px; }
.report-period-table { width:100%; border-collapse:collapse; font-size:.875rem; }
.report-period-table caption { text-align:left; font-weight:700; padding:.75rem 0; }
.report-period-table th,.report-period-table td { padding:.75rem; border-bottom:1px solid var(--color-border); text-align:right; white-space:nowrap; }
.report-period-table th:first-child { text-align:left; }

/* B2 replaces the three duplicate per-series listings with one period table. */
#reports-income-chart > details, #reports-average-chart > details, #reports-volume-chart > details { display:none; }
.report-period-details > summary { min-height:44px; padding-block:.75rem; cursor:pointer; }
/* B4: only header/report controls opt out of legacy all-buttons-full-width. */
@media (max-width:22rem) {
  .app-header-inner { gap:.5rem; }
  .session-block { gap:.25rem; }
  .session-block .btn { width:auto; min-height:44px; padding-inline:.5rem; }
  #report-filter .range-actions { flex-direction:row; flex-wrap:wrap; align-items:center; gap:.5rem; }
  #report-filter .range-actions .btn { width:auto; flex:1 1 auto; min-height:44px; }
  #view-reports .view-actions .btn { width:auto; }
}

.sale-source-records > summary { min-height:44px; padding-block:.75rem; cursor:pointer; }

/* V1: Figma visual alignment, reviewed by Claude; retain financial direction tokens. */
body { background: var(--color-page); font-size: .875rem; line-height: 1.5; }
.view-title { font-size: 1.75rem; font-weight: 600; line-height: 1.25; }
.panel-title, .view h2, .dialog-title { font-size: 1rem; font-weight: 600; line-height: 1.4; }
.view h3 { font-size: .9375rem; font-weight: 600; }
.hint, .muted, .basis-line, .brand-sub { font-size: .8125rem; line-height: 1.5; }
.btn, .btn-sm, .collection-mode, .tab { font-size: .875rem; font-weight: 500; border-radius: .5rem; min-height: 44px; }
.btn-ghost { background: var(--color-bg); }
.field label { font-size: .8125rem; font-weight: 500; color: var(--color-muted-text); }
.field input, .field select, .field textarea, .search-row > input { border-radius: .375rem; font-size: .875rem; }
.panel, .card, .stat { background: var(--color-bg); border-radius: .75rem; }
.panel, .card { padding: 1rem; box-shadow: none; }
.stat { padding: 1rem; border-color: transparent; }
.stat dd.stat-amount, .report-sales-metrics dd { font-size: 1.75rem; font-weight: 500; line-height: 1.25; }
.nav-item { border-color: transparent; background: transparent; color: var(--color-muted-text); font-size: .875rem; font-weight: 400; }
.nav-item.is-active, .nav-item[data-view="fx"].is-active { border-color: transparent; background: var(--color-bg); color: var(--color-accent); font-weight: 500; }
.report-tabs { background: var(--color-bg); border-radius: .75rem; padding-inline: .5rem; }
.report-tabs .tab { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: transparent; color: var(--color-muted-text); }
.report-tabs .tab[aria-selected="true"] { border-bottom-color: var(--color-accent); color: var(--color-accent); font-weight: 600; }
@media (min-width: 768px) {
  html:not([data-ui-compact]) .app-shell { grid-template-columns: minmax(0,13.75rem) minmax(0,1fr); gap: 1.5rem; }
  html:not([data-ui-compact]) .app-nav { border-color: transparent; background: var(--color-muted-bg); box-shadow: none; }
  .panel, .card { padding: 1.25rem; }
}
@media (max-width: 767px) {
  .field input, .field select, .field textarea, .search-row > input { font-size: 1rem; }
}
@media (prefers-contrast: more) {
  .panel, .card, .stat, .nav-item, .report-tabs .tab { border-color: var(--color-text); }
}

/* V2/V3/V4: compact controls, preserve DOM order and all error/status content. */
.inventory-advanced { flex: 0 1 auto; min-width: 0; }
.inventory-advanced > summary { min-height:44px; padding:.625rem .75rem; cursor:pointer; border:1px solid var(--color-border); border-radius:.5rem; }
.inventory-advanced[open] { flex-basis:100%; }
.inventory-filter-fields { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,10rem),1fr)); gap:.75rem; padding-block:.75rem; }
#inventory-search { gap:.5rem; align-items:center; }
#inventory-search > input { flex:1 1 15rem; }
.inventory-selection .hint { margin:0; }
.report-tabs { flex-wrap:nowrap; overflow-x:auto; }
.report-tabs .tab { flex:0 0 auto; white-space:nowrap; padding-inline:1rem; }
.report-range-strip { padding:.5rem 0; color:var(--color-muted-text); font-size:.8125rem; }
#reports-range { display:flex; flex-wrap:wrap; gap:.25rem 1rem; margin:0; }
#reports-range > div { display:flex; gap:.4rem; border:0; padding:0; }
#reports-range dt, #reports-range dd { margin:0; font-size:inherit; }
#report-filter { gap:.5rem; margin-block:.75rem; }
#report-filter .field { gap:.25rem; }
#report-filter .range-actions { gap:.375rem; flex-wrap:wrap; }
@media (min-width:768px) {
  #report-filter { grid-template-columns:minmax(9rem,1fr) minmax(9rem,1fr) auto; align-items:end; }
}
@media (max-width:767px) {
  .view-title, .stat dd.stat-amount, .report-sales-metrics dd { font-size:1.375rem; }
  #report-filter { grid-template-columns:repeat(2,minmax(0,1fr)); }
  #report-filter .range-actions, #report-filter-error { grid-column:1 / -1; }
  #report-filter .range-actions .btn { width:auto; flex:1 1 auto; }
}
.inventory-toolbar-row { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:.5rem 1rem; margin-block:.5rem; }
.inventory-toolbar-row .collection-toolbar { margin:0; }
/* V5: scalable amount columns; never split an amount's digits. */
.stat-grid { grid-template-columns:repeat(auto-fit,minmax(min(100%,16rem),1fr)); }
.stat dd, .stat dd.stat-amount, .report-sales-metrics dd { overflow-wrap:normal; word-break:normal; max-width:100%; overflow-x:auto; }
#report-filter { display:flex; flex-wrap:wrap; align-items:center; }
#report-filter .range-actions { order:0; }
#report-custom-dates { order:1; flex-basis:100%; }
#report-custom-dates > summary { min-height:44px; padding:.5rem 0; cursor:pointer; }
#report-custom-dates:not([open]) { display:none; }
.report-date-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.5rem; }
#report-filter-error { order:2; flex-basis:100%; }
.item-entry-fields { display:grid; gap:1rem; min-width:0; }
.item-entry-grid { min-width:0; }
.local-photo-previews { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,7rem),1fr)); gap:.5rem; }
.local-photo-previews figure { margin:0; min-width:0; }
.local-photo-previews img { width:100%; aspect-ratio:1; object-fit:contain; background:var(--color-muted-bg); border-radius:.5rem; }
.local-photo-previews figcaption { font-size:.8125rem; overflow-wrap:anywhere; }
#item-dialog .dialog-actions { position:sticky; bottom:0; background:var(--color-bg); padding-block:.75rem; border-top:1px solid var(--color-border); z-index:1; }
@media (min-width:900px) {
  #item-dialog.is-create { max-width:min(64rem,calc(100vw - 3rem)); width:64rem; }
  #item-dialog.is-create .item-entry-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.4fr); gap:1.5rem; align-items:start; }
}
/* V6: common-page density, without hiding financial states or controls. */
#accounts-list { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,20rem),1fr)); gap:1rem; align-items:start; }
.account-card > .btn { margin-block-start:.5rem; margin-inline-end:.375rem; }
#view-fx > .view-head .view-title { color:var(--color-text); }
#view-sales .card-title, #accounts-list .card-title { font-size:.9375rem; font-weight:600; }
/* V7: shared secondary-page form rhythm, preserving all fields and permissions. */
#store-filter, #audit-filter { gap:.75rem; align-items:start; }
#store-filter > .hint, #audit-filter > .hint { grid-column:1 / -1; margin:0; }
#audit-all-history { width:1.25rem; height:1.25rem; min-height:0; flex:none; margin:0 .5rem 0 0; }
#audit-filter > label.field > span { display:flex; align-items:center; min-height:44px; font-size:.875rem; }
#archive-generate-form, #user-create-form { gap:1rem; }
@media (min-width:1000px) {
  #store-filter, #audit-filter { grid-template-columns:repeat(4,minmax(0,1fr)); }
  #store-filter .filter-actions { align-self:end; }
  #archive-generate-form, #user-create-form { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  #archive-generate-form > h2, #archive-generate-form > p, #archive-generate-form > .form-actions,
  #user-create-form > h2, #user-create-form > p, #user-create-form > fieldset, #user-create-form > .form-actions { grid-column:1 / -1; }
}
/* V8: list-first account management; immutable role capabilities are prose. */
.user-create-disclosure { margin-bottom:1rem; }
.user-create-disclosure > summary { min-height:44px; padding:.625rem .75rem; cursor:pointer; color:var(--color-accent); border:1px solid var(--color-border); border-radius:.5rem; width:fit-content; }
.user-create-disclosure[open] > summary { margin-bottom:.75rem; }
#users-list .cap-fieldset:disabled .field-check { display:none; }
#users-list .cap-fieldset:disabled { border:0; padding:0; }
#users-list .cap-fieldset:disabled legend { display:none; }
@media (min-width:1000px) {
  #view-ledger .price-list { grid-template-columns:minmax(12rem,30%) minmax(0,1fr); }
}

/* V9: dense desktop record rows; native details retain complete evidence. */
.audit-counts { display:flex; flex-wrap:wrap; gap:.375rem .75rem; margin:0; font-size:.8125rem; }
.audit-counts dt { color:var(--color-muted); }
.audit-counts dd { margin:0 1rem 0 0; font-weight:600; }
@media (min-width:1000px) {
  #audit-list, #store-ledger-list, #archives-list { gap:0; border:1px solid var(--color-border); border-radius:.75rem; overflow:hidden; }
  #audit-list > .card, #store-ledger-list > .card, #archives-list > .card { border:0; border-radius:0; box-shadow:none; padding:.875rem 1rem; border-bottom:1px solid var(--color-border); }
  #audit-list > .card:last-child, #store-ledger-list > .card:last-child, #archives-list > .card:last-child { border-bottom:0; }
  .audit-card { display:grid; grid-template-columns:minmax(10rem,1fr) minmax(0,3fr); gap:.5rem 1.25rem; }
  .audit-card > .card-head { align-content:start; margin:0; }
  .audit-card > .card-summary { margin:0; grid-template-columns:4rem minmax(0,1fr) 4rem minmax(0,1fr); }
  .audit-card > .card-details { grid-column:1 / -1; margin:0; }
  .store-event-card > .card-summary { grid-template-columns:minmax(7rem,1fr) minmax(0,1.5fr) minmax(7rem,1fr) minmax(0,1.5fr) !important; gap:.375rem .75rem; }
  .archive-card { display:grid; grid-template-columns:minmax(12rem,1fr) minmax(0,2fr); gap:.5rem 1.25rem; }
  .archive-card > .card-head, .archive-card > .price-list { margin:0; }
  .archive-card > .archive-integrity, .archive-card > .archive-formats, .archive-card > .item-actions { grid-column:1 / -1; margin:0; }
}

/* V10: user-directed inventory card hierarchy. */
#inventory-list .item-card { display:flex; flex-direction:column; gap:.375rem; }
.item-selection-row { display:flex; justify-content:flex-start; width:100%; min-height:32px; }
.item-selection-row .item-select { min-height:32px; min-width:32px; justify-content:flex-start; }
.item-media-stack { min-width:0; width:100%; }
.item-detail-link { display:block; width:100%; min-height:44px; border:0; background:transparent; color:var(--color-accent); text-align:left; padding:.375rem 0; font:inherit; cursor:pointer; }
.item-detail-link:hover { text-decoration:underline; }
#inventory-list .item-code-row { flex-direction:column; align-items:flex-start; gap:.375rem; }
#inventory-list .item-code-meta { margin-left:0; justify-content:flex-start; }
.item-status-available { background:#e8f5ed; color:#167544; border-color:#cae8d6; }
#inventory-list .item-body { display:flex; flex-direction:column; flex:1; }
#inventory-list .card-summary { display:grid; grid-template-columns:1fr 1fr; gap:.25rem .75rem; }
#inventory-list .card-summary dt:nth-of-type(1) { grid-column:1; grid-row:1; }
#inventory-list .card-summary dd:nth-of-type(1) { grid-column:1; grid-row:2; }
#inventory-list .card-summary dt:nth-of-type(2) { grid-column:2; grid-row:1; }
#inventory-list .card-summary dd:nth-of-type(2) { grid-column:2; grid-row:2; }
#inventory-list .card-summary dd { text-align:left; min-width:0; }
.item-primary-actions { display:flex; flex-wrap:nowrap; justify-content:space-between; align-items:center; gap:.25rem; margin-top:auto; border-top:1px solid var(--color-border); padding-top:.375rem; }
.item-secondary-actions { display:flex; gap:.25rem; margin-left:auto; }
.item-primary-actions .item-icon-action { display:inline-flex; flex-direction:row; align-items:center; justify-content:center; gap:.25rem; min-width:44px; min-height:44px; padding:.375rem; border:0; background:transparent; color:var(--color-muted-text); font-size:0; flex:none; }
.item-primary-actions .item-edit-action { font-size:.875rem; }
.item-primary-actions .item-icon-action:hover, .item-primary-actions .item-icon-action:focus-visible { background:var(--color-muted-bg); color:var(--color-accent); }
.item-primary-actions .btn-danger:hover, .item-primary-actions .btn-danger:focus-visible { color:#b42318; background:#fff0ee; }
.item-action-icon { display:inline-block; width:18px; height:18px; flex:none; order:-1; background:currentColor; mask-size:contain; mask-repeat:no-repeat; mask-position:center; }
.item-edit-photo-preview img { width:96px; height:72px; object-fit:cover; border-radius:.5rem; }
#inventory-list[data-collection-mode="icons"] .item-card,
#inventory-list[data-collection-mode="list"] .item-card { display:grid; grid-template-columns:72px minmax(0,1fr); gap:.375rem .75rem; }
#inventory-list[data-collection-mode="icons"] .item-selection-row,
#inventory-list[data-collection-mode="list"] .item-selection-row { grid-column:1 / -1; }
#inventory-list[data-collection-mode="icons"] .item-media-stack,
#inventory-list[data-collection-mode="list"] .item-media-stack { width:72px; }
@media (max-width:359px) { #inventory-list[data-collection-mode="grid"] { grid-template-columns:minmax(0,1fr); } }
.icon-edit { mask-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M12%2020h9%20M16.5%203.5a2.1%202.1%200%200%201%203%203L9%2017l-4%201%201-4z%22/%3E%3C/svg%3E"); }
.icon-archive { mask-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%204h18v4H3z%20M5%208v12h14V8%20M9%2012h6%22/%3E%3C/svg%3E"); }
.icon-trash { mask-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%206h18%20M9%206V3h6v3%20M5%206l1%2015h12l1-15%20M10%2010v7%20M14%2010v7%22/%3E%3C/svg%3E"); }
#inventory-list .item-code-row > .item-code { flex:0 0 auto; }
.item-selection-row .item-select { min-width:44px; min-height:44px; }
#inventory-list .item-primary-actions .item-icon-action { width:44px; }
#inventory-list .item-primary-actions .item-edit-action { width:auto; }
#inventory-list .item-primary-actions { width:100%; }

#item-quick-content > .btn, #item-full-content > .btn { margin:.5rem .5rem 0 0; }
/* At narrow widths with enlarged text, allow actions to wrap inside the row body. */
@media (max-width:600px) { #inventory-list .item-primary-actions { flex-wrap:wrap; } }

/* V12: aligned search/filter controls, including Safari native selects. */
#inventory-search { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)) auto; align-items:start; gap:.5rem; }
#inventory-search > select, #inventory-search > input { width:100%; min-width:0; height:44px; min-height:44px; padding:.625rem .75rem; box-sizing:border-box; border:1px solid var(--color-input); border-radius:.375rem; background-color:var(--color-bg); font:inherit; }
#inventory-search > select { appearance:none; -webkit-appearance:none; padding-right:2rem; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right .625rem center; }
#inventory-search .inventory-advanced > summary { height:44px; box-sizing:border-box; display:flex; align-items:center; }
#inventory-search .inventory-advanced[open], #inventory-range-error { grid-column:1 / -1; }
#inventory-search .inventory-advanced[open] > summary { width:fit-content; }
#item-edit-photo-tools { display:flex; flex-direction:row; align-items:center; gap:1rem; padding:.5rem 0; }
@media(max-width:767px) {
 #inventory-search { grid-template-columns:repeat(2,minmax(0,1fr)); }
 #inventory-query, #inventory-search .inventory-advanced { grid-column:1 / -1; }
 #inventory-search .inventory-advanced > summary { width:100%; }
}
@media(max-width:480px) {
 #inventory-search { grid-template-columns:minmax(0,1fr); }
 #inventory-search > select, #inventory-search > input { grid-column:1; }
}

/* V13: DSH isolated patch, independently reviewed. */
@media (max-width: 767px) {
  #inventory-search > select,
  #inventory-search > input {
    font-size: max(16px, 1rem);
    height: auto;
    min-height: 44px;
    line-height: 1.5;
  }
}

/* V14: clear filters stays beside the collapsed disclosure. */
#inventory-search > #inventory-filter-clear { min-height:44px; }
@media (min-width:768px) { #inventory-search { grid-template-columns:repeat(3,minmax(0,1fr)) auto auto; } }

/* V16: compact range selection; custom inputs remain reachable by their button. */
#dashboard-custom:not([open]) { display:none; }
.dashboard-ranges { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:2px; padding:3px; border-radius:.5rem; background:var(--color-muted-bg); }
.dashboard-ranges .btn { border-color:transparent; background:transparent; padding-inline:.5rem; }
.dashboard-ranges .btn[aria-pressed="true"] { background:var(--color-bg); color:var(--color-text); box-shadow:0 1px 3px #0001; }
@media(max-width:360px) { .dashboard-ranges { grid-template-columns:repeat(2,minmax(0,1fr)); } }

/* V17 DSH reviewed primary metric grid */
#dashboard-primary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.75rem;
}

#dashboard-primary .stat {
  padding: 0.75rem;
}

#dashboard-primary .stat-amount {
  font-size: 1.25rem;
}

#dashboard-primary .basis-line {
  font-size: 0.8125rem;
}

@media (max-width: 1100px) {
  #dashboard-primary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  #dashboard-primary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 360px) {
  #dashboard-primary {
    grid-template-columns: minmax(0, 1fr);
  }
}

.primary-metric { position:relative; min-width:0; }
.primary-metric .stat-amount { white-space:nowrap; overflow-x:auto; overflow-wrap:normal; max-width:100%; }
.primary-metric-link { border:0; background:transparent; color:var(--color-muted-text); text-align:left; padding:0; min-height:24px; cursor:pointer; }
.primary-metric-link::after { content:""; position:absolute; inset:0; }
.primary-metric .stat-amount { position:relative; z-index:1; }
.primary-metric:focus-within { outline:2px solid var(--color-primary); outline-offset:2px; }
html[data-dashboard-large-text] #dashboard-primary { grid-template-columns:minmax(0,1fr); }
#dashboard-more > summary { min-height:44px; display:flex; align-items:center; cursor:pointer; }
#dashboard-more .stat-grid { grid-template-columns:1fr; }
#dashboard-more .dashboard-card { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); padding:.5rem; }
#dashboard-more .stat-amount { font-size:1rem; }
#dashboard-more .basis-line,#dashboard-more .item-actions { grid-column:1 / -1; }
#dashboard-more .panel { border:0; padding:.5rem; }
#dashboard-primary-warning { color:var(--color-pending-text); }

/* V18 reviewed DSH density patch */
/*
 * Overview density & desktop layout.
 * Isolated stylesheet: no hidden financial text, no line clamping.
 * Mobile layout is intentionally left untouched (base rules only add
 * block display for the currency label and forbid wrapping of the value).
 */

#dashboard-primary .metric-currency {
  display: block;
  font-size: .6875rem;
  font-weight: 400;
  line-height: 1.3;
  color: var(--color-muted-text);
}

#dashboard-primary .metric-number {
  display: block;
  white-space: nowrap;
}

@media (min-width: 768px) {
  #dashboard-more .dashboard-card {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    align-items: center;
    gap: .25rem .75rem;
  }

  #dashboard-more .item-actions {
    grid-column: 3;
    grid-row: 1;
    margin: 0;
  }

  #dashboard-more .basis-line {
    grid-column: 1 / -1;
  }

  #dashboard-more .item-actions .btn {
    min-height: 32px;
    padding: .25rem .5rem;
  }
}

/* V19: isolated DSH account balance emphasis */
body[data-ui="ui2"] .account-card .account-balance {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow-x: auto;
  overflow-wrap: normal;
  min-width: 0;
  max-width: 100%;
  grid-column: 1 / -1;
  margin: 0 0 .5rem;
}

body[data-ui="ui2"] .account-card .account-balance-label {
  grid-column: 1 / -1;
  font-size: .8125rem;
  color: var(--color-muted-text);
}

/* V20 Claude visual review corrections */
#dashboard-primary .stat-amount {
  font-size: 1.75rem;
}

#dashboard-primary .metric-currency {
  font-size: .75rem;
}

#dashboard-primary .primary-metric-link {
  min-height: 44px;
  margin-top: auto;
}

#dashboard-more .item-actions .btn {
  min-height: 44px;
}

#dashboard-more > summary::before {
  content: "▸";
  margin-right: .5rem;
}

#dashboard-more[open] > summary::before {
  content: "▾";
}

@media (max-width: 600px) {
  #dashboard-primary .stat-amount {
    font-size: 1.375rem;
  }
}

/* V22 sales date shortcuts: DSH reviewed output */
#sales-search .sales-presets {display:flex;flex-wrap:wrap;gap:.25rem;flex-basis:100%;} #sales-search .sales-presets .btn {min-height:44px;min-width:44px;} #sales-search .sales-presets .btn[aria-pressed="true"] {background:var(--color-muted-bg);font-weight:600;} .sale-payment-status {margin-top:.25rem;} @media(max-width:600px){#sales-search .sales-presets{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));width:100%;} #sales-search .sales-presets .btn{padding-inline:.25rem;}}
/* GPT review: native date inputs fill the same mobile row as search. */
@media(max-width:600px){#sales-search .sales-date-field input{width:100%;min-width:0;box-sizing:border-box;}}
@media(max-width:600px){#sales-search .sales-date-field{width:100%;flex:0 0 100%;}}

/* V23 DSH scoped finance filters; reviewed by GPT */
#sales-search .sales-finance-filter {
  min-width: 0;
  flex: 1 1 10rem;
}

#sales-search .sales-finance-filter select {
  width: 100%;
  min-height: 44px;
}

#sales-match-summary {
  margin: .5rem 0;
}

@media (max-width: 600px) {
  #sales-search .sales-finance-filter {
    width: 100%;
    flex: 0 0 100%;
  }
}

/* V24 DSH scoped summary, GPT reviewed */
#sales-amount-summary .sales-currency-totals {display:flex;flex-wrap:wrap;gap:.5rem 1.25rem;margin:.25rem 0 .75rem;}
#sales-amount-summary .sales-currency-total {min-width:0;overflow-wrap:anywhere;}
#sales-amount-summary h2 {font-size:1rem;margin:.5rem 0;}
@media(max-width:600px){#sales-amount-summary .sales-currency-totals{display:grid;grid-template-columns:minmax(0,1fr);}}

/* V25 Safari reviewed DSH fix */
/* Sales finance filter selects.
   Mirrors the native-appearance reset used by `#inventory-search > select`
   in ui2.css, re-scoped and extended with touch-target sizing. */

#sales-search .sales-finance-filter select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 0.75rem 0.5rem;
  padding-inline-end: 2rem;
  min-height: 44px;
  box-sizing: border-box;
  padding-block: 0.625rem;
  line-height: 1.25;
}

#store-presets{display:flex;flex-wrap:wrap;gap:.25rem;margin-bottom:.75rem;} #store-presets .btn{min-height:44px;} #store-presets [aria-pressed="true"]{background:var(--color-muted-bg);font-weight:600;}

/* V26 reviewed DSH ledger layout */
.store-primary-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.store-primary-metric {
  min-width: 0;
  padding: 1rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

.store-primary-metric strong {
  display: block;
  font-size: 1.4rem;
  overflow-wrap: anywhere;
  margin-top: 0.5rem;
}

@media (max-width: 700px) {
  .store-primary-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #store-presets {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  #store-presets .btn {
    min-width: 0;
    padding-inline: 0.2rem;
  }
}

@media (max-width: 360px) {
  .store-primary-metrics {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* V27 reviewed DSH table; GPT adjusted colspan-safe column widths */
@media (min-width: 900px) {
  .store-desktop-table {
    display: table;
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
  }

  .store-mobile-events {
    display: none;
  }
}

@media (max-width: 899.98px) {
  .store-desktop-table {
    display: none;
  }

  .store-mobile-events {
    display: block;
  }
}

.store-desktop-table th,
.store-desktop-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
  overflow-wrap: anywhere;
}

.store-desktop-table th {
  font-size: 0.875rem;
  color: #64748b;
}

.store-desktop-table th:nth-child(1) {
  width: 12%;
}

.store-desktop-table th:nth-child(2) {
  width: 12%;
}

.store-desktop-table th:nth-child(3) {
  width: 24%;
}

.store-desktop-table th:nth-child(4) {
  width: 38%;
}

.store-desktop-table th:nth-child(5) {
  width: 14%;
}

.store-desktop-table .price-list {
  display: block;
}

.store-desktop-table .price-list dd {
  margin: 0 0 0.5rem;
}

#store-type {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1.41 0 6 4.59 10.59 0 12 1.41 6 7.41 0 1.41z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 0.75rem 0.5rem;
  padding-right: 2.25rem;
  min-height: 44px;
}

.store-mobile-events{display:grid;gap:.75rem;} @media(min-width:900px){.store-mobile-events{display:none;}} #store-type{box-sizing:border-box;padding-block:.625rem;line-height:1.25;}
/* Keep amount labels and values paired within each table row. */
.store-desktop-table > tbody > tr > td > .price-list{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:.25rem .5rem;margin:0;}
.store-desktop-table > tbody > tr > td > .price-list dd{margin:0;}

/* V28 DSH pending FX layout reviewed */
#fx-list .fx-pending-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto;
  gap: 1rem;
  align-items: center;
}

#fx-list .fx-pending-card .price-list {
  margin: 0;
}

.fx-pending-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (max-width: 700px) {
  #fx-list .fx-pending-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .fx-pending-actions .btn {
    min-height: 44px;
    flex: 1 1 auto;
  }
}

/* V29 minimal integration for DSH audit renderer. */
.audit-desktop-table{display:none;} .audit-mobile-entries{display:grid;gap:.75rem;}
@media(min-width:900px){.audit-mobile-entries{display:none;} .audit-desktop-table{display:table;width:100%;table-layout:fixed;border-collapse:collapse;} .audit-desktop-table th,.audit-desktop-table td{padding:.75rem;vertical-align:top;text-align:left;border-bottom:1px solid var(--color-border);overflow-wrap:anywhere;} .audit-desktop-table th{color:var(--color-text-secondary);font-size:.875rem;} .audit-desktop-table th:nth-child(1){width:20%;}.audit-desktop-table th:nth-child(2){width:18%;}.audit-desktop-table th:nth-child(3){width:18%;}.audit-desktop-table th:nth-child(4){width:28%;}.audit-desktop-table th:nth-child(5){width:16%;}}

/* V30: archive versions; original cards remain on narrow screens. */
.archive-desktop-table { display:none; }
.archive-mobile-entries { display:grid; gap:.75rem; }
@media (min-width:900px) {
  .archive-mobile-entries { display:none; }
  .archive-desktop-table { display:table; width:100%; table-layout:fixed; border-collapse:collapse; }
  .archive-desktop-table th, .archive-desktop-table td { padding:.75rem; text-align:left; vertical-align:top; overflow-wrap:anywhere; border-bottom:1px solid var(--color-border); }
  .archive-desktop-table th { color:var(--color-text-secondary); font-size:.875rem; }
  .archive-desktop-table th:nth-child(1) { width:16%; }
  .archive-desktop-table th:nth-child(2) { width:7%; }
  .archive-desktop-table th:nth-child(3) { width:23%; }
  .archive-desktop-table th:nth-child(4) { width:13%; }
  .archive-desktop-table th:nth-child(5) { width:23%; }
  .archive-desktop-table th:nth-child(6) { width:18%; }
}

.item-read-state { display:flex; flex-wrap:wrap; gap:.5rem; align-items:center; margin:.5rem 0; }

/* V40 full details: Figma overview / records columns. */
#item-full-dialog {
  width: min(calc(100% - 2rem), 70rem);
}

.full-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.3fr);
  gap: 1.25rem;
  margin-top: 1rem;
}

.full-detail-layout > * {
  min-width: 0;
}

.full-detail-overview,
.full-detail-body {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 1.25rem;
}

.full-detail-fields > .price-list {
  margin-top: 0;
}

.full-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.full-detail-actions button {
  max-width: 100%;
  white-space: normal;
}

.full-detail-overview img {
  width: 100%;
  height: auto;
  max-height: 45vh;
  object-fit: contain;
}

@media (max-width: 767px) {
  #item-full-dialog {
    width: calc(100% - 1rem);
  }

  .full-detail-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
  }

  .full-detail-overview,
  .full-detail-body {
    padding: 0.875rem;
  }
}

/* V41: full detail is a normal page in the application shell, not a modal. */
#item-full-dialog.full-detail-page { width:100%; max-width:none; min-width:0; }
.full-detail-page .full-detail-layout { margin-top:1rem; }
@media (min-width:768px) {
 .full-detail-page .full-detail-fields > .price-list { grid-template-columns:minmax(9rem,1fr) minmax(0,1.3fr); }
}

/* V50 trial readability: DS authored, GPT scoped */
@media (min-width: 601px) {
#dashboard-primary {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
}
}

html[data-dashboard-large-text] #dashboard-primary {
  grid-template-columns: 1fr;
}

#dashboard-primary .stat-amount,
#dashboard-primary .metric-number {
  white-space: normal;
  overflow-wrap: anywhere;
  overflow: visible;
  max-width: 100%;
}

#sales-search { gap: .5rem; }

@media (min-width: 1000px) {
  #sales-list[data-collection-mode="list"] .sale-card .item-body {
    display: grid;
    grid-template-columns: minmax(10rem, 1fr) minmax(18rem, 1.5fr) auto;
    gap: .5rem 1rem;
    align-items: start;
  }

  #sales-list[data-collection-mode="list"] .sale-card .item-body > .card-head { grid-column: 1; grid-row: 1 / span 2; }
  #sales-list[data-collection-mode="list"] .sale-card .item-body > .card-summary { grid-column: 2; grid-row: 1 / span 2; margin: 0; }
  #sales-list[data-collection-mode="list"] .sale-card .item-body > .sale-payment-status { grid-column: 3; grid-row: 1; justify-self: start; margin: 0; }
  #sales-list[data-collection-mode="list"] .sale-card .item-body > .item-actions { grid-column: 3; grid-row: 2; margin: 0; flex-wrap: wrap; }
  #sales-list[data-collection-mode="list"] .sale-card .item-body > .card-details { grid-column: 1 / -1; margin: 0; padding-top: .5rem; }
  #sales-list[data-collection-mode="list"] .sale-card .card-head .item-code-row { display: block; }
}

/* V52 DS account statement */
#funds-detail #funds-detail-balances {
  grid-template-columns: max-content minmax(0, 1fr);
}

#funds-detail #funds-detail-balances dt {
  white-space: nowrap;
}

#funds-detail #funds-detail-balances dd {
  min-width: 0;
  overflow-wrap: anywhere;
}

#funds-detail .fund-statement-scroll {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

#funds-detail .fund-statement-scroll:focus {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

#funds-detail .fund-statement {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
}

#funds-detail .fund-statement th,
#funds-detail .fund-statement td {
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: top;
}

#funds-detail .fund-statement th:nth-child(n + 3),
#funds-detail .fund-statement td:nth-child(n + 3) {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#funds-detail .fund-statement th:nth-child(2),
#funds-detail .fund-statement td:nth-child(2) {
  width: 35%;
  white-space: normal;
  overflow-wrap: anywhere;
}

#funds-detail details .fund-statement-scroll {
  width: 100%;
}

@media (max-width: 600px) {
  #funds-detail #funds-detail-balances {
    grid-template-columns: minmax(0, 1fr);
  }

  #funds-detail #funds-detail-balances dt,
  #funds-detail #funds-detail-balances dd {
    text-align: left;
  }
}

/* V52 DS user table */
#users-list .users-table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

#users-list .users-table {
  width: 100%;
  border-collapse: collapse;
}

#users-list .users-table th,
#users-list .users-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
}

#users-list .users-table td {
  overflow-wrap: anywhere;
}

#users-list .users-table summary {
  color: inherit;
  white-space: nowrap;
}

#users-list .users-table .card {
  margin: 12px 0;
  min-width: 0;
}

@media (max-width: 600px) {
  #users-list .users-table,
  #users-list .users-table tbody {
    display: block;
  }

  #users-list .users-table thead {
    display: none;
  }

  #users-list .users-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-bottom: 1px solid #e5e7eb;
  }

  #users-list .users-table td {
    display: block;
    padding: 8px;
  }

  #users-list .users-table td.users-perms {
    grid-column: 1 / -1;
  }
}

/* V52 DS visual review correction */
#users-list .users-table-scroll {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

#users-list .users-table caption {
  text-align: left;
  padding: 16px;
  font-weight: 600;
}

#users-list .users-table summary {
  color: #4263c7;
}

#funds-detail .fund-statement caption {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
}

#funds-detail .fund-statement th {
  text-align: left;
}

#funds-detail .fund-statement th:nth-child(n+3) {
  text-align: right;
}

#store-unrecorded > details > summary {
  padding: 12px 0;
  cursor: pointer;
  font-weight: 600;
}

/* V53 DS forms, selector contracts reviewed by GPT */
/* ==========================================================================
   Forms — sale & item dialogs
   Scoped only to #sale-dialog / #item-dialog. No site-wide selectors.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Dialog shell
   -------------------------------------------------------------------------- */
#sale-dialog,
#item-dialog {
  width: min(72rem, calc(100vw - 2rem));
  max-width: min(72rem, calc(100vw - 2rem));
}

#sale-dialog .dialog-title,
#item-dialog .dialog-title {
  font-size: 28px;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Sale entry — single column by default
   -------------------------------------------------------------------------- */
#sale-dialog .sale-entry-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

/* White panels: product (left) and main (right) */
#sale-dialog .sale-entry-product,
#sale-dialog .sale-entry-main {
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 20px;
  min-width: 0;
}

/* Main area + cost fieldset — single column by default */
#sale-dialog .sale-entry-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

#sale-dialog .cost-fieldset {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

/* Full-row blocks inside the single-column grids */
#sale-dialog .sale-entry-main > fieldset,
#sale-dialog .sale-entry-main > .form-section-title,
#sale-dialog .sale-entry-main > .field-check,
#sale-dialog .cost-fieldset > .form-section-title,
#sale-dialog .cost-fieldset > fieldset,
#sale-dialog .cost-fieldset > .field-check {
  grid-column: 1 / -1;
}

/* Selected product summary media */
#sale-dialog #sale-selected-summary .item-read-photo {
  aspect-ratio: 1;
  min-width: 0;
  overflow: hidden;
}

#sale-dialog #sale-selected-summary .item-read-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  max-width: 100%;
}

/* Section titles */
#sale-dialog .form-section-title,
#item-dialog .form-section-title {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
}

/* Sticky action bar */
#sale-dialog .dialog-actions {
  position: sticky;
  bottom: 0;
  padding: 12px 0;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
}

/* --------------------------------------------------------------------------
   Item entry (create only) — compact two columns on desktop
   -------------------------------------------------------------------------- */
#item-dialog .item-entry-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

#item-dialog .item-entry-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

/* --------------------------------------------------------------------------
   Desktop
   -------------------------------------------------------------------------- */
@media (min-width: 900px) {
  /* Sale: product | main  ->  1fr 2fr */
  #sale-dialog .sale-entry-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  }

  #sale-dialog .sale-entry-main {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #sale-dialog .cost-fieldset {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Item create: form | fields -> 1fr 2fr, fields side by side */
  #item-dialog.is-create .item-entry-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  }

  #item-dialog.is-create .item-entry-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Full-row blocks inside item entry fields */
  #item-dialog.is-create .item-entry-fields > fieldset,
  #item-dialog.is-create .item-entry-fields .field:has(textarea),
  #item-dialog.is-create .item-entry-fields #item-reason-field {
    grid-column: 1 / -1;
  }
}

/* --------------------------------------------------------------------------
   Small screens — keep everything single column
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
  #sale-dialog,
  #item-dialog {
    width: calc(100vw - 1rem);
    max-width: calc(100vw - 1rem);
  }

  #sale-dialog .sale-entry-product,
  #sale-dialog .sale-entry-main {
    padding: 12px;
  }

  #sale-dialog .sale-entry-grid,
  #sale-dialog .sale-entry-main,
  #sale-dialog .cost-fieldset,
  #item-dialog .item-entry-grid,
  #item-dialog .item-entry-fields {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* --------------------------------------------------------------------------
   Hidden state must always win — keep last
   -------------------------------------------------------------------------- */
#sale-dialog [hidden],
#item-dialog [hidden] {
  display: none !important;
}

/* V53 DS account subview */
#view-funds:has(#funds-detail:not([hidden])) > .view-head { display: none; }
#funds-balances:has(#funds-detail:not([hidden])) > section[aria-labelledby=accounts-title] { display: none; }
#funds-detail-title { font-size: 28px; font-weight: 600; }
#funds-detail-current { font-size: 28px; font-weight: 600; margin: 8px 0 24px; }
#funds-detail > .panel { margin: 0; }

/* V53 GPT fallback: DS completed without output artifact; mobile space correction. */
@media (max-width:600px) {
  #sale-dialog #sale-selected-summary .item-read-photo { height:160px; aspect-ratio:auto; }
  #sale-dialog .dialog-actions, #item-dialog .dialog-actions { display:flex; flex-direction:row; flex-wrap:nowrap; gap:8px; }
  #sale-dialog .dialog-actions > .btn, #item-dialog .dialog-actions > .btn { width:auto; min-width:0; flex:1 1 0; }
  #sale-dialog .dialog-head .btn, #item-dialog .dialog-head .btn { width:auto; flex:none; }
}

/* V54 DS list/report breadth */
/* 报表页：筛选、库存摘要与统计指标 */

#sales-search .sales-advanced {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
}

#sales-search .sales-advanced summary {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
}

#sales-search .sales-advanced[open] {
  flex-basis: 100%;
}

#sales-search .sales-advanced-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 12px 0;
}

#sales-search .sales-advanced-fields > .field {
  min-width: 0;
  max-width: none;
  margin: 0;
}

#sales-search .sales-advanced-fields input,
#sales-search .sales-advanced-fields select {
  width: 100%;
  min-width: 0;
}

#inventory-result-summary {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0;
}

#inventory-result-summary .inventory-result-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin: 0;
}

#inventory-result-summary .inventory-result-totals > div {
  min-width: 0;
}

#inventory-result-summary .inventory-result-totals dt {
  font-size: 13px;
  color: var(--color-muted-text);
}

#inventory-result-summary .inventory-result-totals dd {
  margin: 4px 0 0;
  font-size: 20px;
  font-weight: 600;
  white-space: nowrap;
  overflow-x: auto;
  max-width: 100%;
}

#report-panel-summary .stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

#report-panel-summary .stat {
  border: 1px solid var(--color-border);
}

#report-panel-summary .stat dd {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.25;
}

#view-reports .report-summary-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 600px) {
  #sales-search .sales-advanced-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #sales-search input[type="search"] {
    flex-basis: 100%;
  }

  #report-panel-summary .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #report-panel-summary .stat dd {
    font-size: 22px;
  }
}

@media (max-width: 360px) {
  #sales-search .sales-advanced-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  #report-panel-summary .stat-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* V55 DS pending FX table */
/* fx-table.css — scoped styles for the pending-settlement table and settled totals.
   Scope: .fx-pending-table-wrap / .fx-pending-table / #settled-totals .price-list
   No global resets or element selectors outside these scopes. */

/* ---------- Table wrapper ---------- */
.fx-pending-table-wrap {
  width: 100%;
  min-width: 0;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  overflow: hidden;
}

/* Keep the 100%-wide wrapper and its contents from overflowing on border-box. */
.fx-pending-table-wrap,
.fx-pending-table-wrap * {
  box-sizing: border-box;
}

/* ---------- Table base ---------- */
.fx-pending-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.fx-pending-table th,
.fx-pending-table td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid #ececec;
  vertical-align: top;
}

.fx-pending-table th {
  color: #888;
  font-size: 12px;
  font-weight: 500;
}

.fx-pending-table td {
  font-size: 14px;
  color: #222;
}

/* ---------- Column widths: 32% / 24% / 14% / 30% ---------- */
.fx-pending-table th:nth-child(1),
.fx-pending-table td:nth-child(1) {
  width: 32%;
}

.fx-pending-table th:nth-child(2),
.fx-pending-table td:nth-child(2) {
  width: 24%;
}

.fx-pending-table th:nth-child(3),
.fx-pending-table td:nth-child(3) {
  width: 14%;
}

.fx-pending-table th:nth-child(4),
.fx-pending-table td:nth-child(4) {
  width: 30%;
}

/* ---------- Headings and helper text ---------- */
.fx-pending-table-wrap h3 {
  margin: 0;
  font-size: 16px;
}

.fx-pending-table-wrap small {
  color: #888;
}

/* ---------- Amount cell ---------- */
.fx-pending-table td:nth-child(2) {
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* ---------- Badge ---------- */
.fx-pending-table .badge {
  background: #fff3db;
  color: #8a5c12;
}

/* ---------- Actions ---------- */
.fx-pending-table .fx-pending-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fx-pending-table .fx-pending-actions button {
  min-height: 44px;
}

/* ---------- Mobile: rows become cards (<=600px) ---------- */
@media (max-width: 600px) {
  .fx-pending-table,
  .fx-pending-table thead,
  .fx-pending-table tbody,
  .fx-pending-table tr,
  .fx-pending-table td {
    display: block;
  }

  .fx-pending-table thead {
    display: none;
  }

  .fx-pending-table tr {
    padding: 16px;
    border-bottom: 1px solid #ececec;
  }

  .fx-pending-table td:nth-child(n) {
    border: 0;
    padding: 6px 0;
    width: auto;
    display: flex;
    gap: 12px;
    justify-content: space-between;
  }

  .fx-pending-table td::before {
    content: attr(data-label);
    font-size: 12px;
    color: #888;
  }

  .fx-pending-table td:first-child {
    display: block;
  }

  .fx-pending-table td:first-child::before {
    display: none;
  }

  .fx-pending-table td:nth-child(4) {
    display: block;
  }

  .fx-pending-table td:nth-child(4)::before {
    display: none;
  }

  .fx-pending-table .fx-pending-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Keep every scoped element from forcing horizontal overflow. */
  .fx-pending-table-wrap,
  .fx-pending-table-wrap * {
    min-width: 0;
    max-width: 100%;
  }
}

/* V56 DS settled summary */
/* Scoped to the settled-summary component only. */
.settled-summary {
  min-width: 0;
}

.settled-summary .settled-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
}

.settled-summary .settled-kpi {
  box-sizing: border-box;
  min-width: 0;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
}

.settled-summary .settled-kpi dt {
  font-size: 13px;
  color: var(--color-muted-text);
  overflow-wrap: anywhere;
}

.settled-summary .settled-kpi dd {
  margin: 8px 0 0;
  overflow-x: auto;
  font-size: 28px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  white-space: nowrap;
}

.settled-summary p.settled-summary-meta {
  font-size: 13px;
}

.settled-summary ul.settled-foreign {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0;
  margin: 12px 0;
  list-style: none;
}

.settled-summary ul.settled-foreign > li {
  max-width: 100%;
  padding: 6px 10px;
  overflow-wrap: anywhere;
  background: #f3f4f6;
  border-radius: 6px;
}

@media (max-width: 800px) {
  .settled-summary .settled-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settled-summary .settled-kpi dd {
    font-size: 22px;
  }
}

@media (max-width: 360px) {
  .settled-summary .settled-kpis {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* V57 DS layouts */
/* Layout adjustments scoped to the settings dialog, login view, and funds account tools. */

#display-settings-dialog {
  width: min(680px, calc(100% - 32px));
}

#display-settings-dialog .settings-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  margin: 16px 0;
}

#display-settings-dialog .settings-group h3 {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 15px;
}

#display-settings-dialog .settings-group .field {
  margin: 0;
  min-width: 0;
}

#display-settings-dialog .settings-group select {
  width: 100%;
}

@media (max-width: 600px) {
  #display-settings-dialog .settings-group {
    grid-template-columns: 1fr;
  }
}

#login-view .login-card {
  background: #fff;
  padding: 32px;
  border-radius: 16px;
  max-width: 420px;
}

#login-view .login-title {
  font-size: 28px;
  line-height: 1.25;
  margin: 16px 0;
}

#login-view .login-card form {
  margin-top: 24px;
}

@media (max-width: 600px) {
  #login-view .login-card {
    padding: 24px;
  }
}

@media (min-width: 1200px) {
  #view-funds:not([hidden]):has(#funds-tools:not([hidden])) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-areas:
      "head head"
      "state state"
      "note note"
      "main tools"
      "options options";
    gap: 16px;
  }

  #view-funds:not([hidden]):has(#funds-tools:not([hidden])) > .view-head {
    grid-area: head;
  }

  #view-funds:not([hidden]):has(#funds-tools:not([hidden])) > #funds-state {
    grid-area: state;
  }

  #view-funds:not([hidden]):has(#funds-tools:not([hidden])) > #funds-readonly-note {
    grid-area: note;
  }

  #view-funds:not([hidden]):has(#funds-tools:not([hidden])) > #funds-balances {
    grid-area: main;
    min-width: 0;
  }

  #view-funds:not([hidden]):has(#funds-tools:not([hidden])) > #funds-tools {
    grid-area: tools;
    margin: 0;
    align-self: start;
  }

  #view-funds:not([hidden]):has(#funds-tools:not([hidden])) > #funds-options {
    grid-area: options;
  }

  #funds-tools .funds-tool-buttons {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  #funds-tools .form-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  #funds-tools .form-row input,
  #funds-tools .form-row select {
    width: 100%;
    min-width: 0;
  }
}

/* V60: DS-authored full-detail sections, existing price permissions retained. */
/* 详情分区：右栏白卡改为分组卡片流（对齐 Figma 38/39） */
.full-detail-page .full-detail-body {
  background: transparent; border: 0; padding: 0;
}
.full-detail-page .detail-data-groups {
  display: grid; gap: 16px;
}
.full-detail-page .detail-data-group {
  min-width: 0; padding: 20px;
  background: var(--color-bg); border: 1px solid var(--color-border); border-radius: 12px;
}
.full-detail-page .detail-group-title {
  margin: 0 0 16px; font-size: 16px; font-weight: 600;
}
.full-detail-page .detail-data-group .price-list {
  margin: 0; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
}
.full-detail-page .detail-data-group .price-list dt {
  color: var(--color-muted-text);
}
.full-detail-page .detail-data-group .price-list dd {
  min-width: 0; margin: 0; text-align: right; overflow-wrap: anywhere;
}
@media (max-width: 600px) {
  .full-detail-page .detail-data-group {
    padding: 16px;
  }
  .full-detail-page .detail-data-groups {
    gap: 12px;
  }
  .full-detail-page .detail-group-title {
    font-size: 15px;
  }
}

.full-detail-page .detail-data-group .price-list dd.money-value { overflow-wrap:normal; word-break:normal; overflow-x:auto; }

/* V61 DS: compact completed FX facts, all details retained. */
body[data-ui="ui2"] .settlement-card .settlement-primary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin:16px 0}
body[data-ui="ui2"] .settlement-card .settlement-metric{min-width:0}
body[data-ui="ui2"] .settlement-card .settlement-metric dt{font-size:13px;color:var(--color-muted-text)}
body[data-ui="ui2"] .settlement-card .settlement-metric dd{margin:8px 0 0;font-size:18px;font-weight:600;font-variant-numeric:tabular-nums;overflow-wrap:normal;overflow-x:auto}
body[data-ui="ui2"] .settlement-card .card-head{margin-bottom:0}
body[data-ui="ui2"] .settlement-card .card-title{font-size:16px}
body[data-ui="ui2"] .settlement-card .card-details{margin-top:12px}
body[data-ui="ui2"] .settlement-card .item-actions{display:flex;flex-wrap:wrap;gap:8px}
@media (max-width:600px){
body[data-ui="ui2"] .settlement-card .settlement-primary{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
body[data-ui="ui2"] .settlement-card .settlement-metric dd{font-size:16px}
}

/* V62 DS archive columns; GPT keeps widths on headers to protect colspan detail rows. */
/* 归档表格桌面端列宽修正（仅 ui2 桌面视图）
 * 作用范围：@media (min-width: 1100px) 下的 body[data-ui="ui2"] .archive-desktop-table
 * 背景：表格已有 table-layout: fixed，原六列宽度 16% / 7% / 23% / 13% / 23% / 18%，
 *       第 2 列过窄导致 “v2 · 修订版” 之类短标签被不必要地折行。
 * 调整：六列改为 14% / 13% / 24% / 10% / 21% / 18%（合计 100%）。
 * 仅第 2 列 th/td 设为不换行；不隐藏、不裁切、不省略任何内容；
 * 不影响窄屏（< 1100px）布局，也不影响其它表格。
 */

@media (min-width: 1100px) {
  body[data-ui="ui2"] .archive-desktop-table th:nth-child(1) {
    width: 14%;
  }

  body[data-ui="ui2"] .archive-desktop-table th:nth-child(2) {
    width: 13%;
  }

  body[data-ui="ui2"] .archive-desktop-table th:nth-child(3) {
    width: 24%;
  }

  body[data-ui="ui2"] .archive-desktop-table th:nth-child(4) {
    width: 10%;
  }

  body[data-ui="ui2"] .archive-desktop-table th:nth-child(5) {
    width: 21%;
  }

  body[data-ui="ui2"] .archive-desktop-table th:nth-child(6) {
    width: 18%;
  }

  /* 第 2 列：“v2 · 修订版” 等版本短标签保持单行，不折行、不省略 */
  body[data-ui="ui2"] .archive-desktop-table th:nth-child(2),
  body[data-ui="ui2"] .archive-desktop-table td:nth-child(2) {
    white-space: nowrap;
    overflow-wrap: normal;
  }
}

/* V63 DS preview; GPT aligns table-wrap class with renderer. */
/*
 * 归档预览样式
 * 全部选择器限定在 body[data-ui="ui2"] 作用域内，
 * 仅覆盖归档预览相关区域，不改动其它表格。
 */

/* 工作区默认单列，列内元素不撑破容器 */
body[data-ui="ui2"] .archive-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
}

body[data-ui="ui2"] .archive-workspace > * {
  min-width: 0;
}

/* 宽屏且预览可见时，右侧出现预览栏（最小 320px） */
@media (min-width: 1400px) {
  body[data-ui="ui2"] .archive-workspace:has(.archive-preview:not([hidden])) {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  }
}

/* 预览容器：限高并可滚动；窄屏不限制高度，交给页面纵向滚动 */
body[data-ui="ui2"] .archive-preview {
  max-height: 70vh;
  overflow: auto;
}

@media (max-width: 1399.98px) {
  body[data-ui="ui2"] .archive-preview {
    max-height: none;
  }
}

/* 预览文档：白底、内边距与正文排版；长哈希等长串允许断行 */
body[data-ui="ui2"] .archive-preview-document {
  background: #ffffff;
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

/* 表格外层只允许内部横向滚动，不撑开页面 */
body[data-ui="ui2"] .archive-preview-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

body[data-ui="ui2"] .archive-preview table {
  border-collapse: collapse;
  width: 100%;
}

body[data-ui="ui2"] .archive-preview th,
body[data-ui="ui2"] .archive-preview td {
  padding: 8px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  min-width: 5rem;
}

/* 预览文档内标题字号 */
body[data-ui="ui2"] .archive-preview h3 {
  font-size: 16px;
}

body[data-ui="ui2"] .archive-preview h4 {
  font-size: 14px;
}

/* 水印与页脚：小字、弱化颜色 */
body[data-ui="ui2"] .archive-preview-watermark,
body[data-ui="ui2"] .archive-preview-footer,
body[data-ui="ui2"] .archive-preview .watermark,
body[data-ui="ui2"] .archive-preview .footer {
  font-size: 12px;
  color: var(--color-text-muted, #6b7280);
}

/* 水印保持可见 */
body[data-ui="ui2"] .archive-preview-watermark,
body[data-ui="ui2"] .archive-preview .watermark {
  visibility: visible;
  opacity: 1;
}

/* 页脚允许换行，长内容不溢出 */
body[data-ui="ui2"] .archive-preview-footer,
body[data-ui="ui2"] .archive-preview .footer {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* V63 DS report account rows. */
body[data-ui="ui2"] #reports-account-balances {
  min-width: 0;
}

body[data-ui="ui2"] #reports-account-balances .report-account-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-width: 0;
  padding: 16px 0;
  border-bottom: 1px solid var(--color-border);
}

body[data-ui="ui2"] #reports-account-balances .report-account-identity {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, auto);
  gap: 16px;
  align-items: center;
  min-width: 0;
}

body[data-ui="ui2"] #reports-account-balances .report-account-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
}

body[data-ui="ui2"] #reports-account-balances .report-account-balance {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  white-space: nowrap;
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

body[data-ui="ui2"] #reports-account-balances .report-account-row button {
  min-height: 44px;
  white-space: nowrap;
}

@media (max-width: 600px) {
  body[data-ui="ui2"] #reports-account-balances .report-account-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  body[data-ui="ui2"] #reports-account-balances .report-account-identity {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  body[data-ui="ui2"] #reports-account-balances .report-account-balance {
    text-align: left;
  }

  body[data-ui="ui2"] #reports-account-balances .report-account-row button {
    justify-self: start;
  }
}

/* V65 DSH: archive list/preview balance */
@media (min-width: 1400px) {
  body[data-ui="ui2"] .archive-workspace:has(.archive-preview:not([hidden])) {
    grid-template-columns: minmax(640px, 1fr) minmax(300px, .6fr);
    gap: 16px;
  }

  body[data-ui="ui2"] .archive-desktop-table th,
  body[data-ui="ui2"] .archive-desktop-table td {
    padding: 10px 8px;
  }

  body[data-ui="ui2"] .archive-desktop-table td:first-child:not([colspan]) {
    white-space: nowrap;
  }
}

/* ==========================================================================
 * V69 设计系统层（Claude 接管）：按 Figma「栖物 STORE LEDGER」原型统一令牌、
 * 外壳、按钮、表单、卡片、表格。只追加覆盖，不删除旧规则；业务逻辑不变。
 *   颜色：页面 #f6f7f9 · 侧栏 #f0f2f6 · 正文 #202731 · 次要 #74808e
 *         边框 #e4e9f0 · 主色 #3267d6 · 提示底 #f3f6fb / #eef3fc
 *   字号：正文 14 · 次要 12–13 · 表头 12 · 卡片数字 28 · 页面标题 28
 *   尺寸：按钮 40（手机 44）· 输入 44 · 卡片圆角 12 · 控件圆角 8
 * ======================================================================== */
:root {
  --color-text: #202731;
  --color-muted-text: #74808e;
  --color-border: #e4e9f0;
  --color-divider: #edf0f4;
  --color-page: #f6f7f9;
  --color-nav-bg: #f0f2f6;
  --color-accent: #3267d6;
  --color-ring: #3267d6;
  --color-accent-soft: #eef3fc;
  --color-info-bg: #f3f6fb;
  --color-muted-bg: #f0f2f6;
  --color-pending-bg: #fbf3e6;
  --color-pending-text: #9a6416;
  --color-success: #2f7d57;
  --color-error: #c2413b;
  --color-flow-in: #2f7d57;
  --color-flow-out: #c2413b;
  --color-chart-sales: #b4c6ef;
  --color-chart-profit: #7fae96;
  --radius: .5rem;
  --radius-card: .75rem;
  --font-body: .875rem/1.55 "Noto Sans SC", "PingFang SC", "PingFang HK", -apple-system,
    BlinkMacSystemFont, "Segoe UI", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --shadow-card: none;
}
html[data-flow-colors="reverse"] { --color-flow-in: #c2413b; --color-flow-out: #2f7d57; }

body[data-ui="ui2"] { background: var(--color-page); color: var(--color-text); font: var(--font-body); }
body[data-ui="ui2"] .num,
body[data-ui="ui2"] .money-value,
body[data-ui="ui2"] .stat-amount,
body[data-ui="ui2"] td.statement-money { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- 按钮 */
body[data-ui="ui2"] .btn {
  min-height: 40px; padding: 0 1rem; border: 1px solid var(--color-border); border-radius: var(--radius);
  background: #fff; color: var(--color-text); font-size: .8125rem; font-weight: 500; line-height: 1.2;
  box-shadow: none; transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}
body[data-ui="ui2"] .btn:hover:not(:disabled) { border-color: #cfd6e0; background: #fafbfc; }
body[data-ui="ui2"] .btn-primary { border-color: var(--color-accent); background: var(--color-accent); color: #fff; }
body[data-ui="ui2"] .btn-primary:hover:not(:disabled) { border-color: #2a59bb; background: #2a59bb; }
body[data-ui="ui2"] .btn-danger { border-color: #f1d3d1; background: #fff; color: var(--color-error); }
body[data-ui="ui2"] .btn-danger:hover:not(:disabled) { background: #fdf3f2; border-color: #e7b9b5; }
body[data-ui="ui2"] .btn-sm { min-height: 34px; padding: 0 .75rem; font-size: .8125rem; }
body[data-ui="ui2"] .btn:disabled { opacity: .55; cursor: not-allowed; }
body[data-ui="ui2"] .btn-link { min-height: 0; padding: 0; border: 0; background: none; color: var(--color-accent); font-weight: 500; }
body[data-ui="ui2"] .btn-link:hover:not(:disabled) { background: none; text-decoration: underline; }

/* ---------------------------------------------------------------- 表单 */
body[data-ui="ui2"] .field { gap: .5rem; }
body[data-ui="ui2"] .field label,
body[data-ui="ui2"] .field legend { color: var(--color-muted-text); font-size: .75rem; font-weight: 400; }
body[data-ui="ui2"] .field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
body[data-ui="ui2"] .field select,
body[data-ui="ui2"] .search-row > input,
body[data-ui="ui2"] input[type="search"],
body[data-ui="ui2"] select {
  min-height: 40px; border: 1px solid var(--color-border); border-radius: var(--radius);
  background-color: #fff; color: var(--color-text); font-size: .875rem;
}
body[data-ui="ui2"] .field textarea { border: 1px solid var(--color-border); border-radius: var(--radius); font-size: .875rem; }
body[data-ui="ui2"] .field input:focus-visible,
body[data-ui="ui2"] .field select:focus-visible,
body[data-ui="ui2"] .field textarea:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 0; border-color: var(--color-accent); }

/* ---------------------------------------------------------------- 卡片与面板 */
body[data-ui="ui2"] .panel,
body[data-ui="ui2"] .card,
body[data-ui="ui2"] .stat { border: 0; border-radius: var(--radius-card); background: #fff; box-shadow: none; }
body[data-ui="ui2"] .hint,
body[data-ui="ui2"] .muted,
body[data-ui="ui2"] .basis-line { color: var(--color-muted-text); font-size: .75rem; }
body[data-ui="ui2"] .badge { border-radius: 999px; font-size: .75rem; font-weight: 500; }
body[data-ui="ui2"] .view-title { font-size: 1.75rem; font-weight: 500; letter-spacing: 0; color: var(--color-text); }
body[data-ui="ui2"] .view-head { align-items: flex-end; margin-bottom: .25rem; }
body[data-ui="ui2"] .view h2,
body[data-ui="ui2"] .panel-title { font-size: 1rem; font-weight: 500; }

/* ---------------------------------------------------------------- 外壳：桌面侧栏 + 顶栏 */
.nav-brand, .topbar-context { display: none; }
@media (min-width: 768px) {
  html:not([data-ui-compact]) body[data-ui="ui2"] { padding-bottom: 0; }
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-view {
    display: grid; grid-template-columns: 13.75rem minmax(0, 1fr); grid-template-rows: auto auto 1fr; min-height: 100vh;
  }
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-shell { display: contents; }
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-header {
    grid-column: 2; grid-row: 1; position: sticky; top: 0; z-index: 30; height: auto;
    border-bottom: 1px solid #e8ecf1; background: #fff;
  }
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-header-inner {
    max-width: none; height: 4rem; min-height: 0; padding: 0 2rem; gap: 1rem;
  }
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-header .brand-block { display: none; }
  html:not([data-ui-compact]) body[data-ui="ui2"] .topbar-context {
    display: flex; flex: 1 1 auto; align-items: center; justify-content: space-between; gap: 1rem; min-width: 0; margin: 0;
    color: var(--color-muted-text); font-size: .75rem; white-space: nowrap;
  }
  html:not([data-ui-compact]) body[data-ui="ui2"] .topbar-crumb { min-width: 0; white-space: normal; }
  html:not([data-ui-compact]) body[data-ui="ui2"] #receipt-recovery { grid-column: 2; grid-row: 2; margin: 1rem 2rem 0; }
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-nav {
    grid-column: 1; grid-row: 1 / span 3; position: sticky; top: 0; align-self: start; height: 100vh;
    display: flex; flex-direction: column; gap: .25rem; overflow-y: auto; margin: 0; padding: 1.75rem .75rem 1.5rem;
    border: 0; border-radius: 0; background: var(--color-nav-bg);
  }
  html:not([data-ui-compact]) body[data-ui="ui2"] .nav-brand {
    display: flex; flex-direction: column; gap: .25rem; padding: 0 1rem 1.75rem;
  }
  html:not([data-ui-compact]) body[data-ui="ui2"] .nav-brand-name { font-size: 1.5rem; font-weight: 500; line-height: 1.2; color: var(--color-text); }
  html:not([data-ui-compact]) body[data-ui="ui2"] .nav-brand-sub { font-size: .625rem; letter-spacing: .08em; color: var(--color-muted-text); }
  html:not([data-ui-compact]) body[data-ui="ui2"] .nav-title { display: none; }
  html:not([data-ui-compact]) body[data-ui="ui2"] .nav-primary,
  html:not([data-ui-compact]) body[data-ui="ui2"] .nav-more-list { display: flex; flex-direction: column; gap: .25rem; }
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-nav .nav-item {
    justify-content: flex-start; gap: .75rem; min-height: 2.75rem; padding: 0 1rem; border: 0; border-radius: .625rem;
    background: transparent; color: var(--color-muted-text); font-size: .875rem; font-weight: 400;
  }
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-nav .nav-item:hover { color: var(--color-text); background: rgba(255,255,255,.6); }
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-nav .nav-item.is-active { background: #fff; color: var(--color-accent); font-weight: 500; }
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-nav .nav-icon { width: 1.25rem; height: 1.25rem; }
  html:not([data-ui-compact]) body[data-ui="ui2"] .view-stack {
    grid-column: 2; grid-row: 3; width: 100%; max-width: 76rem; margin: 0; padding: 2rem 2rem 3rem; gap: 1.25rem;
  }
}

/* ---------------------------------------------------------------- 表格（通用） */
body[data-ui="ui2"] table { border-collapse: collapse; }
body[data-ui="ui2"] .data-table { width: 100%; border-collapse: collapse; font-size: .8125rem; }
body[data-ui="ui2"] .data-table th {
  padding: .75rem 1rem; border-bottom: 1px solid var(--color-border); color: var(--color-muted-text);
  font-size: .75rem; font-weight: 400; text-align: left; white-space: nowrap;
}
body[data-ui="ui2"] .data-table td { padding: .875rem 1rem; border-bottom: 1px solid var(--color-divider); vertical-align: middle; }
body[data-ui="ui2"] .data-table tbody tr:last-child td { border-bottom: 0; }
body[data-ui="ui2"] .data-table .num { text-align: right; white-space: nowrap; }

/* ---------------------------------------------------------------- V69 分段控件 */
body[data-ui="ui2"] .segmented {
  display: inline-flex; flex-wrap: wrap; gap: .25rem; padding: .25rem; border-radius: .625rem; background: #e9edf2;
}
body[data-ui="ui2"] .segmented-btn {
  min-height: 32px; padding: 0 .875rem; border: 0; border-radius: .5rem; background: transparent;
  color: var(--color-muted-text); font-size: .8125rem; font-weight: 500; cursor: pointer;
}
body[data-ui="ui2"] .segmented-btn[aria-pressed="true"] { background: #fff; color: var(--color-text); box-shadow: 0 1px 2px rgba(32,39,49,.08); }
body[data-ui="ui2"] .segmented-btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }

/* 总览日期范围也用分段样式 */
body[data-ui="ui2"] .dashboard-ranges {
  display: inline-flex; gap: .25rem; width: auto; padding: .25rem; border-radius: .625rem; background: #e9edf2;
}
body[data-ui="ui2"] .dashboard-ranges .btn {
  min-height: 32px; padding: 0 1rem; border: 0; border-radius: .5rem; background: transparent;
  color: var(--color-muted-text); box-shadow: none;
}
body[data-ui="ui2"] .dashboard-ranges .btn[aria-pressed="true"] { background: #fff; color: var(--color-text); box-shadow: 0 1px 2px rgba(32,39,49,.08); }

/* ---------------------------------------------------------------- V69 资金账户卡片 */
body[data-ui="ui2"] #accounts-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 1rem; }
body[data-ui="ui2"] section[aria-labelledby="accounts-title"] { padding: 0; background: transparent; }
body[data-ui="ui2"] #accounts-title { margin: 0 0 .75rem; }
body[data-ui="ui2"] .account-card { display: flex; flex-direction: column; gap: .375rem; padding: 1.25rem; border: 1px solid transparent; }
body[data-ui="ui2"] .account-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
body[data-ui="ui2"] .account-card .account-name { margin: 0; font-size: .875rem; font-weight: 500; }
body[data-ui="ui2"] .account-currency { color: var(--color-muted-text); font-size: .75rem; }
body[data-ui="ui2"] .account-card .account-balance { margin: .5rem 0 0; font-size: 1.75rem; font-weight: 500; line-height: 1.2; white-space: nowrap; overflow-wrap: normal; }
body[data-ui="ui2"] .account-card .account-balance .metric-currency { margin-right: .25rem; color: var(--color-muted-text); font-size: .75rem; font-weight: 400; }
body[data-ui="ui2"] .account-kind { margin: 0; color: var(--color-accent); font-size: .75rem; }
body[data-ui="ui2"] .account-card-actions { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .5rem; }
body[data-ui="ui2"] .accounts-hkd-total {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 2rem; margin-top: 1rem; padding: 1.125rem 1.25rem;
  border-radius: var(--radius-card); background: #fff;
}
body[data-ui="ui2"] .accounts-hkd-total-label { color: var(--color-muted-text); font-size: .8125rem; }
body[data-ui="ui2"] .accounts-hkd-total-value { font-size: 1.375rem; font-weight: 500; }
body[data-ui="ui2"] .accounts-hkd-total-note { margin-left: auto; color: var(--color-muted-text); font-size: .75rem; }

/* ---------------------------------------------------------------- V69 银行对账单 */
body[data-ui="ui2"] #funds-detail > .panel { padding: 1.5rem; }
body[data-ui="ui2"] #funds-detail-current { margin: .25rem 0 1rem; font-size: 2.25rem; font-weight: 500; line-height: 1.2; font-variant-numeric: tabular-nums; }
body[data-ui="ui2"] #funds-detail-current::before { content: "当前余额"; display: block; margin-bottom: .375rem; color: var(--color-muted-text); font-size: .75rem; font-weight: 400; }
body[data-ui="ui2"] .statement-filter {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; margin-bottom: 1rem;
}
body[data-ui="ui2"] .statement-filter .statement-ranges { flex: 1 1 100%; width: max-content; max-width: 100%; }
body[data-ui="ui2"] .statement-filter .field { flex: 0 1 11rem; min-width: 9rem; margin: 0; }
body[data-ui="ui2"] .statement-filter .filter-actions { flex: 0 0 auto; margin: 0; }
body[data-ui="ui2"] #funds-detail-balances {
  display: grid; grid-auto-flow: column; grid-template-rows: auto auto; grid-auto-columns: minmax(0, 1fr);
  gap: .25rem 1rem; margin: 0 0 1rem; padding: 1rem 1.25rem; border-radius: .625rem; background: var(--color-info-bg);
}
body[data-ui="ui2"] #funds-detail-balances dt { margin: 0; color: var(--color-muted-text); font-size: .75rem; font-weight: 400; white-space: nowrap; }
body[data-ui="ui2"] #funds-detail-balances dd { margin: 0; font-size: .9375rem; font-weight: 500; text-align: left; white-space: nowrap; font-variant-numeric: tabular-nums; }
body[data-ui="ui2"] .fund-statement-scroll { overflow-x: auto; border: 1px solid var(--color-border); border-radius: .625rem; }
body[data-ui="ui2"] table.fund-statement { width: 100%; min-width: 44rem; border-collapse: collapse; font-size: .8125rem; table-layout: fixed; }
body[data-ui="ui2"] table.fund-statement caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
body[data-ui="ui2"] table.fund-statement th,
body[data-ui="ui2"] table.fund-statement td { padding: .75rem 1rem; border-bottom: 1px solid var(--color-divider); vertical-align: top; }
body[data-ui="ui2"] table.fund-statement thead tr:first-child th {
  position: sticky; top: 0; background: #fafbfc; color: var(--color-muted-text); font-size: .75rem; font-weight: 400;
  text-align: left; white-space: nowrap; border-bottom: 1px solid var(--color-border);
}
body[data-ui="ui2"] table.fund-statement .col-date { width: 7.5rem; }
body[data-ui="ui2"] table.fund-statement .col-money { width: 9.5rem; text-align: right; }
body[data-ui="ui2"] table.fund-statement td.statement-money { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-size: .875rem; }
body[data-ui="ui2"] table.fund-statement td.statement-money.is-empty { color: #b8c0cb; }
body[data-ui="ui2"] table.fund-statement td.flow-out:not(.is-empty) { color: var(--color-flow-out); }
body[data-ui="ui2"] table.fund-statement td.flow-in:not(.is-empty) { color: var(--color-flow-in); }
body[data-ui="ui2"] table.fund-statement td.statement-balance { color: var(--color-text); font-weight: 500; }
body[data-ui="ui2"] .statement-date { white-space: nowrap; color: var(--color-text); }
body[data-ui="ui2"] .statement-time { display: block; margin-top: .125rem; color: var(--color-muted-text); font-size: .6875rem; }
body[data-ui="ui2"] .statement-detail > summary { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; list-style: none; cursor: pointer; }
body[data-ui="ui2"] .statement-detail > summary::-webkit-details-marker { display: none; }
body[data-ui="ui2"] .statement-summary-text { min-width: 0; color: var(--color-text); font-size: .8125rem; overflow-wrap: anywhere; }
body[data-ui="ui2"] .statement-kind {
  display: inline-flex; align-items: center; padding: .0625rem .5rem; border-radius: 999px; background: #eef1f5;
  color: var(--color-muted-text); font-size: .6875rem; white-space: nowrap;
}
body[data-ui="ui2"] .statement-kind-transfer_out,
body[data-ui="ui2"] .statement-kind-transfer_in,
body[data-ui="ui2"] .statement-kind-adjustment { background: var(--color-pending-bg); color: var(--color-pending-text); }
body[data-ui="ui2"] .statement-detail[open] > summary .statement-summary-text { font-weight: 500; }
body[data-ui="ui2"] .statement-detail > .card {
  margin: .625rem 0 .25rem; padding: .75rem .875rem; border: 0; border-radius: .5rem; background: var(--color-info-bg);
}
body[data-ui="ui2"] .statement-detail > .card .card-head .card-title,
body[data-ui="ui2"] .statement-detail > .card .card-head .badge-soft { display: none; }
body[data-ui="ui2"] .statement-detail > .card .card-head { margin: 0 0 .375rem; }
body[data-ui="ui2"] .statement-detail > .card .price-list { display: grid; grid-template-columns: 6.5rem minmax(0,1fr); gap: .25rem .75rem; margin: 0; font-size: .75rem; }
body[data-ui="ui2"] .statement-detail > .card .price-list dt { color: var(--color-muted-text); }
body[data-ui="ui2"] .statement-detail > .card .price-list dd { margin: 0; text-align: left; overflow-wrap: anywhere; }
body[data-ui="ui2"] tr.statement-boundary th,
body[data-ui="ui2"] tr.statement-boundary td { background: #fafbfc; font-weight: 500; }
body[data-ui="ui2"] tr.statement-boundary th { text-align: left; color: var(--color-text); font-size: .8125rem; }
body[data-ui="ui2"] tfoot tr.statement-boundary th,
body[data-ui="ui2"] tfoot tr.statement-boundary td { border-top: 1px solid var(--color-border); border-bottom: 0; }
body[data-ui="ui2"] .statement-boundary-hint { margin-left: .5rem; color: var(--color-muted-text); font-weight: 400; font-size: .75rem; }
body[data-ui="ui2"] #funds-detail-pagination { margin-top: .75rem; }
@media (max-width: 767px) {
  body[data-ui="ui2"] #funds-detail-balances { grid-auto-flow: row; grid-template-rows: none; grid-template-columns: repeat(2, minmax(0,1fr)); }
  body[data-ui="ui2"] .statement-filter .field { flex: 1 1 8rem; }
  body[data-ui="ui2"] .fund-statement-scroll { border: 0; overflow: visible; }
  body[data-ui="ui2"] table.fund-statement { min-width: 0; table-layout: auto; }
  body[data-ui="ui2"] table.fund-statement thead tr:first-child { display: none; }
  body[data-ui="ui2"] table.fund-statement,
  body[data-ui="ui2"] table.fund-statement tbody,
  body[data-ui="ui2"] table.fund-statement thead,
  body[data-ui="ui2"] table.fund-statement tfoot { display: block; }
  body[data-ui="ui2"] table.fund-statement tr.statement-row {
    display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .125rem .75rem; padding: .75rem 0; border-bottom: 1px solid var(--color-divider);
  }
  body[data-ui="ui2"] table.fund-statement tr.statement-row td { padding: 0; border: 0; }
  body[data-ui="ui2"] table.fund-statement td.statement-date { grid-column: 1; grid-row: 1; color: var(--color-muted-text); font-size: .75rem; }
  body[data-ui="ui2"] table.fund-statement td.statement-date .statement-time { display: inline; margin-left: .375rem; }
  body[data-ui="ui2"] table.fund-statement td.statement-description { grid-column: 1; grid-row: 2; }
  body[data-ui="ui2"] table.fund-statement td.flow-out,
  body[data-ui="ui2"] table.fund-statement td.flow-in { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  body[data-ui="ui2"] table.fund-statement td.statement-money.is-empty { display: none; }
  body[data-ui="ui2"] table.fund-statement td.statement-balance { grid-column: 1 / -1; grid-row: 3; color: var(--color-muted-text); font-weight: 400; font-size: .75rem; text-align: left; }
  body[data-ui="ui2"] table.fund-statement td.statement-balance::before { content: "余额 "; }
  body[data-ui="ui2"] tr.statement-boundary { display: flex; justify-content: space-between; padding: .625rem .75rem; border-radius: .5rem; background: var(--color-info-bg); }
  body[data-ui="ui2"] tr.statement-boundary th,
  body[data-ui="ui2"] tr.statement-boundary td { padding: 0; border: 0; background: transparent; }
  body[data-ui="ui2"] tr.statement-boundary td.is-empty { display: none; }
  body[data-ui="ui2"] tr.statement-boundary td.statement-balance::before { content: none; }
}

/* V69 修正：侧栏项不拉伸、侧栏铺满；对账单筛选与摘要条 */
@media (min-width: 768px) {
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-nav { max-height: none; min-height: 100vh; }
  html:not([data-ui-compact]) body[data-ui="ui2"] .nav-primary,
  html:not([data-ui-compact]) body[data-ui="ui2"] .nav-more { flex: 0 0 auto; }
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-nav .nav-item { flex: 0 0 auto; height: 2.75rem; }
  html:not([data-ui-compact]) body[data-ui="ui2"] .nav-more > .nav-summary { display: none; }
}
@media (min-width: 1200px) {
  body[data-ui="ui2"] #view-funds:not([hidden]):has(#funds-tools:not([hidden])) { row-gap: 0; column-gap: 1.25rem; }
  body[data-ui="ui2"] #view-funds:not([hidden]):has(#funds-tools:not([hidden])) > #funds-balances,
  body[data-ui="ui2"] #view-funds:not([hidden]):has(#funds-tools:not([hidden])) > #funds-tools { margin-top: 1.25rem; }
}
body[data-ui="ui2"] .statement-filter { display: grid; grid-template-columns: minmax(8rem, 11rem) minmax(8rem, 11rem) auto 1fr; align-items: end; }
body[data-ui="ui2"] .statement-filter .statement-ranges { grid-column: 1 / -1; justify-self: start; width: auto; }
body[data-ui="ui2"] .statement-filter .field { min-width: 0; }
body[data-ui="ui2"] #funds-detail-balances > dt:first-of-type,
body[data-ui="ui2"] #funds-detail-balances > dd:first-of-type { display: none; }
body[data-ui="ui2"] #funds-detail-balances > dd:last-of-type { white-space: normal; font-size: .75rem; font-weight: 400; color: var(--color-muted-text); }
body[data-ui="ui2"] table.fund-statement .col-date { width: 6.5rem; }
body[data-ui="ui2"] table.fund-statement .col-money { width: 8.25rem; }
body[data-ui="ui2"] table.fund-statement { min-width: 40rem; }
@media (max-width: 767px) {
  body[data-ui="ui2"] .statement-filter { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  body[data-ui="ui2"] .statement-filter .filter-actions { grid-column: 1 / -1; }
  body[data-ui="ui2"] .statement-filter .filter-actions .btn { width: 100%; }
}

/* ---------------------------------------------------------------- V69 总览 */
body[data-ui="ui2"] #dashboard-meta { margin: -.25rem 0 0; color: var(--color-muted-text); font-size: .8125rem; }
body[data-ui="ui2"] .dashboard-filter { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; }
body[data-ui="ui2"] #dashboard-primary {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: 1rem;
}
@media (min-width: 1280px) {
  html:not([data-ui-compact]) body[data-ui="ui2"] #dashboard-primary { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
body[data-ui="ui2"] #dashboard-primary .primary-metric {
  display: flex; flex-direction: column; gap: .25rem; min-width: 0; padding: 1.125rem 1.125rem 1rem; border: 0; border-radius: var(--radius-card); background: #fff;
}
body[data-ui="ui2"] #dashboard-primary .stat-title { margin: 0; color: var(--color-muted-text); font-size: .75rem; font-weight: 400; }
body[data-ui="ui2"] #dashboard-primary .stat-amount {
  margin: .25rem 0 0; font-size: 1.5rem; font-weight: 500; line-height: 1.2; white-space: nowrap; overflow-wrap: normal;
}
body[data-ui="ui2"] #dashboard-primary .stat-amount .metric-currency { display: block; margin-bottom: .125rem; color: var(--color-muted-text); font-size: .6875rem; font-weight: 400; }
body[data-ui="ui2"] #dashboard-primary .stat-amount .metric-number { display: block; overflow-wrap: anywhere; white-space: normal; }
body[data-ui="ui2"] #dashboard-primary .basis-line { margin: .125rem 0 0; font-size: .6875rem; line-height: 1.45; }
body[data-ui="ui2"] #dashboard-primary .primary-metric-link {
  align-self: flex-start; margin-top: auto; padding: .5rem 0 0; border: 0; background: none; color: var(--color-accent);
  font-size: .75rem; font-weight: 500; cursor: pointer;
}
body[data-ui="ui2"] #dashboard-primary .primary-metric:nth-child(2) .stat-amount,
body[data-ui="ui2"] #dashboard-primary .primary-metric:nth-child(2) .stat-amount .metric-number { color: var(--color-success); }
body[data-ui="ui2"] #dashboard-primary .primary-metric:nth-child(6) .basis-line { color: var(--color-pending-text); }

/* 图表 */
body[data-ui="ui2"] .income-chart { margin-top: .5rem; }
body[data-ui="ui2"] .income-chart-svg { display: block; width: 100%; height: auto; max-height: 20rem; overflow: visible; }
body[data-ui="ui2"] .income-chart-svg .chart-tick { fill: var(--color-muted-text); font-size: 11px; font-family: inherit; }
body[data-ui="ui2"] .income-chart-dates { display: none; }
body[data-ui="ui2"] .chart-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; margin: .5rem 0 0; font-size: .75rem; color: var(--color-muted-text); }
body[data-ui="ui2"] .chart-legend-item { display: inline-flex; align-items: center; gap: .375rem; }
body[data-ui="ui2"] .chart-legend-item::before { content: ""; width: .75rem; height: .75rem; border-radius: 3px; }
body[data-ui="ui2"] .chart-legend-sales::before { background: var(--color-chart-sales); }
body[data-ui="ui2"] .chart-legend-profit::before { background: var(--color-chart-profit); }
body[data-ui="ui2"] .chart-legend-sales { color: var(--color-accent); }
body[data-ui="ui2"] .chart-legend-profit { color: var(--color-success); }
body[data-ui="ui2"] .chart-legend-note { flex: 1 1 100%; }
body[data-ui="ui2"] #dashboard-income-chart > label,
body[data-ui="ui2"] #reports-income-chart > label { display: inline-flex; align-items: center; gap: .5rem; color: var(--color-muted-text); font-size: .75rem; }
body[data-ui="ui2"] #dashboard-income-chart > label select,
body[data-ui="ui2"] [id^="reports-"] > label select { min-height: 32px; padding: 0 .5rem; border-radius: .5rem; font-size: .8125rem; }
body[data-ui="ui2"] #dashboard-panel > section.panel,
body[data-ui="ui2"] #dashboard-panel > .panel { padding: 1.25rem 1.5rem; }
body[data-ui="ui2"] #dashboard-more > summary { cursor: pointer; color: var(--color-text); font-weight: 500; }
body[data-ui="ui2"] #dashboard-primary .primary-metric:nth-child(1) .stat-amount,
body[data-ui="ui2"] #dashboard-primary .primary-metric:nth-child(3) .stat-amount,
body[data-ui="ui2"] #dashboard-primary .primary-metric:nth-child(1) .metric-number,
body[data-ui="ui2"] #dashboard-primary .primary-metric:nth-child(3) .metric-number { color: var(--color-text); }
body[data-ui="ui2"] .dashboard-filter { justify-content: flex-start; }
body[data-ui="ui2"] #dashboard-filter-hint { margin: 0; }

/* ---------------------------------------------------------------- V69 快捷日期统一为分段控件 */
body[data-ui="ui2"] #store-presets,
body[data-ui="ui2"] [role="group"]:has(> [data-report-range]),
body[data-ui="ui2"] [role="group"]:has(> [data-sales-range]) {
  display: inline-flex; flex-wrap: wrap; gap: .25rem; width: auto; max-width: 100%; padding: .25rem; border-radius: .625rem; background: #e9edf2;
}
body[data-ui="ui2"] [data-store-range],
body[data-ui="ui2"] [data-report-range],
body[data-ui="ui2"] [data-sales-range] {
  min-height: 32px; padding: 0 1rem; border: 0; border-radius: .5rem; background: transparent; color: var(--color-muted-text); box-shadow: none;
}
body[data-ui="ui2"] [data-store-range][aria-pressed="true"],
body[data-ui="ui2"] [data-report-range][aria-pressed="true"],
body[data-ui="ui2"] [data-sales-range][aria-pressed="true"] { background: #fff; color: var(--color-text); box-shadow: 0 1px 2px rgba(32,39,49,.08); }

/* ---------------------------------------------------------------- V69 店铺台账表 */
body[data-ui="ui2"] table.store-statement { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .8125rem; }
body[data-ui="ui2"] table.store-statement th {
  padding: .75rem 1rem; border-bottom: 1px solid var(--color-border); background: #fafbfc; color: var(--color-muted-text);
  font-size: .75rem; font-weight: 400; text-align: left; white-space: nowrap;
}
body[data-ui="ui2"] table.store-statement td { padding: .8125rem 1rem; border-bottom: 1px solid var(--color-divider); vertical-align: top; }
body[data-ui="ui2"] table.store-statement .col-date { width: 6.5rem; }
body[data-ui="ui2"] table.store-statement .col-type { width: 7.5rem; }
body[data-ui="ui2"] table.store-statement .col-money { width: 9rem; text-align: right; }
body[data-ui="ui2"] table.store-statement .col-action { width: 4.5rem; }
body[data-ui="ui2"] .store-date { white-space: nowrap; }
body[data-ui="ui2"] .store-type-label { display: block; color: var(--color-text); }
body[data-ui="ui2"] .store-type-transfer,
body[data-ui="ui2"] .store-type-adjustment,
body[data-ui="ui2"] .store-type-opening { color: var(--color-muted-text) !important; }
body[data-ui="ui2"] .store-flags { display: block; margin-top: .125rem; color: var(--color-muted-text); font-size: .6875rem; }
body[data-ui="ui2"] .store-desc-text { overflow-wrap: anywhere; }
body[data-ui="ui2"] td.store-money { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
body[data-ui="ui2"] td.store-money.flow-in { color: var(--color-flow-in); }
body[data-ui="ui2"] td.store-money.flow-out { color: var(--color-flow-out); }
body[data-ui="ui2"] td.store-money.muted-cell { color: var(--color-muted-text); font-size: .75rem; }
body[data-ui="ui2"] tr.store-event-detail > td { padding: .5rem 1rem 1rem; background: var(--color-info-bg); }
body[data-ui="ui2"] tr.store-event-detail .card { margin: 0; background: transparent; }
@media (max-width: 767px) {
  body[data-ui="ui2"] table.store-statement thead { display: none; }
  body[data-ui="ui2"] table.store-statement,
  body[data-ui="ui2"] table.store-statement tbody { display: block; }
  body[data-ui="ui2"] table.store-statement tr.store-event-row {
    display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .125rem .75rem; padding: .75rem 0; border-bottom: 1px solid var(--color-divider);
  }
  body[data-ui="ui2"] table.store-statement tr.store-event-row td { padding: 0; border: 0; }
  body[data-ui="ui2"] tr.store-event-row .store-date { grid-column: 1; grid-row: 1; color: var(--color-muted-text); font-size: .75rem; }
  body[data-ui="ui2"] tr.store-event-row .store-type { grid-column: 1; grid-row: 2; display: flex; gap: .5rem; align-items: baseline; }
  body[data-ui="ui2"] tr.store-event-row .store-desc { grid-column: 1; grid-row: 3; }
  body[data-ui="ui2"] tr.store-event-row td.store-money:nth-of-type(4) { grid-column: 2; grid-row: 1; }
  body[data-ui="ui2"] tr.store-event-row td.store-money:nth-of-type(5) { grid-column: 2; grid-row: 2; font-weight: 500; }
  body[data-ui="ui2"] tr.store-event-row .store-action { grid-column: 2; grid-row: 3; text-align: right; }
  body[data-ui="ui2"] tr.store-event-detail { display: block; }
  body[data-ui="ui2"] tr.store-event-detail > td { display: block; }
}

/* V69 手机对账单：旧 #funds-detail 规则带 ID 优先级（min-width 620px、td 内边距、第 2 列 35%），
 * 这里用同级 ID 前缀把卡片式布局真正落地；不裁切，金额在可视宽度内完整显示。 */
@media (max-width: 767px) {
  body[data-ui="ui2"] #funds-detail #funds-detail-balances {
    grid-auto-flow: row; grid-template-rows: none; grid-template-columns: max-content minmax(0, 1fr);
    gap: .375rem 1rem; padding: .875rem 1rem;
  }
  body[data-ui="ui2"] #funds-detail #funds-detail-balances dd { text-align: right; }
  body[data-ui="ui2"] #funds-detail #funds-detail-balances > dd:last-of-type { white-space: normal; }
  body[data-ui="ui2"] #funds-detail .fund-statement-scroll { overflow: visible; border: 0; }
  body[data-ui="ui2"] #funds-detail table.fund-statement { min-width: 0; width: 100%; }
  body[data-ui="ui2"] #funds-detail table.fund-statement td,
  body[data-ui="ui2"] #funds-detail table.fund-statement th { width: auto; padding: 0; border: 0; }
  body[data-ui="ui2"] #funds-detail table.fund-statement tr.statement-row td.statement-money:not(.statement-balance) { text-align: right; font-size: .9375rem; font-weight: 500; }
  body[data-ui="ui2"] #funds-detail table.fund-statement tr.statement-row td.statement-balance { text-align: left; }
  body[data-ui="ui2"] #funds-detail table.fund-statement tr.statement-boundary { margin: .5rem 0; padding: .625rem .875rem; }
  body[data-ui="ui2"] #funds-detail table.fund-statement tr.statement-boundary td.statement-balance { text-align: right; }
}
/* 摘要条标签很短：容器至少 15em 时保持「标签 | 金额」同行；大字号（TEXT200）下容器不足 15em 仍纵向排列。 */
@container price-values (min-width: 15em) {
  body[data-ui="ui2"] #funds-detail #funds-detail-balances > dt,
  body[data-ui="ui2"] #funds-detail #funds-detail-balances > dd { grid-column: auto; margin-bottom: 0; }
}
@media (max-width: 767px) {
  body[data-ui="ui2"] #funds-detail-title { font-size: 1.375rem; line-height: 1.3; }
  body[data-ui="ui2"] #funds-detail .view-head { flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
  body[data-ui="ui2"] #funds-detail-current { font-size: 1.875rem; }
}

/* 总览指标：数字随卡片宽度缩放（容器单位），极窄时换行而不是裁切；手机两列。 */
body[data-ui="ui2"] #dashboard-primary .primary-metric { container-type: inline-size; }
body[data-ui="ui2"] #dashboard-primary .stat-amount { font-size: clamp(1.125rem, 15cqi, 1.75rem); white-space: normal; }
@media (max-width: 767px) {
  body[data-ui="ui2"] #dashboard-primary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  body[data-ui="ui2"] #dashboard-primary .primary-metric { padding: .875rem .875rem .75rem; }
  body[data-ui="ui2"] #dashboard-primary .primary-metric-link { min-height: 2.25rem; padding-top: .25rem; }
}
/* V69 店铺台账：表格在所有宽度可见（手机由上面的紧凑列表规则接管）。 */
body[data-ui="ui2"] table.store-statement { display: table; }
body[data-ui="ui2"] #store-ledger-list > .store-mobile-events { display: none; }
@media (max-width: 767px) { body[data-ui="ui2"] table.store-statement { display: block; } }
@media (max-width: 767px) {
  body[data-ui="ui2"] tr.store-event-row td.store-money.is-same { display: none; }
  body[data-ui="ui2"] tr.store-event-row td.store-money.is-same + td.store-money { grid-row: 1 / span 2; align-self: center; font-size: .9375rem; }
}
/* V69 总览筛选：横向一行（快捷区间 + 口径提示），左对齐；自定义展开时整行显示。 */
body[data-ui="ui2"] #dashboard-filter { flex-direction: row; align-items: center; justify-content: flex-start; margin: .25rem 0 .5rem; }
body[data-ui="ui2"] #dashboard-filter > .dashboard-custom[open] { flex: 1 1 100%; order: 3; }
body[data-ui="ui2"] #dashboard-filter-hint { color: var(--color-muted-text); font-size: .75rem; }
body[data-ui="ui2"] .income-chart-empty { margin: .25rem 0 0; color: var(--color-muted-text); font-size: .8125rem; }

/* V69 台账分类小计：分组卡片，名称与金额在窄列内对齐，细项作小字；口径说明为短句列表。 */
body[data-ui="ui2"] .subtotal-details { margin-top: .75rem; border-top: 1px solid var(--color-divider); padding-top: .25rem; }
body[data-ui="ui2"] .subtotal-details > summary { padding: .625rem 0; font-size: .875rem; font-weight: 500; cursor: pointer; }
body[data-ui="ui2"] .subtotal-groups {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: .75rem; margin: .25rem 0 .75rem;
}
body[data-ui="ui2"] .subtotal-group { padding: .875rem 1rem; border: 1px solid var(--color-border); border-radius: .625rem; background: #fff; }
body[data-ui="ui2"] .subtotal-group-title { margin: 0 0 .5rem; color: var(--color-muted-text); font-size: .75rem; font-weight: 500; letter-spacing: .02em; }
body[data-ui="ui2"] .subtotal-list { display: grid; grid-template-columns: minmax(5.5rem, max-content) minmax(0, 1fr); gap: .5rem 1rem; margin: 0; }
body[data-ui="ui2"] .subtotal-key { margin: 0; color: var(--color-text); font-size: .8125rem; line-height: 1.5; }
body[data-ui="ui2"] .subtotal-value { display: flex; flex-direction: column; align-items: flex-end; gap: .125rem; margin: 0; text-align: right; min-width: 0; }
body[data-ui="ui2"] .subtotal-amount { font-size: .875rem; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
body[data-ui="ui2"] .subtotal-sub { grid-column: 1 / -1; margin: -.375rem 0 .125rem; color: var(--color-muted-text); font-size: .6875rem; line-height: 1.45; text-align: left; overflow-wrap: anywhere; }
body[data-ui="ui2"] .subtotal-glossary { display: grid; gap: .5rem; margin: .25rem 0 .75rem; padding: 0; list-style: none; max-width: 48rem; }
body[data-ui="ui2"] .subtotal-glossary-item { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 1rem; font-size: .8125rem; line-height: 1.6; }
body[data-ui="ui2"] .subtotal-glossary-item > strong { font-weight: 500; color: var(--color-text); }
body[data-ui="ui2"] .subtotal-glossary-item > span { color: var(--color-muted-text); }
@media (max-width: 767px) {
  body[data-ui="ui2"] .subtotal-glossary-item { grid-template-columns: minmax(0, 1fr); gap: .125rem; }
}

/* V70 资金对账单（台账，多账户） */
body[data-ui="ui2"] .ledger-statement { display: grid; gap: .875rem; }
body[data-ui="ui2"] .ledger-statement[hidden] { display: none; }
body[data-ui="ui2"] .ledger-statement-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1rem; }
body[data-ui="ui2"] .ledger-statement-head .panel-title,
body[data-ui="ui2"] .ledger-statement-head .hint { margin: 0; }
body[data-ui="ui2"] .ledger-statement-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .625rem 1rem; }
body[data-ui="ui2"] .ledger-internal { display: inline-flex; align-items: center; gap: .375rem; min-height: 2.25rem; color: var(--color-muted-text); font-size: .8125rem; cursor: pointer; }
body[data-ui="ui2"] .ledger-accounts { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; border: 0; }
body[data-ui="ui2"] .ledger-accounts[hidden] { display: none; }
body[data-ui="ui2"] .ledger-account-chip {
  display: inline-flex; align-items: center; gap: .375rem; min-height: 2.25rem; padding: 0 .75rem;
  border: 1px solid var(--color-border); border-radius: 999px; background: #fff; font-size: .8125rem; cursor: pointer;
}
body[data-ui="ui2"] .ledger-account-chip:has(input:checked) { border-color: var(--color-accent); background: var(--color-accent-soft); color: var(--color-accent); }
body[data-ui="ui2"] .ledger-balance-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .75rem 1.25rem; margin: 0;
  padding: 1rem 1.25rem; border-radius: .625rem; background: var(--color-info-bg);
}
body[data-ui="ui2"] .ledger-balance-strip > dt { display: none; }
body[data-ui="ui2"] .ledger-balance-strip > dd { display: flex; flex-direction: column; gap: .125rem; margin: 0; }
body[data-ui="ui2"] .ledger-balance-label { color: var(--color-muted-text); font-size: .75rem; }
body[data-ui="ui2"] .ledger-balance-line { font-size: .9375rem; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
body[data-ui="ui2"] .ledger-balance-muted .ledger-balance-line { color: var(--color-muted-text); font-size: .8125rem; font-weight: 400; }
body[data-ui="ui2"] .ledger-rate-note { margin: .5rem 0 0; }
body[data-ui="ui2"] .ledger-statement-scroll { border: 1px solid var(--color-border); border-radius: .625rem; overflow-x: auto; }
body[data-ui="ui2"] table.ledger-statement-table { width: 100%; min-width: 46rem; border-collapse: collapse; table-layout: fixed; font-size: .8125rem; }
body[data-ui="ui2"] table.ledger-statement-table th,
body[data-ui="ui2"] table.ledger-statement-table td { padding: .75rem 1rem; border-bottom: 1px solid var(--color-divider); vertical-align: top; text-align: left; }
body[data-ui="ui2"] table.ledger-statement-table thead tr:first-child th {
  background: #fafbfc; color: var(--color-muted-text); font-size: .75rem; font-weight: 400; white-space: nowrap;
}
body[data-ui="ui2"] table.ledger-statement-table .col-date { width: 7rem; }
body[data-ui="ui2"] table.ledger-statement-table .col-account { width: 7rem; }
body[data-ui="ui2"] table.ledger-statement-table .col-money { width: 9.5rem; text-align: right; }
body[data-ui="ui2"] .ledger-date { white-space: nowrap; }
body[data-ui="ui2"] .ledger-time { display: block; margin-top: .125rem; color: var(--color-muted-text); font-size: .6875rem; }
body[data-ui="ui2"] .ledger-account { color: var(--color-muted-text); overflow-wrap: anywhere; }
body[data-ui="ui2"] .ledger-desc-inner { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; }
body[data-ui="ui2"] .ledger-summary { overflow-wrap: anywhere; }
body[data-ui="ui2"] td.ledger-money { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-size: .875rem; }
body[data-ui="ui2"] td.ledger-money.is-empty { color: #b8c0cb; }
body[data-ui="ui2"] td.ledger-money.flow-out:not(.is-empty) { color: var(--color-flow-out); }
body[data-ui="ui2"] td.ledger-money.flow-in:not(.is-empty) { color: var(--color-flow-in); }
body[data-ui="ui2"] td.ledger-balance { color: var(--color-text); font-weight: 500; }
body[data-ui="ui2"] .ledger-sub { display: block; margin-top: .125rem; color: var(--color-muted-text); font-size: .6875rem; font-weight: 400; }
body[data-ui="ui2"] tr.ledger-row.is-internal td { color: var(--color-muted-text); }
body[data-ui="ui2"] tr.ledger-boundary th,
body[data-ui="ui2"] tr.ledger-boundary td { background: #fafbfc; font-weight: 500; color: var(--color-text); }
body[data-ui="ui2"] tfoot tr.ledger-boundary th,
body[data-ui="ui2"] tfoot tr.ledger-boundary td { border-top: 1px solid var(--color-border); border-bottom: 0; }
@media (max-width: 767px) {
  body[data-ui="ui2"] .ledger-statement-scroll { border: 0; overflow: visible; }
  body[data-ui="ui2"] table.ledger-statement-table { min-width: 0; table-layout: auto; }
  body[data-ui="ui2"] table.ledger-statement-table,
  body[data-ui="ui2"] table.ledger-statement-table tbody,
  body[data-ui="ui2"] table.ledger-statement-table thead,
  body[data-ui="ui2"] table.ledger-statement-table tfoot { display: block; }
  body[data-ui="ui2"] table.ledger-statement-table thead tr:first-child { display: none; }
  body[data-ui="ui2"] tr.ledger-row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .125rem .75rem; padding: .75rem 0; border-bottom: 1px solid var(--color-divider);
  }
  body[data-ui="ui2"] tr.ledger-row td { padding: 0; border: 0; }
  body[data-ui="ui2"] tr.ledger-row .ledger-date { grid-column: 1; grid-row: 1; color: var(--color-muted-text); font-size: .75rem; }
  body[data-ui="ui2"] tr.ledger-row .ledger-time { display: inline; margin-left: .375rem; }
  body[data-ui="ui2"] tr.ledger-row .ledger-desc { grid-column: 1; grid-row: 2; }
  body[data-ui="ui2"] tr.ledger-row .ledger-account { grid-column: 1; grid-row: 3; font-size: .75rem; }
  body[data-ui="ui2"] tr.ledger-row td.ledger-money.is-empty { display: none; }
  body[data-ui="ui2"] tr.ledger-row td.flow-out,
  body[data-ui="ui2"] tr.ledger-row td.flow-in { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-weight: 500; }
  body[data-ui="ui2"] tr.ledger-row td.ledger-balance { grid-column: 2; grid-row: 3; color: var(--color-muted-text); font-size: .75rem; font-weight: 400; }
  body[data-ui="ui2"] tr.ledger-boundary { display: flex; justify-content: space-between; gap: 1rem; margin: .375rem 0; padding: .625rem .875rem; border-radius: .5rem; background: var(--color-info-bg); }
  body[data-ui="ui2"] tr.ledger-boundary th,
  body[data-ui="ui2"] tr.ledger-boundary td { padding: 0; border: 0; background: transparent; }
  body[data-ui="ui2"] tr.ledger-empty { display: block; padding: .75rem 0; }
}
body[data-ui="ui2"] .demo-badge { display: inline-flex; align-items: center; padding: .125rem .625rem; border-radius: 999px; background: var(--color-pending-bg); color: var(--color-pending-text); font-size: .75rem; font-weight: 500; }
body[data-ui="ui2"] .demo-badge[hidden] { display: none; }
@media (max-width: 767px) {
  body[data-ui="ui2"] .ledger-balance-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: .875rem 1rem; }
  body[data-ui="ui2"] .ledger-statement-controls .segmented { width: 100%; }
}

/* ==========================================================================
 * V71 Apple 设计语言层（浅色）：iOS 系统蓝 #007AFF、SF 系统字栈、毛玻璃外壳。
 *  - 玻璃只用于“浮在内容之上”的外壳：侧栏、顶栏、手机底部标签栏、更多菜单、弹窗、提示条、登录卡；
 *    正文卡片、表格与金额保持实底白色（不透明），数字可读性不受背景影响。
 *  - 不支持 backdrop-filter、用户要求降低透明度或提高对比度时，外壳退回实底并加可见边框。
 *  - 色彩：#007AFF 用于焦点环、选中指示、图标与浅色底；实心按钮底用 #0071E3（白字 4.7:1），
 *    小字链接与选中文字用 #0066CC（5.6:1），收入/支出用 #1E7B34 / #D70015（均 ≥ 5:1）。
 *  - 只追加覆盖，不用 overflow:hidden 裁切；业务逻辑与 DOM 不变。
 * ======================================================================== */
:root {
  --ios-blue: #007AFF;
  --color-accent: #007AFF;
  --color-ring: #007AFF;
  --color-accent-fill: #0071E3;
  --color-accent-fill-hover: #0064CC;
  --color-accent-text: #0066CC;
  --color-accent-soft: rgba(0, 122, 255, .1);
  --color-sale: var(--color-accent-fill);
  --color-fx: var(--color-accent-fill);
  --color-text: #1d1d1f;
  --color-secondary-text: #3a3a3c;
  --color-muted-text: #6e6e73;
  --color-tertiary-text: #aeaeb2;
  --color-border: rgba(60, 60, 67, .16);
  --color-divider: rgba(60, 60, 67, .1);
  --color-input: rgba(60, 60, 67, .3);
  --color-page: #f2f2f7;
  --color-fill: rgba(118, 118, 128, .12);
  --color-fill-hover: rgba(118, 118, 128, .2);
  --color-muted-bg: rgba(118, 118, 128, .12);
  --color-info-bg: #f5f5f7;
  --color-table-head: #f8f8fa;
  --color-pending-bg: rgba(255, 149, 0, .14);
  --color-pending-text: #9a5a00;
  --color-success: #1e7b34;
  --color-error: #d70015;
  --color-flow-in: #1e7b34;
  --color-flow-out: #d70015;
  --flow-in: #1e7b34;
  --flow-out: #d70015;
  --color-chart-sales: #9cc6fb;
  --color-chart-profit: #5fc27e;
  --radius: .625rem;
  --radius-card: 1.125rem;
  --radius-sheet: 1.375rem;
  --font-body: .875rem/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "PingFang SC",
    "PingFang HK", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", "PingFang SC",
    "PingFang HK", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --shadow-card: 0 0 0 .5px rgba(0, 0, 0, .04), 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px -14px rgba(0, 0, 0, .12);
  --shadow-float: 0 0 0 .5px rgba(0, 0, 0, .06), 0 2px 6px rgba(0, 0, 0, .05), 0 20px 48px -18px rgba(0, 0, 0, .3);
  --glass-edge: rgba(255, 255, 255, .7);
  --glass-hairline: rgba(0, 0, 0, .08);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, .8), inset 0 0 0 .5px rgba(255, 255, 255, .45);
  /* 默认实底；支持毛玻璃时在下方 @supports 中换成半透明 + 模糊。 */
  --chrome-bg: #f9f9fb;
  --sheet-bg: #ffffff;
  --menu-bg: #fbfbfd;
  --login-bg: #ffffff;
  --chrome-filter: none;
}
html[data-flow-colors="reverse"] { --color-flow-in: #d70015; --color-flow-out: #1e7b34; }
:root[data-flow-colors="reverse"] { --flow-in: #d70015; --flow-out: #1e7b34; }

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root {
    --chrome-bg: rgba(255, 255, 255, .52);
    --sheet-bg: rgba(255, 255, 255, .94);
    --login-bg: rgba(255, 255, 255, .62);
    --chrome-filter: saturate(180%) blur(24px);
  }
}
@media (prefers-reduced-transparency: reduce) {
  :root { --chrome-bg: #f9f9fb; --sheet-bg: #ffffff; --menu-bg: #ffffff; --login-bg: #ffffff; --chrome-filter: none; }
}
@media (prefers-contrast: more) {
  :root {
    --chrome-bg: #ffffff; --sheet-bg: #ffffff; --menu-bg: #ffffff; --login-bg: #ffffff; --chrome-filter: none;
    --glass-edge: var(--color-text); --glass-hairline: var(--color-text); --color-border: #6e6e73; --color-divider: #aeaeb2;
    --color-input: #6e6e73;
  }
}

/* ---------------------------------------------------------------- 页面底：柔和多色渐变“壁纸”，让玻璃外壳透出色彩 */
body[data-ui="ui2"] {
  background: var(--color-page); color: var(--color-text); font: var(--font-body);
  accent-color: var(--ios-blue); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
body[data-ui="ui2"]::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(54rem 40rem at -6% -10%, rgba(0, 122, 255, .2), transparent 62%),
    radial-gradient(44rem 34rem at 106% 2%, rgba(175, 82, 222, .15), transparent 60%),
    radial-gradient(50rem 38rem at 72% 110%, rgba(52, 199, 89, .13), transparent 62%),
    radial-gradient(38rem 30rem at 12% 98%, rgba(255, 149, 0, .11), transparent 60%),
    linear-gradient(180deg, #f6f7fb 0%, #eef0f6 100%);
}
@media (prefers-contrast: more) { body[data-ui="ui2"]::before { background: var(--color-page); } }
body[data-ui="ui2"] ::selection { background: rgba(0, 122, 255, .22); }

/* ---------------------------------------------------------------- 字体层级（SF 风格） */
body[data-ui="ui2"] .view-title {
  font-family: var(--font-display); font-size: 1.875rem; font-weight: 700; line-height: 1.2; letter-spacing: -.01em;
}
body[data-ui="ui2"] .view h2,
body[data-ui="ui2"] .panel-title { font-size: 1.0625rem; font-weight: 600; letter-spacing: -.005em; }
body[data-ui="ui2"] .dialog-title { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; letter-spacing: -.005em; }
body[data-ui="ui2"] .stat-amount,
body[data-ui="ui2"] .account-card .account-balance,
body[data-ui="ui2"] #funds-detail-current,
body[data-ui="ui2"] .accounts-hkd-total-value {
  font-family: var(--font-display); font-weight: 600; letter-spacing: -.015em; font-variant-numeric: tabular-nums;
}
body[data-ui="ui2"] .field label,
body[data-ui="ui2"] .field legend { color: var(--color-muted-text); font-size: .75rem; font-weight: 500; }

/* ---------------------------------------------------------------- 内容卡片：实底白色 + 大圆角 + 极轻阴影 */
body[data-ui="ui2"] .panel,
body[data-ui="ui2"] .card,
body[data-ui="ui2"] .stat { border: 0; border-radius: var(--radius-card); background: #fff; box-shadow: var(--shadow-card); }
body[data-ui="ui2"] #dashboard-primary .primary-metric,
body[data-ui="ui2"] .accounts-hkd-total { background: #fff; box-shadow: var(--shadow-card); }
body[data-ui="ui2"] .panel .panel,
body[data-ui="ui2"] .panel .stat,
body[data-ui="ui2"] .card .card { box-shadow: none; }
body[data-ui="ui2"] .panel .stat { background: var(--color-info-bg); border-radius: .875rem; }
body[data-ui="ui2"] section[aria-labelledby="accounts-title"],
body[data-ui="ui2"] tr.store-event-detail .card,
body[data-ui="ui2"] .statement-detail > .card { box-shadow: none; }
body[data-ui="ui2"] .subtotal-group { border: 0; border-radius: .875rem; background: var(--color-info-bg); }
body[data-ui="ui2"] .ledger-balance-strip,
body[data-ui="ui2"] #funds-detail-balances { border-radius: .875rem; background: var(--color-info-bg); }
body[data-ui="ui2"] .chart-legend-sales,
body[data-ui="ui2"] .account-kind,
body[data-ui="ui2"] #dashboard-primary .primary-metric-link { color: var(--color-accent-text); }
@media (prefers-contrast: more) {
  body[data-ui="ui2"] .panel,
  body[data-ui="ui2"] .card,
  body[data-ui="ui2"] .stat,
  body[data-ui="ui2"] #dashboard-primary .primary-metric { border: 1px solid var(--color-text); box-shadow: none; }
}

/* 按钮与分段控件见文件末尾 V72 Liquid Glass 层。 */

/* ---------------------------------------------------------------- 输入框：白底细边，聚焦时蓝色光晕 */
body[data-ui="ui2"] .field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
body[data-ui="ui2"] .field select,
body[data-ui="ui2"] .field textarea,
body[data-ui="ui2"] .search-row > input,
body[data-ui="ui2"] input[type="search"],
body[data-ui="ui2"] select {
  border: 1px solid var(--color-border); border-radius: .625rem; background-color: #fff;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .02); transition: border-color .15s ease, box-shadow .15s ease;
}
body[data-ui="ui2"] .field input:focus-visible,
body[data-ui="ui2"] .field select:focus-visible,
body[data-ui="ui2"] .field textarea:focus-visible,
body[data-ui="ui2"] .search-row > input:focus-visible,
body[data-ui="ui2"] select:focus-visible {
  outline: 2px solid var(--color-ring); outline-offset: 0; border-color: var(--color-accent);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, .16);
}

/* ---------------------------------------------------------------- 表格与对账单 */
body[data-ui="ui2"] .data-table th,
body[data-ui="ui2"] table.store-statement th,
body[data-ui="ui2"] table.fund-statement thead tr:first-child th,
body[data-ui="ui2"] table.ledger-statement-table thead tr:first-child th {
  background: var(--color-table-head); color: var(--color-muted-text); font-size: .75rem; font-weight: 500;
}
body[data-ui="ui2"] tr.statement-boundary th,
body[data-ui="ui2"] tr.statement-boundary td,
body[data-ui="ui2"] tr.ledger-boundary th,
body[data-ui="ui2"] tr.ledger-boundary td { background: var(--color-table-head); }
body[data-ui="ui2"] .fund-statement-scroll,
body[data-ui="ui2"] .ledger-statement-scroll { border-color: var(--color-divider); border-radius: .875rem; }
body[data-ui="ui2"] td.ledger-money.is-empty,
body[data-ui="ui2"] table.fund-statement td.statement-money.is-empty { color: var(--color-tertiary-text); }
body[data-ui="ui2"] .statement-kind { background: var(--color-fill); color: var(--color-secondary-text); }
body[data-ui="ui2"] .statement-kind-transfer_out,
body[data-ui="ui2"] .statement-kind-transfer_in,
body[data-ui="ui2"] .statement-kind-adjustment { background: var(--color-pending-bg); color: var(--color-pending-text); }
body[data-ui="ui2"] .ledger-account-chip { border-color: var(--color-border); background: #fff; }
body[data-ui="ui2"] .ledger-account-chip:has(input:checked) { border-color: var(--color-accent); background: var(--color-accent-soft); color: var(--color-accent-text); }
@media (hover: hover) and (min-width: 768px) {
  body[data-ui="ui2"] tr.ledger-row:hover > td,
  body[data-ui="ui2"] tr.statement-row:hover > td,
  body[data-ui="ui2"] tr.store-event-row:hover > td { background: rgba(0, 122, 255, .035); }
}
@media (max-width: 767px) {
  body[data-ui="ui2"] tr.statement-boundary,
  body[data-ui="ui2"] tr.ledger-boundary { border-radius: .75rem; background: var(--color-info-bg); }
  body[data-ui="ui2"] tr.statement-boundary th,
  body[data-ui="ui2"] tr.statement-boundary td,
  body[data-ui="ui2"] tr.ledger-boundary th,
  body[data-ui="ui2"] tr.ledger-boundary td { background: transparent; }
}

/* ---------------------------------------------------------------- 角色与演示标记 */
body[data-ui="ui2"] #role-badge { border: 0; padding: .1875rem .625rem; background: var(--color-fill); color: var(--color-secondary-text); }
body[data-ui="ui2"] .demo-badge { padding: .1875rem .625rem; }

/* ---------------------------------------------------------------- 外壳：桌面悬浮玻璃侧栏 + 玻璃顶栏 */
@media (min-width: 768px) {
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-view { grid-template-columns: 15rem minmax(0, 1fr); }
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-nav {
    top: .75rem; height: calc(100dvh / var(--ui-zoom, 1) - 1.5rem); min-height: 0; max-height: none;
    margin: .75rem 0 .75rem .75rem; padding: 1.25rem .625rem 1rem; gap: .125rem;
    border: .5px solid var(--glass-edge); border-radius: var(--radius-sheet);
    background: var(--chrome-bg); -webkit-backdrop-filter: var(--chrome-filter); backdrop-filter: var(--chrome-filter);
    box-shadow: var(--glass-highlight), 0 0 0 .5px var(--glass-hairline), 0 16px 40px -20px rgba(0, 0, 0, .22);
  }
  html:not([data-ui-compact]) body[data-ui="ui2"] .nav-brand {
    display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); align-items: center; column-gap: .625rem; row-gap: 0;
    padding: 0 .5rem 1.25rem;
  }
  html:not([data-ui-compact]) body[data-ui="ui2"] .nav-brand::before {
    content: "簿"; grid-row: 1 / span 2; display: grid; place-items: center; width: 2.25rem; height: 2.25rem;
    border-radius: .625rem; background: linear-gradient(180deg, #1a84ff 0%, #0060cc 100%); color: #fff;
    font-size: 1rem; font-weight: 700; box-shadow: 0 6px 14px -6px rgba(0, 96, 204, .7), inset 0 1px 0 rgba(255, 255, 255, .3);
  }
  html:not([data-ui-compact]) body[data-ui="ui2"] .nav-brand-name { font-family: var(--font-display); font-size: 1.125rem; font-weight: 700; line-height: 1.2; }
  html:not([data-ui-compact]) body[data-ui="ui2"] .nav-brand-sub { font-size: .625rem; font-weight: 500; letter-spacing: .1em; }
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-nav .nav-item {
    height: 2.5rem; min-height: 2.5rem; padding: 0 .75rem; gap: .625rem; border: 0; border-radius: .625rem;
    background: transparent; color: var(--color-text); font-size: .875rem; font-weight: 400;
  }
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-nav .nav-item .nav-icon { color: var(--ios-blue); }
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-nav .nav-item:hover { background: rgba(0, 0, 0, .05); color: var(--color-text); }
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-nav .nav-item.is-active {
    background: rgba(255, 255, 255, .9); color: var(--color-accent-text); font-weight: 600;
    box-shadow: 0 0 0 .5px rgba(0, 0, 0, .04), 0 1px 3px rgba(0, 0, 0, .1);
  }
  html:not([data-ui-compact]) body[data-ui="ui2"] .nav-more-list { gap: .125rem; }
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-header {
    border-bottom: .5px solid var(--glass-hairline);
    background: var(--chrome-bg); -webkit-backdrop-filter: var(--chrome-filter); backdrop-filter: var(--chrome-filter);
  }
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-header-inner { height: 3.5rem; padding: 0 2rem; }
  html:not([data-ui-compact]) body[data-ui="ui2"] .view-stack { padding: 1.75rem 2rem 3rem; }
}

/* ---------------------------------------------------------------- 手机：透明顶栏 + 悬浮玻璃标签栏（iOS tab bar） */
html[data-ui-compact] body[data-ui="ui2"] .app-header { border: 0; background: transparent; }
html[data-ui-compact] body[data-ui="ui2"] .view-title { font-size: 1.75rem; }
html[data-ui-compact]:not([data-nav-flow]) body[data-ui="ui2"] {
  padding-bottom: calc(var(--nav-height) + 1.5rem + env(safe-area-inset-bottom));
}
html[data-ui-compact]:not([data-nav-flow]) body[data-ui="ui2"] .app-nav {
  left: .75rem; right: .75rem; bottom: calc(.5rem + env(safe-area-inset-bottom));
  gap: .125rem; padding: .3125rem;
  border: .5px solid var(--glass-edge); border-radius: 1.75rem;
  background: var(--chrome-bg); -webkit-backdrop-filter: var(--chrome-filter); backdrop-filter: var(--chrome-filter);
  box-shadow: var(--glass-highlight), var(--shadow-float);
}
html[data-ui-compact] body[data-ui="ui2"] .nav-primary > .nav-item,
html[data-ui-compact] body[data-ui="ui2"] .nav-summary {
  min-height: 3.25rem; padding: .25rem .125rem; border: 0; border-radius: 1.375rem;
  background: transparent; color: var(--color-secondary-text); font-size: .6875rem; font-weight: 500; line-height: 1.2;
}
html[data-ui-compact] body[data-ui="ui2"] .nav-primary > .nav-item .nav-icon,
html[data-ui-compact] body[data-ui="ui2"] .nav-summary .nav-icon { width: 1.5rem; height: 1.5rem; }
html[data-ui-compact] body[data-ui="ui2"] .nav-primary > .nav-item.is-active,
html[data-ui-compact] body[data-ui="ui2"] .nav-more[open] > .nav-summary,
html[data-ui-compact] body[data-ui="ui2"] .nav-more:has(.nav-item.is-active) > .nav-summary {
  background: rgba(118, 118, 128, .14); color: var(--color-accent-text); font-weight: 600;
}
html[data-ui-compact] body[data-ui="ui2"] .nav-primary > .nav-item.is-active .nav-icon,
html[data-ui-compact] body[data-ui="ui2"] .nav-more:has(.nav-item.is-active) > .nav-summary .nav-icon { color: var(--ios-blue); }
/* 更多菜单：浮在标签栏上方的圆角菜单。导航本身带 backdrop-filter，菜单是其后代，取不到页面模糊，半透明底会让正文透出，故用实底。 */
html[data-ui-compact] body[data-ui="ui2"] .nav-more-list {
  padding: .375rem; border: .5px solid var(--glass-hairline); border-radius: 1.125rem;
  background: var(--menu-bg); box-shadow: var(--shadow-float);
}
html[data-ui-compact]:not([data-nav-flow]) body[data-ui="ui2"] .nav-more-list { bottom: calc(var(--nav-height) + .5rem); }
html[data-ui-compact] body[data-ui="ui2"] .nav-more-list .nav-item {
  min-height: 2.75rem; padding: 0 .75rem; gap: .75rem; border: 0; border-radius: .75rem;
  background: transparent; color: var(--color-text); font-size: .9375rem; font-weight: 400;
}
html[data-ui-compact] body[data-ui="ui2"] .nav-more-list .nav-item .nav-icon { color: var(--ios-blue); }
html[data-ui-compact] body[data-ui="ui2"] .nav-more-list .nav-item:hover { background: rgba(0, 0, 0, .05); }
html[data-ui-compact] body[data-ui="ui2"] .nav-more-list .nav-item.is-active { background: var(--color-accent-soft); color: var(--color-accent-text); font-weight: 600; }
html[data-nav-flow] body[data-ui="ui2"] .app-nav { border-radius: var(--radius-card); background: #fff; box-shadow: var(--shadow-card); }

/* ---------------------------------------------------------------- 弹窗：玻璃面板（sheet） */
body[data-ui="ui2"] .dialog {
  padding: 1.25rem 1.25rem 1rem; border: .5px solid var(--glass-edge); border-radius: var(--radius-sheet);
  background: var(--sheet-bg); -webkit-backdrop-filter: var(--chrome-filter); backdrop-filter: var(--chrome-filter);
  box-shadow: var(--glass-highlight), var(--shadow-float);
}
body[data-ui="ui2"] .dialog::backdrop { background: rgba(0, 0, 0, .24); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
@media (prefers-reduced-transparency: reduce) {
  body[data-ui="ui2"] .dialog::backdrop { background: rgba(0, 0, 0, .4); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* ---------------------------------------------------------------- 提示条：玻璃横幅（保留成功/错误的彩色边框与文字） */
body[data-ui="ui2"] .flash {
  border-radius: 1rem; background: var(--sheet-bg);
  -webkit-backdrop-filter: var(--chrome-filter); backdrop-filter: var(--chrome-filter);
  box-shadow: var(--glass-highlight), var(--shadow-float);
}

/* ---------------------------------------------------------------- 登录：壁纸上的玻璃卡片 + 应用图标 */
body[data-ui="ui2"] #login-view { min-height: 100dvh; align-items: center; padding: 2rem 1rem; }
body[data-ui="ui2"] #login-view .login-card {
  padding: 2rem; border: .5px solid var(--glass-edge); border-radius: 1.5rem;
  background: var(--login-bg); -webkit-backdrop-filter: var(--chrome-filter); backdrop-filter: var(--chrome-filter);
  box-shadow: var(--glass-highlight), var(--shadow-float);
}
body[data-ui="ui2"] #login-view .brand-mark {
  display: inline-grid; place-items: center; width: 3.5rem; height: 3.5rem; margin: 0;
  border-radius: 1rem; background: linear-gradient(180deg, #1a84ff 0%, #0060cc 100%); color: #fff;
  font-size: 1.0625rem; font-weight: 700; box-shadow: 0 10px 22px -10px rgba(0, 96, 204, .75), inset 0 1px 0 rgba(255, 255, 255, .3);
}
body[data-ui="ui2"] #login-view .login-title { margin: 1.25rem 0 .25rem; font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; letter-spacing: -.01em; }
body[data-ui="ui2"] #login-view .btn-primary { min-height: 2.75rem; font-size: .9375rem; font-weight: 600; }
@media (max-width: 600px) { body[data-ui="ui2"] #login-view .login-card { padding: 1.5rem; } }

/* V71 细节：库存工具条与卡片操作沿用旧的 ID/类规则（优先级更高），在此统一为同一套外观。 */
body[data-ui="ui2"] #inventory-search > select,
body[data-ui="ui2"] #inventory-search > input,
body[data-ui="ui2"] #sales-search .sales-finance-filter select { border-color: var(--color-border); border-radius: .625rem; }
body[data-ui="ui2"] #store-ledger-list > p.muted,
body[data-ui="ui2"] #audit-list > p.muted,
body[data-ui="ui2"] #archives-list > p.muted { margin: 0; padding: .875rem 1rem; }
body[data-ui="ui2"] .state:not(.state-error) { border: 0; border-radius: .875rem; background: rgba(255, 255, 255, .72); color: var(--color-muted-text); }
@media (prefers-contrast: more) { body[data-ui="ui2"] .state:not(.state-error) { border: 1px solid var(--color-text); background: #fff; } }
/* V71 弹窗吸底操作条：与玻璃面板同色调（近实底，压住下方滚动内容），细分隔线。 */
body[data-ui="ui2"] #item-dialog .dialog-actions,
body[data-ui="ui2"] #sale-dialog .dialog-actions {
  margin-inline: -1.25rem; padding: .75rem 1.25rem; border-top: .5px solid var(--color-divider);
  background: rgba(248, 248, 250, .97);
}
@media (prefers-contrast: more) {
  body[data-ui="ui2"] #item-dialog .dialog-actions,
  body[data-ui="ui2"] #sale-dialog .dialog-actions { background: #fff; border-top-color: var(--color-text); }
}
/* 文件选择：系统按钮换成灰色胶囊，输入框本身不加边框。 */
body[data-ui="ui2"] .field input[type="file"] { min-height: 2.75rem; padding: .25rem 0; border: 0; background: transparent; box-shadow: none; font-size: .8125rem; color: var(--color-muted-text); }
body[data-ui="ui2"] input[type="file"]::file-selector-button {
  margin-right: .75rem; padding: .5rem 1rem; border: 0; border-radius: 999px;
  background: var(--color-fill); color: var(--color-text); font: inherit; font-weight: 500; cursor: pointer;
}
body[data-ui="ui2"] input[type="file"]::file-selector-button:hover { background: var(--color-fill-hover); }
body[data-ui="ui2"] fieldset { border-color: var(--color-border); border-radius: .875rem; }

/* ==========================================================================
 * V72 Liquid Glass 控件（用户 2026-11-16 反馈）
 *  1. 顶栏去掉实色底与硬分隔线，改为向下渐隐的“滚动边缘”模糊，和悬浮侧栏自然衔接；
 *     右上角的演示标记、角色、显示设置、退出收进同一个玻璃胶囊组。
 *  2. 侧栏菜单、日期快捷、显示方式、页签、账户范围等所有选择器统一为 iOS Liquid Glass
 *     分段选择器：半透明凹槽轨道 + 带顶部高光与投影的玻璃滑块；工具栏下拉改为胶囊“弹出按钮”，
 *     搜索框改为 iOS 搜索栏。
 *  3. 按钮统一：同一高度（桌面 36px / 手机 44px）、同一胶囊形、同一字号；
 *     次要 = 白色玻璃，主要 = 蓝色玻璃（白字对比 ≥ 4.6:1），危险 = 红色浅玻璃，图标按钮 = 玻璃圆钮。
 *  选择器前缀 #main 用于压过旧版按 ID 写死的尺寸（如 #sales-search .sales-presets .btn）。
 * ======================================================================== */
:root {
  --control-h: 2.25rem;
  --control-inner-h: 1.875rem;
  --control-pad: .1875rem;
  --control-font: .875rem;
  --glass-btn-bg: linear-gradient(180deg, rgba(255, 255, 255, .92) 0%, rgba(255, 255, 255, .64) 100%);
  --glass-btn-bg-hover: linear-gradient(180deg, #fff 0%, rgba(255, 255, 255, .8) 100%);
  --glass-btn-shadow: inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 -1px 0 rgba(255, 255, 255, .4),
    0 0 0 .5px rgba(0, 0, 0, .09), 0 1px 2px rgba(0, 0, 0, .06), 0 4px 12px -6px rgba(0, 0, 0, .2);
  --glass-btn-shadow-hover: inset 0 1px 0 #fff, inset 0 -1px 0 rgba(255, 255, 255, .5),
    0 0 0 .5px rgba(0, 0, 0, .1), 0 2px 4px rgba(0, 0, 0, .07), 0 8px 20px -8px rgba(0, 0, 0, .26);
  --glass-blue-bg: linear-gradient(180deg, #1f7fe8 0%, #0066d6 100%);
  --glass-blue-bg-hover: linear-gradient(180deg, #1a78df 0%, #005ec6 100%);
  --glass-blue-shadow: inset 0 1px 0 rgba(255, 255, 255, .38), inset 0 -1px 0 rgba(0, 0, 0, .1),
    0 0 0 .5px rgba(0, 82, 170, .45), 0 4px 14px -6px rgba(0, 113, 227, .65);
  --glass-red-bg: linear-gradient(180deg, rgba(255, 59, 48, .15) 0%, rgba(255, 59, 48, .09) 100%);
  --glass-red-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 0 0 .5px rgba(215, 0, 21, .2), 0 4px 12px -6px rgba(215, 0, 21, .28);
  --track-bg: rgba(118, 118, 128, .12);
  --track-shadow: inset 0 1px 2px rgba(0, 0, 0, .07), inset 0 0 0 .5px rgba(0, 0, 0, .04);
  --thumb-bg: linear-gradient(180deg, #fff 0%, rgba(255, 255, 255, .9) 100%);
  --thumb-shadow: inset 0 1px 0 #fff, 0 0 0 .5px rgba(0, 0, 0, .06), 0 1px 1px rgba(0, 0, 0, .04), 0 3px 8px rgba(0, 0, 0, .13);
  --header-fade: rgba(243, 244, 249, .86);
  --icon-chevrons: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 16'%3E%3Cpath d='M3 6l3-3 3 3M3 10l3 3 3-3' fill='none' stroke='%236e6e73' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --icon-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='4.75' fill='none' stroke='%236e6e73' stroke-width='1.6'/%3E%3Cpath d='M10.5 10.5L14 14' stroke='%236e6e73' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  --icon-chevron-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%236e6e73' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
html[data-ui-compact] { --control-h: 2.75rem; --control-inner-h: 2.375rem; }
@media (prefers-contrast: more) {
  :root {
    --glass-btn-bg: #fff; --glass-btn-bg-hover: #f2f2f7; --thumb-bg: #fff; --track-bg: #e5e5ea;
    --glass-btn-shadow: 0 0 0 1px var(--color-text); --glass-btn-shadow-hover: 0 0 0 1px var(--color-text);
    --thumb-shadow: 0 0 0 1.5px var(--color-text); --track-shadow: 0 0 0 1px var(--color-text);
  }
}

/* ---------------------------------------------------------------- 按钮：同高、胶囊、玻璃 */
body[data-ui="ui2"] #main .btn:not(.btn-link) {
  min-height: var(--control-h); height: auto; padding: 0 1rem; border: 0; border-radius: 999px;
  background: var(--glass-btn-bg); color: var(--color-text); box-shadow: var(--glass-btn-shadow);
  font-size: var(--control-font); font-weight: 500; line-height: 1.2; letter-spacing: 0;
  transition: background .18s ease, box-shadow .18s ease, color .18s ease, transform .12s ease;
}
body[data-ui="ui2"] #main .btn:not(.btn-link):hover:not(:disabled) { background: var(--glass-btn-bg-hover); box-shadow: var(--glass-btn-shadow-hover); }
body[data-ui="ui2"] #main .btn:not(.btn-link):active:not(:disabled) { transform: scale(.97); }
body[data-ui="ui2"] #main .btn-primary:not(.btn-link),
body[data-ui="ui2"] #main .btn[aria-pressed="true"]:not(.segmented-btn) {
  background: var(--glass-blue-bg); color: #fff; box-shadow: var(--glass-blue-shadow); font-weight: 600;
}
body[data-ui="ui2"] #main .btn-primary:not(.btn-link):hover:not(:disabled),
body[data-ui="ui2"] #main .btn[aria-pressed="true"]:not(.segmented-btn):hover:not(:disabled) { background: var(--glass-blue-bg-hover); box-shadow: var(--glass-blue-shadow); }
body[data-ui="ui2"] #main .btn-danger:not(.btn-link) { background: var(--glass-red-bg); color: var(--color-error); box-shadow: var(--glass-red-shadow); }
body[data-ui="ui2"] #main .btn-danger:not(.btn-link):hover:not(:disabled) { background: linear-gradient(180deg, rgba(255, 59, 48, .22) 0%, rgba(255, 59, 48, .14) 100%); box-shadow: var(--glass-red-shadow); }
body[data-ui="ui2"] #main .btn:not(.btn-link):disabled { opacity: .45; box-shadow: none; transform: none; cursor: not-allowed; }
body[data-ui="ui2"] #main .btn-link { color: var(--color-accent-text); }
@media (prefers-contrast: more) {
  body[data-ui="ui2"] #main .btn-primary:not(.btn-link) { background: var(--color-accent-fill); box-shadow: 0 0 0 1px var(--color-text); }
  body[data-ui="ui2"] #main .btn-danger:not(.btn-link) { background: #fff; box-shadow: 0 0 0 1px var(--color-error); }
}

/* 货品卡片：“修改”为胶囊，归档 / 作废为玻璃圆钮（仅图标，文字保留在无障碍名称中）。 */
body[data-ui="ui2"] #main .item-primary-actions .item-icon-action:not(.item-edit-action) {
  width: var(--control-h); min-width: var(--control-h); padding: 0; font-size: 0; color: var(--color-muted-text);
}
body[data-ui="ui2"] #main .item-primary-actions .btn-danger.item-icon-action { color: var(--color-error); }
body[data-ui="ui2"] #main .item-primary-actions .item-edit-action { padding: 0 .9375rem 0 .75rem; }

/* 折叠“筛选条件”等摘要按钮：与按钮同高的玻璃胶囊，右侧小箭头随展开旋转。 */
body[data-ui="ui2"] #main :is(.inventory-advanced, .sales-advanced) > summary {
  display: inline-flex; align-items: center; gap: .375rem; min-height: var(--control-h); height: auto;
  padding: 0 .875rem 0 1rem; border: 0; border-radius: 999px; list-style: none;
  background: var(--glass-btn-bg); color: var(--color-text); box-shadow: var(--glass-btn-shadow);
  font-size: var(--control-font); font-weight: 500; cursor: pointer;
}
body[data-ui="ui2"] #main :is(.inventory-advanced, .sales-advanced) > summary::-webkit-details-marker { display: none; }
body[data-ui="ui2"] #main :is(.inventory-advanced, .sales-advanced) > summary::marker { content: ""; }
body[data-ui="ui2"] #main :is(.inventory-advanced, .sales-advanced) > summary::after {
  content: ""; width: .75rem; height: .75rem; background: var(--icon-chevron-down) center / contain no-repeat; transition: transform .18s ease;
}
body[data-ui="ui2"] #main :is(.inventory-advanced, .sales-advanced)[open] > summary::after { transform: rotate(180deg); }
body[data-ui="ui2"] #main :is(.inventory-advanced, .sales-advanced) > summary:hover { background: var(--glass-btn-bg-hover); box-shadow: var(--glass-btn-shadow-hover); }

/* ---------------------------------------------------------------- 分段选择器（Liquid Glass segmented picker） */
body[data-ui="ui2"] #main :is(.segmented, .dashboard-ranges, #store-presets, .sales-presets, .collection-mode-group, .tabs) {
  display: inline-flex; flex-wrap: wrap; align-items: center; align-self: flex-start; justify-self: start;
  width: fit-content; max-width: 100%; min-height: var(--control-h); gap: .125rem; margin-block: 0;
  padding: var(--control-pad); border: 0; border-radius: calc(var(--control-h) / 2 + 1px);
  background: var(--track-bg); box-shadow: var(--track-shadow);
}
body[data-ui="ui2"] #main :is(.segmented, .dashboard-ranges, #store-presets, .sales-presets, .collection-mode-group, .tabs) > :is(.btn, .segmented-btn, .collection-mode, .tab) {
  flex: 0 0 auto; min-width: 0; min-height: var(--control-inner-h); height: auto; padding: 0 .875rem;
  border: 0; border-radius: calc(var(--control-inner-h) / 2); background: transparent; box-shadow: none;
  color: var(--color-secondary-text); font-size: .8125rem; font-weight: 500; line-height: 1.2; white-space: nowrap; transform: none;
  transition: background .2s ease, box-shadow .2s ease, color .2s ease;
}
body[data-ui="ui2"] #main :is(.segmented, .dashboard-ranges, #store-presets, .sales-presets, .collection-mode-group, .tabs) > :is(.btn, .segmented-btn, .collection-mode, .tab):hover:not([aria-pressed="true"]):not([aria-selected="true"]):not(.is-active):not(:disabled) {
  background: rgba(255, 255, 255, .5); box-shadow: none;
}
body[data-ui="ui2"] #main :is(.segmented, .dashboard-ranges, #store-presets, .sales-presets, .collection-mode-group, .tabs) > :is([aria-pressed="true"], [aria-selected="true"], .is-active) {
  background: var(--thumb-bg); color: var(--color-text); font-weight: 600; box-shadow: var(--thumb-shadow);
}
body[data-ui="ui2"] #main .report-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
/* 手机：日期快捷与账户范围铺满整行、等分（iOS 惯例）；页签可横向滑动。 */
html[data-ui-compact] body[data-ui="ui2"] #main :is(.dashboard-ranges, #store-presets, .sales-presets, .statement-ranges, .report-presets, .ledger-statement-controls .segmented) {
  display: flex; flex-wrap: nowrap; width: 100%;
}
html[data-ui-compact] body[data-ui="ui2"] #main :is(.dashboard-ranges, #store-presets, .sales-presets, .statement-ranges, .report-presets, .ledger-statement-controls .segmented) > * {
  flex: 1 1 0; padding-inline: .375rem;
}
html[data-ui-compact] body[data-ui="ui2"] #main .collection-toolbar { flex-wrap: wrap; }
/* 统计页：快捷范围与“查询”同一行。 */
body[data-ui="ui2"] #main #report-filter .range-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
body[data-ui="ui2"] #main #report-filter .range-actions > .btn { width: auto; flex: 0 0 auto; }

/* ---------------------------------------------------------------- 工具栏下拉 = 胶囊弹出按钮；搜索框 = iOS 搜索栏 */
body[data-ui="ui2"] #main :is(#inventory-search > select, #dashboard-income-chart > label select, [id^="reports-"] > label select) {
  -webkit-appearance: none; appearance: none; min-height: var(--control-h); height: var(--control-h);
  padding: 0 2.125rem 0 1rem; border: 0; border-radius: 999px;
  background: var(--icon-chevrons) right .875rem center / .625rem no-repeat, var(--glass-btn-bg);
  box-shadow: var(--glass-btn-shadow); color: var(--color-text); font-size: var(--control-font); font-weight: 500; cursor: pointer;
}
body[data-ui="ui2"] #main input[type="search"] {
  -webkit-appearance: none; appearance: none; min-height: var(--control-h); height: var(--control-h);
  padding: 0 1rem 0 2.25rem; border: 0; border-radius: 999px;
  background: var(--icon-search) left .875rem center / .875rem no-repeat, var(--track-bg);
  box-shadow: var(--track-shadow); color: var(--color-text); font-size: var(--control-font);
}
body[data-ui="ui2"] #main input[type="search"]:focus-visible {
  background-color: #fff; background-image: var(--icon-search);
  outline: 2px solid var(--color-ring); outline-offset: 0; box-shadow: 0 0 0 4px rgba(0, 122, 255, .16);
}
html[data-ui-compact] body[data-ui="ui2"] #main input[type="search"] { font-size: 1rem; }
body[data-ui="ui2"] #main #inventory-search { align-items: center; }

/* ---------------------------------------------------------------- 账户勾选：玻璃胶囊开关 */
body[data-ui="ui2"] #main .ledger-account-chip {
  min-height: var(--control-h); padding: 0 .875rem; border: 0; border-radius: 999px;
  background: var(--glass-btn-bg); box-shadow: var(--glass-btn-shadow); font-weight: 500;
}
body[data-ui="ui2"] #main .ledger-account-chip:has(input:checked) {
  background: linear-gradient(180deg, rgba(0, 122, 255, .16) 0%, rgba(0, 122, 255, .1) 100%); color: var(--color-accent-text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 0 0 .5px rgba(0, 122, 255, .35);
}

/* ---------------------------------------------------------------- 顶栏：无硬边的滚动边缘 + 玻璃胶囊组 */
@media (min-width: 768px) {
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-header {
    border-bottom: 0; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-header::before {
    content: ""; position: absolute; inset: 0 0 -1.5rem 0; z-index: -1; pointer-events: none;
    background: linear-gradient(180deg, var(--header-fade) 0%, rgba(243, 244, 249, .6) 55%, rgba(243, 244, 249, 0) 100%);
    -webkit-backdrop-filter: var(--chrome-filter); backdrop-filter: var(--chrome-filter);
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 50%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 0%, #000 50%, transparent 100%);
  }
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-header-inner { height: 4rem; padding: .75rem 2rem 0; align-items: center; }
  html:not([data-ui-compact]) body[data-ui="ui2"] .view-stack { padding-top: 1rem; }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-header::before {
    background: var(--color-page); -webkit-mask-image: none; mask-image: none; inset: 0; border-bottom: 1px solid var(--color-border);
  }
}
body[data-ui="ui2"] #main .session-block {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: .125rem; min-height: var(--control-h);
  padding: var(--control-pad); border-radius: calc(var(--control-h) / 2 + 1px);
  background: rgba(255, 255, 255, .55); box-shadow: var(--glass-btn-shadow);
  -webkit-backdrop-filter: var(--chrome-filter); backdrop-filter: var(--chrome-filter);
}
body[data-ui="ui2"] #main .session-block .btn:not(.btn-link) {
  width: auto; min-height: var(--control-inner-h); padding: 0 .75rem; background: transparent; box-shadow: none; font-size: .8125rem;
}
body[data-ui="ui2"] #main .session-block .btn:not(.btn-link):hover:not(:disabled) { background: rgba(118, 118, 128, .14); box-shadow: none; }
body[data-ui="ui2"] #main .session-block :is(#role-badge, .demo-badge) {
  display: inline-flex; align-items: center; min-height: calc(var(--control-inner-h) - .25rem); margin: 0 .125rem;
  padding: 0 .625rem; border: 0; border-radius: 999px; font-size: .75rem; font-weight: 500; white-space: nowrap;
}
body[data-ui="ui2"] #main .session-block #role-badge { background: var(--track-bg); color: var(--color-secondary-text); }
body[data-ui="ui2"] #main .session-block .demo-badge[hidden] { display: none; }
@media (prefers-contrast: more) { body[data-ui="ui2"] #main .session-block { background: #fff; } }

/* ---------------------------------------------------------------- 菜单：侧栏与手机标签栏的选中项 = 玻璃滑块 */
@media (min-width: 768px) {
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-nav .nav-item { min-height: var(--control-h); height: auto; padding: .4375rem .75rem; border-radius: calc(var(--control-h) / 2); }
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-nav .nav-item:hover:not(.is-active) { background: rgba(255, 255, 255, .5); }
  html:not([data-ui-compact]) body[data-ui="ui2"] .app-nav .nav-item.is-active {
    background: var(--thumb-bg); box-shadow: var(--thumb-shadow); color: var(--color-accent-text); font-weight: 600;
  }
}
html[data-ui-compact] body[data-ui="ui2"] .nav-primary > .nav-item.is-active,
html[data-ui-compact] body[data-ui="ui2"] .nav-more[open] > .nav-summary,
html[data-ui-compact] body[data-ui="ui2"] .nav-more:has(.nav-item.is-active) > .nav-summary {
  background: var(--thumb-bg); box-shadow: var(--thumb-shadow); color: var(--color-accent-text);
}
html[data-ui-compact] body[data-ui="ui2"] .nav-more-list .nav-item.is-active { background: var(--thumb-bg); box-shadow: var(--thumb-shadow); }

/* 售出筛选：快捷日期独占一行（按内容宽度），搜索栏、“筛选条件”、“筛选”同一行；展开筛选条件时占满下一行。 */
body[data-ui="ui2"] #main #sales-search {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: .625rem .5rem;
}
body[data-ui="ui2"] #main #sales-search .sales-presets { grid-column: 1 / -1; grid-row: 1; flex-basis: auto; }
body[data-ui="ui2"] #main #sales-search > input[type="search"] { grid-column: 1; grid-row: 2; width: 100%; min-width: 0; }
body[data-ui="ui2"] #main #sales-search .sales-advanced { grid-column: 2; grid-row: 2; }
body[data-ui="ui2"] #main #sales-search .sales-advanced[open] { grid-column: 1 / -1; grid-row: 3; }
body[data-ui="ui2"] #main #sales-search > button[type="submit"] { grid-column: 3; grid-row: 2; }
/* 少量选项的下拉在 UI2 中由分段选择器代替（app.js enhanceSegmentedSelect）；图表类型标签与分段同一行。 */
body[data-ui="ui2"] #main .select-segmented { vertical-align: middle; }
body[data-ui="ui2"] #main :is(#dashboard-income-chart, [id^="reports-"]) > label:has(> select[hidden]) { margin-right: .5rem; }
body[data-ui="ui2"] #main #inventory-search > .select-segmented { justify-self: start; }

/* 表单里的下拉：与工具栏弹出按钮同一套上下箭头，保持白底细边的表单外观。 */
body[data-ui="ui2"] #main .field select {
  -webkit-appearance: none; appearance: none; padding-right: 2.25rem;
  background: var(--icon-chevrons) right .875rem center / .625rem no-repeat, #fff;
}
@media (prefers-contrast: more) {
  body[data-ui="ui2"] #main :is(#inventory-search > select, #dashboard-income-chart > label select, [id^="reports-"] > label select) { box-shadow: 0 0 0 1px var(--color-text); }
}

/* ==========================================================================
 * V73 Liquid Glass 滑块与卡片文字对齐（用户 2026-11-16 反馈：滑块看不出玻璃效果；列表文字对齐不好）
 *  依据 Apple「Adopting Liquid Glass」：控件在交互时“变成 Liquid Glass”（滑块、开关的旋钮在拖动时
 *  变成玻璃），分段控件的选中块在切换时流动到新位置。网页上用以下层次近似：
 *   - 凹槽轨道：半透明灰 + 内阴影，让上面的玻璃有“浮起”的对比；
 *   - 玻璃滑块（app.js 插入的 .glass-thumb）：半透明白 + 背景模糊提饱和度 + 顶部高光 + 渐变高光边
 *     （左上、右下更亮，模拟镜面反光）+ 柔和投影；
 *   - 交互时：切换中或按住时滑块变得更通透、高光更强并略微放大（透镜感），带回弹缓动滑到新选项；
 *   - 降低透明度 / 增强对比度时为实底白块；减少动态效果时不滑动。
 *  Chrome 独有的 SVG 折射（backdrop-filter: url()）未采用：非标准、Safari/Firefox 不支持。
 * ======================================================================== */
body[data-ui="ui2"] #main :is(.segmented, .dashboard-ranges, #store-presets, .sales-presets, .collection-mode-group, .tabs) {
  position: relative; isolation: isolate;
  background: rgba(118, 118, 128, .14);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .09), inset 0 0 0 .5px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .75);
}
body[data-ui="ui2"] #main :is(.segmented, .dashboard-ranges, #store-presets, .sales-presets, .collection-mode-group, .tabs) > :not(.glass-thumb) { position: relative; z-index: 1; }
/* 有玻璃滑块时，选中项本身不再画白块（由滑块承担）；文字仍加粗、用正文色。 */
body[data-ui="ui2"] #main :is(.segmented, .dashboard-ranges, #store-presets, .sales-presets, .collection-mode-group, .tabs)[data-glass-thumb] > :is([aria-pressed="true"], [aria-selected="true"], .is-active) { background: transparent; box-shadow: none; }

.glass-thumb {
  --gx: 0px; --gy: 0px; --gw: 0px; --gh: 0px; --gs: 1;
  position: absolute; left: 0; top: 0; z-index: 0; width: var(--gw); height: var(--gh);
  border-radius: calc(var(--gh) / 2); pointer-events: none; opacity: 0;
  transform: translate(var(--gx), var(--gy)) scale(var(--gs));
  /* 玻璃体：顶部亮、中间通透、底部有反光——透出下面凹槽的颜色，而不是一块实心白片。 */
  background: linear-gradient(180deg, rgba(255, 255, 255, .5) 0%, rgba(255, 255, 255, .12) 52%, rgba(255, 255, 255, .3) 100%);
  -webkit-backdrop-filter: blur(1px) saturate(1.8);
  backdrop-filter: blur(1px) saturate(1.8);
  /* 厚度与光：上下缘高光线、内侧一圈淡蓝反光（取周围色）、内侧上方亮下方暗；外侧细描边 + 两层投影，浮在凹槽上。 */
  box-shadow:
    inset 0 1px .5px rgba(255, 255, 255, .95), inset 0 -1px .5px rgba(255, 255, 255, .8),
    inset 0 0 0 1px rgba(255, 255, 255, .5), inset 0 0 8px rgba(110, 160, 255, .28),
    inset 0 5px 8px -5px rgba(255, 255, 255, .95), inset 0 -6px 10px -6px rgba(0, 30, 90, .2),
    0 0 0 .5px rgba(0, 0, 0, .12), 0 3px 8px -2px rgba(0, 0, 0, .18), 0 12px 22px -14px rgba(0, 0, 0, .35);
  transition:
    transform .55s cubic-bezier(.3, 1.35, .45, 1), width .55s cubic-bezier(.3, 1.35, .45, 1),
    height .55s cubic-bezier(.3, 1.35, .45, 1), border-radius .55s ease,
    background .25s ease, box-shadow .25s ease, opacity .2s ease;
}
/* 渐变高光边：左上与右下更亮，像玻璃边缘的镜面反光。 */
.glass-thumb::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(135deg, #fff 0%, rgba(255, 255, 255, .3) 30%, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, .35) 70%, #fff 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.glass-thumb.is-on { opacity: 1; }
.glass-thumb.no-anim { transition: none; }
/* 切换中 / 按住：透镜态——更通透（白色更少）、高光边与淡蓝反光更强，放大一点（Apple：控件在交互时变成 Liquid Glass）。 */
.glass-thumb.is-moving,
[data-glass-press] > .glass-thumb {
  --gs: 1.1;
  background: linear-gradient(180deg, rgba(255, 255, 255, .32) 0%, rgba(255, 255, 255, .02) 50%, rgba(255, 255, 255, .2) 100%);
  -webkit-backdrop-filter: blur(.5px) saturate(2.2);
  backdrop-filter: blur(.5px) saturate(2.2);
  box-shadow:
    inset 0 1.5px 1px #fff, inset 0 -1.5px 1px rgba(255, 255, 255, .9),
    inset 0 0 0 1px rgba(255, 255, 255, .6), inset 0 0 12px rgba(110, 160, 255, .4),
    inset 3px 0 4px -2px rgba(255, 255, 255, .7), inset -3px 0 4px -2px rgba(255, 255, 255, .7),
    0 0 0 .5px rgba(0, 0, 0, .1), 0 10px 24px -8px rgba(0, 0, 0, .3);
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .glass-thumb, .glass-thumb.is-moving, [data-glass-press] > .glass-thumb {
    background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .25), 0 2px 5px rgba(0, 0, 0, .12);
  }
  .glass-thumb::before { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .glass-thumb, .glass-thumb.is-moving, [data-glass-press] > .glass-thumb { --gs: 1; }
}

/* 侧栏菜单 / 手机标签栏：同一块玻璃滑块在菜单项之间滑动。 */
body[data-ui="ui2"] #app-nav .nav-item { position: relative; z-index: 1; }
body[data-ui="ui2"] #app-nav[data-glass-thumb] .nav-item.is-active,
html[data-ui-compact] body[data-ui="ui2"] #app-nav[data-glass-thumb] .nav-primary > .nav-item.is-active,
html[data-ui-compact] body[data-ui="ui2"] #app-nav[data-glass-thumb] .nav-more:has(.nav-item.is-active) > .nav-summary {
  background: transparent; box-shadow: none;
}
/* “更多”弹出菜单里的选中项仍用浅蓝底（镜片只在标签栏上）。 */
html[data-ui-compact] body[data-ui="ui2"] #app-nav[data-glass-thumb] .nav-more-list .nav-item.is-active { background: var(--color-accent-soft); }
body[data-ui="ui2"] #app-nav > .glass-thumb { z-index: 0; }

/* ---------------------------------------------------------------- 卡片文字：统一层级与对齐 */
/* 名称为标题，编号与日期为同一行的副标题；价格标签小一号、灰色，金额右对齐并等宽数字。 */
body[data-ui="ui2"] #main .collection-card .item-name { margin: 0; font-size: .9375rem; font-weight: 600; line-height: 1.35; }
body[data-ui="ui2"] #main .collection-card .item-code-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; margin: .125rem 0 0;
}
body[data-ui="ui2"] #main .collection-card .item-code {
  margin: 0; color: var(--color-secondary-text); font-size: .8125rem; font-weight: 500; letter-spacing: .01em; font-variant-numeric: tabular-nums;
}
body[data-ui="ui2"] #main .collection-card .item-code-meta { display: inline-flex; align-items: center; gap: .375rem; margin: 0; }
body[data-ui="ui2"] #main .collection-card .card-date { color: var(--color-muted-text); font-size: .8125rem; }
body[data-ui="ui2"] #main .sale-card .item-code + .item-code-meta .card-date::before { content: "·"; margin-right: .5rem; color: var(--color-tertiary-text); }
body[data-ui="ui2"] #main .collection-card .price-list > dt { color: var(--color-muted-text); font-size: .8125rem; font-weight: 400; }
body[data-ui="ui2"] #main .collection-card .price-list > dd { font-size: .875rem; font-weight: 500; font-variant-numeric: tabular-nums; }
/* 折叠详情：细分隔线 + 小号灰字 + 会旋转的箭头，与上方文字左对齐。 */
body[data-ui="ui2"] #main .card-details { margin-top: .625rem; border-top: .5px solid var(--color-divider); }
body[data-ui="ui2"] #main .card-details-summary {
  min-height: 2.5rem; padding: 0; gap: .375rem; color: var(--color-muted-text); font-size: .8125rem; list-style: none;
}
body[data-ui="ui2"] #main .card-details-summary::-webkit-details-marker { display: none; }
body[data-ui="ui2"] #main .card-details-summary::before {
  content: ""; width: .625rem; height: .625rem; margin: 0; border: 0; flex: none;
  background: var(--icon-chevron-down) center / contain no-repeat; transform: rotate(-90deg); transition: transform .2s ease;
}
body[data-ui="ui2"] #main .card-details[open] > .card-details-summary::before { transform: rotate(0deg); }
body[data-ui="ui2"] #main .card-details > .price-list { margin: 0 0 .5rem; }

/* 售出列表（文字模式）：宽卡片三栏——名称/编号·日期｜成交价、到账、原币收款｜状态与操作；窄卡片自动堆叠。 */
body[data-ui="ui2"] #main #sales-list[data-collection-mode="list"] .sale-card { container: salecard / inline-size; padding: .875rem 1.125rem .25rem; }
body[data-ui="ui2"] #main #sales-list[data-collection-mode="list"] .sale-card .item-body {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: .625rem 1rem;
  grid-template-areas: "head status" "prices prices" "actions actions" "details details";
}
body[data-ui="ui2"] #main #sales-list[data-collection-mode="list"] .sale-card .item-body > .card-head { grid-area: head; display: block; min-width: 0; }
body[data-ui="ui2"] #main #sales-list[data-collection-mode="list"] .sale-card .item-body > .sale-payment-status { grid-area: status; justify-self: end; margin: 0; }
body[data-ui="ui2"] #main #sales-list[data-collection-mode="list"] .sale-card .item-body > .card-summary {
  grid-area: prices; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .25rem 1rem; margin: 0; align-self: start;
}
body[data-ui="ui2"] #main #sales-list[data-collection-mode="list"] .sale-card .card-summary > dt { margin: 0; line-height: 1.5rem; }
body[data-ui="ui2"] #main #sales-list[data-collection-mode="list"] .sale-card .card-summary > dd { margin: 0; line-height: 1.5rem; text-align: right; white-space: nowrap; }
body[data-ui="ui2"] #main #sales-list[data-collection-mode="list"] .sale-card .item-body > .item-actions { grid-area: actions; justify-self: end; display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; }
body[data-ui="ui2"] #main #sales-list[data-collection-mode="list"] .sale-card .item-body > .card-details { grid-area: details; margin-top: 0; }
@container salecard (min-width: 44rem) {
  body[data-ui="ui2"] #main #sales-list[data-collection-mode="list"] .sale-card .item-body {
    grid-template-columns: minmax(0, 1fr) 17rem auto; column-gap: 2rem; row-gap: .5rem;
    grid-template-areas: "head prices status" "head prices actions" "details details details";
  }
  body[data-ui="ui2"] #main #sales-list[data-collection-mode="list"] .sale-card .item-body > .item-actions { align-self: end; }
}
/* 售出卡片：编号与日期同一行（覆盖旧版“编号占满一行、日期靠右”的规则）。 */
body[data-ui="ui2"] #main #sales-list .sale-card .item-code-row { display: flex; flex-wrap: wrap; justify-content: flex-start; align-items: baseline; gap: .125rem .5rem; }
body[data-ui="ui2"] #main #sales-list .sale-card .item-code-row > .item-code { flex: 0 1 auto; }
body[data-ui="ui2"] #main #sales-list .sale-card .item-code-meta { margin-left: 0; justify-content: flex-start; }
/* 库存工具条：按工具条自身宽度分三档排版（容器查询），分组分段选择器始终一行。
 *  宽：排序｜分组｜搜索｜筛选条件｜清除筛选 一行；
 *  中：排序｜分组 / 搜索｜筛选条件｜清除筛选 两行，两颗按钮与上方分段选择器等宽对齐；
 *  窄（手机）：逐行堆叠，分组铺满整行。展开“筛选条件”时其内容另起整行。 */
body[data-ui="ui2"] #main #inventory-search > .select-segmented,
body[data-ui="ui2"] #main :is(#dashboard-income-chart, [id^="reports-"]) > .select-segmented { flex-wrap: nowrap; }
body[data-ui="ui2"] #main #view-inventory { container: invview / inline-size; }
body[data-ui="ui2"] #main #inventory-search {
  display: grid; align-items: center; gap: .625rem .5rem;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "sort sort" "group group" "search search" "adv clear";
}
body[data-ui="ui2"] #main #inventory-search > #inventory-sort { grid-area: sort; width: 100%; }
body[data-ui="ui2"] #main #inventory-search > .select-segmented { grid-area: group; width: 100%; }
body[data-ui="ui2"] #main #inventory-search > .select-segmented > .segmented-btn { flex: 1 1 0; }
body[data-ui="ui2"] #main #inventory-search > #inventory-query { grid-area: search; width: 100%; }
body[data-ui="ui2"] #main #inventory-search > .inventory-advanced { grid-area: adv; min-width: 0; }
body[data-ui="ui2"] #main #inventory-search > .inventory-advanced > summary { width: 100%; justify-content: center; }
body[data-ui="ui2"] #main #inventory-search > #inventory-filter-clear { grid-area: clear; width: 100%; }
body[data-ui="ui2"] #main #inventory-search > .inventory-advanced[open] { grid-area: auto; grid-column: 1 / -1; }
body[data-ui="ui2"] #main #inventory-search > .inventory-advanced[open] > summary { width: auto; }
body[data-ui="ui2"] #main #inventory-search > #inventory-range-error { grid-column: 1 / -1; }
@container invview (min-width: 34rem) {
  body[data-ui="ui2"] #main #inventory-search {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "sort group group" "search adv clear";
  }
  body[data-ui="ui2"] #main #inventory-search > .select-segmented { width: auto; justify-self: stretch; }
  body[data-ui="ui2"] #main #inventory-search > .select-segmented > .segmented-btn { flex: 1 0 auto; }
}
@container invview (min-width: 64rem) {
  body[data-ui="ui2"] #main #inventory-search {
    grid-template-columns: minmax(10rem, 15rem) auto minmax(10rem, 1fr) auto auto;
    grid-template-areas: "sort group search adv clear";
  }
  body[data-ui="ui2"] #main #inventory-search > .select-segmented > .segmented-btn { flex: 0 0 auto; }
  body[data-ui="ui2"] #main #inventory-search > .inventory-advanced > summary { width: auto; }
  body[data-ui="ui2"] #main #inventory-search > #inventory-filter-clear { width: auto; }
}

body[data-ui="ui2"] #main #inventory-search > #inventory-filter-clear { min-height: var(--control-h); }

/* ==========================================================================
 * V74 显示设置：关闭毛玻璃与动画（html[data-effects="off"]，由 app.js 按用户选择设置）
 *  效果等同系统“降低透明度 + 减少动态效果”，并把渐变背景换成纯色：
 *  外壳实底不模糊、滑块实底白块且不缩放、无过渡与动画。
 * ======================================================================== */
html[data-effects="off"] {
  --chrome-bg: #f9f9fb; --sheet-bg: #fff; --menu-bg: #fff; --login-bg: #fff; --chrome-filter: none;
}
html[data-effects="off"] *,
html[data-effects="off"] *::before,
html[data-effects="off"] *::after {
  animation-duration: .01ms !important; animation-iteration-count: 1 !important;
  transition-duration: .01ms !important; scroll-behavior: auto !important;
}
html[data-effects="off"] body[data-ui="ui2"]::before { background: var(--color-page); }
html[data-effects="off"] body[data-ui="ui2"] .app-header::before {
  background: var(--color-page); -webkit-backdrop-filter: none; backdrop-filter: none;
  -webkit-mask-image: none; mask-image: none; inset: 0; border-bottom: 1px solid var(--color-divider);
}
html[data-effects="off"] body[data-ui="ui2"] #main .session-block { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
html[data-effects="off"] body[data-ui="ui2"] .dialog::backdrop { background: rgba(0, 0, 0, .4); -webkit-backdrop-filter: none; backdrop-filter: none; }
html[data-effects="off"] .glass-thumb,
html[data-effects="off"] .glass-thumb.is-moving,
html[data-effects="off"] [data-glass-press] > .glass-thumb {
  --gs: 1; background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none;
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .1), 0 1px 3px rgba(0, 0, 0, .12);
}
html[data-effects="off"] .glass-thumb::before { display: none; }
html[data-effects="off"] body[data-ui="ui2"] #main .btn:not(.btn-link):active:not(:disabled) { transform: none; }

/* 设置里的 iOS 开关：标签与开关同一行，说明在下方。状态同时由滑钮位置表示，不只靠颜色。 */
body[data-ui="ui2"] .switch-field { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .375rem 1rem; }
body[data-ui="ui2"] .switch-field > label { color: var(--color-text); font-size: .9375rem; font-weight: 500; }
body[data-ui="ui2"] .switch-field > .hint { grid-column: 1 / -1; margin: 0; }
/* V76 开关按 iOS 规格：轨道 51×31、圆点 27、四周留 2；圆点垂直居中。
 * 旧版 .field input 的 44px 最小高度与内边距会把开关撑胖，这里逐项归零。
 * 位置用变量 --sw-base（开/关）与拖动时的 --sw-x（px，只由脚本写入）表示；按住时圆点横向拉长。 */
body[data-ui="ui2"] input.ios-switch {
  --sw-w: 3.1875rem; --sw-h: 1.9375rem; --sw-inset: .125rem; --sw-knob: 1.6875rem; --sw-stretch: .375rem;
  --sw-travel: calc(var(--sw-w) - var(--sw-knob) - 2 * var(--sw-inset)); --sw-base: 0px;
  -webkit-appearance: none; appearance: none; position: relative; display: block; flex: none; box-sizing: border-box;
  width: var(--sw-w); min-width: var(--sw-w); max-width: var(--sw-w); height: var(--sw-h); min-height: var(--sw-h); max-height: var(--sw-h);
  margin: 0; padding: 0; border: 0; border-radius: 999px; font-size: 0; line-height: 0; vertical-align: middle;
  background: rgba(120, 120, 128, .16); cursor: pointer; touch-action: pan-y; -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
  box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .05); transition: background-color .25s ease;
}
body[data-ui="ui2"] input.ios-switch::before {
  content: ""; position: absolute; top: 50%; left: var(--sw-inset); box-sizing: border-box;
  width: var(--sw-knob); height: var(--sw-knob); border-radius: 999px; background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 3px 1px rgba(0, 0, 0, .06), 0 0 0 .5px rgba(0, 0, 0, .04);
  transform: translate(var(--sw-x, var(--sw-base)), -50%);
  transition: transform .3s cubic-bezier(.3, 1.3, .5, 1), width .2s ease;
}
body[data-ui="ui2"] input.ios-switch:checked { --sw-base: var(--sw-travel); background: #34c759; }
/* 按住：圆点向内拉长（开时向左长），与 iOS 一致。 */
body[data-ui="ui2"] input.ios-switch:is(:active, .is-pressed):not(:disabled)::before { width: calc(var(--sw-knob) + var(--sw-stretch)); }
body[data-ui="ui2"] input.ios-switch:checked:is(:active, .is-pressed):not(:disabled) { --sw-base: calc(var(--sw-travel) - var(--sw-stretch)); }
/* 拖动中：圆点跟手（不做过渡），轨道颜色按圆点过没过中线显示。 */
body[data-ui="ui2"] input.ios-switch.is-dragging::before { transition: width .2s ease; }
body[data-ui="ui2"] input.ios-switch.is-dragging { background: rgba(120, 120, 128, .16); }
body[data-ui="ui2"] input.ios-switch.is-dragging[data-sw-on] { background: #34c759; }
body[data-ui="ui2"] input.ios-switch:disabled { opacity: .5; cursor: default; }
body[data-ui="ui2"] input.ios-switch:focus-visible { outline: 2px solid var(--color-ring); outline-offset: 2px; }
@media (prefers-contrast: more) {
  body[data-ui="ui2"] input.ios-switch { box-shadow: inset 0 0 0 1px var(--color-text); }
  body[data-ui="ui2"] input.ios-switch:checked,
  body[data-ui="ui2"] input.ios-switch.is-dragging[data-sw-on] { background: #248a3d; }
}

/* V75 设置 → 关于：标签与值两列，数值等宽。 */
body[data-ui="ui2"] #display-settings-dialog .about-group { grid-template-columns: minmax(0, 1fr); }
body[data-ui="ui2"] .about-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .375rem 1.25rem; margin: 0; font-size: .875rem; }
body[data-ui="ui2"] .about-list > dt { margin: 0; color: var(--color-muted-text); }
body[data-ui="ui2"] .about-list > dd { margin: 0; color: var(--color-text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
body[data-ui="ui2"] .about-group > #about-copy { justify-self: start; }

/* ==========================================================================
 * V76 尺寸、比例与排版校正 + 滑块拖拽
 * ======================================================================== */
/* 卡片编号行：编号与状态徽章同一行、左对齐（V73 的居中对齐与旧版纵向排列叠加后变成了居中，这里纠正）。 */
body[data-ui="ui2"] #main .collection-card .item-code-row { flex-direction: row; justify-content: flex-start; align-items: center; }
body[data-ui="ui2"] #main .collection-card .item-code-meta { justify-content: flex-start; }
/* 网格卡片：勾选框浮在照片左上角，不再单独占一行。 */
body[data-ui="ui2"] #main #inventory-list[data-collection-mode="grid"] .item-card { position: relative; }
body[data-ui="ui2"] #main #inventory-list[data-collection-mode="grid"] .item-selection-row {
  position: absolute; top: 1.125rem; left: 1.125rem; z-index: 2; width: auto; min-height: 0;
}
body[data-ui="ui2"] #main #inventory-list[data-collection-mode="grid"] .item-selection-row .item-select {
  min-width: 2rem; min-height: 2rem; width: 2rem; height: 2rem; justify-content: center; border-radius: 999px;
  background: rgba(255, 255, 255, .78); -webkit-backdrop-filter: blur(8px) saturate(1.6); backdrop-filter: blur(8px) saturate(1.6);
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .08), 0 1px 3px rgba(0, 0, 0, .12);
}
body[data-ui="ui2"] #main #inventory-list[data-collection-mode="grid"] .item-selection-row .item-select input[type="checkbox"] { width: 1.125rem; height: 1.125rem; }
@media (pointer: coarse) {
  body[data-ui="ui2"] #main #inventory-list[data-collection-mode="grid"] .item-selection-row .item-select { min-width: 2.75rem; min-height: 2.75rem; width: 2.75rem; height: 2.75rem; }
  body[data-ui="ui2"] #main #inventory-list[data-collection-mode="grid"] .item-selection-row { top: .875rem; left: .875rem; }
}
html[data-effects="off"] body[data-ui="ui2"] #main #inventory-list[data-collection-mode="grid"] .item-selection-row .item-select { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
/* 总览主卡：没有币种行的卡（如“待结汇 2 笔”）留出同高的空行，让各卡数值落在同一条基线上。 */
body[data-ui="ui2"] #dashboard-primary .stat-amount:not(:has(.metric-currency))::before {
  content: ""; display: block; height: calc(.6875rem * 1.2); margin-bottom: .125rem;
}
/* 表单控件统一高度：桌面 40px，触屏 44px（旧版 .field 44px 与部分 40px 混用）。工具条里的搜索框仍与按钮同高 36px。 */
body[data-ui="ui2"] :is(#main, .dialog) .field > :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not(.ios-switch), select) {
  min-height: 2.5rem; height: 2.5rem; padding-top: 0; padding-bottom: 0; font-size: .9375rem;
}
@media (pointer: coarse) {
  body[data-ui="ui2"] :is(#main, .dialog) .field > :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not(.ios-switch), select) { min-height: 2.75rem; height: 2.75rem; }
}
/* 面板里的指标小块统一为浅灰底、无描边、14px 圆角（统计报表与店铺台账此前一灰一白）。 */
body[data-ui="ui2"] #main .panel :is(.stat-grid > .stat, .store-primary-metric) {
  background: #f5f5f7; border: 0; border-radius: 14px; box-shadow: none; padding: .875rem 1rem;
}
body[data-ui="ui2"] #main .inventory-result-summary { border-radius: 18px; }
html[data-effects="off"] body[data-ui="ui2"] #main .panel :is(.stat-grid > .stat, .store-primary-metric) { background: #f2f2f7; }

/* 滑块拖拽：横向轨道把横向手势留给拖拽、纵向手势仍滚动页面；可横向滚动的轨道只在选中项上拖。 */
body[data-ui="ui2"] [data-glass-thumb] { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
body[data-ui="ui2"] #main [data-glass-thumb] { touch-action: pan-y; }
body[data-ui="ui2"] #main [data-glass-thumb][data-glass-scroll] { touch-action: auto; }
body[data-ui="ui2"] #main [data-glass-thumb][data-glass-scroll] > :is([aria-pressed="true"], [aria-selected="true"], .is-active) { touch-action: none; }
html[data-ui-compact] body[data-ui="ui2"] #app-nav[data-glass-thumb] { touch-action: pan-y; }
html:not([data-ui-compact]) body[data-ui="ui2"] #app-nav[data-glass-thumb] .nav-item.is-active { touch-action: none; }
body[data-ui="ui2"] [data-glass-drag] { cursor: grabbing; }
body[data-ui="ui2"] [data-glass-drag] > .glass-thumb {
  transition: transform .07s linear, width .12s ease, height .12s ease, border-radius .12s ease, background .25s ease, box-shadow .25s ease, opacity .2s ease;
}
