

    body.modal-open .bottom-actions,
    body.modal-open .float-nav{
      pointer-events: none;
    }

    :root{
      --bg:#0b0f14;
      --panel:#0f1620;
      --panel-2:#111b27;
      --border:rgba(255,255,255,.08);
      --muted:rgba(255,255,255,.55);
      --text:#f6f8fb;
      --accent:#7dd3fc;
      --accent-2:#a78bfa;
      --danger:#ff6b6b;
      --warn:#fbbf24;
      --ok:#34d399;
      --radius-lg:18px;
      --radius-md:12px;
      --shadow:0 10px 30px rgba(0,0,0,.35);
      --app-header-height: 0px;
    }

    body.theme-light{
      --bg:#f3f4f6;
      --panel:#ffffff;
      --panel-2:#f9fafb;
      --border:rgba(15,23,42,.08);
      --muted:#6b7280;
      --text:#111827;
      --accent:#0ea5e9;
      --accent-2:#6366f1;
      --danger:#dc2626;
      --warn:#d97706;
      --ok:#16a34a;
    }

    *{box-sizing:border-box}
    html,body{
      height:100%;
      overflow:hidden; /* 禁止整页滚动，防止移动端地址栏自动隐藏/显示 */
    }
    body{
      margin:0;
      font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
      color:var(--text);
      background:
        radial-gradient(1200px 600px at 10% -20%, rgba(167,139,250,.12), transparent 60%),
        radial-gradient(1200px 600px at 90% -10%, rgba(125,211,252,.12), transparent 60%),
        var(--bg);
      transition:background .25s ease,color .25s ease;
    }

    header{
      position:sticky; top:0; z-index:10;
      backdrop-filter: blur(12px);
      background: linear-gradient(180deg, rgba(11,15,20,.92), rgba(11,15,20,.6));
      border-bottom:1px solid var(--border);
    }
    body.theme-light header{
      background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.85));
    }
    .header-inner{
      max-width:1200px;
      margin:0 auto;
      padding:18px 20px;
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:16px;
    }
    .brand{display:flex; align-items:center; gap:14px;}
    
    .brand-text{min-width:0; flex: 1 1 auto;}
    .brand-right{display:flex; align-items:center; justify-content:flex-end; margin-left:auto; flex:0 0 auto;}
.brand-badge{
      width:34px; height:34px; border-radius:12px;
      display:flex; align-items:center; justify-content:center;
      background: radial-gradient(circle at 30% 30%, #ffffff, #e5e7eb);
      box-shadow: inset 0 0 0 1px rgba(0,0,0,.08), 0 6px 16px rgba(0,0,0,.45);
      font-size:22px;
    }
    h1{
      font-size:20px; margin:0 0 4px 0; letter-spacing:.5px;
    }
    .subtitle{
      font-size:12px; color:var(--muted);
    }

    .actions{display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end;}
    button{
      cursor:pointer;
      border-radius:12px;
      border:1px solid var(--border);
      background: var(--panel-2);
      color:var(--text);
      padding:10px 12px;
      font-size:12px;
      transition:.18s ease;
    }
    button:hover{transform: translateY(-1px); border-color: rgba(255,255,255,.18);}
    button:active{transform: translateY(0); opacity:.9;}
    .btn-primary{
      background: linear-gradient(135deg, rgba(125,211,252,.18), rgba(125,211,252,.05));
      border-color: rgba(125,211,252,.35);
    }
    .btn-secondary{
      background: linear-gradient(135deg, rgba(167,139,250,.18), rgba(167,139,250,.05));
      border-color: rgba(167,139,250,.35);
    }
    #consumeAiRecognize,
    #consumeAddRow,
    #restockAddRow,
    #restockBulkAddAll,
    #recordEditAddRow{
      background: linear-gradient(135deg, rgba(34,197,94,.18), rgba(34,197,94,.05));
      border-color: rgba(34,197,94,.45);
      color: var(--text);
    }
    body.theme-light #consumeAiRecognize,
    body.theme-light #consumeAddRow,
    body.theme-light #restockAddRow,
    body.theme-light #restockBulkAddAll,
    body.theme-light #recordEditAddRow{
      border-color: rgba(22,163,74,.45);
      background: linear-gradient(135deg, rgba(22,163,74,.18), rgba(22,163,74,.06));
    }
    .btn-todo-done{
      border-color: var(--accent-2);
      color: var(--accent-2);
      background: transparent;
      box-shadow: none;
    }
    .btn-todo-done:hover{
      background: rgba(249,115,22,.08);
    }
    .btn-ghost{
      background: transparent;
    }
.icon-btn{
  width:36px;
  height:36px;
  border-radius:999px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.04);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  padding:0;
  line-height:1;
  user-select:none;
}
body.theme-light .icon-btn{ background: rgba(15,23,42,.04); }
.icon-btn:hover{ filter: brightness(1.06); }

.icon-btn svg,
.series-collapse-btn svg{
  width:16px;
  height:16px;
  display:block;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.float-nav .icon-btn svg{ width:14px; height:14px; }
.series-collapse-btn svg{ width:14px; height:14px; }


/* 用户菜单（用户名 -> 退出） */
.auth-wrap{
  position: relative;
  display: inline-flex;
  align-items: center;
}
#btnAuth.is-user{
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth-menu{
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 85px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(17,27,39,.92);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}
body.theme-light .auth-menu{
  background: rgba(255,255,255,.92);
}
.auth-menu button{
  width: 100%;
}

/* 底部吸底操作栏（记录出库/记录入库） */
.bottom-actions{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8990;
  background: rgba(11,15,20,.62);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
body.theme-light .bottom-actions{
  background: rgba(255,255,255,.78);
}
.bottom-actions .bottom-inner{
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 20px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
}
.bottom-actions .bottom-inner button{
  flex: 1 1 0;
  padding: 12px 14px;
  font-size: 13px;
  border-radius: 14px;
}

.bottom-actions .bottom-inner #btnConsume{
  background: linear-gradient(135deg, #0ea5e9, #7dd3fc);
  border-color: rgba(125,211,252,.65);
  color: #ffffff;
}

.bottom-actions .bottom-inner #btnRestock{
  background: linear-gradient(135deg, #6366f1, #a78bfa);
  border-color: rgba(167,139,250,.65);
  color: #ffffff;
}
@media (max-width: 720px){
  .bottom-actions .bottom-inner{
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  }
}

/* 移动端悬浮导航条（滚动一屏后出现） */
.float-nav{
  position: fixed;
  right: 8px;
  bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 8991;
  padding: 6px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(17,27,39,.45);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
body.theme-light .float-nav{
  background: rgba(255,255,255,.55);
}
.float-nav .icon-btn{
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
}
body.theme-light .float-nav .icon-btn{
  background: rgba(15,23,42,.04);
}
@media (min-width: 721px){
  .float-nav{ display:none !important; }
}
@media (max-width: 720px){
  /* 避免 toast 被底部操作栏遮挡 */
  .toast-stack{ bottom: 96px; }
}

.sort-group{ display:flex; gap:10px; align-items:center;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x:auto;
  -webkit-overflow-scrolling: touch;
}
.sort-group::-webkit-scrollbar{ display:none; }
.btn-sort{
  padding:6px 12px;
  border-radius:999px;
  border:1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  cursor:pointer;
  white-space:nowrap;
  margin:2px 0px 0px 0px;
  font-size:11px;
  transition:.15s ease;
}
.btn-sort.active{
  color:var(--text);
  border-color: rgba(34,197,94,.35);
  background: linear-gradient(135deg, rgba(34,197,94,.18), rgba(34,197,94,.05));
  margin:2px 0px 0px 0px;
}

    
/* —— 余量排序行：增加“标准/紧凑”布局切换 —— */
.sort-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:nowrap;
  flex: 1 1 auto;
  min-width: 0;
}

/* 色系筛选行 */
.series-filter-row{
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.series-filter-list{
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 2px 0;
}

.series-filter-list::-webkit-scrollbar{
  display: none;
}

.series-filter-btn{
  flex: 0 0 auto;
  scroll-snap-align: start;
  white-space: nowrap;
}

.view-toggle{
  margin-left:auto;
  display:inline-flex;
  flex:0 0 auto;
  flex-shrink:0;
  border:1px solid var(--border);
  border-radius:999px;
  overflow:hidden;
  background: rgba(255,255,255,.04);
}
body.theme-light .view-toggle{ background: rgba(15,23,42,.04); }

.view-toggle .view-tab{
  border:0;
  background: transparent;
  padding:9px 14px;
  border-radius:0;
  font-size:12px;
  cursor:pointer;
  white-space:nowrap;
  transform:none !important;
}
.view-toggle .view-tab{
  min-width:56px;
}
.view-toggle .view-tab:hover{ border-color: transparent; }
.view-toggle .view-tab.active{
  background: rgba(255,255,255,.22);
}
body.theme-light .view-toggle .view-tab.active{
  background: rgba(15,23,42,.10);
}

/* —— 紧凑布局卡片（参考截图） —— */
.card.compact{
  padding:12px;
  gap:10px;
}
.card.compact .status{
  position: static;
  top:auto;
  right:auto;
}
.card.compact .card-top{
  display:flex;
  align-items:center;
  gap:8px;
}
.card.compact .spacer{ flex:1 1 auto; }
.card.compact .card-more-btn{
  /* iOS 风格：更小更精致 */
  width:22px;
  height:22px;
  border-radius:999px;
  font-size:14px;
  padding:0;
  line-height:1;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.14);
}
body.theme-light .card.compact .card-more-btn{ background: rgba(15,23,42,.03); border: 1px solid rgba(15,23,42,.10); }

.card.compact .compact-block{
  height:48px;
  border-radius:10px;
  display:flex;
  align-items:center;
  padding:0 12px;
  background-image: linear-gradient(180deg, rgba(255,255,255,.12), rgba(0,0,0,.10));
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
body.theme-light .card.compact .compact-block{
  border-color: rgba(15,23,42,.10);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.04);
  background-image: linear-gradient(180deg, rgba(255,255,255,.18), rgba(0,0,0,.04));
}

.card.compact .compact-remain{
  /* 与标准模式 remain 保持一致（字体/字号/字重） */
  font-size:22px;
  font-weight:700;
  display:flex;
  align-items:baseline;
  gap:4px;
  text-shadow:none;
}
.card.compact .compact-remain.debt{ color: var(--danger); }

.card.compact .compact-remain small{
  font-size:11px;
  opacity:.85;
  font-weight:500;
}

.card-menu{
  position:absolute;
  top:38px;
  right:8px;
  min-width: 108px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(17,27,39,.92);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  z-index: 30;
}
body.theme-light .card-menu{
  background: rgba(255,255,255,.92);
}

.card-menu .menu-item{
  width:100%;
  border:0;
  background: transparent;
  padding:7px 8px;
  border-radius: 9px;
  font-size:12px;
  transform:none !important;
}
.card-menu .menu-item:hover{
  background: rgba(255,255,255,.08);
}
body.theme-light .card-menu .menu-item:hover{
  background: rgba(15,23,42,.06);
}

main{
      max-width:1200px;
      margin:18px auto 60px;
      padding:0 20px calc(120px + env(safe-area-inset-bottom));
      display:flex;
      flex-direction:column;
      gap:18px;
    }

    .panel{
      background: linear-gradient(180deg, rgba(255,255,255,.02), transparent 30%), var(--panel);
      border:1px solid var(--border);
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow);
      padding:12px 12px 10px;
    }
    .panel.form-panel{
      display:flex;
      flex-direction:column;
      gap:12px;
    }
    body.theme-light .panel{
      box-shadow: 0 12px 30px rgba(15,23,42,.08);
    }
    .panel-title{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:12px;
      margin-bottom:12px;
    }
    .panel-night .panel-title{
      margin-bottom:0;
    }
    .panel-title h2{
      font-size:16px; 
      margin:0;
      white-space: nowrap;
      flex: 0 0 auto;
    }
    .panel-hint{
      font-size:11px; color:var(--muted);
      padding:4px 8px; border-radius:999px;
      border:1px solid var(--border);
      background: rgba(255,255,255,.02);
    }

    .alerts-grid{
      display:grid;
      grid-template-columns: 1fr;
      gap:12px;
    }
    .alert-card{
      background: var(--panel-2);
      border:1px solid var(--border);
      border-radius: var(--radius-md);
      padding:14px 14px 10px;
    }
    .alert-head{
      display:flex; align-items:center; justify-content:space-between;
      margin-bottom:8px;
    }
    .alert-head h3{font-size:13px; margin:0; color:var(--muted); font-weight:600;}
    .count-badge{
      font-size:11px; padding:2px 8px; border-radius:999px;
      border:1px solid var(--border);
      background: rgba(255,255,255,.04);
      color:var(--text);
    }
    .pill-list{display:flex; flex-wrap:wrap; gap:6px; min-height:22px;}
    .pill{
      display:inline-flex; align-items:center; gap:6px;
      padding:4px 8px;
      border-radius:999px;
      font-size:11px;
      border:1px solid var(--border);
      background: rgba(255,255,255,.02);
    }
    .swatch{
      width:12px; height:12px; border-radius:4px;
      border:1px solid rgba(255,255,255,.15);
      box-shadow: inset 0 0 0 1px rgba(0,0,0,.15);
      flex:0 0 auto;
    }

    .inventory-meta{display:flex; gap:8px; flex-wrap:wrap;}
    .meta-chip{
      font-size:11px; color:var(--muted);
      padding:4px 8px; border-radius:999px;
      border:1px solid var(--border);
      background: rgba(255,255,255,.02);
    }

    .filters{
      display:grid;
      grid-template-columns: 1.2fr 1fr 1.2fr .6fr;
      gap:10px 12px;
      align-items:end;
    }
    
    .inventory-filters{ 
      display: flex;
      flex-direction: column;
      gap: 16px;
    }
    
    .inventory-filters .field{
      width: 100%;
      min-width: 0;
      display: flex;
      align-items: center;
      gap: 12px;
    }
    
    .inventory-filters .field label{
      font-size: 11px;
      color: var(--muted);
      margin: 0;
      white-space: nowrap;
      flex-shrink: 0;
    }
    
    .field label{
      font-size:11px; color:var(--muted);
      display:block; margin-bottom:6px;
    }
    input[type="text"], input[type="password"], input[type="number"], select{
      width:100%;
      height: 40px;
      border-radius: 10px;
      border:1px solid var(--border);
      background: var(--panel-2);
      color: var(--text);
      padding: 0 12px;
      font-size:12px;
      outline:none;
      box-sizing: border-box;
    }
    input::placeholder{color: rgba(255,255,255,.35);}
    body.theme-light input::placeholder{color: rgba(148,163,184,.9);}
    .quick-group{display:flex; gap:6px;}
    .divider{
      height:1px; background: var(--border);
      margin:14px 0;
    }

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

    .card{
      background: linear-gradient(180deg, rgba(255,255,255,.02), transparent 35%), var(--panel-2);
      border:1px solid var(--border);
      border-radius: var(--radius-md);
      padding:12px 12px 10px;
      display:flex;
      flex-direction:column;
      gap:8px;
      position: relative;
    }
    .card.debt{
      border-color: rgba(255,107,107,.45);
      box-shadow: inset 0 0 0 1px rgba(255,107,107,.12);
    }
    .code{
      font-size:14px; font-weight:700; letter-spacing:.6px;
    }
    .color-block{
      height:34px; border-radius:10px;
      border:1px solid rgba(255,255,255,.12);
      background: #777;
    }
    .remain{
      font-size:22px; font-weight:700;
      display:flex; align-items:baseline; gap:4px;
    }
    .remain small{font-size:11px; color:var(--muted); font-weight:500;}
    .remain.debt{color: var(--danger);}
    .status{
      position: absolute;   /* ✅ 关键 */
      top: 10px;            /* 跟 card 的 padding 对齐 */
      right: 12px;          /* 靠右展示 */
      font-size: 10px;
      padding: 2px 6px;
      border-radius: 999px;
      border: 1px solid var(--border);
      background: rgba(255,255,255,.02);
      white-space: nowrap;  /* 防止换行 */
    }
    .status.ok{color: var(--ok); border-color: rgba(52,211,153,.35);}
    .status.warn{color: var(--warn); border-color: rgba(251,191,36,.4);}
    .status.debt{color: var(--danger); border-color: rgba(255,107,107,.45);}

    .card-actions{
      margin-top:auto;
      display:flex;
      gap:8px;
    }
    .card-actions button{
      flex: 1 1 0;
      padding:8px 8px;
      font-size:11px;
      white-space: nowrap;
    }

    .footer{
      display:flex; align-items:center; justify-content:center;
      gap:10px; padding-top:6px;
    }
    
    .footer.footer-bottom{
      flex-direction:column;
      gap:10px;
      padding-top:10px;
    }
    .btn-danger{
      background: linear-gradient(135deg, rgba(255,107,107,.22), rgba(255,107,107,.06));
      border-color: rgba(255,107,107,.45);
    }
    /* 明细表格：移动端给“图纸名称”更多空间，避免被挤压成竖排 */
    #detailDialog table{ table-layout: fixed; }
    #detailDialog th:nth-child(4), #detailDialog td:nth-child(4){
      overflow-wrap:anywhere;
      word-break: break-word;
    }
    @media (max-width: 560px){
      /* 时间列更窄：日期/时间两行显示后这里可以缩 */
      #detailDialog th:nth-child(1){ width: 96px !important; }

      /* 操作 / 数量也稍微缩一点，给图纸名称让空间 */
      #detailDialog th:nth-child(2){ width: 56px !important; }
      #detailDialog th:nth-child(3){ width: 56px !important; }

      /* 表头“图纸名称”不换行（内容长了 td 里仍可换行） */
      #detailDialog th:nth-child(4){ white-space: nowrap; }

      /* 时间单元格不要把字挤坏 */
      #detailDialog td:nth-child(1){ word-break: normal; }
    }

    /* 编辑出库记录弹窗：按钮之间加间距 */
    #recordEditDialog .modal-foot{
      gap:12px;
    }
    @media (max-width: 560px){
      #recordEditDialog .modal-foot{
        gap:10px;
      }
      #recordEditDialog .modal-foot button{
        flex:1 1 0;
        min-width:0;
      }
    }
.help{
      font-size:11px; color:var(--muted);
    }
    .modal-field .help{
      margin-top:8px; /* 统一：输入框 / 上传控件 与说明文字之间留一点空 */
      display:block;
    }
    .linklike{
      background: transparent;
      border-color: transparent;
      color: var(--accent);
      padding:0;
      font-size:11px;
      text-decoration: underline;
      text-underline-offset: 3px;
    }

    dialog{
      width:min(620px, 92vw);
      border-radius: var(--radius-lg);
      border:1px solid var(--border);
      background: var(--panel);
      color: var(--text);
      box-shadow: 0 20px 60px rgba(0,0,0,.55);
      padding:0;
    }
    body.theme-light dialog{
      box-shadow: 0 18px 40px rgba(15,23,42,.2);
    }
    dialog::backdrop{
      background: rgba(0,0,0,.45);
      backdrop-filter: blur(6px);
    }
    .modal-head{
      display:flex; align-items:center; justify-content:space-between;
      padding:14px 16px;
      border-bottom:1px solid var(--border);
      background: linear-gradient(135deg, rgba(255,255,255,.03), transparent);
    }
    .modal-head h3{margin:0; font-size:15px;}
    .modal-head button{
      padding:6px 8px; font-size:11px;
    }
    .modal-head-actions{display:flex; gap:8px; align-items:center;}
    .btn-danger-outline{
      background: rgba(255,107,107,.12);
      border-color: rgba(255,107,107,.45);
      color: var(--danger);
      border-radius:999px;
      padding:6px 10px;
    }
    .modal-body{
      padding:14px 16px 16px;
      display:flex; flex-direction:column; gap:12px;
    }
    .modal-actions{
      display:flex;
      justify-content:center;
      margin-top:8px;
    }
    .modal-actions .btn-primary{
      width:100%;
      max-width:280px;
      height:44px;
      border-radius:22px;
      font-size:13px;
      font-weight:500;
    }
    .modal-field label{
      font-size:11px; color:var(--muted);
      display:block; margin-bottom:6px;
    }
    .radio-group {
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
    }
    .radio-option {
      cursor: pointer;
      padding: 10px 16px;
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      background: var(--panel-2);
      transition: all 0.15s ease;
      flex: 1;
      min-width: 0;
      text-align: center;
    }
    .radio-option:hover {
      border-color: var(--accent);
      background: var(--panel);
    }
    .radio-option input[type="radio"] {
      display: none;
    }
    .radio-option span {
      font-size: 14px;
      color: var(--text);
      display: block;
      width: 100%;
    }
    .radio-option:has(input:checked) {
      border-color: var(--accent);
      background: rgba(14, 165, 233, 0.1);
    }
    body.theme-light .radio-option:has(input:checked) {
      background: rgba(14, 165, 233, 0.08);
    }
.modal-foot{
  padding:12px 16px 16px;
  display:flex;
  justify-content:center;
  gap:12px;
}
.modal-foot button{
  min-width:160px;
}
#workDialog .modal-foot{
  gap:12px;
  flex-wrap:wrap;
}
#workDialog .modal-foot button{
  flex:1 1 0;
  min-width:0;
}
    table{
      width:100%;
      border-collapse: collapse;
      font-size:11px;
      background: var(--panel-2);
      border:1px solid var(--border);
      border-radius: 10px;
      overflow:hidden;
    }
    thead th{
      text-align:left;
      padding:10px 10px;
      color: var(--muted);
      background: rgba(255,255,255,.03);
      border-bottom:1px solid var(--border);
      font-weight:600;
    }
    tbody td{
      padding:9px 10px;
      border-bottom:1px solid rgba(255,255,255,.04);
      vertical-align:top;
    }
    tbody tr:last-child td{border-bottom:none;}
    .op-consume{color: var(--danger);}
    .op-restock{color: var(--ok);}

    .empty{
      font-size:11px; color:var(--muted);
      padding:10px 0;
    }

    .tabs{
      display:flex;
      flex-direction:column;
      gap:10px;
    }
    .tab-nav{
      display:flex;
      gap:6px;
      border-radius:999px;
      padding:4px;
      background:
        linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02)),
        rgba(15,23,42,.12);
      box-shadow:
        inset 0 0 0 1px rgba(255,255,255,.08),
        inset 0 6px 12px rgba(0,0,0,.18),
        0 6px 16px rgba(0,0,0,.28);
    }
    .tab-nav button{
      flex:1;
      padding:7px 10px;
      font-size:11px;
      border-radius:999px;
      border:1px solid transparent;
      background:transparent;
      color:var(--muted);
      transition:.18s ease;
    }

/* 图纸标签筛选行（带标签文字） */
.category-filter-row{
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0;
}

.category-filter-label{
  font-size: 11px;
  color: var(--muted);
  margin: 0;
  white-space: nowrap;
  flex-shrink: 0;
}

.category-filter-row:empty{
  display: none;
}

.category-tabs{
  display:flex;
  align-items:center;
  gap:8px;
  flex: 1 1 auto;
  min-width: 0;
}
.category-tabs:empty{
  display:none;
}
    .category-scroll{
      display:flex;
      gap:6px;
      overflow-x:auto;
      padding:1px 0;
      scroll-snap-type:x mandatory;
      scrollbar-width:none;
    }
    .category-scroll::-webkit-scrollbar{
      display:none;
    }
    .category-chip{
      scroll-snap-align:start;
      border:1px solid var(--border);
      background:var(--panel-2);
      color:var(--muted);
      padding:6px 10px;
      border-radius:999px;
      font-size:11px;
      white-space:nowrap;
      cursor:pointer;
      transition:.15s ease;
    }
    .category-chip.active{
      color:var(--text);
      border-color: rgba(34,197,94,.35);
      background: linear-gradient(135deg, rgba(34,197,94,.18), rgba(34,197,94,.05));
    }
    .category-chip:hover{ transform: translateY(-1px); }

    .empty-illus{
      width:108px;
      height:108px;
      margin:0 auto 16px;
      border-radius:24px;
      border:1px dashed rgba(125,211,252,.35);
      background:
        radial-gradient(circle at 30% 30%, rgba(125,211,252,.16), transparent 60%),
        radial-gradient(circle at 70% 70%, rgba(167,139,250,.12), transparent 60%),
        rgba(255,255,255,.02);
      position:relative;
      display:flex;
      align-items:center;
      justify-content:center;
    }
    .empty-illus::before,
    .empty-illus::after{
      content:"";
      position:absolute;
      border-radius:999px;
      background: rgba(125,211,252,.45);
    }
    .empty-illus::before{
      width:36px;
      height:12px;
      top:36px;
      left:36px;
    }
    .empty-illus::after{
      width:20px;
      height:20px;
      bottom:32px;
      right:32px;
      background: rgba(167,139,250,.35);
    }
    .empty-text{
      text-align:center;
      font-size:12px;
      color:var(--muted);
      letter-spacing:.2px;
    }
    .tab-nav button.active{
      background: linear-gradient(135deg, rgba(34,211,238,.3), rgba(249,115,22,.22));
      color:#0f172a;
      border-color: rgba(255,255,255,.22);
      box-shadow:
        0 6px 14px rgba(0,0,0,.35),
        inset 0 1px 0 rgba(255,255,255,.18);
    }
    body.theme-light .tab-nav{
      background:
        linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,.6)),
        rgba(148,163,184,.25);
      box-shadow:
        inset 0 0 0 1px rgba(15,23,42,.08),
        inset 0 6px 12px rgba(15,23,42,.08),
        0 8px 16px rgba(15,23,42,.12);
    }
    body.theme-light .tab-nav button{
      color: rgba(15,23,42,.6);
    }
    body.theme-light .tab-nav button.active{
      background: linear-gradient(135deg, rgba(34,211,238,.22), rgba(249,115,22,.18));
      color: rgba(15,23,42,.95);
      border-color: rgba(56,189,248,.35);
      box-shadow:
        0 6px 12px rgba(15,23,42,.18),
        inset 0 1px 0 rgba(255,255,255,.9);
    }
    .tab-panel{display:none; gap:10px; flex-direction:column;}
    .tab-panel.active{display:flex;}

    .record-rows{
      display:flex;
      flex-direction:column;
      gap:6px;
      margin-top:4px;
    }
    .manual-row-toolbar{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:10px;
      margin:8px 0 10px;
      flex-wrap:wrap;
    }
    .manual-row-toolbar button{ flex:0 0 auto; }
    .manual-row-toolbar .help{
      margin:0;
      font-weight:600;
      white-space:nowrap;
      text-align:right;
    }
    .record-row{
      display:grid;
      grid-template-columns: 1fr 1fr auto;
      gap:6px;
      align-items:center;
    }
    .record-row input{
      padding:7px 8px;
      font-size:12px;
    }
    .record-row button{
      padding:6px 8px;
      font-size:11px;
      min-width: 46px;
    }

    .file-upload{
      border-radius: var(--radius-md);
      border:1px dashed rgba(255,255,255,.25);
      background: radial-gradient(circle at 0 0, rgba(125,211,252,.08), transparent 50%), var(--panel-2);
      padding:12px 14px;
      display:flex;
      flex-direction:column;
      gap:8px;
      align-items:center;
      text-align:center;
    }
    body.theme-light .file-upload{
      border-color: rgba(148,163,184,.6);
      background: radial-gradient(circle at 0 0, rgba(56,189,248,.08), transparent 50%), var(--panel-2);
    }
    .file-upload-desc{
      font-size:11px; 
      color:var(--muted);
      line-height:1.4;
    }
    .file-upload-filename{
      font-size:12px; 
      color:var(--accent);
      font-weight:500;
      min-height:18px;
    }
    .file-upload-btn{
      padding:8px 18px;
      font-size:13px;
      border-radius:var(--radius-md);
      border:none;
      background:linear-gradient(135deg, #7dd3fc 0%, #fdba74 100%);
      color:#334155;
      cursor:pointer;
      transition:all 0.15s ease;
      font-weight:500;
      display:flex;
      align-items:center;
      gap:6px;
      box-shadow:0 2px 8px rgba(125, 211, 252, 0.25);
    }
    .file-upload-btn::before{
      content:"";
      width:16px;
      height:16px;
      background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='17 8 12 3 7 8'/%3E%3Cline x1='12' y1='3' x2='12' y2='15'/%3E%3C/svg%3E");
      background-size:contain;
      background-repeat:no-repeat;
      background-position:center;
      flex-shrink:0;
    }
    .file-upload-btn:hover{
      box-shadow:0 4px 12px rgba(125, 211, 252, 0.35);
      transform:translateY(-1px);
      background:linear-gradient(135deg, #93d5fc 0%, #fdcb8a 100%);
    }
    .file-upload-btn:active{
      transform:translateY(0) scale(0.98);
    }
    .file-upload-actions{
      display:flex;
      gap:10px;
      align-items:center;
      flex-wrap:wrap;
      justify-content:center;
    }
    .file-upload-btn.secondary{
      background:rgba(148,163,184,.18);
      color:var(--text);
      box-shadow:0 2px 8px rgba(0,0,0,.15);
    }
    .file-upload-btn.secondary::before{
      background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='7 10 12 15 17 10'/%3E%3Cline x1='12' y1='15' x2='12' y2='3'/%3E%3C/svg%3E");
    }
    .file-upload-btn.secondary:hover{
      background:rgba(148,163,184,.28);
      box-shadow:0 4px 12px rgba(0,0,0,.2);
    }
.work-upload{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
}
.work-upload-box{
  width:min(240px, 72vw);
  aspect-ratio: 1 / 1;
  border:1px dashed var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255,255,255,.04), transparent 45%), var(--panel-2);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  position:relative;
  overflow:hidden;
}
.work-upload-box:focus-visible{
  outline:2px solid var(--accent);
  outline-offset:2px;
}
.work-upload-placeholder{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
  color:var(--muted);
  font-size:12px;
  text-align:center;
}
.work-upload-illus{
  width:72px;
  height:72px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:18px;
  border:1px dashed rgba(125,211,252,.45);
  background:
    radial-gradient(circle at 30% 30%, rgba(125,211,252,.22), transparent 62%),
    radial-gradient(circle at 70% 70%, rgba(167,139,250,.16), transparent 62%),
    rgba(255,255,255,.03);
  color:var(--accent);
  position:relative;
}
.work-upload-illus::before,
.work-upload-illus::after{
  content:"";
  position:absolute;
  border-radius:999px;
  background: rgba(125,211,252,.5);
}
.work-upload-illus::before{
  width:30px;
  height:9px;
  top:22px;
  left:20px;
}
.work-upload-illus::after{
  width:16px;
  height:16px;
  bottom:18px;
  right:18px;
  background: rgba(167,139,250,.4);
}
body.theme-light .work-upload-illus{
  border-color: rgba(59,130,246,.25);
  background:
    radial-gradient(circle at 30% 30%, rgba(56,189,248,.18), transparent 62%),
    radial-gradient(circle at 70% 70%, rgba(167,139,250,.12), transparent 62%),
    rgba(15,23,42,.03);
}
.work-upload-illus svg{
  width:34px;
  height:34px;
  stroke: currentColor;
  fill: none;
  stroke-width:2.2;
  opacity:.9;
}
.work-upload-box img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:none;
}
.work-upload-box.has-preview .work-upload-placeholder{
  display:none;
}
.work-upload-box.has-preview img{
  display:block;
}
.work-cropper{
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:10px;
  border:1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel-2);
}
.work-cropper-stage{
  width:min(320px, 80vw);
  aspect-ratio: 1 / 1;
  margin:0 auto;
  border-radius: var(--radius-sm);
  overflow:hidden;
  background: rgba(0,0,0,.04);
  touch-action: none;
  overscroll-behavior: none;
}
.work-cropper-stage .cropper-container,
.work-cropper-stage .cropper-canvas,
.work-cropper-stage .cropper-drag-box,
.work-cropper-stage .cropper-crop-box,
.work-cropper-stage .cropper-view-box{
  touch-action: none;
  overscroll-behavior: contain;
}
.work-cropper-stage img{
  display:block;
  max-width:100%;
}
.work-cropper-controls{
  display:flex;
  align-items:center;
  gap:10px;
  font-size:12px;
  color:var(--muted);
}
.work-cropper-controls input[type="range"]{
  flex:1;
}
.work-cropper-actions{
  display:flex;
  gap:10px;
  justify-content:center;
  flex-wrap:wrap;
}
.work-inline-fields{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.work-inline-fields .modal-field{
  flex:1 1 0;
  min-width:0;
}
.work-duration-inputs{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.work-duration-inputs .duration-field{
  flex:1 1 0;
  min-width:0;
  display:flex;
  align-items:center;
  gap:6px;
  height:36px;
  padding:0 10px;
  border-radius: var(--radius-md);
  border:1px solid var(--border);
  background: var(--panel-2);
}
.work-duration-inputs .duration-field input{
  width:100%;
  min-width:0;
  border:none;
  outline:none;
  background:transparent;
  color: var(--text);
  font-size:12px;
  font-family: inherit;
  appearance: textfield;
  padding:0;
  height:100%;
}
.work-duration-inputs .duration-field input::-webkit-outer-spin-button,
.work-duration-inputs .duration-field input::-webkit-inner-spin-button{
  appearance: none;
  margin:0;
}
.work-duration-inputs .duration-field:focus-within{
  border-color: rgba(34,197,94,.45);
  box-shadow: 0 0 0 2px rgba(34,197,94,.15);
}
.work-duration-inputs .duration-unit{
  font-size:12px;
  color: var(--muted);
  white-space:nowrap;
}
.work-datetime{
  position:relative;
  display:flex;
  align-items:center;
}
.work-datetime-input{
  width:100%;
  padding:10px 36px 10px 12px;
  border-radius: var(--radius-md);
  border:1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size:12px;
  font-family: inherit;
}
.work-datetime-input:focus{
  outline:none;
  border-color: rgba(34,197,94,.45);
  box-shadow: 0 0 0 2px rgba(34,197,94,.15);
}
.work-datetime-input::-webkit-calendar-picker-indicator{
  position:absolute;
  top:0;
  left:0;
  right:0;
  bottom:0;
  width:100%;
  height:100%;
  opacity:0;
  cursor:pointer;
  margin:0;
}
.work-datetime-input::-webkit-inner-spin-button,
.work-datetime-input::-webkit-clear-button{
  display:none;
}
.work-datetime-icon{
  position:absolute;
  right:10px;
  width:18px;
  height:18px;
  color:var(--muted);
  pointer-events:none;
}
.work-datetime-icon svg{
  width:100%;
  height:100%;
  stroke: currentColor;
  fill: none;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.pattern-preview{
      margin-top:8px;
      border-radius:12px;
      border:1px solid var(--border);
      background: var(--panel-2);
      padding:6px;
      display:flex;
      align-items:center;
      justify-content:center;
      min-height:120px;
      position:relative;
    }
    .pattern-preview img{
      max-width:100%;
      max-height:180px;
      object-fit:contain;
      display:block;
    }
    #recordEditImageClear{
      position:absolute;
      top:8px;
      right:8px;
      padding:6px 8px;
      font-size:11px;
      border-radius:999px;
      background: rgba(15,23,42,.35);
      color: #fff;
      border: 1px solid rgba(255,255,255,.1);
    }
    [data-theme="dark"] #recordEditImageClear{
      background: rgba(255,255,255,.2);
      color: #fff;
      border: 1px solid rgba(255,255,255,.2);
    }

    .toast-stack{
      position: fixed;
      right: 16px;
      bottom: 16px;
      display:flex;
      flex-direction:column;
      gap:8px;
      z-index: 2147483647;
    }
    .toast{
      min-width: 200px;
      max-width: 360px;
      padding:10px 12px;
      border-radius: 12px;
      border:1px solid var(--border);
      background: rgba(17,27,39,.95);
      box-shadow: 0 10px 22px rgba(0,0,0,.45);
      display:flex; align-items:center; gap:8px;
      font-size:12px;
      transition: .22s ease;
    }
    body.theme-light .toast{
      background:#111827;
      color:#e5e7eb;
    }
    .toast-dot{
      width:8px; height:8px; border-radius:50%;
      background: currentColor;
      box-shadow: 0 0 0 2px rgba(255,255,255,.06);
    }

    /* 设置弹窗布局 */
    .settings-layout{
      display:flex;
      flex-direction:column;
      gap:10px;
      align-items:stretch;
    }
    .settings-nav{
      display:flex;
      flex-direction:row;
      gap:6px;
      border-radius:999px;
      background:rgba(255,255,255,.03);
      padding:3px;
    }
    .settings-nav button{
      flex:1;
      width:auto;
      padding:6px 8px;
      font-size:11px;
      border-radius:999px;
      border:none;
      background:transparent;
      color:var(--muted);
      text-align:center;
      justify-content:center;
      line-height:1.2;
      white-space:nowrap;
      min-width:0;
    }
    .settings-nav button.active{
      background: radial-gradient(circle at 30% 0, rgba(125,211,252,.30), rgba(167,139,250,.40));
      color:var(--text);
      box-shadow:0 4px 10px rgba(0,0,0,.35);
    }
    body.theme-light .settings-nav button.active{
      box-shadow:0 4px 10px rgba(15,23,42,.15);
    }
    .settings-panels{
      flex:1;
      display:flex;
      flex-direction:column;
      gap:12px;
    }
    .settings-panel{
      display:none;
      flex-direction:column;
      gap:10px;
    }
    .settings-panel.active{display:flex;}

    .ai-result-box{
      max-height: 260px;
      overflow: auto;
      border-radius: 10px;
    }
    .ai-row-unknown td{
      background: rgba(255,107,107,.08);
    }
    body.theme-light .ai-row-unknown td{
      background: rgba(220,38,38,.06);
    }

    .ai-conf-td{
      vertical-align: middle !important;
    }
    .ai-conf{
      display:inline-flex;
      align-items:center;
      justify-content:flex-start;
      line-height:1.2;
    }


    @media (max-width: 1100px){
      .grid{grid-template-columns: repeat(4, minmax(0, 1fr));}
      .filters{grid-template-columns: 1fr 1fr 1fr .8fr;}
    }
    @media (max-width: 900px){
      .alerts-grid{grid-template-columns: 1fr;}
      .grid{grid-template-columns: repeat(3, minmax(0, 1fr));}
      .filters{grid-template-columns: 1fr 1fr;}
      .header-inner{flex-direction:column; align-items:stretch;}
      .actions{width:100%; justify-content:flex-end;}
          .brand{width:100%; justify-content:space-between;}
}
    @media (max-width: 560px){
      .grid{grid-template-columns: repeat(2, minmax(0, 1fr));}
      
      /* 作品集搜索栏移动端适配 */
      .works-page-title{
        font-size: 14px;
      }
      
      .works-search-box{
        width: 140px;
      }
    }
  
  /* --- Modal backdrop (avoid <dialog>.showModal top-layer so toast can be above) --- */
  .modal-backdrop{
    position:fixed; inset:0;
    background:rgba(0,0,0,.35);
    backdrop-filter: blur(3px);
    z-index: 9000;
    display:none;
  }
  .modal-backdrop.show{ display:block; }

  /* --- Global loading overlay (blocks all interactions) --- */
  .loading-overlay{
    position:fixed;
    inset:0;
    display:none;
    align-items:center;
    justify-content:center;
    background:rgba(0,0,0,.4);
    backdrop-filter: blur(4px);
    z-index: 9500;
    cursor: wait;
  }
  .loading-overlay.show{ display:flex; }
  body.loading-open{ overflow:hidden; }
  .loading-card{
    width:min(360px, 86vw);
    border-radius:14px;
    padding:16px 18px;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:10px;
    background:
      radial-gradient(120% 120% at 10% 0%, rgba(34,211,238,.18), rgba(34,211,238,0) 55%),
      radial-gradient(120% 120% at 90% 0%, rgba(249,115,22,.16), rgba(249,115,22,0) 55%),
      var(--panel-2);
    border:1px solid rgba(255,255,255,.08);
    box-shadow: 0 10px 24px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.06);
  }
  body.theme-light .loading-card{
    border-color: rgba(15,23,42,.08);
    box-shadow: 0 12px 22px rgba(15,23,42,.08), inset 0 1px 0 rgba(255,255,255,.7);
  }
  .loading-spinner{
    width:36px;
    height:36px;
    border-radius:50%;
    border:3px solid rgba(255,255,255,.18);
    border-top-color: var(--accent);
    animation: loadingSpin 0.9s linear infinite;
    flex:0 0 auto;
  }
  body.theme-light .loading-spinner{
    border-color: rgba(15,23,42,.12);
    border-top-color: var(--accent);
  }
  .loading-text{
    font-size:12px;
    color: var(--text);
    line-height:1.4;
    text-align:center;
  }
  @keyframes loadingSpin { to { transform: rotate(360deg); } }

  /* --- Confirm dialog layout --- */
  .modal-backdrop.submodal{ z-index: 9002; }
  #confirmDialog{ width: min(520px, 86vw); z-index: 9005; }
  #confirmDialog .modal-foot{ gap: 12px; flex-wrap: wrap; }
  #confirmDialog .modal-foot button{ min-width: 0; flex: 1 1 0; }
  #recordEditDialog{ width: min(680px, 92vw); }
  #todoAddDialog .modal-foot{ gap: 12px; flex-wrap: wrap; }
  #todoAddDialog .modal-foot button{ min-width: 0; flex: 1 1 0; }


dialog{
  position:fixed;
  top:50%;
  left:50%;
  transform: translate(-50%, -50%);
  z-index: 9001;
  margin: 0;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow: hidden;
}
dialog button:focus{
  outline:none;
  box-shadow:none;
}
dialog button:focus-visible{
  outline:2px solid rgba(14,165,233,.6);
  outline-offset:2px;
}
dialog.is-locked{
  pointer-events:none;
}
dialog[open]{
  display:flex;
  flex-direction:column;
}
  dialog .modal-head,
  dialog .modal-foot{
    flex: 0 0 auto;
  }
dialog .modal-body{
  flex: 1 1 auto;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.work-cropper-dialog{
  width:min(560px, 92vw);
  z-index: 9003;
  touch-action: none;
  overscroll-behavior: none;
}
.work-cropper-dialog .modal-body{
  display:flex;
  justify-content:center;
}

  /* Toast always on top - even above dialog backdrop */
  #toastStack{ z-index: 2147483647 !important; }


    .guest-tip-text p{
      margin:0 0 8px 0;
      font-size:13px;
      line-height:1.55;
      color:#444;
    }
    .guest-tip-text p:last-child{ margin-bottom:0; }

  /* 批量入库（221色号） */
  .bulk-top{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    margin-top:8px;
  }
  #restockBulkAddAll{
    padding:10px 14px;
    border:1px solid var(--border);
    border-radius:14px;
    background:var(--card);
    cursor:pointer;
  }
  .bulk-meta{
    color:var(--muted);
    font-size:13px;
    white-space:nowrap;
    font-weight:600;
  }
  .bulk-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:10px;
    margin-top:12px;
    max-height:46vh;
    overflow:auto;
    padding-right:4px;
  }
  @media (max-width: 720px){
    .bulk-grid{grid-template-columns:repeat(2,minmax(0,1fr));max-height:42vh;}
    .bulk-meta{font-size:12px;font-weight:600;}
    /* 手机端库存按系列两列展示（iPhone 16 Pro 等窄屏也保持两列） */
    .series-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;}
  }

  .bulk-item{
    display:grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items:center;
    padding:4px 2px;
  }
  .bulk-item .code{
    font-weight:600;
    font-size:12px;
    color:var(--text);
    letter-spacing:.2px;
  }
  .bulk-item input{
    width:100%;
    padding:7px 8px;
    font-size:12px;
    border-radius:10px;
    border:1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
  }

    .series-list{
      display:flex;
      flex-direction:column;
      gap:10px;
      margin-top:10px;
    }
    .series-row{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:12px;
      padding:8px 10px;
      border:1px solid var(--border);
      border-radius:12px;
      background:var(--panel);
    }
    .series-meta{
      display:flex;
      flex-direction:column;
      gap:2px;
      min-width:0;
    }
    .series-name{
      white-space:nowrap;
      overflow:hidden;
      text-overflow:ellipsis;
      font-size:12px;
    }
    .series-row .btn-secondary,
    .series-row .btn-danger{
      flex:0 0 auto;
      white-space:nowrap;
    }

    .category-list{
      display:flex;
      flex-direction:column;
      gap:8px;
      margin-top:10px;
    }
    .category-tag-item{
      display:flex;
      align-items:center;
      justify-content:space-between;
      padding:10px 12px;
      background:var(--panel-2);
      border-radius:var(--radius-md);
      border:1px solid var(--border);
    }
    .category-tag-name{
      flex:1;
      font-size:14px;
      color:var(--text);
    }
    .category-tag-del{
      width:24px;
      height:24px;
      border:none;
      background:var(--danger);
      color:#fff;
      border-radius:50%;
      cursor:pointer;
      font-size:16px;
      line-height:1;
      display:flex;
      align-items:center;
      justify-content:center;
      flex-shrink:0;
    }
    .category-tag-del:hover{
      opacity:0.85;
    }
    .category-row{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:12px;
      padding:8px 10px;
      border:1px solid var(--border);
      border-radius:12px;
      background:var(--panel);
    }
    .category-name{
      font-size:12px;
      font-weight:600;
      white-space:nowrap;
      overflow:hidden;
      text-overflow:ellipsis;
    }
    .category-actions{
      display:flex;
      gap:8px;
      flex:0 0 auto;
    }
    .series-row button,
    .category-row button{
      padding:6px 12px;
      font-size:11px;
      border-radius:10px;
    }

    .series-section{
      margin-top:10px;
    }
    .series-header{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:10px;
      margin:14px 2px 10px;
      padding-top:10px;
      border-top:1px dashed var(--border);
      color:var(--muted);
      font-weight:700;
    }

    .series-title{
      color: var(--muted);
      font-weight: 800;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      min-width: 0;
    }
    .series-actions{
      display:flex;
      align-items:center;
      gap:10px;
      flex: 0 0 auto;
    }
    .series-stats{
      font-size:12px;
      color: var(--muted);
      font-weight: 600;
      white-space: nowrap;
    }
    .series-collapse-btn{
      width:24px;
      height:24px;
      border-radius:999px;
      border:1px solid var(--border);
      background: rgba(255,255,255,.04);
      display:inline-flex;
      align-items:center;
      justify-content:center;
      cursor:pointer;
      padding:0;
      line-height:1;
      user-select:none;
    }
    body.theme-light .series-collapse-btn{ background: rgba(15,23,42,.04); }
    .series-section.collapsed .series-header{ margin-bottom: 4px; }
    .series-grid{
      display:grid;
      grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
      gap:12px;
    }

    #inventoryGrid.grid{ display:block; }

  /* ✅ iPhone 等移动端：库存卡片每行固定两列（覆盖后续基础样式） */
  @media (max-width: 720px){
    #inventoryGrid .series-grid{
      display:grid !important;
      grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
      gap:10px !important;
    }
    
        #inventoryGrid .series-section.collapsed .series-grid{ display:none !important; }
/* 记录出库/AI智能记录弹窗：避免“确认记录”被挤出屏幕（只影响 #consumeDialog） */
    #consumeDialog{
      max-height: calc(100vh - 24px);
      max-height: calc(100dvh - 24px);
      overflow: hidden;
    }

    #consumeDialog .tabs{
      flex: 1 1 auto;
      overflow: auto;
      -webkit-overflow-scrolling: touch;
    }

    #consumeDialog .modal-foot{
      flex: 0 0 auto;
      padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }

  }


/* 拼豆记录弹窗（仅样式微调：移动端更精致/更紧凑） */
#recordsDialog .records-toolbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-top:8px;
  margin-bottom:6px;
}
.works-stats{
  margin-top:0;
}
#worksStats.stats-cards{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:12px;
  align-items:stretch;
}
#worksStats .stats-card{
  border-radius:14px;
  padding:10px 12px;
  background:
    radial-gradient(120% 120% at 10% 0%, rgba(34,211,238,.18), rgba(34,211,238,0) 55%),
    radial-gradient(120% 120% at 90% 0%, rgba(249,115,22,.16), rgba(249,115,22,0) 55%),
    var(--panel-2);
  border:1px solid rgba(255,255,255,.08);
  box-shadow: 0 10px 24px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.06);
  display:flex;
  flex-direction:column;
  gap:6px;
}
body.theme-light #worksStats .stats-card{
  border-color: rgba(15,23,42,.08);
  box-shadow: 0 12px 22px rgba(15,23,42,.08), inset 0 1px 0 rgba(255,255,255,.7);
}
#worksStats .stats-card-label{
  font-size:11px;
  color:var(--muted);
  letter-spacing:.2px;
}
#worksStats .stats-card-value{
  font-size:16px;
  font-weight:600;
  font-variant-numeric:tabular-nums;
  color:var(--text);
}
#pageWorks{
  position: relative;
}
#pageWorks.page.active{
  animation: none;
  transform: none;
}

/* 作品集搜索栏 - 全屏宽度，贴顶 */
.works-search-bar{
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  /* 突破父容器左右padding，实现全屏宽度 */
  margin: 0 -20px 0 -20px;
  width: calc(100% + 40px);
  background: rgba(255,255,255,0.86);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}
@media (max-width: 720px){
  .works-search-bar{
    margin: 0 -14px 0 -14px;
    width: calc(100% + 28px);
    padding: 10px 14px;
  }
}
body.theme-dark .works-search-bar{
  background: rgba(10,14,18,0.82);
}

.works-page-title{
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}

.works-search-box{
  position: relative;
  width: 160px;
  flex-shrink: 0;
}

.works-search-icon{
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: #9ca3af;
  pointer-events: none;
}

.works-search-input{
  width: 100%;
  height: 30px;
  padding: 0 10px 0 30px;
  border: 1.5px solid transparent;
  border-radius: 15px;
  background: 
    linear-gradient(var(--panel), var(--panel)) padding-box,
    linear-gradient(135deg, rgba(34,211,238,0.35), rgba(249,115,22,0.35)) border-box;
  color: var(--text);
  font-size: 12px;
  outline: none;
  -webkit-appearance: none;
}

.works-search-input:focus{
  background: 
    linear-gradient(var(--panel), var(--panel)) padding-box,
    linear-gradient(135deg, rgba(34,211,238,0.6), rgba(249,115,22,0.6)) border-box;
}

.works-search-input::placeholder{
  color: var(--muted);
  font-size: 12px;
}

/* iOS Safari 清除按钮样式 */
.works-search-input::-webkit-search-cancel-button{
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 16px;
  height: 16px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%239ca3af" stroke-width="2" stroke-linecap="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>');
  background-size: 16px 16px;
  background-repeat: no-repeat;
  cursor: pointer;
  margin-left: 4px;
  opacity: 1;
}

/* 出库记录搜索栏 */
.records-search-bar{
  position: relative;
  width: 100%;
}

/* 当没有标签行时，增加顶部间距 */
.records-search-bar.no-category-margin{
  margin-top: 5px;
}

.records-search-icon{
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: #9ca3af;
  pointer-events: none;
  z-index: 1;
}

.records-search-input{
  width: 100%;
  height: 30px;
  padding: 0 10px 0 30px;
  border: 1.5px solid transparent;
  border-radius: 15px;
  background: 
    linear-gradient(var(--panel), var(--panel)) padding-box,
    linear-gradient(135deg, rgba(34,211,238,0.35), rgba(249,115,22,0.35)) border-box;
  color: var(--text);
  font-size: 12px;
  outline: none;
  -webkit-appearance: none;
}

.records-search-input:focus{
  background: 
    linear-gradient(var(--panel), var(--panel)) padding-box,
    linear-gradient(135deg, rgba(34,211,238,0.6), rgba(249,115,22,0.6)) border-box;
}

.records-search-input::placeholder{
  color: var(--muted);
  font-size: 12px;
}

.records-search-input::-webkit-search-cancel-button{
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 16px;
  height: 16px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%239ca3af" stroke-width="2" stroke-linecap="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>');
  background-size: 16px 16px;
  background-repeat: no-repeat;
  cursor: pointer;
  margin-left: 4px;
  opacity: 1;
}

.works-empty{
  position:fixed;
  left:50%;
  top:50%;
  transform: translate(-50%, -50%);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:24px;
  text-align:center;
}
.works-empty .empty-illus{
  margin-bottom:0;
  width:216px;
  height:216px;
  border-radius:48px;
}
.works-empty .empty-illus::before{
  width:72px;
  height:24px;
  top:72px;
  left:72px;
}
.works-empty .empty-illus::after{
  width:40px;
  height:40px;
  bottom:64px;
  right:64px;
}
.works-empty .empty-text{
  font-size:14px;
  color:var(--muted);
  margin-top:16px;
}
.works-empty .btn-primary{
  width:216px;
  justify-content:center;
  display:flex;
  margin:0 auto;
  align-self:center;
  margin-top:24px;
}

/* 未登录时的作品集占位图 */
.works-guest-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  min-height: 60vh;
}
.works-guest-empty-icon {
  color: #ccc;
  margin-bottom: 24px;
}
.theme-dark .works-guest-empty-icon {
  color: #555;
}
.works-guest-empty-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}
.works-guest-empty-text {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 32px;
}
.works-guest-empty-btn {
  padding: 14px 48px;
  border: none;
  border-radius: 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(102, 126, 234, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}
.works-guest-empty-btn:active {
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.works-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap:12px;
  row-gap:6px;
  grid-auto-rows: 8px;
  align-items:start;
}
.works-grid.is-empty{
  grid-template-columns: 1fr;
}
.works-list-empty{
  width:100%;
  grid-column: 1 / -1;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding:22px 0 12px;
  gap:12px;
  color:var(--muted);
}
.works-list-empty .empty-text{
  font-size:12px;
}
.work-card{
  margin-bottom:0;
  border-radius: var(--radius-md);
  border:1px solid var(--border);
  background: var(--panel-2);
  overflow:hidden;
  cursor:pointer;
  position:relative;
  box-shadow: 0 6px 12px rgba(0,0,0,.12);
  transition: transform .18s ease, box-shadow .18s ease;
}
.work-card:hover{
  transform: translateY(-2px);
  box-shadow: 0 10px 18px rgba(0,0,0,.2);
}
.work-card img{
  width:100%;
  display:block;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: rgba(0,0,0,.04);
}
.work-card-body{
  padding:10px 10px 12px;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.work-card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:6px;
}
.work-card-tag{
  position:absolute;
  top:8px;
  right:8px;
  font-size:10px;
  font-weight:600;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid rgba(14,165,233,.6);
  background: rgba(14,165,233,.45);
  color: var(--text);
  white-space:nowrap;
  pointer-events:none;
  backdrop-filter: blur(4px);
}
.work-card-title{
  font-size:12px;
  font-weight:600;
  color:var(--text);
  line-height:1.3;
  min-width:0;
  flex:1 1 auto;
  white-space:normal;
  overflow-wrap:anywhere;
}
.work-card-meta{
  display:flex;
  align-items:center;
  flex-wrap:nowrap;
  min-width:0;
  line-height:1.2;
  font-variant-numeric: tabular-nums;
  color:var(--muted);
  font-size:11px;
  white-space:nowrap;
  gap:10px;
}
.work-card-meta .meta-item{
  display:flex;
  align-items:center;
  gap:2px;
  white-space:nowrap;
  line-height:1.2;
}
.work-card-meta svg{
  width:14px;
  height:14px;
  stroke: currentColor;
  fill:none;
  stroke-width:1.6;
  flex:0 0 auto;
  display:block;
}
.work-detail-image{
  border-radius:12px;
  overflow:hidden;
  border:1px solid var(--border);
  background: var(--panel-2);
  position:relative;
  aspect-ratio: 1 / 1;
  display:flex;
  align-items:center;
  justify-content:center;
}
.work-detail-placeholder{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  transition: opacity .2s ease;
}
.work-detail-image img{
  width:100%;
  display:block;
  max-height: 60vh;
  object-fit: contain;
  opacity:0;
  transition: opacity .2s ease;
}
.work-detail-image.is-loaded .work-detail-placeholder{
  opacity:0;
  pointer-events:none;
}
.work-detail-image.is-loaded img{
  opacity:1;
}
.work-detail-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}
.work-detail-head .pattern-tag{
  font-size:10px;
  font-weight:600;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid rgba(14,165,233,.25);
  background: rgba(14,165,233,.12);
  color: var(--text);
  white-space:nowrap;
  pointer-events:none;
}
.work-detail-title{
  font-size:14px;
  font-weight:700;
  margin:0;
}
.work-detail-stats{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:10px;
}
.work-detail-stat,
.work-detail-time{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:6px;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid var(--border);
  background: var(--panel-2);
  font-size:12px;
  color:var(--muted);
}
.work-detail-stat strong,
.work-detail-time strong{
  color:var(--text);
  font-weight:600;
  font-variant-numeric: tabular-nums;
}
.work-detail-notes{
  font-size:12px;
  color:var(--text);
  line-height:1.5;
  padding:8px 10px;
  border-radius:10px;
  border:1px dashed var(--border);
  background: rgba(255,255,255,.03);
}
.work-detail-notes a{
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
@media (min-width: 900px){
  .works-grid{ grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 520px){
  .work-detail-meta{ grid-template-columns: 1fr; }
}

/* 统计页：收紧内容区留白 */
#pageStats{
  gap:12px;
}
#pageStats .panel{
  padding:12px 12px 10px;
}
#pageStats #recordsDialog .tabs{
  gap:8px;
}
#pageStats #recordsDialog .tab-nav{
  padding:4px;
  gap:6px;
}
#pageStats #recordsDialog .tab-nav button{
  padding:8px 10px;
  font-size:12px;
  font-weight:600;
}
#pageConsume #consumeDialog .tabs,
#pageRestock #restockDialog .tabs{
  gap:8px;
}
#pageRestock{
  min-height: calc(100dvh - var(--tabbar-height) - 40px);
}
#pageRestock #restockDialog{
  flex: 0 0 auto;
}
#pageRestock #restockDialog .tabs{
  flex: 0 0 auto;
}
#pageConsume #consumeDialog .tab-nav,
#pageRestock #restockDialog .tab-nav{
  padding:4px;
  gap:6px;
}
#pageConsume #consumeDialog .tab-nav button,
#pageRestock #restockDialog .tab-nav button{
  padding:8px 10px;
  font-size:12px;
  font-weight:600;
}
#pageStats #recordsDialog .records-toolbar{
  margin-top:4px;
  margin-bottom:4px;
}

/* iOS 风格开关（15px 高） */
/* 拼豆记录弹窗：限制最大高度，避免超出屏幕（只影响 #recordsDialog） */
#recordsDialog{
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow:hidden;
}
#recordsDialog[open]{
  display:flex;
  flex-direction:column;
}

#recordsDialog .check{
  display:flex;
  align-items:center;
  position:relative;
  gap:10px;
  font-size:12px;
  color:var(--muted);
  user-select:none;
}
#recordsDialog .check input{
  position:absolute;
  opacity:0;
  width:1px;
  height:1px;
}
#recordsDialog .check .switch{
  width:32px;
  height:15px;
  border-radius:999px;
  background: rgba(255,255,255,.10);
  border:1px solid rgba(255,255,255,.16);
  position:relative;
  flex:0 0 auto;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.28);
  transition: background .18s ease, border-color .18s ease;
}
body.theme-light #recordsDialog .check .switch{
  background: rgba(15,23,42,.08);
  border-color: rgba(15,23,42,.14);
  box-shadow: inset 0 1px 2px rgba(15,23,42,.12);
}
#recordsDialog .check .switch::after{
  content:"";
  width:13px;
  height:13px;
  border-radius:999px;
  background: #fff;
  position:absolute;
  top:50%;
  left:1px;
  transform: translate(0,-50%);
  box-shadow: 0 2px 6px rgba(0,0,0,.30);
  transition: transform .18s ease, box-shadow .18s ease;
}
#recordsDialog .check input:focus-visible + .switch{
  outline: 2px solid rgba(125,211,252,.45);
  outline-offset: 2px;
}
#recordsDialog .check input:checked + .switch{
  background: rgba(52,211,153,.55);
  border-color: rgba(52,211,153,.65);
}
#recordsDialog .check input:checked + .switch::after{
  transform: translate(17px,-50%);
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

/* 列表字号/布局更贴近「色号-查看明细」弹窗 */
#recordsDialog .records-table{margin-top:4px;}
#recordsDialog .records-table .records-list{
  display:flex;
  flex-direction:column;
  gap:12px;
}
#recordsDialog .record-card{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  align-items:flex-start;
  padding:12px;
  border-radius: var(--radius-md);
  border:1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent 40%), var(--panel-2);
  position:relative;
}
#recordsDialog .record-head{
  display:grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items:start;
  gap:8px;
}
#recordsDialog .record-card .pattern-tag{
  justify-self:end;
  align-self:start;
  font-size:10px;
  font-weight:600;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid rgba(14,165,233,.25);
  background: rgba(14,165,233,.12);
  color: var(--text);
  white-space:nowrap;
  pointer-events:none;
}
#recordsDialog .records-consume .record-thumb{
  width:80px;
  height:80px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.12);
  background:
    radial-gradient(120% 120% at 20% 15%, rgba(255,255,255,.18) 0%, rgba(255,255,255,0) 55%),
    linear-gradient(145deg, rgba(52,211,153,.22), rgba(125,211,252,.14)),
    var(--panel-2);
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;
  overflow:hidden;
  flex:0 0 auto;
  align-self:center;
  color:var(--ok);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.12),
    0 10px 24px rgba(2,6,23,.18);
}
#recordsDialog .records-consume .record-thumb.has-image{
  background: var(--panel-2);
  box-shadow:none;
}
body.theme-light #recordsDialog .records-consume .record-thumb{
  background:
    radial-gradient(120% 120% at 20% 15%, rgba(255,255,255,.65) 0%, rgba(255,255,255,0) 55%),
    linear-gradient(145deg, rgba(22,163,74,.18), rgba(14,165,233,.16)),
    var(--panel-2);
  border-color: rgba(15,23,42,.08);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.9),
    0 10px 22px rgba(15,23,42,.08);
}
body.theme-light #recordsDialog .records-consume .record-thumb.has-image{
  background: var(--panel-2);
  box-shadow:none;
}
#recordsDialog .records-consume .record-thumb.has-image::after{
  display:none;
}
#recordsDialog .records-consume .record-thumb.has-image .consume-thumb-icon{
  display:none;
}
#recordsDialog .records-consume .record-thumb img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
}
#recordsDialog .records-consume .record-thumb::after{
  content:"";
  position:absolute;
  inset:10px;
  border-radius:12px;
  border:1px dashed rgba(255,255,255,.28);
  opacity:.7;
  pointer-events:none;
}
body.theme-light #recordsDialog .records-consume .record-thumb::after{
  border-color: rgba(15,23,42,.12);
  opacity:.6;
}
#recordsDialog .records-consume .record-thumb .consume-thumb-icon{
  display:none;
}
#recordsDialog .records-restock .record-thumb{
  width:80px;
  height:80px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.12);
  background:
    radial-gradient(120% 120% at 20% 15%, rgba(255,255,255,.18) 0%, rgba(255,255,255,0) 55%),
    linear-gradient(145deg, rgba(251,191,36,.22), rgba(251,146,60,.16)),
    var(--panel-2);
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  align-self:center;
  color:var(--warn);
  position:relative;
  overflow:hidden;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.12),
    0 10px 24px rgba(2,6,23,.18);
}
#recordsDialog .records-restock .record-thumb::after{
  content:"";
  position:absolute;
  inset:10px;
  border-radius:12px;
  border:1px dashed rgba(255,255,255,.28);
  opacity:.7;
  pointer-events:none;
}
#recordsDialog .records-restock .record-thumb .restock-thumb-icon{
  display:none;
}

#recordsDialog .record-thumb .consume-thumb-icon svg,
#recordsDialog .record-thumb .restock-thumb-icon svg{
  width:18px;
  height:18px;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  display:block;
}
body.theme-light #recordsDialog .records-restock .record-thumb{
  background:
    radial-gradient(120% 120% at 20% 15%, rgba(255,255,255,.65) 0%, rgba(255,255,255,0) 55%),
    linear-gradient(145deg, rgba(251,191,36,.18), rgba(249,115,22,.14)),
    var(--panel-2);
  border-color: rgba(15,23,42,.08);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.9),
    0 10px 22px rgba(15,23,42,.08);
}
body.theme-light #recordsDialog .records-restock .record-thumb::after{
  border-color: rgba(15,23,42,.12);
  opacity:.6;
}
#recordsDialog .record-main{
  display:flex;
  flex-direction:column;
  gap:8px;
  flex:1 1 0;
  min-width:0;
}
#recordsDialog .record-title{
  font-size:13px;
  font-weight:600;
  min-width:0;
  white-space:normal;
  overflow-wrap:anywhere;
  word-break:break-word;
  display:-webkit-box;
  -webkit-line-clamp:2;
  line-clamp:2;
  -webkit-box-orient: vertical;
  overflow:hidden;
}
#recordsDialog .record-title.is-empty{
  color:var(--muted);
  font-weight:500;
}
#recordsDialog .record-meta-line{
  display:flex;
  align-items:center;
  flex-wrap:nowrap;
  min-width:0;
  line-height:1.2;
  font-variant-numeric: tabular-nums;
  color:var(--muted);
  font-size:12px;
  white-space:nowrap;
  gap:10px;
}
#recordsDialog .record-meta-item{
  display:flex;
  align-items:center;
  gap:2px;
  white-space:nowrap;
}
#recordsDialog .record-meta-line .meta-icon{
  width:14px;
  height:14px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color:var(--muted);
  flex:0 0 auto;
}
#recordsDialog .record-meta-line .meta-icon svg{
  width:14px;
  height:14px;
  stroke:currentColor;
  fill:none;
  stroke-width:1.6;
}
#recordsDialog .record-meta-line .meta-text{white-space:nowrap;}
#recordsDialog .record-time{
  display:flex;
  align-items:center;
  gap:2px;
  white-space:nowrap;
}
#recordsDialog .record-time .dt-date{white-space:nowrap;}
#recordsDialog .record-time .dt-time{white-space:nowrap;}
#recordsDialog .record-total{
  margin-left:0;
  padding-left:0;
  border-left:0;
  white-space:nowrap;
}
#recordsDialog .record-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
  padding-top:10px;
  margin-top:2px;
  border-top:1px solid var(--border);
  width:100%;
}
#recordsDialog .record-actions .link-action{
  display:inline-flex;
  align-items:center;
  gap:4px;
  padding:0 8px;
  min-width:54px;
  height:26px;
  justify-content:center;
  border-radius:999px;
  border:1px solid var(--accent);
  background:transparent;
  color:var(--accent);
  font-size:12px;
  line-height:1;
  text-decoration:none;
}
#recordsDialog .record-actions .publish-btn:disabled{
  border-color: var(--border);
  color: var(--muted);
  background: rgba(0,0,0,.03);
  cursor: default;
}
body.theme-light #recordsDialog .record-actions .publish-btn:disabled{
  background: rgba(15,23,42,.03);
}
#recordsDialog .record-actions .link-action:hover{
  text-decoration:none;
}
#recordsDialog .record-toggle-btn{
  display:inline-flex;
  align-items:center;
  gap:2px;
}
#recordsDialog .record-toggle-btn .toggle-icon{
  display:inline-flex;
  align-items:center;
}
#recordsDialog .record-toggle-btn svg{
  width:14px;
  height:14px;
  display:block;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#recordsDialog .record-actions .record-toggle-btn svg{
  width:12px;
  height:12px;
}
#recordsDialog .record-card .record-detail{
  flex:1 1 100%;
  padding:10px 0 0;
  border-top:1px solid var(--border);
  border-bottom:none;
}
#todoDialog .records-table{margin-top:4px;}
#todoDialog .category-tabs{
  margin:0 0 12px 0;
}
/* 批量模式下也显示标签栏，让用户可以筛选标签 */
#todoDialog.batch-select .category-tabs{
  display:flex;
}
#todoDialog .todo-batch-actions{
  display:flex;
  gap:10px;
  margin:0 0 12px 0;
}
#todoDialog .todo-batch-actions button{
  flex:1 1 0;
  justify-content:center;
  text-align:center;
}
#todoDialog .todo-batch-actions button:first-child{
  color: var(--text);
  border-color: rgba(34,197,94,.35);
  background: linear-gradient(135deg, rgba(34,197,94,.18), rgba(34,197,94,.05));
}
#todoDialog .todo-batch-actions button:last-child{
  color: var(--text);
  border-color: rgba(14,165,233,.45);
  background: linear-gradient(135deg, rgba(14,165,233,.18), rgba(14,165,233,.05));
}
#todoDialog .records-table .records-list{
  display:flex;
  flex-direction:column;
  gap:12px;
}
#todoDialog .record-card{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  align-items:flex-start;
  padding:12px;
  border-radius: var(--radius-md);
  border:1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent 40%), var(--panel-2);
  position:relative;
}
#todoDialog .todo-select{
  display:none;
  align-self:center;
  flex:0 0 auto;
}
#todoDialog .todo-select input{
  appearance: none;
  width:16px;
  height:16px;
  border-radius:999px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.02);
  display:inline-block;
  position:relative;
}
#todoDialog .todo-select input:checked{
  border-color: rgba(14,165,233,.55);
  background: rgba(14,165,233,.25);
}
#todoDialog .todo-select input:checked::after{
  content:"";
  position:absolute;
  left:4px;
  top:4px;
  width:6px;
  height:6px;
  border-radius:999px;
  background: var(--text);
}
#todoDialog.batch-select .todo-select{ display:inline-flex; }
#todoDialog.batch-select .record-actions{ display:none; }
#todoDialog.batch-select .record-card{ cursor:pointer; }
#todoDialog.batch-select .record-card.is-selected{
  border-color: rgba(14,165,233,.55);
  box-shadow: inset 0 0 0 1px rgba(14,165,233,.2);
}
#todoDialog .record-head{
  display:grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items:start;
  gap:8px;
}
#todoDialog .record-card .pattern-tag{
  justify-self:end;
  align-self:start;
  font-size:10px;
  font-weight:600;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid rgba(14,165,233,.25);
  background: rgba(14,165,233,.12);
  color: var(--text);
  white-space:nowrap;
  pointer-events:none;
}
#todoDialog .records-consume .record-thumb{
  width:80px;
  height:80px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.12);
  background:
    radial-gradient(120% 120% at 20% 15%, rgba(255,255,255,.18) 0%, rgba(255,255,255,0) 55%),
    linear-gradient(145deg, rgba(52,211,153,.22), rgba(125,211,252,.14)),
    var(--panel-2);
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;
  overflow:hidden;
  flex:0 0 auto;
  align-self:center;
  color:var(--ok);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.12),
    0 10px 24px rgba(2,6,23,.18);
}
#todoDialog .records-consume .record-thumb.has-image{
  background: var(--panel-2);
  box-shadow:none;
}
body.theme-light #todoDialog .records-consume .record-thumb{
  background:
    radial-gradient(120% 120% at 20% 15%, rgba(255,255,255,.65) 0%, rgba(255,255,255,0) 55%),
    linear-gradient(145deg, rgba(22,163,74,.18), rgba(14,165,233,.16)),
    var(--panel-2);
  border-color: rgba(15,23,42,.08);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.9),
    0 10px 22px rgba(15,23,42,.08);
}
body.theme-light #todoDialog .records-consume .record-thumb.has-image{
  background: var(--panel-2);
  box-shadow:none;
}
#todoDialog .records-consume .record-thumb.has-image::after{
  display:none;
}
#todoDialog .records-consume .record-thumb.has-image .consume-thumb-icon{
  display:none;
}
#todoDialog .records-consume .record-thumb img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
}
#todoDialog .records-consume .record-thumb::after{
  content:"";
  position:absolute;
  inset:10px;
  border-radius:12px;
  border:1px dashed rgba(255,255,255,.28);
  opacity:.7;
  pointer-events:none;
}
body.theme-light #todoDialog .records-consume .record-thumb::after{
  border-color: rgba(15,23,42,.12);
  opacity:.6;
}
#todoDialog .records-consume .record-thumb .consume-thumb-icon{
  display:none;
}
#todoDialog .record-thumb .consume-thumb-icon svg{
  width:18px;
  height:18px;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  display:block;
}
#todoDialog .record-main{
  display:flex;
  flex-direction:column;
  gap:8px;
  flex:1 1 0;
  min-width:0;
}
#todoDialog .record-title{
  font-size:13px;
  font-weight:600;
  min-width:0;
  white-space:normal;
  overflow-wrap:anywhere;
  word-break:break-word;
  display:-webkit-box;
  -webkit-line-clamp:2;
  line-clamp:2;
  -webkit-box-orient: vertical;
  overflow:hidden;
}
#todoDialog .record-title.is-empty{
  color:var(--muted);
  font-weight:500;
}
#todoDialog .record-meta-line{
  display:flex;
  align-items:center;
  flex-wrap:nowrap;
  min-width:0;
  line-height:1.2;
  font-variant-numeric: tabular-nums;
  color:var(--muted);
  font-size:12px;
  white-space:nowrap;
  gap:10px;
}
#todoDialog .record-meta-item{
  display:flex;
  align-items:center;
  gap:6px;
  white-space:nowrap;
}
#todoDialog .record-meta-line .meta-icon{
  width:14px;
  height:14px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color:var(--muted);
  flex:0 0 auto;
}
#todoDialog .record-meta-line .meta-icon svg{
  width:14px;
  height:14px;
  stroke:currentColor;
  fill:none;
  stroke-width:1.6;
}
#todoDialog .record-meta-line .meta-text{white-space:nowrap;}
#todoDialog .record-time{
  display:flex;
  align-items:center;
  gap:6px;
  white-space:nowrap;
}
#todoDialog .record-time .dt-date{white-space:nowrap;}
#todoDialog .record-time .dt-time{white-space:nowrap;}
#todoDialog .record-total{
  margin-left:0;
  padding-left:0;
  border-left:0;
  white-space:nowrap;
}
#todoDialog .record-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
  padding-top:10px;
  margin-top:2px;
  border-top:1px solid var(--border);
  width:100%;
}
#todoDialog .record-actions .link-action{
  display:inline-flex;
  align-items:center;
  gap:4px;
  padding:0 8px;
  min-width:54px;
  height:26px;
  justify-content:center;
  border-radius:999px;
  border:1px solid var(--accent);
  background:transparent;
  color:var(--accent);
  font-size:12px;
  line-height:1;
  text-decoration:none;
}
#todoDialog .record-actions .link-action:hover{
  text-decoration:none;
}
#todoDialog .record-actions .btn-todo-done{
  border-color: var(--accent-2);
  color: var(--accent-2);
  background: transparent;
  box-shadow: none;
}
#todoDialog .record-actions .btn-todo-done:hover{
  background: rgba(249,115,22,.08);
}
#todoDialog .record-actions .btn-todo-publish{
  border-color: var(--accent-2);
  color: var(--accent-2);
  background: transparent;
  box-shadow: none;
}
#todoDialog .record-actions .btn-todo-publish:hover{
  background: rgba(249,115,22,.08);
}
#todoDialog .record-toggle-btn{
  display:inline-flex;
  align-items:center;
  gap:2px;
}
#todoDialog .record-toggle-btn .toggle-icon{
  display:inline-flex;
  align-items:center;
}
#todoDialog .record-toggle-btn svg{
  width:14px;
  height:14px;
  display:block;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#todoDialog .record-actions .record-toggle-btn svg{
  width:12px;
  height:12px;
}
#todoDialog .record-card .record-detail{
  flex:1 1 100%;
  padding:10px 0 0;
  border-top:1px solid var(--border);
  border-bottom:none;
}
#todoDialog .record-detail{padding:10px 0 14px;border-bottom:1px solid var(--border);}
#todoDialog .record-pill-wrap{background:transparent;border:none;border-radius:0;padding:0;}
#todoDialog .record-pill-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px 10px;}
#todoDialog .record-pill{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:12px;background:var(--panel-2);border:1px solid var(--border);}
#todoDialog .record-dot{width:12px;height:12px;border-radius:999px;border:1px solid rgba(255,255,255,.15);box-shadow:inset 0 0 0 1px rgba(0,0,0,.15);flex:0 0 auto;}
#todoDialog .record-pill-text{font-weight:400;font-variant-numeric:tabular-nums;color:var(--text);}
#recordsDialog .records-row .time{
  display:flex;
  flex-direction:column;
  gap:2px;
  line-height:1.1;
  font-variant-numeric: tabular-nums;
}
#recordsDialog .records-row .time .dt-date{white-space:nowrap;}
#recordsDialog .records-row .time .dt-time{white-space:nowrap; color:var(--muted);}

#detailDialog td.time{
  display:flex;
  flex-direction:column;
  gap:2px;
  line-height:1.1;
  font-variant-numeric: tabular-nums;
}
#detailDialog td.time .dt-date{white-space:nowrap;}
#detailDialog td.time .dt-time{white-space:nowrap; color:var(--muted);}

#recordsDialog .records-row.records-head > div{
  text-align:left !important;
}
#recordsDialog .records-row.records-head .num{
  text-align:left !important;
}
#recordsDialog .records-row.records-head .op{
  text-align:left !important;
  justify-content:flex-start !important;
}
#recordsDialog .records-row.records-head > div:nth-child(2){
  white-space:nowrap;
}

#recordsDialog .records-row{
  display:grid;
  align-items:center;
  gap:10px;
  padding:10px 0;
  border-bottom:1px solid var(--border);
  font-size:12px;
}
#recordsDialog .records-row.records-head{
  padding-top:2px;
  padding-bottom:8px;
  color:var(--muted);
  font-size:11px;
  font-weight:600;
  border-bottom:1px solid var(--border);
}
#recordsDialog .records-row.records-head > div{white-space:nowrap;}
#recordsDialog .records-row .num{text-align:left;font-variant-numeric:tabular-nums;}
#recordsDialog .records-row .op{text-align:left;white-space:nowrap;}
#recordsDialog .records-row .op .link-action{margin-left:10px;}

/* 桌面/平板默认列宽 */
#recordsDialog .records-consume .records-row{grid-template-columns:170px 1fr 90px 130px;}
#recordsDialog .records-restock .records-row{grid-template-columns:170px 90px 1fr;}

/* 入库记录：操作列靠右 */
#recordsDialog .records-restock .records-row .op,
#recordsDialog .records-restock .records-row.records-head .op{
  justify-self:end;
  text-align:right;
}

/* 出库记录：操作列靠右 */
#recordsDialog .records-consume .records-row .op,
#recordsDialog .records-consume .records-row.records-head .op{
  justify-self:end;
  text-align:right;
}

/* 移动端：压缩时间/总数列，给图纸名称更多空间，确保两个操作按钮都在屏内 */
@media (max-width: 560px){
  #recordsDialog .records-row{gap:8px; padding:9px 0;}
  #recordsDialog .record-card{padding:10px; gap:10px;}
  #recordsDialog .record-thumb{width:72px; height:72px; border-radius:14px;}
  #recordsDialog .record-title{font-size:12px;}
  #recordsDialog .record-meta-line{font-size:11px;}
  #recordsDialog .record-total{margin-left:0; padding-left:0; border-left:0;}
  #recordsDialog .record-actions{gap:8px; padding-top:8px;}
  #recordsDialog .record-actions .link-action{padding:0 7px; min-width:50px; height:24px; font-size:11px;}
  #recordsDialog .record-actions .record-toggle-btn svg{width:11px; height:11px;}
  #recordsDialog .records-restock .record-thumb .restock-thumb-icon,
  #recordsDialog .records-consume .record-thumb .consume-thumb-icon{
    width:28px;
    height:28px;
  }
  #recordsDialog .record-thumb .consume-thumb-icon svg,
  #recordsDialog .record-thumb .restock-thumb-icon svg{
    width:16px;
    height:16px;
  }
  #recordsDialog .records-consume .records-row{grid-template-columns:85px minmax(0,1fr) 48px 70px;}
  #recordsDialog .records-restock .records-row{grid-template-columns:120px 70px 1fr;}

  /* 时间两行：日期+时间（含秒）；图纸名称可换行 */
  #recordsDialog .records-row .time{
    display:flex;
    flex-direction:column;
    gap:2px;
    line-height:1.1;
    font-variant-numeric: tabular-nums;
  }
  #recordsDialog .records-row .time .dt-date{white-space:nowrap;}
  #recordsDialog .records-row .time .dt-time{white-space:nowrap; color:var(--muted);}
  #recordsDialog .records-consume .records-row > div:nth-child(2){
    overflow-wrap:anywhere;
    word-break:break-word;
  }

  /* 操作列改为 flex，确保“删除/展开(收起)”紧凑排布 */
  #recordsDialog .records-row .op{
    display:flex;
    justify-content:flex-start;
    flex-wrap:wrap;
    align-items:center;
    gap:6px 10px;
    text-align:left;
    white-space:normal;
    min-width:0;
  }
  #recordsDialog .records-row .op .link-action{margin-left:0;}

  /* 入库记录：操作列在右侧 */
  #recordsDialog .records-restock .records-row .op,
  #recordsDialog .records-restock .records-row.records-head .op{
    justify-content:flex-end;
    justify-self:end;
    text-align:right;
  }

  /* 出库记录：操作列在右侧 */
  #recordsDialog .records-consume .records-row .op,
  #recordsDialog .records-consume .records-row.records-head .op{
    justify-content:flex-end;
    justify-self:end;
    text-align:right;
  }

  #todoDialog .record-card{padding:10px; gap:10px;}
  #todoDialog .record-thumb{width:72px; height:72px; border-radius:14px;}
  #todoDialog .record-title{font-size:12px;}
  #todoDialog .record-meta-line{font-size:11px;}
  #todoDialog .record-total{margin-left:0; padding-left:0; border-left:0;}
  #todoDialog .record-actions{gap:8px; padding-top:8px;}
  #todoDialog .record-actions .link-action{padding:0 7px; min-width:50px; height:24px; font-size:11px;}
  #todoDialog .record-actions .record-toggle-btn svg{width:11px; height:11px;}
  #todoDialog .records-consume .record-thumb .consume-thumb-icon{
    width:28px;
    height:28px;
  }
  #todoDialog .record-thumb .consume-thumb-icon svg{
    width:16px;
    height:16px;
  }

  #todoDialog .record-detail{padding:8px 0 12px;}
  #todoDialog .record-pill-wrap{padding:0; border-radius:0;}
  #todoDialog .record-pill-grid{grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px 8px;}
  #todoDialog .record-pill{gap:8px; padding:7px 8px; border-radius:11px;}
  #todoDialog .record-dot{width:14px; height:14px;}
  #todoDialog .record-pill-text{font-size:12px;}
}

#recordsDialog .link-action{border:none;background:transparent;padding:0;cursor:pointer;color:var(--accent);font-size:12px;}
#recordsDialog .link-action:hover{text-decoration:underline;}

/* 展开明细：移动端更紧凑，一行 3 个 */
#recordsDialog .record-detail{padding:10px 0 14px;border-bottom:1px solid var(--border);}
#recordsDialog .record-pill-wrap{background:transparent;border:none;border-radius:0;padding:0;}
#recordsDialog .record-pill-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px 10px;}
#recordsDialog .record-pill{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:12px;background:var(--panel-2);border:1px solid var(--border);}
#recordsDialog .record-dot{width:12px;height:12px;border-radius:999px;border:1px solid rgba(255,255,255,.15);box-shadow:inset 0 0 0 1px rgba(0,0,0,.15);flex:0 0 auto;}
#recordsDialog .record-pill-text{font-weight:400;font-variant-numeric:tabular-nums;color:var(--text);}

/*出库统计列表 */
#recordsDialog .records-toolbar.stats-toolbar{
  justify-content:flex-start;
  flex-wrap:wrap;
}
#recordsDialog .records-toolbar.stats-toolbar.stats-cards{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:12px;
  align-items:stretch;
}
#recordsDialog .stats-card{
  border-radius:14px;
  padding:10px 12px;
  background:
    radial-gradient(120% 120% at 10% 0%, rgba(34,211,238,.18), rgba(34,211,238,0) 55%),
    radial-gradient(120% 120% at 90% 0%, rgba(249,115,22,.16), rgba(249,115,22,0) 55%),
    var(--panel-2);
  border:1px solid rgba(255,255,255,.08);
  box-shadow: 0 10px 24px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.06);
  display:flex;
  flex-direction:column;
  gap:6px;
}
body.theme-light #recordsDialog .stats-card{
  border-color: rgba(15,23,42,.08);
  box-shadow: 0 12px 22px rgba(15,23,42,.08), inset 0 1px 0 rgba(255,255,255,.7);
}
#recordsDialog .stats-card-label{
  font-size:11px;
  color:var(--muted);
  letter-spacing:.2px;
}
#recordsDialog .stats-card-value{
  font-size:16px;
  font-weight:600;
  font-variant-numeric:tabular-nums;
  color:var(--text);
}
#recordsDialog .stats-filter{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin:6px 0 8px;
}
#recordsDialog .stats-filter .category-chip{
  padding:6px 12px;
  font-size:11px;
}
#recordsDialog .stats-filter .category-chip.active,
#recordsDialog .stats-filter .category-chip[aria-pressed="true"]{
  color:var(--text);
  border-color: rgba(34,197,94,.35);
  background: linear-gradient(135deg, rgba(34,197,94,.18), rgba(34,197,94,.05));
}
#recordsDialog .stats-table{margin-top:4px;}
#recordsDialog .stats-row{
  display:grid;
  align-items:center;
  gap:10px;
  padding:10px 0;
  border-bottom:1px solid var(--border);
  font-size:12px;
  grid-template-columns:60px 1fr 80px 90px;
}
#recordsDialog .stats-row.stats-head{
  padding-top:2px;
  padding-bottom:8px;
  color:var(--muted);
  font-size:11px;
  font-weight:600;
  border-bottom:1px solid var(--border);
}
#recordsDialog .stats-row.stats-head > div{white-space:nowrap;}
#recordsDialog .stats-row .num{font-variant-numeric:tabular-nums;}
#recordsDialog .stats-code{
  display:flex;
  align-items:center;
  gap:8px;
}
#recordsDialog .stats-dot{
  width:12px;
  height:12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.15);
  box-shadow:inset 0 0 0 1px rgba(0,0,0,.15);
  flex:0 0 auto;
}

@media (max-width: 560px){
  #recordsDialog .record-detail{padding:8px 0 12px;}
  #recordsDialog .record-pill-wrap{padding:0; border-radius:0;}
  #recordsDialog .record-pill-grid{grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px 8px;}
  #recordsDialog .record-pill{gap:8px; padding:7px 8px; border-radius:11px;}
  #recordsDialog .record-dot{width:14px; height:14px;}
  #recordsDialog .record-pill-text{font-size:12px;}
  #recordsDialog .stats-row{grid-template-columns:46px minmax(0,1fr) 60px 60px;}
}

/* 图纸消耗计算 */
#patternCalcDialog .calc-toolbar,
#todoBatchCalcDialog .calc-toolbar{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  margin-top:8px;
  margin-bottom:6px;
}
#todoBatchCalcDialog .calc-toolbar{
  margin-top:0;
  margin-bottom:0;
}
#patternCalcDialog .calc-table,
#todoBatchCalcDialog .calc-table{margin-top:4px;}
#patternCalcDialog .calc-row,
#todoBatchCalcDialog .calc-row{
  display:grid;
  align-items:center;
  gap:10px;
  padding:10px 0;
  border-bottom:1px solid var(--border);
  font-size:12px;
  grid-template-columns:90px 90px 90px 110px;
}
#patternCalcDialog .calc-row.calc-head,
#todoBatchCalcDialog .calc-row.calc-head{
  padding-top:2px;
  padding-bottom:8px;
  color:var(--muted);
  font-size:11px;
  font-weight:600;
  border-bottom:1px solid var(--border);
}
#patternCalcDialog .calc-row.calc-head > div,
#todoBatchCalcDialog .calc-row.calc-head > div{white-space:nowrap;}
#patternCalcDialog .calc-row .num,
#todoBatchCalcDialog .calc-row .num{font-variant-numeric:tabular-nums;}
#patternCalcDialog .calc-code,
#todoBatchCalcDialog .calc-code{
  display:flex;
  align-items:center;
  gap:8px;
}
#patternCalcDialog .calc-dot,
#todoBatchCalcDialog .calc-dot{
  width:12px;
  height:12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.15);
  box-shadow:inset 0 0 0 1px rgba(0,0,0,.15);
  flex:0 0 auto;
}
#patternCalcDialog .calc-remain.debt,
#todoBatchCalcDialog .calc-remain.debt{color: var(--danger); font-weight:600;}

/* 预出库计算排序按钮 */
.calc-sort-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-start;
  transition: color 0.2s;
  white-space: nowrap;
}

.calc-sort-btn:hover {
  color: var(--text);
}

.calc-sort-btn.active {
  color: var(--primary);
}

.calc-sort-btn .sort-icon {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
  opacity: 0.3;
}

.calc-sort-btn.active .sort-icon {
  opacity: 1;
}

.calc-sort-btn .sort-arrow {
  width: 10px;
  height: 8px;
}

/* 非激活状态下所有箭头更暗 */
.calc-sort-btn:not(.active) .sort-arrow {
  opacity: 0.3;
}

/* 激活状态下高亮对应方向的箭头 */
.calc-sort-btn.active.sort-desc .sort-arrow.sort-desc,
.calc-sort-btn.active.sort-asc .sort-arrow.sort-asc {
  opacity: 1;
}

/* 激活状态下非当前方向的箭头保持半透明 */
.calc-sort-btn.active.sort-desc .sort-arrow.sort-asc,
.calc-sort-btn.active.sort-asc .sort-arrow.sort-desc {
  opacity: 0.3;
}

@media (max-width: 560px){
  #patternCalcDialog .calc-row,
  #todoBatchCalcDialog .calc-row{grid-template-columns:70px 70px 70px 90px; gap:8px;}
}



/* 移动端：余量排序与布局切换同一行，并缩小切换按钮（更精致） */
@media (max-width: 720px){
  /* 移动端：同一行展示，右侧 tab 固定贴右；左侧排序按钮不够放时可横向滚动 */
  .sort-row{
    display:flex;
    align-items:center;
    gap: 8px;
    flex-wrap: nowrap;
    width:100%;
  }

  .sort-group{
    display:flex;
    align-items:center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .sort-group::-webkit-scrollbar{ display:none; }

  .view-toggle{
    flex: 0 0 auto;
    margin-left: 8px;   /* ✅ 确保与排序按钮有间距 */
  }
}


.sort-row::-webkit-scrollbar{ display:none; }

    :root{
      --bg:#0b1113;
      --panel:#111a1d;
      --panel-2:#141f24;
      --border:rgba(255,255,255,.08);
      --muted:rgba(255,255,255,.62);
      --text:#f6f8fb;
      --accent:#22d3ee;
      --accent-2:#f97316;
      --warn:#f59e0b;
      --ok:#22c55e;
      --tabbar-height:64px;
    }

    body.theme-light{
      --bg:#f5f3ef;
      --panel:#ffffff;
      --panel-2:#f8fafc;
      --border:rgba(15,23,42,.08);
      --muted:#6b7280;
      --text:#0f172a;
      --accent:#0ea5a4;
      --accent-2:#f97316;
      --warn:#d97706;
      --ok:#16a34a;
    }

    body{
      font-family:"Avenir Next Rounded","SF Pro Rounded","PingFang SC","Microsoft YaHei","Helvetica Neue",sans-serif;
      background: var(--bg);
      position: relative;
    }
    body::before{
      content:"";
      position: fixed;
      inset: 0;
      background:
        radial-gradient(1200px 600px at 8% -12%, rgba(34,211,238,.14), transparent 60%),
        radial-gradient(1200px 600px at 92% -8%, rgba(249,115,22,.14), transparent 60%),
        var(--bg);
      z-index:-1;
      pointer-events:none;
    }

    .app-main{
      max-width:1200px;
      margin:0 auto;
      padding:12px 20px calc(var(--tabbar-height) + 28px + env(safe-area-inset-bottom));
      display:block;
      /* 内部滚动容器：滚动发生在这里，避免整页滚动导致地址栏变化 */
      height:100%;
      overflow-y:auto;
      -webkit-overflow-scrolling:touch;
    }
    @media (max-width: 720px){
      .app-main{
        padding:14px 14px calc(var(--tabbar-height) + 20px + env(safe-area-inset-bottom));
      }
    }
    
    /* 作品集页面：去掉顶部padding，让搜索栏贴顶 */
    body[data-page="works"] .app-main{
      padding-top: 0;
    }
    /* 设置子页面：去掉顶部padding，让标题栏贴顶 */
    body[data-page="account-settings"] .app-main,
    body[data-page="categories-manage"] .app-main,
    body[data-page="login"] .app-main,
    body[data-page="register"] .app-main{
      padding-top: 0;
    }

    .page{
      display:none;
      flex-direction:column;
      gap:12px;
      min-height: 0;
    }
    .page.active{
      display:flex;
      animation: pageIn .35s ease both;
    }

    .page.active .panel{
      animation: panelIn .4s ease both;
    }
    .page.active .panel:nth-of-type(1){ animation-delay: .02s; }
    .page.active .panel:nth-of-type(2){ animation-delay: .06s; }
    .page.active .panel:nth-of-type(3){ animation-delay: .1s; }
    .page.active .panel:nth-of-type(4){ animation-delay: .14s; }

    @keyframes pageIn{
      from{ opacity:0; transform: translateY(8px); }
      to{ opacity:1; transform: translateY(0); }
    }
    @keyframes panelIn{
      from{ opacity:0; transform: translateY(10px); }
      to{ opacity:1; transform: translateY(0); }
    }
    @media (prefers-reduced-motion: reduce){
      .page.active,
      .page.active .panel{
        animation: none;
      }
    }

    .page-header{
      display:flex;
      align-items:flex-end;
      justify-content:space-between;
      gap:12px;
      padding:4px 2px;
    }
    .page-header.with-back{
      align-items:center;
      justify-content:center;
      position:relative;
      padding:6px 2px;
    }
    .page-title{
      font-size:22px;
      font-weight:700;
      letter-spacing:.5px;
    }
    .page-header.with-back .page-title{
      text-align:center;
      padding:0 64px;
    }
    .page-subtitle{
      font-size:12px;
      color:var(--muted);
    }

    .back-btn{
      border-radius:999px;
      padding:8px 12px;
      background: var(--panel-2);
      border:1px solid var(--border);
      font-size:12px;
    }
    .page-header.with-back .back-btn{
      position:absolute;
      left:0;
      top:50%;
      transform: translateY(-50%);
    }
    .page-header.with-back .header-action-btn{
      position:absolute;
      right:0;
      top:50%;
      transform: translateY(-50%);
      max-width: 140px;
      width: auto;
      white-space: nowrap;
    }
    .page-header.with-back .header-action-group{
      position:absolute;
      right:0;
      top:50%;
      transform: translateY(-50%);
      display:flex;
      gap:8px;
      align-items:center;
    }
    .page-header.with-back .header-action-group .header-action-btn{
      position:static;
      transform:none;
    }
    .page-header.with-back .header-action-btn.back-btn{
      left:auto;
      right:0;
    }
    .back-btn,
    .page-header.with-back .header-action-btn{
      display:inline-flex;
      align-items:center;
      gap:6px;
    }
    .back-btn svg,
    .page-header.with-back .header-action-btn svg{
      width:14px;
      height:14px;
      stroke: currentColor;
      stroke-width: 2.25;
      stroke-linecap: round;
      stroke-linejoin: round;
      fill: none;
      display:block;
    }

    .action-grid{
      display:flex;
      flex-direction:column;
      align-items:center;
      gap:25px;
    }
    .action-card{
      border-radius: 20px;
      padding:22px 60px;
      text-align:center;
      display:flex;
      flex-direction:column;
      align-items:center;
      gap:10px;
      background: linear-gradient(160deg, rgba(255,255,255,.08), rgba(0,0,0,.06)), var(--panel-2);
      border:1px solid rgba(255,255,255,.12);
      box-shadow: 0 12px 24px rgba(0,0,0,.18);
      width:100%;
      max-width:520px;
    }
    .action-card.primary{
      border-color: rgba(34,211,238,.5);
      box-shadow: 0 14px 26px rgba(34,211,238,.12), inset 0 0 0 1px rgba(34,211,238,.22);
    }
    .action-card.secondary{
      border-color: rgba(249,115,22,.5);
      box-shadow: 0 14px 26px rgba(249,115,22,.12), inset 0 0 0 1px rgba(249,115,22,.22);
    }
    .action-card.tertiary{
      border-color: rgba(52,211,153,.5);
      box-shadow: 0 14px 26px rgba(52,211,153,.12), inset 0 0 0 1px rgba(52,211,153,.22);
    }
    body.theme-light .action-card{
      border-color: rgba(15,23,42,.12);
      box-shadow: 0 14px 26px rgba(15,23,42,.12);
    }
    body.theme-light .action-card.primary{
      border-color: rgba(14,165,164,.45);
      box-shadow: 0 14px 26px rgba(14,165,164,.12), inset 0 0 0 1px rgba(14,165,164,.22);
    }
    body.theme-light .action-card.secondary{
      border-color: rgba(249,115,22,.45);
      box-shadow: 0 14px 26px rgba(249,115,22,.12), inset 0 0 0 1px rgba(249,115,22,.2);
    }
    body.theme-light .action-card.tertiary{
      border-color: rgba(22,163,74,.45);
      box-shadow: 0 14px 26px rgba(22,163,74,.12), inset 0 0 0 1px rgba(22,163,74,.2);
    }
    .action-title{ font-size:18px; font-weight:700; letter-spacing:.3px; }
    .action-desc{ font-size:12px; color:var(--muted); }

    .page[data-page="records"]{
      justify-content:center;
      min-height: calc(100dvh - var(--tabbar-height) - 40px);
    }
    .records-actions{
      background: transparent;
      border: 0;
      box-shadow: none;
      padding: 0;
      width: 100%;
      border-radius: 0;
      display:flex;
      align-items:center;
      justify-content:center;
      flex:1 1 auto;
    }

.tabbar{
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      display: grid;
      grid-template-columns: repeat(5, minmax(0, 1fr));
      padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
      background: rgba(10,14,18,.82);
      border-top: 1px solid var(--border);
      backdrop-filter: blur(16px);
      z-index: 100;
}
    body.theme-light .tabbar{ background: rgba(255,255,255,.86); }

.tabbar-btn{
      border: 0;
      background: transparent;
      color: var(--muted);
      display:flex;
      flex-direction:column;
      align-items:center;
      gap:4px;
      font-size:11px;
      padding:6px 0;
      position:relative;
      min-height: 40px;
}
    .tabbar-btn:hover,
    .tabbar-btn:active{
      transform:none;
      border-color: transparent;
    }
.tabbar-btn svg{
      width:22px;
      height:22px;
      stroke: currentColor;
      fill: none;
      stroke-width: 1.8;
}
.tab-label{
      line-height:1.1;
}
.tabbar-btn.active{
      color: var(--text);
}
.tabbar-btn.active .tab-label{ font-weight:700; }
.tabbar-btn.active::before{
      content:"";
      position:absolute;
      inset:0;
      border-radius:14px;
      background: rgba(34,211,238,.14);
      z-index:-1;
}

    .btn-primary{
      background: linear-gradient(135deg, rgba(34,211,238,.24), rgba(34,211,238,.06));
      border-color: rgba(34,211,238,.55);
    }
    .btn-secondary{
      background: linear-gradient(135deg, rgba(249,115,22,.2), rgba(249,115,22,.06));
      border-color: rgba(249,115,22,.5);
    }

    .settings-nav button.active{
      background: linear-gradient(135deg, rgba(34,211,238,.45), rgba(249,115,22,.35));
      color: var(--text);
    }

    .toast-stack{
      bottom: calc(var(--tabbar-height) + 16px);
    }

    body.modal-open .tabbar{
      pointer-events: none;
    }

    body:not([data-page=\"inventory\"]) .float-nav{
      display:none !important;
    }
    .float-nav{
      bottom: calc(var(--tabbar-height) + 16px + env(safe-area-inset-bottom));
    }

    #consumeDialog,
    #restockDialog,
    #recordsDialog,
    #settingsDialog{
      max-height: none;
      overflow: visible;
    }
    .settings-actions{
      display:flex;
      justify-content:flex-end;
    }
    .settings-actions .btn-primary{
      min-width: 90px;
      padding: 10px 16px;
      height: 36px;
      border-radius: 10px;
    }
    .inline-field{
      display:flex;
      align-items:stretch;
      gap:12px;
    }
    .inline-field input{
      height: 36px;
    }
    .inline-field .settings-actions{
      padding-top:0;
    }
    .account-actions{
      display:flex;
      flex-direction:column;
      gap:10px;
    }
    .account-row{
      display:flex;
      align-items:center;
      gap:10px;
      flex-wrap:wrap;
    }
    .export-row{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:12px;
      flex-wrap:wrap;
    }
    .export-row .help{
      margin:0;
      text-align:right;
    }
    .me-footer-note{
      margin-top:8px;
      text-align:center;
    }
    .me-actions{
      display:flex;
      gap:10px;
      flex-wrap:wrap;
      align-items:center;
    }

/* ====== 我的页面 小红书风格 ====== */

/* 页面背景 */
#pageMe {
  background: transparent;
  min-height: 100vh;
  gap: 0;
}

/* 顶部用户信息区 - 浅色毛玻璃卡片 */
.me-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 28px 24px;
  margin-bottom: 10px;
  border-radius: 20px;
  cursor: pointer;
  position: relative;
  background:
    radial-gradient(120% 120% at 10% 0%, rgba(34,211,238,.18), rgba(34,211,238,0) 55%),
    radial-gradient(120% 120% at 90% 0%, rgba(249,115,22,.16), rgba(249,115,22,0) 55%),
    var(--panel-2);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 10px 24px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.06);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.me-header:active {
  transform: scale(0.98);
  box-shadow: 0 6px 16px rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.06);
}
body.theme-light .me-header {
  border-color: rgba(15,23,42,.08);
  box-shadow: 0 12px 22px rgba(15,23,42,.08), inset 0 1px 0 rgba(255,255,255,.7);
}
body.theme-light .me-header:active {
  box-shadow: 0 6px 14px rgba(15,23,42,.06), inset 0 1px 0 rgba(255,255,255,.7);
}

.me-avatar-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}
.me-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--panel);
  border: 2.5px solid rgba(34,211,238,0.3);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
body.theme-light .me-avatar {
  border-color: rgba(34,211,238,0.4);
  box-shadow: 0 4px 12px rgba(15,23,42,0.08);
}
.me-avatar[src=""], .me-avatar:not([src]) {
  display: none;
}
.me-avatar-default {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(34,211,238,0.15), rgba(249,115,22,0.1));
  border-radius: 50%;
  border: 2.5px solid rgba(34,211,238,0.3);
  color: var(--muted);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
body.theme-light .me-avatar-default {
  border-color: rgba(34,211,238,0.4);
  color: #64748b;
}
.me-avatar-default svg {
  width: 32px;
  height: 32px;
}
.me-avatar:not([src=""]):not(:not([src])) ~ .me-avatar-default {
  display: none;
}

.me-info {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 1;
}
.me-name {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.me-desc {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.me-arrow {
  color: var(--muted);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

/* 设置分组标题 */
.settings-group-title {
  font-size: 12px;
  color: #999;
  padding: 10px 0 10px;
  font-weight: 500;
}

/* 设置分组卡片 */
.settings-group {
  background: #fff;
  margin: 0 0 12px;
  border-radius: 12px;
  overflow: hidden;
}
.theme-dark .settings-group {
  background: var(--panel-2);
}

/* 设置项 */
.settings-item {
  display: flex;
  align-items: center;
  padding: 16px;
  gap: 14px;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}
.settings-item:active {
  background: #f8f8f8;
}
.theme-dark .settings-item:active {
  background: var(--hover-bg);
}
.settings-item:not(:last-child)::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 58px;
  right: 16px;
  height: 1px;
  background: #f0f0f0;
}
.theme-dark .settings-item:not(:last-child)::after {
  background: var(--border);
}

/* 设置项图标 */
.settings-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.settings-icon svg {
  width: 18px;
  height: 18px;
}

/* 设置项标签 */
.settings-label {
  flex: 1;
  font-size: 15px;
  color: #333;
  font-weight: 400;
}
.theme-dark .settings-label {
  color: var(--text);
}
.settings-label-danger {
  color: #ff2442;
}

/* 设置项值 */
.settings-value {
  font-size: 14px;
  color: #999;
  margin-right: 2px;
}

/* 设置项箭头 */
.settings-arrow {
  color: #ccc;
  flex-shrink: 0;
}
.theme-dark .settings-arrow {
  color: var(--text-tertiary);
}

/* 设置项开关 */
.settings-switch {
  flex-shrink: 0;
}

/* 小红书风格开关 */
.ios-switch {
  width: 48px;
  height: 28px;
  border-radius: 14px;
  background: #e0e0e0;
  position: relative;
  cursor: pointer;
  transition: background 0.25s ease;
}
.ios-switch.on {
  background: #ff2442;
}
.ios-switch::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: transform 0.25s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.ios-switch.on::after {
  transform: translateX(20px);
}
.theme-dark .ios-switch {
  background: #39393d;
}

/* 页脚 */
.me-footer {
  text-align: center;
  padding: 10px 16px 0px;
}
.me-footer-text {
  font-size: 12px;
  color: #999;
}

/* ====== 登录/注册页面 ====== */
.auth-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.auth-hero {
  padding: 32px 0 40px;
}
.auth-title {
  font-size: 36px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 12px;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.theme-dark .auth-title {
  background: linear-gradient(135deg, #fff 0%, #e0e0e0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.auth-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.auth-form {
  width: 100%;
  background: var(--panel);
  border-radius: 16px;
  padding: 24px 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.theme-dark .auth-form {
  background: var(--panel-2);
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}

.auth-field {
  margin-bottom: 16px;
}
.auth-field input {
  width: 100%;
  height: 52px;
  padding: 0 18px;
  border: 1.5px solid #e8e8e8;
  border-radius: 14px;
  font-size: 16px;
  background: #fafafa;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
.theme-dark .auth-field input {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
}
.auth-field input:focus {
  outline: none;
  border-color: #ff2442;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255,36,66,0.1);
}
.theme-dark .auth-field input:focus {
  background: var(--panel);
  box-shadow: 0 0 0 3px rgba(255,36,66,0.15);
}
.auth-field input::placeholder {
  color: #aaa;
}

.auth-submit {
  width: 100%;
  height: 52px;
  border: none;
  border-radius: 26px;
  background: linear-gradient(135deg, #ff2442 0%, #ff6b81 100%);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  margin-top: 12px;
  box-shadow: 0 4px 16px rgba(255,36,66,0.3);
}
.auth-submit:active {
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(255,36,66,0.25);
}
.auth-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.auth-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
  font-size: 14px;
  color: #888;
}
.theme-dark .auth-switch {
  color: var(--text-secondary);
}
.auth-switch button {
  border: none;
  background: none;
  color: #ff2442;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ====== 设置子页面（图纸标签等） ====== */
.settings-page {
  background: transparent;
  display: flex;
  flex-direction: column;
}

.settings-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 10px;
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 10;
  /* 突破 app-main 的左右 padding 限制，紧贴屏幕 */
  margin: 0 -14px 16px;
  width: calc(100% + 28px);
}
@media (min-width: 721px) {
  .settings-page-header {
    margin: 0 -20px 16px;
    width: calc(100% + 40px);
  }
}

.settings-page-back {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  cursor: pointer;
  color: var(--text);
  transition: opacity 0.15s;
  padding: 0;
}
.settings-page-back:active {
  opacity: 0.5;
}

.settings-page-header h2 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.settings-page-placeholder {
  width: 44px;
}

.settings-page-header-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  transition: opacity 0.15s;
  padding: 0;
}
.settings-page-header-btn:active {
  opacity: 0.5;
}

.settings-page-content {
  padding: 0;
  display: flex;
  flex-direction: column;
}

.settings-page .settings-group {
  margin: 0;
  border-radius: 12px;
}

/* 账户设置页面中的退出登录按钮 */
#pageAccountSettings .settings-page-content > .settings-group:last-child {
  margin-top: 24px;
  margin-bottom: 20px;
}

.settings-page-add {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.settings-page-add input {
  flex: 1;
  height: 44px;
  padding: 0 14px;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  font-size: 15px;
  background: #fff;
  box-sizing: border-box;
}
.theme-dark .settings-page-add input {
  background: var(--panel);
  border-color: var(--border);
  color: var(--text);
}
.settings-page-add input:focus {
  outline: none;
  border-color: #ff2442;
}
.settings-page-add-btn {
  height: 44px;
  padding: 0 20px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #ff2442 0%, #ff6b81 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.settings-page-add-btn:active {
  opacity: 0.9;
}

.settings-page-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.category-page-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #fff;
  border-radius: 12px;
  gap: 12px;
}
.theme-dark .category-page-item {
  background: var(--panel);
}

.category-page-name {
  font-size: 15px;
  color: #333;
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.theme-dark .category-page-name {
  color: var(--text);
}

.category-page-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.category-page-btn {
  height: 28px;
  padding: 0 10px;
  border: none;
  background: #f0f0f0;
  border-radius: 14px;
  font-size: 12px;
  color: #666;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-dark .category-page-btn {
  background: var(--bg);
  color: var(--text-secondary);
}
.category-page-btn:active {
  opacity: 0.6;
}

.category-page-del {
  width: 28px;
  height: 28px;
  border: none;
  background: #f0f0f0;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #999;
  transition: background 0.15s, opacity 0.15s;
  flex-shrink: 0;
}
.theme-dark .category-page-del {
  background: var(--bg);
  color: var(--text-secondary);
}
.category-page-del:active {
  opacity: 0.6;
}
.category-page-del:active {
  background: #ffebee;
  color: #e74c3c;
}

/* 退出登录按钮组 */
.me-logout-group {
  margin-top: 24px;
}
.me-logout-group .settings-item {
  justify-content: center;
}

.settings-page-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}
.settings-page-empty .empty-icon {
  color: #ccc;
  margin-bottom: 16px;
}
.theme-dark .settings-page-empty .empty-icon {
  color: #555;
}
.settings-page-empty .empty-text {
  font-size: 16px;
  color: #666;
  margin-bottom: 8px;
}
.theme-dark .settings-page-empty .empty-text {
  color: var(--text-secondary);
}
.settings-page-empty .empty-tip {
  font-size: 13px;
  color: #999;
}

/* ====== 底部弹出Sheet ====== */
.bottom-sheet {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8000;
  display: none;
  pointer-events: none;
}
.bottom-sheet.active {
  display: block;
  pointer-events: auto;
}

.bottom-sheet-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.theme-dark .bottom-sheet-overlay {
  background: rgba(0,0,0,0.6);
}
.bottom-sheet.active .bottom-sheet-overlay {
  opacity: 1;
}

.bottom-sheet-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 16px 16px 0 0;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  max-height: 85vh;
  overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom);
}
.theme-dark .bottom-sheet-content {
  background: var(--panel-2);
  border-top: 1px solid rgba(255,255,255,0.1);
}
.bottom-sheet.active .bottom-sheet-content {
  transform: translateY(0);
}

.bottom-sheet-header {
  padding: 12px 20px 16px;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
  position: sticky;
  top: 0;
  background: inherit;
}
.theme-dark .bottom-sheet-header {
  border-bottom-color: var(--border);
}

.bottom-sheet-handle {
  width: 36px;
  height: 4px;
  background: #ddd;
  border-radius: 2px;
  margin: 0 auto 12px;
}
.theme-dark .bottom-sheet-handle {
  background: #555;
}

.bottom-sheet-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #333;
}
.theme-dark .bottom-sheet-header h3 {
  color: var(--text);
}

.bottom-sheet-body {
  padding: 20px;
}

.bottom-sheet-footer {
  display: flex;
  gap: 12px;
  padding: 16px 20px 20px;
}
.bottom-sheet-footer .btn-ghost,
.bottom-sheet-footer .sheet-btn-primary {
  flex: 1;
  height: 48px;
  border: none;
  border-radius: 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.bottom-sheet-footer .btn-ghost {
  background: #f5f5f5;
  color: #666;
}
.theme-dark .bottom-sheet-footer .btn-ghost {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}
.bottom-sheet-footer .btn-ghost:active,
.bottom-sheet-footer .sheet-btn-primary:active {
  transform: scale(0.98);
}

.sheet-field {
  margin-bottom: 16px;
}
.sheet-field label {
  display: block;
  font-size: 14px;
  color: #666;
  margin-bottom: 8px;
}
.theme-dark .sheet-field label {
  color: var(--text-secondary);
}
.sheet-field input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  font-size: 16px;
  background: #f8f8f8;
  box-sizing: border-box;
  transition: border-color 0.15s, background 0.15s;
}
.theme-dark .sheet-field input {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
}
.sheet-field input:focus {
  outline: none;
  border-color: #ff2442;
  background: #fff;
}
.theme-dark .sheet-field input:focus {
  background: var(--panel-2);
}

.sheet-tip {
  font-size: 13px;
  color: #999;
  margin-bottom: 20px;
  line-height: 1.5;
}

.sheet-confirm-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 20px;
  text-align: left;
  white-space: pre-wrap;
}
.theme-dark .sheet-confirm-text {
  color: var(--text);
}

.sheet-btn-primary {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(102, 126, 234, 0.4);
}
.sheet-btn-primary:active {
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}
/* footer 中的按钮不需要阴影 */
.bottom-sheet-footer .sheet-btn-primary {
  box-shadow: none;
}
.bottom-sheet-footer .sheet-btn-primary:active {
  box-shadow: none;
}

/* 主题选项列表 */
.theme-option-list {
  display: flex;
  flex-direction: column;
}
.theme-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 4px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
}
.theme-dark .theme-option {
  border-bottom-color: var(--border);
}
.theme-option:last-child {
  border-bottom: none;
}
.theme-option:active {
  background: rgba(0,0,0,0.03);
}
.theme-dark .theme-option:active {
  background: rgba(255,255,255,0.05);
}
.theme-option-label {
  font-size: 16px;
  color: #333;
}
.theme-dark .theme-option-label {
  color: var(--text);
}
.theme-option-check {
  display: none;
}
.theme-option.active .theme-option-check {
  display: flex;
}

/* 色系列表 - Sheet样式 */
.series-sheet-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.series-sheet-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #f8f8f8;
  border-radius: 10px;
}
.theme-dark .series-sheet-item {
  background: var(--bg);
}
.series-sheet-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.series-sheet-name {
  font-size: 15px;
  font-weight: 500;
  color: #333;
}
.theme-dark .series-sheet-name {
  color: var(--text);
}
.series-sheet-count {
  font-size: 13px;
  color: #999;
}
.series-sheet-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}
.series-sheet-btn:active {
  opacity: 0.8;
}
.series-sheet-btn.add {
  background: linear-gradient(135deg, #ff2442 0%, #ff6b81 100%);
  color: #fff;
}
.series-sheet-btn.remove {
  background: #f0f0f0;
  color: #666;
}
.theme-dark .series-sheet-btn.remove {
  background: var(--panel-2);
  color: var(--text-secondary);
}

/* 批量设置图纸标签 */
#patternBatchDialog { width: min(680px, 92vw); }

.batch-sheet-content {
  max-height: 80vh;
}

.batch-sheet-body {
  max-height: calc(80vh - 160px);
  overflow-y: auto;
}

.batch-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.batch-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--panel-2);
  cursor: pointer;
  transition: all 0.15s ease;
}
.batch-item:hover {
  border-color: rgba(14,165,233,.35);
}
.batch-item.is-selected {
  border-color: rgba(14,165,233,.55);
  background: rgba(14,165,233,.08);
}

.batch-checkbox {
  flex: 0 0 auto;
}
.batch-checkbox input {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.02);
  position: relative;
  cursor: pointer;
}
.batch-checkbox input:checked {
  border-color: rgba(14,165,233,.55);
  background: rgba(14,165,233,.25);
}
.batch-checkbox input:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--text);
}

.batch-info {
  flex: 1 1 0;
  min-width: 0;
}
.batch-info-name {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.batch-info-name.is-empty {
  color: var(--muted);
  font-style: italic;
}
.batch-info-date {
  font-size: 11px;
  color: var(--muted);
}

/* 底部弹出菜单 - 旧版（使用hidden属性的#bottomSheet） */
#bottomSheet {
  position: fixed;
  inset: 0;
  z-index: 8000;
  pointer-events: none;
}
#bottomSheet:not([hidden]) {
  pointer-events: auto;
}
#bottomSheet[hidden] {
  display: none;
}

.bottom-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.25s ease;
}
#bottomSheet.active .bottom-sheet-backdrop {
  opacity: 1;
}

.bottom-sheet-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--panel);
  border-radius: 14px 14px 0 0;
  padding: 0 0 calc(8px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.36, 0.66, 0.04, 1);
  display: flex;
  flex-direction: column;
}
#bottomSheet.active .bottom-sheet-content {
  transform: translateY(0);
}

.bottom-sheet-handle {
  display: none;
}

.bottom-sheet-title {
  display: none;
}

.bottom-sheet-menu {
  padding: 0;
  overflow: hidden;
}

.bottom-sheet-menu .menu-item {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 16px 20px;
  font-size: 16px;
  color: var(--text);
  text-align: center;
  transition: background 0.15s ease;
  border-radius: 0;
  position: relative;
  font-weight: 400;
}
.bottom-sheet-menu .menu-item + .menu-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0.5px;
  background: var(--border);
  opacity: 0.6;
}
.bottom-sheet-menu .menu-item:active {
  background: rgba(255, 255, 255, 0.1);
}
body.theme-light .bottom-sheet-menu .menu-item:active {
  background: rgba(0, 0, 0, 0.05);
}

/* 出库次数和备注同行布局 */
.modal-field-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.modal-field-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.modal-field-col-grow {
  flex: 1;
  min-width: 0;
}
.modal-field-row .modal-field-col > label {
  margin-bottom: 0;
}

/* 出库次数控件 */
.times-control {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  width: fit-content;
  height: 40px;
}
.times-btn {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  flex-shrink: 0;
  padding: 0;
  position: relative;
}
.times-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.times-btn svg {
  width: 12px;
  height: 12px;
  display: block;
  position: relative;
  z-index: 1;
}
.times-btn-minus {
  background: 
    linear-gradient(135deg, 
      rgba(251,146,60,0.85) 0%, 
      rgba(249,115,22,0.9) 50%,
      rgba(234,88,12,0.95) 100%);
  color: white;
  box-shadow: 
    0 2px 6px rgba(249,115,22,0.18),
    0 1px 3px rgba(0,0,0,0.08),
    inset 0 1px 1px rgba(255,255,255,0.4),
    inset 0 -1px 1px rgba(0,0,0,0.15);
  backdrop-filter: blur(2px);
}
.times-btn-minus::before {
  background: 
    linear-gradient(135deg, 
      rgba(253,186,116,0.6) 0%, 
      rgba(251,146,60,0.5) 100%);
}
.times-btn-minus:hover {
  transform: translateY(-1px) scale(1.05);
  background: 
    linear-gradient(135deg, 
      rgba(251,146,60,0.95) 0%, 
      rgba(249,115,22,1) 50%,
      rgba(234,88,12,1) 100%);
  box-shadow: 
    0 4px 14px rgba(249,115,22,0.3),
    0 2px 6px rgba(0,0,0,0.12),
    inset 0 1.5px 1px rgba(255,255,255,0.5),
    inset 0 -1px 2px rgba(0,0,0,0.2);
}
.times-btn-minus:hover::before {
  opacity: 1;
}
.times-btn-plus {
  background: 
    linear-gradient(135deg, 
      rgba(59,130,246,0.85) 0%, 
      rgba(37,99,235,0.9) 50%,
      rgba(29,78,216,0.95) 100%);
  color: white;
  box-shadow: 
    0 2px 6px rgba(37,99,235,0.18),
    0 1px 3px rgba(0,0,0,0.08),
    inset 0 1px 1px rgba(255,255,255,0.4),
    inset 0 -1px 1px rgba(0,0,0,0.15);
  backdrop-filter: blur(2px);
}
.times-btn-plus::before {
  background: 
    linear-gradient(135deg, 
      rgba(96,165,250,0.6) 0%, 
      rgba(59,130,246,0.5) 100%);
}
.times-btn-plus:hover {
  transform: translateY(-1px) scale(1.05);
  background: 
    linear-gradient(135deg, 
      rgba(59,130,246,0.95) 0%, 
      rgba(37,99,235,1) 50%,
      rgba(29,78,216,1) 100%);
  box-shadow: 
    0 4px 14px rgba(37,99,235,0.3),
    0 2px 6px rgba(0,0,0,0.12),
    inset 0 1.5px 1px rgba(255,255,255,0.5),
    inset 0 -1px 2px rgba(0,0,0,0.2);
}
.times-btn-plus:hover::before {
  opacity: 1;
}
.times-btn:active {
  transform: translateY(0) scale(0.95);
  box-shadow: 
    0 1px 3px rgba(0,0,0,0.15),
    inset 0 2px 3px rgba(0,0,0,0.25),
    inset 0 1px 1px rgba(255,255,255,0.1);
  filter: brightness(0.95);
}
.times-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.times-btn:disabled:hover {
  transform: none;
  box-shadow: none;
}
.times-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  min-width: 24px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
