/* ============================================================
   清新录单系统 · 设计系统
   薄荷绿清新工具风：白卡片 + 浅薄荷底 + 青绿主色
   ============================================================ */
:root{
  --primary:#0CA678; --primary-600:#0B8F6A; --primary-700:#097A5B;
  --primary-50:#E9F7F1; --primary-100:#D3F0E4; --primary-200:#AEE2CC;
  --bg:#F3F8F6; --surface:#FFFFFF; --surface-2:#F8FBFA;
  --text:#17322B; --text-2:#46615A; --muted:#7E968D;
  --border:#E2ECE7; --border-strong:#CFDFD8;
  --amber:#B97E14; --amber-bg:#FCF3E2; --amber-line:#F0DDB4;
  --red:#D64550; --red-bg:#FDEDEE; --red-line:#F5C9CC;
  --blue:#2E7DD1; --blue-bg:#EAF3FC;
  --violet:#7C6BD6; --violet-bg:#EFEDFB;
  --radius:16px; --radius-sm:10px;
  --shadow-1:0 1px 2px rgba(23,50,43,.05);
  --shadow-2:0 1px 2px rgba(23,50,43,.04), 0 10px 30px rgba(23,50,43,.08);
  --card-pad:20px;
  --font:'Noto Sans SC','PingFang SC','Hiragino Sans GB','Microsoft YaHei',sans-serif;
}
[data-theme="lake"]{
  --primary:#1793A8; --primary-600:#13808F; --primary-700:#0F6C79;
  --primary-50:#E7F5F8; --primary-100:#CDEAF0; --primary-200:#A3D9E4;
}
[data-theme="citrus"]{
  --primary:#D9822B; --primary-600:#C0731F; --primary-700:#A26318;
  --primary-50:#FCF2E6; --primary-100:#F8E4CB; --primary-200:#F0CD9E;
}
[data-density="compact"]{ --card-pad:14px; }
[data-size="large"]{ font-size:17px; }

*{margin:0;padding:0;box-sizing:border-box;}
html{font-size:16px;}
body{
  font-family:var(--font); background:var(--bg); color:var(--text);
  -webkit-font-smoothing:antialiased; line-height:1.6; min-height:100vh;
}
::selection{background:var(--primary-100);}
h1,h2,h3,h4{line-height:1.35;font-weight:600;}
a{color:var(--primary-600);}
button{font-family:inherit;}
input,select,textarea{font-family:inherit;font-size:0.95rem;color:var(--text);}
.num{font-variant-numeric:tabular-nums;}
.text-wrap-pretty{text-wrap:pretty;}

/* ---------- 布局 ---------- */
.app{display:grid;grid-template-columns:236px 1fr;min-height:100vh;}
.sidebar{
  position:sticky;top:0;height:100vh;overflow-y:auto;background:var(--surface);
  border-right:1px solid var(--border);display:flex;flex-direction:column;z-index:30;
}
.brand{display:flex;align-items:center;gap:10px;padding:20px 20px 14px;}
.brand-mark{
  width:38px;height:38px;border-radius:12px;flex:none;
  background:linear-gradient(135deg,var(--primary),var(--primary-700));
  display:grid;place-items:center;color:#fff;
}
.brand-mark svg{width:22px;height:22px;}
.brand b{font-size:1.02rem;letter-spacing:.5px;}
.brand small{display:block;color:var(--muted);font-size:.72rem;font-weight:400;margin-top:1px;}
.nav{flex:1;padding:4px 12px 12px;}
.nav-group{margin-top:14px;}
.nav-group>span{
  display:block;font-size:.7rem;color:var(--muted);letter-spacing:1.5px;
  padding:0 10px 6px;font-weight:500;
}
.nav-item{
  display:flex;align-items:center;gap:10px;width:100%;border:0;background:none;
  padding:9px 10px;border-radius:10px;font-size:.92rem;color:var(--text-2);
  cursor:pointer;text-align:left;transition:background .15s,color .15s;margin-bottom:2px;
}
.nav-item:hover{background:var(--surface-2);color:var(--text);}
.nav-item.active{background:var(--primary-50);color:var(--primary-700);font-weight:600;}
.nav-item .ic{width:19px;height:19px;flex:none;opacity:.85;}
.side-foot{padding:14px 20px;border-top:1px solid var(--border);font-size:.72rem;color:var(--muted);}
.side-foot b{color:var(--text-2);font-weight:600;}

.main{min-width:0;display:flex;flex-direction:column;}
.topbar{
  position:sticky;top:0;z-index:20;display:flex;align-items:center;justify-content:space-between;
  gap:16px;padding:18px 28px 14px;background:linear-gradient(var(--bg) 82%,transparent);
}
.topbar h1{font-size:1.35rem;letter-spacing:.3px;}
.topbar .desc{font-size:.82rem;color:var(--muted);margin-top:2px;}
.topbar-right{display:flex;align-items:center;gap:10px;}
.today-chip{
  font-size:.78rem;color:var(--text-2);background:var(--surface);border:1px solid var(--border);
  padding:6px 12px;border-radius:999px;box-shadow:var(--shadow-1);display:flex;align-items:center;gap:6px;
}
.today-chip .ic{width:14px;height:14px;color:var(--primary);}
.content{padding:6px 28px 90px;max-width:1220px;width:100%;margin:0 auto;}
.page{display:none;animation:fadeUp .28s ease;}
.page.active{display:block;}
@keyframes fadeUp{from{opacity:0;transform:translateY(8px);}to{opacity:1;transform:none;}}

/* ---------- 卡片 / 通用 ---------- */
.card{
  background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);
  padding:var(--card-pad);box-shadow:var(--shadow-1);margin-bottom:18px;
}
.card-title{display:flex;align-items:center;gap:8px;font-size:1rem;font-weight:600;margin-bottom:14px;}
.card-title .ic{width:18px;height:18px;color:var(--primary);}
.card-title .sub{font-size:.78rem;color:var(--muted);font-weight:400;margin-left:4px;}
.card-head-row{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-bottom:14px;}
.hint{font-size:.78rem;color:var(--muted);}
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:18px;}
.grid-3{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;}
.step-badge{
  display:inline-flex;align-items:center;justify-content:center;flex:none;
  width:24px;height:24px;border-radius:8px;background:var(--primary);color:#fff;
  font-size:.8rem;font-weight:700;margin-right:8px;
}
.divider{height:1px;background:var(--border);margin:16px 0;}

/* ---------- 按钮 ---------- */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:7px;
  border-radius:var(--radius-sm);border:1px solid transparent;cursor:pointer;
  padding:9px 18px;font-size:.9rem;font-weight:600;transition:all .16s ease;
  background:var(--surface-2);color:var(--text-2);text-decoration:none;
}
.btn .ic{width:16px;height:16px;}
.btn:hover{transform:translateY(-1px);box-shadow:var(--shadow-1);}
.btn:active{transform:none;}
.btn-primary{background:var(--primary);color:#fff;}
.btn-primary:hover{background:var(--primary-600);}
.btn-ghost{background:var(--surface);border-color:var(--border-strong);color:var(--text-2);}
.btn-ghost:hover{border-color:var(--primary);color:var(--primary-700);}
.btn-danger{background:var(--red-bg);color:var(--red);}
.btn-danger:hover{background:var(--red);color:#fff;}
.btn-sm{padding:5px 12px;font-size:.8rem;border-radius:8px;}
.btn-lg{padding:12px 26px;font-size:1rem;border-radius:12px;}
.btn-icon{padding:8px;border-radius:10px;}
.btn[disabled]{opacity:.5;cursor:not-allowed;transform:none!important;}
.btn-link{background:none;border:none;color:var(--primary-600);padding:4px 6px;font-size:.82rem;cursor:pointer;font-weight:600;}
.btn-link:hover{text-decoration:underline;}

/* ---------- 表单 ---------- */
.field{margin-bottom:14px;}
.field>label{display:flex;align-items:center;gap:6px;font-size:.8rem;font-weight:600;color:var(--text-2);margin-bottom:6px;}
.field .opt{color:var(--muted);font-weight:400;font-size:.72rem;}
.field .ai-chip{
  background:var(--violet-bg);color:var(--violet);font-size:.66rem;font-weight:600;
  padding:1px 7px;border-radius:999px;
}
.input,.select,.textarea{
  width:100%;border:1.5px solid var(--border-strong);border-radius:var(--radius-sm);
  padding:9px 12px;background:var(--surface);transition:border .15s,box-shadow .15s;outline:none;
}
.input:focus,.select:focus,.textarea:focus{border-color:var(--primary);box-shadow:0 0 0 3px var(--primary-50);}
.textarea{resize:vertical;min-height:64px;}
.select{appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237E968D' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 10px center;padding-right:32px;cursor:pointer;}
.form-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:12px 14px;}
.form-grid .field{margin-bottom:0;}
.check{display:flex;align-items:center;gap:8px;font-size:.86rem;color:var(--text-2);cursor:pointer;user-select:none;}
.check input{width:17px;height:17px;accent-color:var(--primary);cursor:pointer;}
details.fold{border:1px dashed var(--border-strong);border-radius:var(--radius-sm);padding:10px 14px;margin:14px 0;}
details.fold summary{cursor:pointer;font-size:.84rem;font-weight:600;color:var(--muted);user-select:none;list-style:none;display:flex;align-items:center;gap:6px;}
details.fold summary::before{content:'▸';transition:transform .15s;}
details.fold[open] summary::before{transform:rotate(90deg);}
details.fold .fold-body{padding-top:12px;}

/* ---------- 利润框 ---------- */
.profit-box{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  background:linear-gradient(120deg,var(--primary-50),var(--surface));
  border:1px solid var(--primary-100);border-radius:12px;padding:13px 16px;margin:16px 0;
}
.profit-box .lab{font-size:.8rem;color:var(--text-2);}
.profit-box .lab small{display:block;color:var(--muted);font-size:.7rem;}
.profit-box .val{font-size:1.45rem;font-weight:700;color:var(--primary-700);font-variant-numeric:tabular-nums;}
.profit-box .val.neg{color:var(--red);}

/* ---------- 表格 ---------- */
.tbl-wrap{overflow-x:auto;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface);}
table.tbl{width:100%;border-collapse:collapse;font-size:.86rem;min-width:640px;}
.tbl th{
  text-align:left;font-size:.74rem;color:var(--muted);font-weight:600;letter-spacing:.4px;
  padding:11px 12px;background:var(--surface-2);border-bottom:1px solid var(--border);white-space:nowrap;
}
.tbl td{padding:11px 12px;border-bottom:1px solid var(--border);vertical-align:middle;}
.tbl tbody tr:last-child td{border-bottom:none;}
.tbl tbody tr{transition:background .12s;}
.tbl tbody tr:hover{background:var(--surface-2);}
.tbl .num{font-variant-numeric:tabular-nums;}
.tbl .pos{color:var(--primary-700);font-weight:600;}
.tbl .neg{color:var(--red);font-weight:600;}
.tbl .sub-line{display:block;font-size:.72rem;color:var(--muted);}
.tbl .actions{display:flex;gap:2px;white-space:nowrap;}
.row-check{width:16px;height:16px;accent-color:var(--primary);cursor:pointer;}

/* ---------- 标签 ---------- */
.tag{display:inline-flex;align-items:center;gap:4px;font-size:.72rem;font-weight:600;padding:2.5px 9px;border-radius:999px;white-space:nowrap;}
.tag.ok{background:var(--primary-50);color:var(--primary-700);}
.tag.warn{background:var(--amber-bg);color:var(--amber);}
.tag.err{background:var(--red-bg);color:var(--red);}
.tag.info{background:var(--blue-bg);color:var(--blue);}
.tag.muted{background:var(--surface-2);color:var(--muted);border:1px solid var(--border);}
.tag.violet{background:var(--violet-bg);color:var(--violet);}

/* ---------- 工具栏 / 筛选 ---------- */
.toolbar{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin-bottom:14px;}
.searchbar{position:relative;flex:1;min-width:180px;max-width:300px;}
.searchbar .ic{position:absolute;left:10px;top:50%;transform:translateY(-50%);width:15px;height:15px;color:var(--muted);}
.searchbar .input{padding-left:32px;}
.seg{display:inline-flex;background:var(--surface);border:1px solid var(--border-strong);border-radius:10px;padding:3px;gap:2px;}
.seg button{
  border:none;background:none;padding:5px 13px;border-radius:8px;font-size:.8rem;
  color:var(--muted);cursor:pointer;font-weight:500;transition:all .15s;white-space:nowrap;
}
.seg button.on{background:var(--primary);color:#fff;font-weight:600;}
.batch-bar{
  display:flex;flex-wrap:wrap;gap:10px;align-items:center;background:var(--surface-2);
  border:1px dashed var(--border-strong);border-radius:12px;padding:10px 14px;margin-bottom:12px;font-size:.82rem;color:var(--muted);
}
.batch-bar .select{width:auto;padding:6px 30px 6px 10px;font-size:.8rem;}
.range-inputs{display:flex;gap:8px;align-items:center;}
.range-inputs .input{width:135px;font-size:.8rem;padding:7px 10px;}

/* ---------- 统计卡 ---------- */
.stats-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:14px;margin-bottom:18px;}
.stat-card{
  background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);
  padding:16px 18px;box-shadow:var(--shadow-1);position:relative;overflow:hidden;
}
.stat-card::after{content:'';position:absolute;right:-24px;top:-24px;width:80px;height:80px;border-radius:50%;background:var(--primary-50);opacity:.7;}
.stat-card .s-lab{font-size:.76rem;color:var(--muted);display:flex;align-items:center;gap:6px;position:relative;z-index:1;}
.stat-card .s-lab .ic{width:14px;height:14px;color:var(--primary);}
.stat-card .s-val{font-size:1.5rem;font-weight:700;margin-top:6px;font-variant-numeric:tabular-nums;position:relative;z-index:1;}
.stat-card .s-val small{font-size:.8rem;font-weight:500;color:var(--muted);}
.stat-card .s-sub{font-size:.72rem;color:var(--muted);margin-top:2px;position:relative;z-index:1;}
.stat-card.warn .s-val{color:var(--amber);}
.stat-card.danger .s-val{color:var(--red);}

/* ---------- 上传 ---------- */
.upload-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;}
.upload-card{border:1.5px dashed var(--border-strong);border-radius:14px;padding:14px;background:var(--surface-2);transition:border .15s,background .15s;}
.upload-card:hover{border-color:var(--primary);background:var(--primary-50);}
.upload-card h4{font-size:.88rem;display:flex;gap:6px;align-items:center;margin-bottom:4px;}
.upload-card h4 .ic{width:16px;height:16px;color:var(--primary);}
.upload-card .u-tip{font-size:.72rem;color:var(--muted);margin-bottom:10px;}
.upload-zone{
  display:flex;flex-direction:column;align-items:center;gap:6px;padding:18px 10px;
  border-radius:10px;cursor:pointer;color:var(--muted);font-size:.78rem;transition:color .15s;
}
.upload-card:hover .upload-zone{color:var(--primary-600);}
.upload-zone .ic{width:26px;height:26px;}
.thumbs{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px;}
.thumb{position:relative;width:72px;height:72px;border-radius:10px;overflow:hidden;border:1px solid var(--border);background:var(--surface);}
.thumb img{width:100%;height:100%;object-fit:cover;display:block;}
.thumb .rm{
  position:absolute;top:3px;right:3px;width:18px;height:18px;border-radius:50%;border:none;
  background:rgba(23,50,43,.55);color:#fff;font-size:.65rem;cursor:pointer;display:grid;place-items:center;line-height:1;
}
.thumb .rm:hover{background:var(--red);}
.rec-status{
  display:none;align-items:center;gap:10px;margin-top:14px;padding:11px 14px;border-radius:12px;
  background:var(--violet-bg);color:var(--violet);font-size:.82rem;
}
.rec-status.show{display:flex;}
.rec-status.done{background:var(--primary-50);color:var(--primary-700);}
.spinner{width:15px;height:15px;border:2.5px solid var(--violet-bg);border-top-color:var(--violet);border-radius:50%;animation:spin .7s linear infinite;flex:none;}
.rec-status.done .spinner{border-color:var(--primary-100);border-top-color:var(--primary);}
@keyframes spin{to{transform:rotate(360deg);}}

/* ---------- 录单双栏 ---------- */
.luadan-grid{display:grid;grid-template-columns:400px 1fr;gap:18px;align-items:start;}

/* ---------- 扫码 ---------- */
.scan-hero{
  text-align:center;padding:34px 20px;
}
.scan-hero .scan-input{
  width:100%;max-width:460px;margin:0 auto;display:block;text-align:center;
  font-size:1.15rem;padding:14px;border:2px solid var(--primary-200);border-radius:14px;letter-spacing:1px;
}
.scan-hero .scan-input:focus{border-color:var(--primary);box-shadow:0 0 0 4px var(--primary-50);}
.scan-result{
  margin:16px auto 0;max-width:460px;padding:10px 16px;border-radius:12px;font-size:.86rem;
  display:none;align-items:center;gap:8px;justify-content:center;
}
.scan-result.ok{display:flex;background:var(--primary-50);color:var(--primary-700);}
.scan-result.err{display:flex;background:var(--red-bg);color:var(--red);}

/* ---------- 进度条 ---------- */
.progress{height:8px;background:var(--surface-2);border-radius:999px;overflow:hidden;border:1px solid var(--border);}
.progress i{display:block;height:100%;background:linear-gradient(90deg,var(--primary),var(--primary-600));border-radius:999px;transition:width .3s;width:0;}

/* ---------- 空状态 ---------- */
.empty{text-align:center;padding:38px 16px;color:var(--muted);}
.empty .e-ic{width:44px;height:44px;margin:0 auto 10px;border-radius:14px;background:var(--surface-2);display:grid;place-items:center;}
.empty .e-ic .ic{width:22px;height:22px;color:var(--border-strong);}
.empty p{font-size:.84rem;}
.empty .btn{margin-top:12px;}

/* ---------- 公告 ---------- */
.ann-item{display:flex;gap:12px;padding:12px 2px;border-bottom:1px dashed var(--border);}
.ann-item:last-child{border-bottom:none;}
.ann-ic{width:34px;height:34px;flex:none;border-radius:10px;background:var(--amber-bg);color:var(--amber);display:grid;place-items:center;}
.ann-ic .ic{width:17px;height:17px;}
.ann-item b{font-size:.88rem;display:block;}
.ann-item p{font-size:.78rem;color:var(--text-2);margin-top:2px;text-wrap:pretty;}
.ann-item time{font-size:.7rem;color:var(--muted);}

/* ---------- 商品分类 ---------- */
.pd-grid{display:grid;grid-template-columns:220px 1fr;gap:18px;align-items:start;}
.cat-item{
  display:flex;align-items:center;gap:8px;padding:9px 12px;border-radius:10px;cursor:pointer;
  font-size:.88rem;color:var(--text-2);border:1px solid transparent;transition:all .14s;margin-bottom:3px;
}
.cat-item:hover{background:var(--surface-2);}
.cat-item.on{background:var(--primary-50);color:var(--primary-700);font-weight:600;border-color:var(--primary-100);}
.cat-item .grip{color:var(--border-strong);cursor:grab;font-size:.9rem;line-height:1;}
.cat-item .cnt{margin-left:auto;font-size:.7rem;color:var(--muted);}
.cat-item.dragging{opacity:.4;}
.prod-img{
  width:44px;height:44px;border-radius:10px;flex:none;overflow:hidden;
  background:linear-gradient(135deg,var(--primary-50),var(--primary-100));color:var(--primary-700);
  display:grid;place-items:center;font-weight:700;font-size:1.05rem;
}
.prod-img img{width:100%;height:100%;object-fit:cover;}

/* ---------- Toast ---------- */
#toast-root{position:fixed;top:18px;right:18px;z-index:200;display:flex;flex-direction:column;gap:10px;pointer-events:none;}
.toast{
  display:flex;align-items:center;gap:9px;background:var(--surface);color:var(--text);
  border:1px solid var(--border);border-left:4px solid var(--primary);border-radius:12px;
  padding:11px 16px;font-size:.86rem;box-shadow:var(--shadow-2);min-width:230px;max-width:340px;
  animation:toastIn .3s cubic-bezier(.2,.9,.3,1.2);
}
.toast.err{border-left-color:var(--red);}
.toast.warn{border-left-color:var(--amber);}
.toast .ic{width:17px;height:17px;flex:none;}
.toast.ok .ic{color:var(--primary);}
.toast.err .ic{color:var(--red);}
.toast.warn .ic{color:var(--amber);}
.toast.out{animation:toastOut .25s ease forwards;}
@keyframes toastIn{from{opacity:0;transform:translateX(24px);}to{opacity:1;transform:none;}}
@keyframes toastOut{to{opacity:0;transform:translateX(24px);}}

/* ---------- 模态框 ---------- */
.modal-mask{
  position:fixed;inset:0;background:rgba(23,50,43,.35);backdrop-filter:blur(3px);
  z-index:150;display:none;align-items:center;justify-content:center;padding:20px;
}
.modal-mask.show{display:flex;animation:fadeIn .2s ease;}
@keyframes fadeIn{from{opacity:0;}to{opacity:1;}}
.modal{
  background:var(--surface);border-radius:18px;box-shadow:var(--shadow-2);width:100%;max-width:560px;
  max-height:88vh;display:flex;flex-direction:column;animation:popIn .25s cubic-bezier(.2,.9,.3,1.15);
}
.modal.wide{max-width:720px;}
@keyframes popIn{from{opacity:0;transform:scale(.94) translateY(10px);}to{opacity:1;transform:none;}}
.modal-head{display:flex;align-items:center;justify-content:space-between;padding:18px 22px 0;}
.modal-head h3{font-size:1.05rem;}
.modal-body{padding:16px 22px;overflow-y:auto;}
.modal-foot{display:flex;justify-content:flex-end;gap:10px;padding:0 22px 18px;}
.x-btn{border:none;background:var(--surface-2);width:30px;height:30px;border-radius:9px;cursor:pointer;color:var(--muted);display:grid;place-items:center;}
.x-btn:hover{background:var(--red-bg);color:var(--red);}
.x-btn .ic{width:15px;height:15px;}

/* ---------- Tweaks 面板 ---------- */
#tweaks-fab{
  position:fixed;right:18px;bottom:18px;z-index:120;width:46px;height:46px;border-radius:50%;
  border:none;background:var(--primary);color:#fff;cursor:pointer;box-shadow:var(--shadow-2);
  display:grid;place-items:center;transition:transform .15s;
}
#tweaks-fab:hover{transform:rotate(30deg) scale(1.06);}
#tweaks-fab .ic{width:21px;height:21px;}
#tweaks-panel{
  position:fixed;right:18px;bottom:74px;z-index:120;width:250px;background:var(--surface);
  border:1px solid var(--border);border-radius:16px;box-shadow:var(--shadow-2);padding:16px;
  display:none;animation:popIn .2s ease;
}
#tweaks-panel.show{display:block;}
#tweaks-panel h4{font-size:.86rem;margin-bottom:12px;display:flex;align-items:center;gap:6px;}
#tweaks-panel h4 .ic{width:15px;height:15px;color:var(--primary);}
.tw-row{margin-bottom:12px;}
.tw-row>span{display:block;font-size:.74rem;color:var(--muted);margin-bottom:6px;}
.swatches{display:flex;gap:8px;}
.swatch{width:30px;height:30px;border-radius:50%;border:2.5px solid transparent;cursor:pointer;transition:transform .12s;}
.swatch:hover{transform:scale(1.1);}
.swatch.on{border-color:var(--text);box-shadow:0 0 0 2px var(--surface) inset;}
.mini-seg{display:flex;background:var(--surface-2);border-radius:9px;padding:3px;gap:2px;}
.mini-seg button{flex:1;border:none;background:none;font-size:.76rem;padding:5px;border-radius:7px;cursor:pointer;color:var(--muted);}
.mini-seg button.on{background:var(--surface);color:var(--primary-700);font-weight:600;box-shadow:var(--shadow-1);}

/* ---------- 移动端 ---------- */
.mobile-head,.drawer,#bottomnav{display:none;}
@media (max-width:960px){
  .app{grid-template-columns:1fr;}
  .sidebar{display:none;}
  .mobile-head{
    display:flex;align-items:center;justify-content:space-between;position:sticky;top:0;z-index:40;
    background:var(--surface);border-bottom:1px solid var(--border);padding:12px 16px;
  }
  .mobile-head .brand{padding:0;}
  .topbar{padding:14px 16px 10px;}
  .content{padding:4px 16px 110px;}
  .luadan-grid{grid-template-columns:1fr;}
  .pd-grid{grid-template-columns:1fr;}
  .upload-grid{grid-template-columns:1fr;}
  .grid-2{grid-template-columns:1fr;}
  #bottomnav{
    display:flex;position:fixed;left:0;right:0;bottom:0;z-index:100;background:var(--surface);
    border-top:1px solid var(--border);padding:6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  #bottomnav button{
    flex:1;border:none;background:none;display:flex;flex-direction:column;align-items:center;gap:3px;
    font-size:.66rem;color:var(--muted);cursor:pointer;padding:5px 2px;border-radius:10px;
  }
  #bottomnav button .ic{width:21px;height:21px;}
  #bottomnav button.on{color:var(--primary-700);font-weight:600;}
  .drawer-mask{position:fixed;inset:0;background:rgba(23,50,43,.35);z-index:110;display:none;}
  .drawer-mask.show{display:block;animation:fadeIn .2s;}
  .drawer{
    display:block;position:fixed;top:0;bottom:0;right:0;width:min(78vw,300px);background:var(--surface);
    z-index:111;transform:translateX(100%);transition:transform .25s ease;overflow-y:auto;padding:16px 12px;
  }
  .drawer.show{transform:none;}
  #toast-root{left:16px;right:16px;top:14px;align-items:center;}
}
@media (max-width:640px){
  .form-grid{grid-template-columns:1fr 1fr;}
  .range-inputs{width:100%;}
  .range-inputs .input{flex:1;width:auto;}
}
@media (prefers-reduced-motion:reduce){
  *{animation-duration:.01ms!important;transition-duration:.01ms!important;}
}

/* 快捷入口 */
.quick-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:12px;}
.quick-btn{
  display:flex;flex-direction:column;align-items:center;gap:8px;padding:18px 10px;border-radius:14px;
  border:1px solid var(--border);background:var(--surface);cursor:pointer;transition:all .15s;font-size:.84rem;
  color:var(--text-2);font-weight:600;
}
.quick-btn:hover{border-color:var(--primary);background:var(--primary-50);color:var(--primary-700);transform:translateY(-2px);box-shadow:var(--shadow-1);}
.quick-btn .q-ic{width:40px;height:40px;border-radius:12px;background:var(--primary-50);color:var(--primary);display:grid;place-items:center;}
.quick-btn .q-ic .ic{width:20px;height:20px;}

/* 待办列表 */
.todo-item{display:flex;align-items:center;gap:10px;padding:10px 2px;border-bottom:1px dashed var(--border);font-size:.85rem;}
.todo-item:last-child{border-bottom:none;}
.todo-item .t-num{margin-left:auto;font-weight:700;color:var(--amber);font-variant-numeric:tabular-nums;}
.todo-item .t-num.zero{color:var(--primary);}

/* 图表容器 */
.chart-box{position:relative;height:300px;}
.rank-row{display:flex;align-items:center;gap:10px;margin-bottom:10px;font-size:.82rem;}
.rank-row .r-name{width:130px;flex:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text-2);}
.rank-row .r-bar{flex:1;height:20px;background:var(--surface-2);border-radius:6px;overflow:hidden;}
.rank-row .r-bar i{display:block;height:100%;background:linear-gradient(90deg,var(--primary-200),var(--primary));border-radius:6px;}
.rank-row .r-val{width:90px;text-align:right;font-variant-numeric:tabular-nums;font-weight:600;color:var(--primary-700);flex:none;}

/* 识别失败条目 */
.fail-item{display:flex;align-items:center;gap:12px;padding:12px;border:1px solid var(--amber-line);background:var(--amber-bg);border-radius:12px;margin-bottom:10px;flex-wrap:wrap;}
.fail-item img{width:52px;height:52px;border-radius:9px;object-fit:cover;flex:none;}
.fail-item .f-tip{font-size:.76rem;color:var(--amber);flex:1 1 100%;}
.fail-item .input{width:150px;padding:7px 10px;font-size:.82rem;}

/* 存储信息 */
.store-row{display:flex;justify-content:space-between;padding:9px 0;border-bottom:1px dashed var(--border);font-size:.86rem;}
.store-row:last-child{border-bottom:none;}
.store-row span:first-child{color:var(--muted);}
.store-row b{font-variant-numeric:tabular-nums;}

/* ============ 登录页 ============ */
.login-mask{
  position:fixed; inset:0; z-index:2000;
  display:flex; align-items:center; justify-content:center; padding:20px;
  background:linear-gradient(135deg,#E9F7F1 0%,#F3F8F6 45%,#D3F0E4 100%);
}
.login-card{
  width:100%; max-width:380px;
  background:var(--surface); border:1px solid var(--border);
  border-radius:22px; box-shadow:var(--shadow-2);
  padding:36px 32px 28px;
  animation:loginIn .35s ease both;
}
@keyframes loginIn{ from{opacity:0; transform:translateY(14px)} to{opacity:1; transform:none} }
.login-brand{ text-align:center; margin-bottom:26px; }
.login-brand h1{ font-size:22px; margin:12px 0 4px; color:var(--text); letter-spacing:1px; }
.login-brand p{ font-size:12.5px; color:var(--muted); margin:0; }
.login-mark{ margin:0 auto; width:52px; height:52px; }
.login-mark svg{ width:26px; height:26px; }
.login-card .field{ margin-bottom:14px; }
.login-card .input{ height:44px; font-size:15px; }
.login-err{
  background:var(--red-bg); color:var(--red); border:1px solid var(--red-line);
  border-radius:10px; padding:9px 12px; font-size:13px; margin-bottom:14px;
}
.login-btn{ width:100%; height:44px; font-size:15.5px; letter-spacing:6px; margin-top:2px; }
.login-btn:disabled{ opacity:.6; cursor:default; }
.login-hint{ text-align:center; font-size:12px; color:var(--muted); margin:16px 0 0; }

/* 顶栏当前用户徽章 */
.user-chip{
  display:inline-flex; align-items:center; gap:7px;
  height:34px; padding:0 13px 0 10px;
  background:var(--primary-50); border:1px solid var(--primary-100);
  border-radius:99px; font-size:13px; color:var(--primary-700); white-space:nowrap;
  cursor:pointer; transition:box-shadow .15s;
}
.user-chip:hover{ box-shadow:0 0 0 3px var(--primary-100); }
.user-chip::before{
  content:''; width:8px; height:8px; border-radius:50%;
  background:var(--primary); box-shadow:0 0 0 3px var(--primary-100);
}
.mobile-head-actions{ display:flex; align-items:center; gap:6px; }

/* hidden 属性必须始终生效（防止被 display:flex 等样式覆盖） */
[hidden]{ display:none !important; }

/* ============ 摄像头扫码 ============ */
.camera-scan-mask{ position:fixed; inset:0; z-index:2000; background:rgba(15,23,42,.92); display:flex; align-items:center; justify-content:center; padding:16px; }
.camera-scan-box{ width:min(560px,100%); background:var(--surface); border-radius:var(--radius); overflow:hidden; box-shadow:var(--shadow-2); }
.camera-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; padding:12px 14px; font-size:14px; font-weight:600; color:var(--text); border-bottom:1px solid var(--border); }
.camera-view{ position:relative; background:#0b1220; aspect-ratio:4/3; }
.camera-view video{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.camera-frame{ position:absolute; left:50%; top:50%; width:min(78%,420px); height:44%; transform:translate(-50%,-50%); border:2px solid rgba(255,255,255,.85); border-radius:10px; box-shadow:0 0 0 2000px rgba(11,18,32,.45); pointer-events:none; }
.camera-frame::after{ content:''; position:absolute; left:6%; right:6%; top:0; height:2px; background:var(--primary); box-shadow:0 0 8px var(--primary); animation:camline 1.6s ease-in-out infinite alternate; }
@keyframes camline{ from{ top:6%; } to{ top:calc(100% - 2px); } }
.camera-tip{ padding:10px 14px; font-size:13px; color:var(--text-2); text-align:center; border-top:1px solid var(--border); }
