:root{
  --bg:#f7f7f9;
  --card:#ffffff;
  --text:#1d1d1f;
  --muted:#6e6e73;
  --muted2:#8e8e93;
  --line:#e8e8ed;
  --line2:#f2f2f4;
  --blue:#0071e3;
  --blueHover:#0064c8;
  --red:#c9342f; --redbg:#fff3f2; --redline:#ffd2cf;
  --yellow:#a85a00; --yellowbg:#fff8ea; --yellowline:#f7ddb0;
  --green:#15803d; --greenbg:#f0faf3; --greenline:#bce7c8;
  --gray:#5f6670; --graybg:#f3f4f6; --grayline:#dfe2e6;
  --purple:#6941c6; --purplebg:#f6f2ff; --purpleline:#ded2ff;
  --shadow:0 1px 2px rgba(0,0,0,.025),0 8px 28px rgba(0,0,0,.035);
}
*{box-sizing:border-box}
html{background:var(--bg)}
body{
  margin:0;background:var(--bg);color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","SF Pro Display","PingFang SC","Microsoft YaHei",Arial,sans-serif;
  -webkit-font-smoothing:antialiased;
}
.wrap{max-width:1480px;margin:0 auto;padding:38px 28px 72px}
.hero{display:flex;justify-content:space-between;align-items:flex-end;gap:28px;margin-bottom:24px}
h1{font-size:34px;line-height:1.12;margin:0 0 10px;font-weight:760;letter-spacing:-.035em}
.subtitle{font-size:14px;line-height:1.7;color:var(--muted);max-width:850px}
.legend{display:flex;gap:7px;flex-wrap:wrap;justify-content:flex-end;padding-bottom:2px}
.legend span,.state-badge{
  display:inline-flex;align-items:center;justify-content:center;
  min-height:28px;padding:5px 10px;border-radius:999px;font-size:12px;font-weight:680;white-space:nowrap
}
.s-unbought{background:var(--redbg);color:var(--red)}
.s-ordered{background:var(--yellowbg);color:var(--yellow)}
.s-arrived{background:var(--greenbg);color:var(--green)}
.s-skip{background:var(--graybg);color:var(--gray)}
.s-confirm{background:var(--purplebg);color:var(--purple)}

.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-bottom:16px}
.stat{
  min-height:112px;background:var(--card);border:1px solid var(--line);
  border-radius:18px;padding:17px 18px;box-shadow:var(--shadow)
}
.stat .k{font-size:12px;color:var(--muted);margin-bottom:8px;font-weight:560}
.stat .v{font-size:28px;font-weight:760;letter-spacing:-.035em}
.progress{height:7px;background:#ececf0;border-radius:999px;margin-top:12px;overflow:hidden}
.progress>div{height:100%;background:var(--green);width:0;transition:width .25s ease}

.notice{
  background:rgba(255,255,255,.82);border:1px solid var(--line);border-radius:16px;
  padding:14px 17px;font-size:13px;line-height:1.7;margin-bottom:12px;
  box-shadow:0 1px 2px rgba(0,0,0,.018)
}
.notice strong{font-weight:720}

.toolbar{
  position:sticky;top:0;z-index:20;display:flex;gap:8px;align-items:center;flex-wrap:wrap;
  padding:12px 0;background:rgba(247,247,249,.88);backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px)
}
.search{flex:1;min-width:280px}
.control,button{
  height:42px;border:1px solid #dedfe3;background:#fff;border-radius:11px;padding:0 13px;
  font:inherit;color:var(--text);outline:none;transition:border-color .15s,box-shadow .15s,background .15s,transform .08s
}
.control:focus{border-color:#a9c9ee;box-shadow:0 0 0 3px rgba(0,113,227,.10)}
button{cursor:pointer;font-weight:640}
button:hover{background:#f8f8fa}
button:active{transform:translateY(1px)}
.primary{background:#1d1d1f;color:#fff;border-color:#1d1d1f}
.primary:hover{background:#323235}
.blue{background:var(--blue);color:#fff;border-color:var(--blue)}
.blue:hover{background:var(--blueHover)}

.table-card{
  margin-top:2px;background:#fff;border:1px solid var(--line);border-radius:18px;overflow:hidden;
  box-shadow:0 1px 2px rgba(0,0,0,.02),0 8px 24px rgba(0,0,0,.025)
}
.table-scroll{width:100%;overflow-x:auto;overflow-y:visible}
table{width:100%;border-collapse:separate;border-spacing:0;min-width:1220px}
th{
  position:static;
  font-size:11px;text-align:left;color:#7b7d83;font-weight:680;background:#fafafa;
  padding:13px 12px;border-bottom:1px solid var(--line);white-space:nowrap;
  height:44px;vertical-align:middle
}
td{
  font-size:13px;padding:14px 12px;border-bottom:1px solid var(--line2);
  vertical-align:middle;background:#fff;transition:background .15s;
  height:70px
}
tbody tr:hover td{background:#fbfbfc}
tbody tr:last-child td{border-bottom:none}
.row-arrived td{background:#fbfefc}
.row-arrived:hover td{background:#f7fcf8}
.row-arrived .item-name{color:#737a75}
.item-name{font-weight:710;line-height:1.4;color:#222326}
.small{font-size:11px;color:var(--muted);line-height:1.48;margin-top:4px;max-width:310px}
.source{
  display:inline-flex;align-items:center;font-size:10px;padding:4px 7px;background:#f5f5f7;
  border-radius:7px;color:#73767d;margin-top:6px
}

.status-select{
  min-width:100px;height:36px;border-radius:10px;padding:0 10px;font-size:12px;font-weight:700;
  outline:none;cursor:pointer
}
.status-select.s-unbought{border:1px solid var(--redline);background:var(--redbg);color:var(--red)}
.status-select.s-ordered{border:1px solid var(--yellowline);background:var(--yellowbg);color:var(--yellow)}
.status-select.s-arrived{border:1px solid var(--greenline);background:var(--greenbg);color:var(--green)}
.status-select.s-skip{border:1px solid var(--grayline);background:var(--graybg);color:var(--gray)}
.status-select.s-confirm{border:1px solid var(--purpleline);background:var(--purplebg);color:var(--purple)}

.check-wrap{display:flex;align-items:center;justify-content:center}
.check{
  appearance:none;-webkit-appearance:none;width:24px;height:24px;border:1.5px solid #b7bbc2;
  border-radius:7px;background:#fff;cursor:pointer;display:grid;place-content:center;
  transition:all .15s ease;margin:0
}
.check::before{
  content:"";width:10px;height:6px;border-left:2px solid white;border-bottom:2px solid white;
  transform:rotate(-45deg) scale(0);margin-top:-2px;transition:transform .12s ease
}
.check:checked{background:var(--green);border-color:var(--green);box-shadow:0 0 0 3px rgba(21,128,61,.09)}
.check:checked::before{transform:rotate(-45deg) scale(1)}
.check:hover{border-color:#7f858d}

.price{
  width:82px;height:36px;border:1px solid #dfe1e5;border-radius:10px;padding:0 9px;
  background:#fff;outline:none;transition:border-color .15s,box-shadow .15s
}
.price:focus{border-color:#a9c9ee;box-shadow:0 0 0 3px rgba(0,113,227,.09)}

.actions{display:flex;align-items:center;gap:7px;white-space:nowrap}
.action-btn{
  height:34px;min-width:58px;padding:0 11px;border-radius:9px;border:1px solid #e0e2e6;
  background:#fff;font-size:12px;font-weight:650;color:#45474d;display:inline-flex;align-items:center;justify-content:center
}
.action-btn:hover{background:#f5f5f7;border-color:#d5d7dc}
.action-btn.delete{color:#b42318}
.action-btn.delete:hover{background:#fff4f3;border-color:#ffd0cc}

.mobile{display:none}
.modal-backdrop{
  display:none;position:fixed;inset:0;background:rgba(16,18,22,.32);z-index:50;
  align-items:center;justify-content:center;padding:16px;backdrop-filter:blur(5px)
}
.modal-backdrop.show{display:flex}
.modal{
  background:#fff;border:1px solid rgba(0,0,0,.06);border-radius:22px;
  box-shadow:0 28px 80px rgba(0,0,0,.20);width:min(660px,100%);max-height:90vh;overflow:auto;padding:23px
}
.modal h2{font-size:22px;margin:0 0 18px;letter-spacing:-.02em}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:13px}
.field{display:flex;flex-direction:column;gap:7px}.field.full{grid-column:1/-1}
.field label{font-size:12px;color:var(--muted);font-weight:680}
.field input,.field select,.field textarea{
  width:100%;border:1px solid #dfe1e5;border-radius:11px;padding:10px 11px;font:inherit;outline:none;background:#fff
}
.field input:focus,.field select:focus,.field textarea:focus{border-color:#a9c9ee;box-shadow:0 0 0 3px rgba(0,113,227,.09)}
.field textarea{min-height:82px;resize:vertical}
.modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:18px}
.footer{font-size:11px;color:var(--muted);line-height:1.7;margin-top:15px;padding:0 2px}

@media(max-width:1080px){
  .wrap{padding:28px 18px 60px}
  .stats{grid-template-columns:repeat(2,1fr)}
  .hero{align-items:flex-start}
}
@media(max-width:930px){
  .wrap{padding:22px 13px 50px}
  .hero{display:block}.legend{justify-content:flex-start;margin-top:12px}
  h1{font-size:29px}.stats{grid-template-columns:1fr 1fr}.stat{min-height:100px}
  .table-card{display:none}.mobile{display:block}
  .toolbar{top:0}.search{min-width:100%;order:-1}
  .m-card{
    background:#fff;border:1px solid var(--line);border-radius:17px;margin-bottom:10px;
    padding:14px;box-shadow:0 1px 2px rgba(0,0,0,.018)
  }
  .m-card.row-arrived{background:#fbfefc}
  .m-top{display:flex;gap:10px;align-items:flex-start}.m-main{flex:1;min-width:0}
  .m-status{display:flex;gap:7px;align-items:center}
  .m-row{display:flex;justify-content:space-between;align-items:center;gap:12px;padding-top:10px;margin-top:10px;border-top:1px solid #f0f1f3;font-size:12px}
  .m-label{color:var(--muted)}.form-grid{grid-template-columns:1fr}
  .mobile-actions{display:flex;gap:7px}
}

thead{display:table-header-group}
thead tr{height:44px;background:#fafafa}
thead th{background:#fafafa!important}
tbody{position:relative}
tbody tr:first-child td{border-top:0}
.table-scroll{position:relative}
@media(min-width:931px){
  .table-card{overflow:hidden}
  .table-scroll{overflow-x:auto}
}

.sync-pill{display:inline-flex;align-items:center;gap:7px;height:34px;padding:0 11px;border-radius:999px;border:1px solid var(--line);background:#fff;font-size:12px;font-weight:650;color:var(--muted);white-space:nowrap}
.sync-dot{width:7px;height:7px;border-radius:50%;background:#9ca3af}
.sync-pill.ok{color:var(--green);background:var(--greenbg);border-color:var(--greenline)}
.sync-pill.ok .sync-dot{background:var(--green)}
.sync-pill.saving{color:var(--yellow);background:var(--yellowbg);border-color:var(--yellowline)}
.sync-pill.saving .sync-dot{background:var(--yellow)}
.sync-pill.error{color:var(--red);background:var(--redbg);border-color:var(--redline)}
.sync-pill.error .sync-dot{background:var(--red)}
