:root{
  --bg:#f6f7fb;
  --panel:#ffffff;
  --text:#0f172a;
  --muted:#475569;
  --line:rgba(15,23,42,.12);
  --accent:#0ea5e9;
  --green:#22c55e;
  --danger:#ef4444;
  --shadow:0 10px 30px rgba(2,6,23,.10);
  --radius:18px;
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
}
.hidden{display:none!important}

.wrap{
  max-width:1200px;
  margin:0 auto;
  padding:16px;
}

.header{
  position:sticky;
  top:0;
  z-index:20;
  background:rgba(246,247,251,.94);
  backdrop-filter:blur(10px);
  border-bottom:1px solid var(--line);
}
.header-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
}
.brand{
  margin:0;
  font-size:28px;
}
.sub{
  margin:4px 0 0;
  color:var(--muted);
}

.toolbar,
.statusbar,
.panel,
.fallback,
.card,
.dialog{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}

.toolbar{
  display:flex;
  gap:12px;
  align-items:center;
  padding:14px;
  margin-bottom:14px;
  flex-wrap:wrap;
}
.search,
.select,
textarea{
  width:100%;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--line);
  font:inherit;
  background:#fff;
}
.search{flex:1; min-width:260px}
.select{max-width:260px}

.statusbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 14px;
  margin-bottom:14px;
  color:var(--muted);
  font-weight:700;
  flex-wrap:wrap;
}

.layout{
  display:grid;
  grid-template-columns:1fr 320px;
  gap:16px;
}
@media (max-width:980px){
  .layout{grid-template-columns:1fr}
}

.grid{
  display:grid;
  grid-template-columns:repeat(4, minmax(0,1fr));
  gap:14px;
}
@media (max-width:1100px){
  .grid{grid-template-columns:repeat(3, minmax(0,1fr))}
}
@media (max-width:760px){
  .grid{grid-template-columns:repeat(2, minmax(0,1fr))}
}
@media (max-width:520px){
  .grid{grid-template-columns:1fr}
}

.card{
  overflow:hidden;
  display:flex;
  flex-direction:column;
}
.card-image{
  aspect-ratio:1/1;
  background:#f8fafc;
  display:flex;
  align-items:center;
  justify-content:center;
  border-bottom:1px solid var(--line);
}
.card-image img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
}
.card-body{
  padding:12px;
  display:flex;
  flex-direction:column;
  gap:10px;
}
.card-title{
  font-size:15px;
  font-weight:900;
  line-height:1.2;
  min-height:38px;
}
.card-meta{
  color:var(--muted);
  font-size:13px;
}
.card-price{
  font-size:18px;
  font-weight:1000;
  color:var(--accent);
}

.card-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.panel{
  padding:16px;
  min-height:220px;
}
.panel h2{
  margin-top:0;
}
.details-empty{
  color:var(--muted);
}
.details-box{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.details-box p{
  margin:0;
  line-height:1.4;
}

.pager{
  display:flex;
  gap:10px;
  justify-content:center;
  padding:18px 0;
}

.btn{
  border:1px solid var(--line);
  background:#fff;
  color:var(--text);
  border-radius:14px;
  padding:10px 14px;
  font:inherit;
  font-weight:800;
  cursor:pointer;
}
.btn:hover{filter:brightness(.98)}
.btn:disabled{
  opacity:.5;
  cursor:not-allowed;
}
.btn-dark{
  background:#0b1220;
  color:#fff;
  border-color:#0b1220;
}
.btn-green{
  background:var(--green);
  color:#06240f;
  border-color:rgba(6,36,15,.12);
}

.fallback{
  padding:20px;
}

.dialog{
  width:min(760px, 92vw);
  padding:0;
}
.dialog::backdrop{
  background:rgba(0,0,0,.42);
}
.dialog-head,
.dialog-foot{
  padding:14px 16px;
  border-bottom:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.dialog-foot{
  border-bottom:none;
  border-top:1px solid var(--line);
}
.dialog-body{
  padding:16px;
  max-height:65vh;
  overflow:auto;
}

.cart-item{
  display:grid;
  grid-template-columns:72px 1fr auto;
  gap:12px;
  align-items:center;
  padding:12px 0;
  border-bottom:1px solid var(--line);
}
.cart-item img{
  width:72px;
  height:72px;
  object-fit:contain;
  background:#fff;
  border:1px solid var(--line);
  border-radius:12px;
}
.cart-item-title{
  font-weight:800;
}
.cart-item-meta{
  font-size:13px;
  color:var(--muted);
}
.cart-item-right{
  display:flex;
  flex-direction:column;
  gap:8px;
  align-items:flex-end;
}
.qty-box{
  display:flex;
  align-items:center;
  gap:8px;
}
.qty-btn{
  width:32px;
  height:32px;
  border-radius:10px;
  border:1px solid var(--line);
  background:#fff;
  font-weight:900;
  cursor:pointer;
}
.cart-note-box{
  margin-top:16px;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.dialog-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.empty{
  padding:18px;
  text-align:center;
  color:var(--muted);
}