:root{
  --bg:#0f172a;
  --card:#111827;
  --muted:#94a3b8;
  --text:#e5e7eb;
  --line:#1f2937;
  --primary:#22c55e;
  --danger:#ef4444;
  --chip:#0b1220;
}
*{box-sizing:border-box}
body{
  margin:0;
  font-family:system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:linear-gradient(180deg, #0b1020, #0a0f1f);
  color:var(--text);
}
.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:14px 16px;
  border-bottom:1px solid var(--line);
  background:rgba(17,24,39,.85);
  backdrop-filter: blur(8px);
}
.brand-title{font-weight:800;font-size:18px}
.brand-sub{color:var(--muted);font-size:12px;margin-top:2px}
.userbox{display:flex;align-items:center;gap:10px}
.userbox-name{font-weight:700}
.userbox-role{color:var(--muted);font-size:12px}
.app{padding:12px}
.tabs{display:flex;gap:8px;margin:0 0 12px 0}
.tab{
  padding:10px 14px;
  border:1px solid var(--line);
  background:rgba(17,24,39,.6);
  color:var(--text);
  border-radius:10px;
  cursor:pointer;
  user-select:none;
}
.tab.active{border-color:rgba(34,197,94,.6); box-shadow:0 0 0 2px rgba(34,197,94,.15) inset}
.tabpage{display:none}
.tabpage.active{display:block}
.pos-grid{
  display:grid;
  grid-template-columns: 1.2fr 1.3fr 1fr;
  gap:12px;
  min-height: calc(100vh - 140px);
}
.panel{
  background:rgba(17,24,39,.65);
  border:1px solid var(--line);
  border-radius:14px;
  padding:12px;
  overflow:hidden;
}
.panel-title{font-weight:800;margin-bottom:10px}
.muted{color:var(--muted);font-weight:600;margin-left:8px;font-size:12px}
.category-bar{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-bottom:10px;
}
.chip{
  background:var(--chip);
  border:1px solid var(--line);
  color:var(--text);
  padding:10px 12px;
  border-radius:999px;
  cursor:pointer;
  user-select:none;
}
.chip.active{border-color:rgba(34,197,94,.6); box-shadow:0 0 0 2px rgba(34,197,94,.12) inset}
.product-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:10px;
}
.product{
  padding:14px 10px;
  border-radius:14px;
  background:rgba(11,18,32,.9);
  border:1px solid var(--line);
  cursor:pointer;
  user-select:none;
  min-height:62px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:4px;
}
.product .thumb{
  width:100%;
  height:80px;
  border-radius:12px;
  overflow:hidden;
  border:1px solid rgba(31,41,55,.7);
  background:rgba(17,24,39,.55);
}
.product .thumb img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.product .name{font-weight:800}
.product .price{color:var(--muted);font-size:12px}
.order-meta{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;gap:10px}
.toggle{display:flex;gap:8px;flex-wrap:wrap}
.order-items{
  border:1px solid var(--line);
  border-radius:12px;
  padding:8px;
  background:rgba(11,18,32,.75);
  height: calc(100vh - 390px);
  overflow:auto;
}
.order-row{
  display:grid;
  grid-template-columns: 1fr auto auto;
  gap:8px;
  align-items:center;
  padding:8px;
  border-bottom:1px dashed rgba(148,163,184,.25);
}
.order-row:last-child{border-bottom:none}
.order-row .title{font-weight:800}
.order-row .sub{color:var(--muted);font-size:12px}
.qtybox{display:flex;align-items:center;gap:6px}
.qtybtn{
  width:38px;height:38px;border-radius:10px;
  border:1px solid var(--line);
  background:rgba(17,24,39,.7);
  color:var(--text);
  cursor:pointer;
  font-weight:900;
}
.qtyval{min-width:28px;text-align:center;font-weight:800}
.lineamt{min-width:70px;text-align:right;font-weight:800}
.totals{
  margin-top:10px;
  border-top:1px solid var(--line);
  padding-top:10px;
}
.totals .row{display:flex;justify-content:space-between;align-items:center;margin:6px 0}
.totals .row.total{font-size:18px;font-weight:900}
.inline{display:flex;justify-content:flex-end}
.input{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:rgba(11,18,32,.85);
  color:var(--text);
}
.input.small{width:120px;text-align:right}
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:rgba(11,18,32,.85);
  color:var(--text);
  cursor:pointer;
  text-decoration:none;
  user-select:none;
}
.btn.primary{border-color:rgba(34,197,94,.7); background:rgba(34,197,94,.18)}
.btn.danger{border-color:rgba(239,68,68,.7); background:rgba(239,68,68,.15)}
.pay-row{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0}
.table-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:8px;
}
.table{
  padding:12px 10px;
  border-radius:12px;
  border:1px solid var(--line);
  background:rgba(11,18,32,.85);
  cursor:pointer;
  text-align:center;
  user-select:none;
  font-weight:800;
}
.table.available{outline:2px solid rgba(34,197,94,.22)}
.table.occupied{outline:2px solid rgba(239,68,68,.22)}
.msg{min-height:18px;color:var(--muted);font-size:12px}
.mt{margin-top:14px}
.history{background:rgba(17,24,39,.65);border:1px solid var(--line);border-radius:14px;padding:12px}
.history-top{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap}
.history-filters{display:flex;gap:8px;flex-wrap:wrap}
.history-list{margin-top:12px}
.history-row{
  display:grid;
  grid-template-columns: 1fr auto auto;
  gap:10px;
  align-items:center;
  padding:10px;
  border:1px solid rgba(31,41,55,.7);
  border-radius:12px;
  margin:8px 0;
  background:rgba(11,18,32,.75);
}
.history-row .meta{color:var(--muted);font-size:12px}
.manage{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:12px;
}
.manage-col{background:rgba(17,24,39,.65);border:1px solid var(--line);border-radius:14px;padding:12px}
.form{display:grid;gap:10px;margin-bottom:12px}
.field{display:grid;gap:6px}
.field span{color:var(--muted);font-size:12px}
.field.compact{grid-template-columns:1fr;gap:6px;width:100%}
.list{
  border:1px solid var(--line);
  border-radius:12px;
  background:rgba(11,18,32,.75);
  overflow:auto;
  max-height: 52vh;
}
.list-item{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:10px;
  border-bottom:1px dashed rgba(148,163,184,.25);
}
.list-item:last-child{border-bottom:none}
.login-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px}
.login-card{
  width:420px;
  background:rgba(17,24,39,.75);
  border:1px solid var(--line);
  border-radius:16px;
  padding:18px;
}
.login-title{font-size:22px;font-weight:900}
.login-subtitle{color:var(--muted);font-size:12px;margin:4px 0 12px}
.alert{background:rgba(239,68,68,.12);border:1px solid rgba(239,68,68,.35);padding:10px;border-radius:12px;margin:0 0 12px 0}
.login-hint{color:var(--muted);font-size:12px;margin-top:10px}

@media (max-width: 1100px){
  .pos-grid{grid-template-columns: 1fr; min-height:auto}
  .order-items{height:auto; max-height:42vh}
  .table-grid{grid-template-columns: repeat(4, minmax(0, 1fr))}
  .manage{grid-template-columns:1fr}
}
