/*
 * 漠翠进销存 · Apple Light Density Layer v1.4
 * 目标：减少字、减少高度、单图标、保留清晰层级。
 * 不修改库存 / 销售 / 调借 / IndexedDB / 云同步业务逻辑。
 */
:root{
  --ui-ink:#111111;--ui-muted:#7a7a80;--ui-border:#e5e5ea;--ui-surface:#fff;
  --ui-bg:#f5f5f7;--ui-success:#34c759;--ui-warning:#ff9f0a;--ui-danger:#ff3b30;
  --ui-info:#007aff;--ui-icon-size:18px;--ui-icon-size-lg:22px;
}
.ui-icon,.ui-icon-only img,.nav-item img,[data-ui-icon]{
  display:block;width:var(--ui-icon-size);height:var(--ui-icon-size);object-fit:contain;
  flex:0 0 auto;pointer-events:none;user-select:none;-webkit-user-drag:none
}
.ui-icon-only{display:inline-grid!important;place-items:center!important;min-width:40px;min-height:40px}
.ui-icon-only.hidden,.page-back.hidden,#pageBack.hidden,#topAction.hidden{display:none!important}
.ui-icon-only img{width:20px;height:20px}

/* Dock */
.bottom-nav .nav-item span{display:grid;place-items:center}
.bottom-nav .nav-item img{width:21px;height:21px;opacity:.48;transition:opacity .14s ease,transform .14s ease}
.bottom-nav .nav-item.active img{opacity:1;transform:none}
.bottom-nav .nav-item b{letter-spacing:0}
.nav-item>span{font-size:0!important}

/* General PNG decoration */
.ui-decorated>.ui-auto-icon{width:16px;height:16px;object-fit:contain;flex:0 0 auto}
.ui-icon-slot{display:grid!important;place-items:center!important;font-size:0!important}
.ui-icon-slot>.ui-auto-icon{display:block;width:20px!important;height:20px!important;object-fit:contain;margin:0!important}
button.ui-decorated:not(.workflow-card):not(.ui-icon-replaced),
a.ui-decorated:not(.workflow-card):not(.ui-icon-replaced){
  display:inline-flex;align-items:center;justify-content:center;gap:6px
}
button.primary .ui-auto-icon,.btn.primary .ui-auto-icon,.primary-btn .ui-auto-icon,
button.is-primary .ui-auto-icon,.segment button.active .ui-auto-icon{
  filter:brightness(0) invert(1)
}

/* ----- 首页：快捷卡片重做为更轻、更短的 Apple 式两行信息 ----- */
body[data-ui-route="dashboard"] .workflow-section{margin-top:14px!important}
body[data-ui-route="dashboard"] .section-title{margin-top:13px!important;margin-bottom:7px!important}
body[data-ui-route="dashboard"] .workflow-grid{gap:8px!important}
body[data-ui-route="dashboard"] .workflow-card{
  min-height:82px!important;
  padding:11px 12px!important;
  border-radius:13px!important;
  display:grid!important;
  grid-template-columns:20px minmax(0,1fr)!important;
  grid-template-areas:"icon title" "meta meta"!important;
  align-content:center!important;
  justify-content:initial!important;
  gap:5px 8px!important;
  box-shadow:none!important;
}
body[data-ui-route="dashboard"] .workflow-card>.ui-auto-icon{
  grid-area:icon!important;width:17px!important;height:17px!important;margin:0!important;align-self:center!important
}
body[data-ui-route="dashboard"] .workflow-title{
  grid-area:title;font-size:14px!important;line-height:1.25!important;align-self:center!important
}
body[data-ui-route="dashboard"] .workflow-meta{
  grid-area:meta;font-size:10px!important;line-height:1.35!important;
  white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important
}
body[data-ui-route="dashboard"] .workflow-foot{display:none!important}
body[data-ui-route="dashboard"] .metric{padding:10px!important;border-radius:13px!important}
body[data-ui-route="dashboard"] .metric .label{font-size:10px!important}
body[data-ui-route="dashboard"] .metric .value{font-size:18px!important;margin-top:4px!important}
body[data-ui-route="dashboard"] .metric .hint{
  font-size:9px!important;line-height:1.35!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis
}

/* ----- 更多：只有一个图标，列表压缩 ----- */
body[data-ui-route="more"] .more-item>.ui-auto-icon{display:none!important}
body[data-ui-route="more"] .more-group{margin-bottom:13px!important}
body[data-ui-route="more"] .more-group-title{font-size:12px!important;margin:0 4px 6px!important}
body[data-ui-route="more"] .more-item{
  min-height:68px!important;padding:9px 12px!important;gap:10px!important;border-radius:13px!important
}
body[data-ui-route="more"] .more-item>.thumb{
  width:42px!important;height:42px!important;border-radius:12px!important;flex:0 0 42px!important
}
body[data-ui-route="more"] .more-item>.thumb .ui-auto-icon{width:18px!important;height:18px!important}
body[data-ui-route="more"] .more-item .item-title{font-size:13px!important}
body[data-ui-route="more"] .more-item .item-meta{
  font-size:10px!important;margin-top:2px!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important
}

/* ----- 商品：保留图片识别能力，但减少纵向占用 ----- */
body[data-ui-route="products"] .grid-3 .metric{padding:9px!important;border-radius:12px!important}
body[data-ui-route="products"] .grid-3 .metric .label{font-size:10px!important}
body[data-ui-route="products"] .grid-3 .metric .value{font-size:15px!important;margin-top:3px!important}
body[data-ui-route="products"] .product-filter-row{margin-top:9px!important;margin-bottom:8px!important}
body[data-ui-route="products"] .btn-row{gap:6px!important}
body[data-ui-route="products"] .btn-row .btn{min-height:38px!important;padding:8px 10px!important;font-size:11px!important}
body[data-ui-route="products"] .list{gap:7px!important}
body[data-ui-route="products"] .list-item{padding:8px!important;gap:9px!important;border-radius:13px!important}
body[data-ui-route="products"] .thumb{width:50px!important;height:50px!important;border-radius:11px!important}
body[data-ui-route="products"] .item-title{font-size:13px!important}
body[data-ui-route="products"] .item-meta{font-size:10px!important;margin-top:2px!important;line-height:1.4!important}
body[data-ui-route="products"] .badge{font-size:9px!important;padding:3px 7px!important}

/* ----- 调借：把解释文字降为辅助信息 ----- */
body[data-ui-route="loans"] #main>.notice:first-child{
  font-size:10px!important;line-height:1.5!important;padding:8px 10px!important;margin-bottom:8px!important;
  display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden
}
body[data-ui-route="loans"] #openExternalGoods{
  min-height:40px!important;padding:8px 12px!important;margin-bottom:9px!important;font-size:12px!important
}
body[data-ui-route="loans"] .grid-3 .metric{padding:9px!important}
body[data-ui-route="loans"] .grid-3 .metric .value{font-size:17px!important}

/* ----- 报表：缩短说明、让数字优先 ----- */
body[data-ui-route="reports"] #reportBody>.notice:first-child{
  font-size:10px!important;line-height:1.5!important;padding:8px 10px!important;
  display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden
}
body[data-ui-route="reports"] .section-title{margin-top:14px!important;margin-bottom:7px!important}
body[data-ui-route="reports"] .metric{padding:10px!important}
body[data-ui-route="reports"] .metric .label{font-size:10px!important}
body[data-ui-route="reports"] .metric .value{font-size:18px!important}
body[data-ui-route="reports"] .metric.compact .value{font-size:14px!important}
body[data-ui-route="reports"] .metric .hint{font-size:9px!important}
body[data-ui-route="reports"] .segment button .ui-auto-icon{width:14px!important;height:14px!important}

/* Shared lightness */
.card,.panel,.sheet,.metric-card{box-shadow:none!important}
button .ui-auto-icon,a .ui-auto-icon{pointer-events:none}
.ui-danger-icon{filter:none!important}

@media(max-width:759px){
  .bottom-nav .nav-item img{width:20px;height:20px}
}


/* =========================================================
   漠翠进销存 · 二级页面收口 v1.5
   仅调整视觉与布局，不修改任何业务数据和计算逻辑
   ========================================================= */

@media (max-width:760px){

  /* 通用二级页面：减少纵向浪费 */
  .main{padding-top:10px!important}
  .notice{padding:8px 10px!important;margin-bottom:9px!important;font-size:11px!important;line-height:1.5!important}
  .form-group{margin-bottom:10px!important}
  .form-label{font-size:11px!important;margin-bottom:5px!important}
  .input,.select,.textarea{padding:9px 11px!important;border-radius:11px!important}
  .textarea{min-height:72px!important}
  .upload-box{min-height:84px!important}
  .empty{padding:24px 12px!important}
  .empty .emoji{font-size:26px!important}

  /* 销售开单 */
  body:has(.sale-form) .sale-form,
  body:has(#saleForm) #saleForm{gap:8px!important}
  body:has(.sale-form) .card,
  body:has(#saleForm) .card{padding:11px!important}
  body:has(.sale-form) .empty,
  body:has(#saleForm) .empty{padding:20px 10px!important}
  body:has(.sale-form) .form-group,
  body:has(#saleForm) .form-group{margin-bottom:9px!important}

  /* 新增商品弹窗：减少输入高度 */
  .modal .form-group{margin-bottom:9px!important}
  .modal .input,.modal .select,.modal .textarea{min-height:42px!important}
  .modal .upload-box{min-height:92px!important}
  .modal-head{padding:10px 0 8px!important;margin-bottom:9px!important}
  .modal-title{font-size:16px!important}
  .modal-close{width:32px!important;height:32px!important}

  /* 调借录入页面 */
  .loan-step-card{padding:11px!important;margin-bottom:9px!important}
  .loan-step-title{margin-bottom:9px!important;font-size:14px!important}
  .loan-step-title span{width:22px!important;height:22px!important;border-radius:7px!important}
  .loan-type-switch button{padding:8px 6px!important;font-size:11px!important}
  .loan-upload-box{min-height:82px!important}
  .field-help{font-size:9px!important;line-height:1.4!important;margin-top:4px!important}

  /* 过手差价：黄色说明降级为辅助提示 */
  body:has(.protected-zone) .notice.warn,
  body:has(#passThroughForm) .notice.warn{
    padding:8px 10px!important;
    font-size:10px!important;
    line-height:1.45!important;
    border-radius:12px!important;
  }

  /* 调货货源库：长说明只显示两行 */
  body:has(#sourceLibrary) .notice,
  body:has(.source-library) .notice{
    display:-webkit-box!important;
    -webkit-box-orient:vertical!important;
    -webkit-line-clamp:2!important;
    overflow:hidden!important;
  }

  /* 外部同行货：说明压缩 */
  body:has(#externalGoods) .notice,
  body:has(.external-goods) .notice{
    display:-webkit-box!important;
    -webkit-box-orient:vertical!important;
    -webkit-line-clamp:2!important;
    overflow:hidden!important;
  }

  /* 库存盘点 */
  .stocktake-row{padding:8px!important;gap:8px!important}
  .stocktake-row .thumb{width:48px!important;height:48px!important}
  .stocktake-row input[type="number"]{max-width:84px!important;min-height:42px!important;padding:7px 9px!important}
  body:has(.stocktake-row) .notice.warn{
    font-size:10px!important;
    padding:7px 9px!important;
  }

  /* 内容工作台：降低卡片拥挤感，不删除功能 */
  .content-card,.content-product-card{padding:10px!important}
  .content-card .thumb,.content-product-card .thumb{width:68px!important;height:68px!important}
  .content-card .badge,.content-product-card .badge{font-size:9px!important;padding:3px 6px!important}
  .content-card .actions,.content-product-card .actions{gap:7px!important;flex-wrap:wrap!important}
  .content-card .actions button,.content-product-card .actions button{
    font-size:10px!important;
    min-height:30px!important;
    padding:4px 6px!important;
  }

  /* 分类管理：压缩行高，降低删除按钮视觉权重 */
  .category-manager-row{min-height:48px!important;padding-top:5px!important;padding-bottom:5px!important}
  .category-manager-row.child{min-height:44px!important}
  .category-manager-name strong{font-size:13px!important}
  .category-inline-action{font-size:10px!important;padding:6px 3px!important}
  .category-inline-action.danger{opacity:.7!important}

  /* 批量导入弹窗 */
  body:has(.batch-import) .notice.warn,
  .modal:has(input[type="file"]) .notice.warn{
    font-size:10px!important;
    line-height:1.45!important;
    padding:7px 9px!important;
  }

  /* 分类选择器：核心布局修复 */
  .category-picker-panel{height:min(84dvh,720px)!important}
  .category-picker-body,
  .category-picker-list{overflow-x:hidden!important;width:100%!important}

  .category-picker-row,
  .category-picker-row.category-special,
  .category-picker-row.category-child{
    display:grid!important;
    grid-template-columns:28px minmax(0,1fr) 24px!important;
    align-items:center!important;
    gap:8px!important;
    width:100%!important;
    min-width:0!important;
    min-height:50px!important;
    padding:0 12px!important;
    writing-mode:horizontal-tb!important;
    text-orientation:mixed!important;
  }

  .category-picker-row.category-child{
    padding-left:40px!important;
    grid-template-columns:18px minmax(0,1fr) 24px!important;
  }

  .category-picker-row > span{
    display:block!important;
    width:28px!important;
    min-width:28px!important;
    height:auto!important;
    writing-mode:horizontal-tb!important;
  }

  .category-picker-row > strong,
  .category-picker-row .category-pick-main,
  .category-picker-row .category-pick-main strong{
    min-width:0!important;
    width:auto!important;
    display:block!important;
    writing-mode:horizontal-tb!important;
    text-orientation:mixed!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }

  .category-picker-row > strong{
    font-size:14px!important;
    line-height:1.3!important;
  }

  .category-picker-row > b{
    width:24px!important;
    min-width:24px!important;
    writing-mode:horizontal-tb!important;
  }

  .category-expand{
    display:block!important;
    width:28px!important;
    min-width:28px!important;
  }

  /* 避免“全部分类 / 未分类”被图标装饰器插入左侧孤立图标 */
  .category-picker-row.category-special > .ui-auto-icon{
    display:none!important;
  }

  /* 所有分类弹层文字禁止竖排 */
  #categoryPickerOverlay button,
  #categoryPickerOverlay strong,
  #categoryPickerOverlay small,
  #categoryPickerOverlay span,
  #categoryPickerOverlay b{
    writing-mode:horizontal-tb!important;
    text-orientation:mixed!important;
  }
}
