/* ===== Soft UI 风格 ===== 柔和阴影 / 圆润边角 / 低饱和配色 */
:root {
  --bg: #f4f5fb;            /* slate-50 偏暖 */
  --panel: #ffffff;
  --field: #f3f4f8;        /* 输入框柔和底 */
  --text: #1f2937;          /* gray-800 */
  --muted: #94a3b8;         /* slate-400 */
  --muted-d: #64748b;
  --primary: #6366f1;       /* indigo-500 */
  --primary-d: #4f46e5;     /* indigo-600 */
  --primary-soft: #eef0fe;  /* indigo-50 */
  --success: #10b981;
  --success-soft: #e7f8f1;
  --danger: #f43f5e;
  --danger-soft: #fdeef1;
  --r-sm: 14px;
  --r-md: 18px;
  --r-lg: 26px;
  --sh-sm: 0 4px 14px rgba(99,102,241,.06), 0 2px 6px rgba(15,23,42,.04);
  --sh-md: 0 10px 28px rgba(15,23,42,.07);
  --sh-lg: 0 18px 44px rgba(15,23,42,.10);
  --sh-primary: 0 10px 22px rgba(99,102,241,.32);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* 顶栏 */
.topbar {
  height: 64px; background: var(--panel);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px; box-shadow: var(--sh-sm); position: sticky; top: 0; z-index: 10;
}
.brand { font-size: 18px; font-weight: 600; color: var(--primary-d); letter-spacing: .3px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.datapath { color: var(--muted); font-size: 12px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userbox { font-size: 12px; color: var(--muted-d); display: flex; align-items: center; gap: 8px; }
.userbox input { width: 96px; }

/* 按钮 */
.btn {
  border: 0; background: var(--field); color: var(--text);
  padding: 10px 18px; border-radius: var(--r-sm); cursor: pointer; font-size: 13px;
  font-weight: 500; transition: all .2s ease; box-shadow: var(--sh-sm); white-space: nowrap;
}
.btn:hover { box-shadow: var(--sh-md); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--primary); color: #fff; box-shadow: var(--sh-primary); }
.btn.primary:hover { background: var(--primary-d); box-shadow: 0 14px 28px rgba(99,102,241,.42); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--field); box-shadow: var(--sh-sm); }
.btn.danger { color: var(--danger); background: var(--danger-soft); box-shadow: none; }
.btn.danger:hover { box-shadow: 0 8px 20px rgba(244,63,94,.22); }
.btn.danger.ghost { background: transparent; }
.btn.danger.ghost:hover { background: var(--danger-soft); }
.btn.small { padding: 6px 13px; font-size: 12px; border-radius: 11px; }

input, textarea, select {
  border: 0; border-radius: var(--r-sm); padding: 10px 13px;
  font-size: 13px; font-family: inherit; background: var(--field); color: var(--text); width: 100%;
  transition: box-shadow .2s, background .2s;
}
input:focus, textarea:focus, select:focus { outline: none; background: #fff; box-shadow: 0 0 0 3px rgba(99,102,241,.18); }
input[readonly], textarea[readonly] { opacity: .7; }
textarea { resize: vertical; }
select { cursor: pointer; }

/* 首次设置提示(默认不再阻断, 保留备用) */
.setup-hint { display: flex; align-items: center; justify-content: center; height: calc(100vh - 64px); }
.setup-card { background: var(--panel); padding: 44px 50px; border-radius: var(--r-lg); box-shadow: var(--sh-lg); max-width: 480px; text-align: center; }
.setup-card h2 { margin: 0 0 14px; font-weight: 600; }
.setup-card p { color: var(--muted-d); line-height: 1.8; }

/* 列表 */
.list-view { padding: 24px 26px 48px; max-width: 1400px; margin: 0 auto; }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.search { flex: 1; min-width: 300px; background: #fff; box-shadow: var(--sh-sm); }
.filter { width: 156px; background: #fff; box-shadow: var(--sh-sm); }
.count { color: var(--muted); font-size: 12px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 22px; }
.card {
  background: var(--panel); border: 0; border-radius: var(--r-lg);
  overflow: hidden; cursor: pointer; transition: all .28s ease; display: flex; flex-direction: column;
  box-shadow: var(--sh-md);
}
.card:hover { box-shadow: var(--sh-lg); transform: translateY(-4px); }
.card-img { height: 160px; background: linear-gradient(135deg,#eef0fe,#f4f5fb) center/cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
.card-body { padding: 16px 18px 18px; }
.card-title { font-weight: 600; font-size: 15px; margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { font-size: 12px; color: var(--muted-d); line-height: 1.75; }
.card-tags { margin-top: 11px; display: flex; gap: 7px; flex-wrap: wrap; }
.tag { font-size: 11px; background: var(--primary-soft); color: var(--primary-d); padding: 4px 11px; border-radius: 999px; font-weight: 500; }
.tag.bulk { background: var(--success-soft); color: var(--success); }
.tag.cat { background: #fff1e6; color: #d97a3a; }
.empty { text-align: center; color: var(--muted); padding: 90px 0; }

/* 抽屉 */
.overlay { position: fixed; inset: 0; background: rgba(30,32,60,.34); backdrop-filter: blur(2px); display: flex; justify-content: flex-end; z-index: 50; }
.drawer { width: 800px; max-width: 95vw; background: var(--bg); height: 100%; display: flex; flex-direction: column; box-shadow: -10px 0 50px rgba(20,24,60,.22); }
.drawer-head { height: 64px; background: var(--panel); box-shadow: var(--sh-sm); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; z-index: 2; }
.drawer-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.drawer-head-right { display: flex; align-items: center; gap: 12px; }
.lock-notice { color: var(--danger); font-size: 12px; background: var(--danger-soft); padding: 6px 13px; border-radius: 999px; font-weight: 500; }
.drawer-body { flex: 1; overflow-y: auto; padding: 24px 26px; }
.drawer-foot { background: var(--panel); box-shadow: 0 -4px 16px rgba(15,23,42,.05); padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; }
.foot-right { display: flex; align-items: center; gap: 16px; }
.meta { color: var(--muted); font-size: 12px; }

.sec { font-size: 14px; font-weight: 600; margin: 26px 0 14px; display: flex; align-items: center; gap: 12px; color: var(--text); }
.sec::before { content: ''; width: 4px; height: 15px; border-radius: 3px; background: var(--primary); display: inline-block; }
.sec:first-child { margin-top: 0; }
.sec .sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.sec .btn { margin-left: auto; }

/* 卡片化的字段容器 */
.grid, .bulk-row {
  background: var(--panel); border-radius: var(--r-md); box-shadow: var(--sh-sm);
}
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 20px; }
.fld { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted-d); font-weight: 500; }
.fld.full { grid-column: 1 / -1; }
.drawer-body > .fld.full { background: var(--panel); border-radius: var(--r-md); box-shadow: var(--sh-sm); padding: 16px 20px; margin-top: 14px; }
.fld input, .fld textarea { color: var(--text); font-weight: 400; }

/* 图片 */
.dropzone { border: 2px dashed #d3d8ea; border-radius: var(--r-md); padding: 28px; text-align: center; color: var(--muted); cursor: pointer; background: var(--panel); transition: all .2s; font-size: 13px; }
.dropzone:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.dropzone.drag { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-d); }
.image-list { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.thumb { position: relative; width: 104px; height: 104px; border-radius: var(--r-sm); overflow: hidden; background: #eef0fe center/cover no-repeat; box-shadow: var(--sh-sm); }
.thumb .rm { position: absolute; top: 5px; right: 5px; width: 22px; height: 22px; border-radius: 50%; background: rgba(20,24,40,.5); color: #fff; border: none; cursor: pointer; font-size: 14px; line-height: 22px; padding: 0; transition: background .15s; }
.thumb .rm:hover { background: var(--danger); }

/* 检测报告 */
.report-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.report-item { display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: var(--r-sm); box-shadow: var(--sh-sm); padding: 10px 14px; }
.report-item .ico { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; flex: none; }
.report-item .ico.pdf { background: #e0564b; }
.report-item .ico.img { background: var(--primary); }
.report-item .ico.file { background: var(--muted); }
.report-item .rname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.report-item .rname.link { color: var(--primary-d); cursor: pointer; }
.report-item .rname.link:hover { text-decoration: underline; }
.report-item .new-badge { font-size: 11px; color: var(--muted); }
.report-item .rm { width: 22px; height: 22px; border-radius: 50%; background: var(--danger-soft); color: var(--danger); border: none; cursor: pointer; font-size: 14px; line-height: 22px; padding: 0; flex: none; }
.report-item .rm:hover { background: var(--danger); color: #fff; }

/* 大货 */
.bulk-list { display: flex; flex-direction: column; gap: 14px; }
.bulk-empty { color: var(--muted); font-size: 13px; padding: 10px 2px; }
.bulk-row { padding: 18px; display: flex; flex-direction: column; }
.bulk-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.bulk-del { align-self: flex-end; margin-top: 14px; }

/* toast */
.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: rgba(31,41,55,.96); color: #fff; padding: 12px 24px; border-radius: 999px; font-size: 13px; z-index: 100; box-shadow: var(--sh-lg); }

/* 工作台门户 */
.portal { max-width: 1100px; margin: 0 auto; padding: 48px 26px; }
.portal-title { font-size: 26px; font-weight: 600; margin: 0 0 6px; }
.portal-sub { color: var(--muted-d); margin: 0 0 34px; }
.portal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; }
.tile { background: var(--panel); border-radius: var(--r-lg); box-shadow: var(--sh-md); padding: 26px 24px; cursor: pointer; transition: all .28s ease; }
.tile:hover { box-shadow: var(--sh-lg); transform: translateY(-4px); }
.tile.disabled { cursor: default; opacity: .6; }
.tile.disabled:hover { box-shadow: var(--sh-md); transform: none; }
.tile-icon { width: 56px; height: 56px; border-radius: 18px; display: flex; align-items: center; justify-content: center; font-size: 28px; margin-bottom: 16px; }
.tile-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.tile-desc { font-size: 13px; color: var(--muted-d); line-height: 1.7; min-height: 44px; }
.tile-go { margin-top: 16px; color: var(--primary-d); font-weight: 600; font-size: 14px; }
.tile-soon { margin-top: 16px; color: var(--muted); font-size: 13px; }

/* 统计概览 */
.stats { display: flex; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.stat { background: var(--panel); border-radius: var(--r-md); box-shadow: var(--sh-sm); padding: 14px 22px; min-width: 120px; }
.stat .num { font-size: 22px; font-weight: 700; color: var(--primary-d); }
.stat .lbl { font-size: 12px; color: var(--muted-d); margin-top: 2px; }

/* 打印面料卡 */
.print-area { display: none; }
@media print {
  body { background: #fff; }
  body > *:not(.print-area) { display: none !important; }
  .print-area { display: block !important; padding: 10mm; }
  .pc-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
  .pc-id { color: #666; font-size: 12px; margin-bottom: 14px; }
  .pc-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
  .pc-table td { border: 1px solid #bbb; padding: 7px 10px; font-size: 13px; vertical-align: top; }
  .pc-table td.k { background: #f3f4f8; width: 110px; color: #444; white-space: nowrap; }
  .pc-imgs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
  .pc-imgs img { width: 150px; height: 150px; object-fit: cover; border: 1px solid #ccc; }
  .pc-h { font-size: 15px; font-weight: 700; margin: 14px 0 8px; border-bottom: 2px solid #333; padding-bottom: 4px; }
}

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d7dbe8; border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #c2c8da; }
