:root{
  --brown-900:#2b1a12;
  --brown-800:#3d2417;
  --brown-700:#5a331f;
  --amber-500:#e2a13a;
  --amber-600:#c9871f;
  --green-600:#3f7d3a;
  --red-600:#c0392b;
  --cream:#fbf6ee;
  --card:#ffffff;
  --ink:#2b2118;
  --muted:#8a7a6b;
  --radius:14px;
  --shadow:0 6px 20px rgba(43,26,18,.08);
}
*{box-sizing:border-box}
body{
  margin:0;
  font-family:'Segoe UI',system-ui,-apple-system,sans-serif;
  background:var(--cream);
  color:var(--ink);
}
a{text-decoration:none;color:inherit}

/* ---------- Layout ---------- */
.app-shell{display:flex;min-height:100vh}
.sidebar{
  width:250px;flex-shrink:0;
  background:linear-gradient(180deg,var(--brown-900),var(--brown-800));
  color:#f2e6d8;
  padding:24px 0;
  position:sticky;top:0;height:100vh;overflow-y:auto;
}
.sidebar .brand{
  display:flex;align-items:center;gap:10px;
  padding:0 22px 22px;border-bottom:1px solid rgba(255,255,255,.08);margin-bottom:14px;
}
.sidebar .brand .logo{
  width:42px;height:42px;border-radius:50%;
  background:var(--amber-500);color:var(--brown-900);
  display:flex;align-items:center;justify-content:center;font-weight:800;font-size:18px;
  flex-shrink:0;
}
.sidebar .brand .logo-img{
  object-fit:contain;background:#fff;padding:3px;
}
.sidebar .brand h1{font-size:16px;margin:0;letter-spacing:.5px}
.sidebar .brand span{display:block;font-size:11px;color:#cbb79f}
.sidebar nav a{
  display:flex;align-items:center;gap:10px;
  padding:11px 22px;font-size:14px;color:#e8d9c6;
  border-left:3px solid transparent;
}
.nav-icon{width:18px;height:18px;flex-shrink:0;stroke:currentColor}
.sidebar nav a:hover,.sidebar nav a.active{
  background:rgba(255,255,255,.06);
  border-left-color:var(--amber-500);
  color:#fff;
}
.sidebar nav .section-title{
  font-size:11px;text-transform:uppercase;letter-spacing:1px;
  color:#a08a70;padding:16px 22px 4px;
}
.main{flex:1;min-width:0}
.topbar{
  display:flex;align-items:center;justify-content:space-between;
  padding:16px 28px;background:var(--card);border-bottom:1px solid #eee2d2;
  position:sticky;top:0;z-index:5;
}
.topbar h2{margin:0;font-size:20px}
.topbar .user-chip{
  display:flex;align-items:center;gap:10px;font-size:14px;color:var(--muted);
}
.topbar .user-chip b{color:var(--ink)}
.content{padding:26px 28px 60px}

/* ---------- Cards / grid ---------- */
.grid{display:grid;gap:18px}
.grid.cols-4{grid-template-columns:repeat(4,1fr)}
.grid.cols-3{grid-template-columns:repeat(3,1fr)}
.grid.cols-2{grid-template-columns:repeat(2,1fr)}
@media(max-width:1100px){.grid.cols-4{grid-template-columns:repeat(2,1fr)}.grid.cols-3{grid-template-columns:repeat(2,1fr)}}
@media(max-width:700px){.grid.cols-4,.grid.cols-3,.grid.cols-2{grid-template-columns:1fr}.sidebar{display:none}}

.card{
  background:var(--card);border-radius:var(--radius);
  box-shadow:var(--shadow);padding:20px;border:1px solid #f1e6d6;
}
.stat-card{position:relative;overflow:hidden}
.stat-card .icon{
  width:44px;height:44px;border-radius:12px;display:flex;align-items:center;justify-content:center;
  font-size:20px;margin-bottom:10px;
}
.stat-card .icon svg{width:22px;height:22px;stroke:currentColor}
.icon-inline{width:16px;height:16px;stroke:currentColor;vertical-align:-3px;margin-right:2px}
h3 .icon-inline{width:18px;height:18px;vertical-align:-3px}
.stat-card .value{font-size:26px;font-weight:800;margin:2px 0}
.stat-card .label{font-size:13px;color:var(--muted)}
.bg-amber{background:#fbe8c8;color:var(--amber-600)}
.bg-green{background:#dcf0da;color:var(--green-600)}
.bg-brown{background:#ecdcca;color:var(--brown-700)}
.bg-red{background:#f8d9d4;color:var(--red-600)}

.card h3{margin-top:0}

.pwa-install-banner{
  position:fixed;left:16px;right:16px;bottom:16px;z-index:1000;max-width:520px;margin:0 auto;
  background:var(--brown-900);color:#fff;border-radius:14px;
  padding:14px 16px;box-shadow:0 8px 24px rgba(0,0,0,.25);
  display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;
}
.pwa-install-banner span{font-size:13.5px;line-height:1.4}
.pwa-install-actions{display:flex;gap:8px;flex-shrink:0}
@media(max-width:500px){.pwa-install-banner{flex-direction:column;align-items:stretch;text-align:center}}

/* ---------- Buttons ---------- */
.btn{
  display:inline-flex;align-items:center;gap:6px;
  padding:10px 18px;border-radius:10px;border:none;cursor:pointer;
  font-size:14px;font-weight:600;transition:.15s;
}
.btn-primary{background:var(--amber-500);color:#2b1a12}
.btn-primary:hover{background:var(--amber-600)}
.btn-outline{background:transparent;border:1px solid #d9c6ab;color:var(--brown-700)}
.btn-outline:hover{background:#f5ead9}
.btn-danger{background:var(--red-600);color:#fff}
.btn-green{background:var(--green-600);color:#fff}
.btn-sm{padding:6px 12px;font-size:12.5px}
.btn:disabled{opacity:.5;cursor:not-allowed}

/* ---------- Forms ---------- */
label{font-size:13px;font-weight:600;color:var(--brown-700);display:block;margin-bottom:6px}
input,select,textarea{
  width:100%;padding:10px 12px;border-radius:9px;border:1px solid #e2d5c2;
  background:#fffdf9;font-size:14px;margin-bottom:14px;
}
input:focus,select:focus,textarea:focus{outline:2px solid var(--amber-500);border-color:transparent}
.form-row{display:flex;gap:14px}
.form-row > div{flex:1}

/* ---------- Tables ---------- */
table{width:100%;border-collapse:collapse;font-size:14px}
thead th{
  text-align:left;padding:10px 12px;background:#f7ede0;color:var(--brown-700);
  font-size:12.5px;text-transform:uppercase;letter-spacing:.4px;
}
tbody td{padding:10px 12px;border-bottom:1px solid #f1e6d6}
tbody tr:hover{background:#fdf7ef}
.badge{padding:3px 10px;border-radius:20px;font-size:12px;font-weight:700}
.badge-green{background:#dcf0da;color:var(--green-600)}
.badge-red{background:#f8d9d4;color:var(--red-600)}
.badge-amber{background:#fbe8c8;color:var(--amber-600)}

/* ---------- Login page ---------- */
.login-wrap{
  min-height:100vh;display:flex;align-items:center;justify-content:center;
  background:
    linear-gradient(180deg,rgba(20,12,7,.55),rgba(20,12,7,.75)),
    url('login-bg.png') center/cover no-repeat fixed;
  padding:20px;
}
.login-card{
  width:100%;max-width:380px;background:rgba(255,255,255,.12);border-radius:20px;
  padding:34px 32px;box-shadow:0 8px 40px rgba(0,0,0,.4);text-align:center;
  border:1px solid rgba(255,255,255,.3);
  backdrop-filter:blur(18px) saturate(160%);
  -webkit-backdrop-filter:blur(18px) saturate(160%);
}
.login-card .logo{
  width:66px;height:66px;border-radius:50%;margin:0 auto 12px;
  background:var(--amber-500);display:flex;align-items:center;justify-content:center;
  font-weight:800;font-size:26px;color:var(--brown-900);
}
.login-card .logo-img{
  object-fit:contain;background:#fff;padding:4px;box-shadow:0 0 0 1px #e2d5c2;
}
.login-card h1{margin:0 0 4px;font-size:20px;color:#fff}
.login-card p.tag{color:rgba(255,255,255,.75);font-size:13px;margin-bottom:22px}
.login-card label{color:rgba(255,255,255,.85)}
.login-card input{
  background:rgba(255,255,255,.15);border:1px solid rgba(255,255,255,.35);color:#fff;
}
.login-card input::placeholder{color:rgba(255,255,255,.55)}
.login-card input:focus{outline:2px solid var(--amber-500);border-color:transparent;background:rgba(255,255,255,.22)}
.login-card .text-muted{color:rgba(255,255,255,.65)}
.error-box{
  background:rgba(248,217,212,.9);color:var(--red-600);padding:10px 14px;border-radius:8px;
  font-size:13px;margin-bottom:14px;text-align:left;
}

/* ---------- POS ---------- */
.pos-wrap{display:grid;grid-template-columns:1fr 380px;gap:20px;align-items:start}
@media(max-width:1000px){.pos-wrap{grid-template-columns:1fr}}
.menu-tabs{display:flex;gap:8px;margin-bottom:16px;flex-wrap:wrap}
.menu-tabs button{
  padding:8px 16px;border-radius:20px;border:1px solid #e2d5c2;background:#fff;cursor:pointer;font-weight:600;font-size:13px;
}
.menu-tabs button.active{background:var(--brown-800);color:#fff;border-color:var(--brown-800)}
.item-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:14px}
.item-card{
  background:#fff;border:1px solid #f1e6d6;border-radius:12px;padding:16px;cursor:pointer;
  text-align:center;transition:.15s;
}
.item-card:hover{border-color:var(--amber-500);transform:translateY(-2px);box-shadow:var(--shadow)}
.item-card .name{font-weight:700;font-size:14px;margin-bottom:6px}
.item-card .price{color:var(--amber-600);font-weight:800}
.cart{position:sticky;top:90px}
.cart-line{display:flex;justify-content:space-between;align-items:center;padding:8px 0;border-bottom:1px dashed #eadfcd;font-size:14px}
.cart-line .qty-ctrl{display:flex;align-items:center;gap:6px}
.cart-line .qty-ctrl button{width:24px;height:24px;border-radius:6px;border:1px solid #e2d5c2;background:#fff;cursor:pointer}
.cart-total-row{display:flex;justify-content:space-between;font-size:15px;padding:6px 0}
.cart-total-row.grand{font-size:19px;font-weight:800;border-top:2px solid var(--brown-800);margin-top:8px;padding-top:12px}
.order-type-toggle{display:flex;gap:8px;margin-bottom:16px}
.order-type-toggle button{flex:1;padding:10px;border-radius:10px;border:1px solid #e2d5c2;background:#fff;cursor:pointer;font-weight:700}
.order-type-toggle button.active{background:var(--green-600);color:#fff;border-color:var(--green-600)}

/* ---------- Receipt (print) ---------- */
.receipt{
  width:80mm;margin:0 auto;
  font-family:'Segoe UI',system-ui,-apple-system,sans-serif;font-size:12.5px;color:#1c130c;
  background:#fff;border-radius:10px;overflow:hidden;box-shadow:0 2px 14px rgba(0,0,0,.12);
  -webkit-print-color-adjust:exact;print-color-adjust:exact;color-adjust:exact;
}
.receipt-brand{
  text-align:center;padding:14px 10px 12px;
  background:linear-gradient(160deg,var(--brown-900),var(--brown-700) 120%);
}
.receipt-logo{
  width:64px;height:64px;object-fit:contain;border-radius:50%;
  margin:0 auto 10px;display:block;background:#fff;padding:4px;
  box-shadow:0 0 0 2px var(--amber-500);
}
.receipt-logo-fallback{
  width:64px;height:64px;border-radius:50%;margin:0 auto 10px;
  background:var(--amber-500);color:var(--brown-900);
  display:flex;align-items:center;justify-content:center;
  font-weight:800;font-size:22px;letter-spacing:.5px;
  box-shadow:0 0 0 2px rgba(255,255,255,.5);
}
.receipt-brand h2{
  margin:0;font-size:18px;letter-spacing:1.5px;text-transform:uppercase;
  color:#fff;font-weight:800;
}
.receipt-sub{margin:5px 0 0;font-size:11px;color:var(--amber-500);text-align:center;font-weight:600}
.receipt-body{padding:12px 12px 14px}
.receipt-divider{
  border-top:1px dashed #d9c6a8;margin:12px 0;
}
.receipt-meta{width:100%;border-collapse:collapse;font-size:11.5px}
.receipt-meta td{padding:2px 0;color:#4a3a2c}
.receipt-meta td:first-child{color:var(--muted);width:70px}
.receipt-meta td:last-child{text-align:right;font-weight:600}
.receipt-items{width:100%;border-collapse:collapse;font-size:12px}
.receipt-items thead th{
  text-align:left;font-size:10.5px;text-transform:uppercase;letter-spacing:.5px;
  color:#fff;background:var(--amber-600);padding:6px 6px;font-weight:700;
}
.receipt-items thead th:first-child{border-radius:6px 0 0 6px}
.receipt-items thead th:last-child{border-radius:0 6px 6px 0}
.receipt-items tbody tr:nth-child(even){background:#fbf3e6}
.receipt-items td{padding:6px;vertical-align:top}
.receipt-items .ri-qty{text-align:center;width:34px}
.receipt-items .ri-amt{text-align:right;white-space:nowrap;font-weight:600;color:var(--brown-800)}
.receipt-items thead .ri-qty{text-align:center}
.receipt-items thead .ri-amt{text-align:right}
.receipt-totals{width:100%;border-collapse:collapse;font-size:12.5px}
.receipt-totals td{padding:3px 0;color:#4a3a2c}
.receipt-totals td:last-child{text-align:right;font-weight:600}
.receipt-totals .receipt-grand td{
  font-size:17px;font-weight:800;color:var(--brown-900);
}
.receipt-totals .receipt-grand{
  background:var(--amber-500);
}
.receipt-totals .receipt-grand td:first-child{padding:8px 0 8px 10px;border-radius:8px 0 0 8px}
.receipt-totals .receipt-grand td:last-child{padding:8px 10px 8px 0;border-radius:0 8px 8px 0}
.receipt-thanks{
  text-align:center;font-style:italic;font-weight:700;margin:14px 0 2px;color:var(--brown-800);
}
.receipt-footnote{text-align:center;font-size:10px;color:var(--muted);margin:0}
.receipt-qr-wrap{text-align:center;margin-top:14px}
.receipt-qr{
  width:104px;height:104px;padding:6px;background:#fff;border-radius:10px;
  border:3px solid var(--amber-500);
}
.receipt-qr-caption{font-size:10.5px;font-weight:700;color:var(--brown-800);margin:8px 0 1px}
.receipt-qr-url{font-size:9.5px;color:var(--muted);margin:0}
@media print{
  body *{visibility:hidden}
  .receipt,.receipt *{visibility:visible}
  .receipt{position:absolute;left:0;top:0;width:80mm;margin:0;box-shadow:none;border-radius:0}
}

.text-muted{color:var(--muted)}
.mt-0{margin-top:0}
.flex-between{display:flex;justify-content:space-between;align-items:center}
