:root{
  --bg:#f6f7fb;
  --card:#fff;
  --text:#0f172a;
  --muted:#64748b;
  --line:#e5e7eb;

  --primary:#2563eb;
  --danger:#dc2626;

  --ok:#16a34a;
  --warn:#f59e0b;
  --bad:#ef4444;

  --shadow:0 10px 30px rgba(15,23,42,.08);
  --radius:16px;
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial;
  color:var(--text);
  background: radial-gradient(1200px 500px at 50% -100px, rgba(37,99,235,.12), transparent 60%), var(--bg);
}

.topbar{
  position:sticky; top:0; z-index:10;
  background:rgba(255,255,255,.85);
  backdrop-filter:blur(12px);
  border-bottom:1px solid var(--line);
  padding:14px 16px;
  display:flex; align-items:center; justify-content:space-between; gap:12px;
}
.brandTitle{font-weight:800; font-size:14px}
.brandSub{font-weight:900; font-size:18px}
.topActions{display:flex; gap:10px}

.container{max-width:1100px; margin:0 auto; padding:18px 16px 60px}

.statusCard{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:12px 14px;
  margin-bottom:14px;
}
.statusRow{display:flex; align-items:center; justify-content:space-between; gap:12px}
.statusTitle{font-weight:900}
.statusText{color:var(--muted); font-size:13px; margin-top:2px}
.debugBox{
  margin:10px 0 0;
  padding:10px;
  background:#0b1220;
  color:#dbeafe;
  border-radius:12px;
  overflow:auto;
  max-height:260px;
}

.controls{display:flex; gap:12px; align-items:center; flex-wrap:wrap}
.field{display:flex; flex-direction:column; gap:6px}
.field.grow{flex:1; min-width:240px}
.label{font-size:12px; color:var(--muted)}
.input,.select{
  border:1px solid var(--line);
  background:#fff;
  border-radius:12px;
  padding:12px;
  min-height:44px;
  outline:none;
}
.input:focus,.select:focus{border-color:rgba(37,99,235,.5); box-shadow:0 0 0 4px rgba(37,99,235,.12)}

.hint{margin-top:10px; font-size:13px; color:var(--muted); min-height:18px}

.grid{
  margin-top:14px;
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:14px;
}
@media(max-width:980px){.grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:620px){.grid{grid-template-columns:1fr}}

.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:14px;
  box-shadow:var(--shadow);
}

.itemCard{display:flex; gap:12px; align-items:center; cursor:pointer; transition:transform .08s ease}
.itemCard:hover{transform:translateY(-1px)}
.thumb{
  width:60px; height:60px;
  border-radius:14px;
  border:1px solid var(--line);
  background:#f8fafc;
  overflow:hidden;
  display:flex; align-items:center; justify-content:center;
}
.thumb img{width:100%; height:100%; object-fit:cover}
.thumb span{font-size:12px; color:var(--muted)}
.itemInfo{flex:1; min-width:0}
.itemName{font-weight:900}
.itemSub{color:var(--muted); font-size:13px; margin-top:2px}
.itemMeta{color:var(--muted); font-size:12px; margin-top:6px}

.btn{
  border:1px solid var(--line);
  background:#fff;
  border-radius:12px;
  padding:10px 12px;
  min-height:44px;
  cursor:pointer;
  font-weight:800;
}
.btn.primary{background:var(--primary); color:#fff; border-color:rgba(37,99,235,.4)}
.btn.secondary{background:#f8fafc}
.btn.ghost{background:transparent}
.btn.danger{background:rgba(220,38,38,.1); border-color:rgba(220,38,38,.2); color:var(--danger)}
.hidden{display:none!important}

.pill{
  font-size:12px; font-weight:900;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  background:#fff;
  white-space:nowrap;
}
.pill.ok{color:var(--ok); border-color:rgba(22,163,74,.25); background:rgba(22,163,74,.08)}
.pill.warn{color:#b45309; border-color:rgba(245,158,11,.25); background:rgba(245,158,11,.12)}
.pill.bad{color:var(--danger); border-color:rgba(220,38,38,.25); background:rgba(220,38,38,.08)}

.detailTop{display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:12px}
.detailTitle{font-weight:900; font-size:18px}
.detailMeta{color:var(--muted); font-size:12px; margin-top:3px}
.detailTitleWrap{flex:1; min-width:0}

.detailLayout{display:grid; grid-template-columns:360px 1fr; gap:14px}
@media(max-width:980px){.detailLayout{grid-template-columns:1fr}}

.imageBox{
  width:100%; height:240px;
  border:1px solid var(--line);
  border-radius:16px;
  overflow:hidden;
  background:#f8fafc;
  display:flex; align-items:center; justify-content:center;
}
.image{width:100%; height:100%; object-fit:cover}
.noImage{color:var(--muted); font-weight:900}
.smallHint{font-size:12px; color:var(--muted); margin-top:8px; min-height:16px}

.formGrid{display:grid; grid-template-columns:1fr 1fr; gap:12px}
.formGrid .span2{grid-column:span 2}
@media(max-width:620px){.formGrid{grid-template-columns:1fr}.formGrid .span2{grid-column:auto}}

.row{display:flex; align-items:center}
.row.right{justify-content:flex-end}
.gap{gap:10px}

.divider{height:1px; background:var(--line); margin:14px 0}
.stockBox{display:flex; align-items:center; gap:10px}
.stockLabel{color:var(--muted); font-size:12px; font-weight:900}
.stockValue{font-size:28px; font-weight:900}
.deltaRow{display:flex; flex-wrap:wrap; gap:8px}
.sectionTitle{font-weight:900; margin:10px 0 8px}
.qrBox{border:1px solid var(--line); background:#fff; border-radius:14px; padding:10px}
.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New"; font-size:12px}

.modal{
  position:fixed; inset:0;
  background:rgba(15,23,42,.35);
  display:flex; align-items:center; justify-content:center;
  padding:16px; z-index:50;
}
.modalCard{
  width:min(760px,100%);
  background:#fff;
  border:1px solid var(--line);
  border-radius:18px;
  padding:14px;
  box-shadow:var(--shadow);
}
.modalCard.small{width:min(420px,100%)}
.modalTitle{font-weight:900; font-size:16px; margin-bottom:8px}

.toast{
  position:fixed; left:50%; bottom:18px;
  transform:translateX(-50%);
  background:rgba(15,23,42,.9);
  color:#fff;
  padding:10px 12px;
  border-radius:999px;
  font-weight:900;
  z-index:60;
}
