@font-face {
  font-family: Vazirmatn;
  src: url('./Vazirmatn-Regular.woff2') format('woff2');
  font-display: swap;
}
:root {
  font-family: Vazirmatn, Tahoma, sans-serif;
  color: #281f32;
  background: #f6f4f9;
  --purple: #6740aa;
  --purple-dark: #4b2788;
  --ink: #281f32;
  --muted: #685e75;
  --line: #e8e1ef;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
body { margin: 0; min-height: 100vh; }
button, input, select { font: inherit; }
button { cursor: pointer; border: 0; border-radius: .75rem; }
button:disabled { cursor: default; opacity: .48; }
:focus-visible { outline: 3px solid #a87bef; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.7rem, 3vw, 2.45rem); line-height: 1.4; }
h2 { font-size: 1.12rem; }
input, select { min-width: 0; width: 100%; padding: .67rem .8rem; border: 1px solid #dcd3e6; border-radius: .65rem; background: #fff; color: var(--ink); }
label { display: grid; gap: .38rem; }
.topbar { background: #261637; color: #fff; display: flex; align-items: center; justify-content: space-between; padding: .85rem clamp(1rem, 4vw, 3.5rem); gap: 1rem; min-height: 66px; }
.brand, .top-actions, #connection { display: flex; align-items: center; gap: .65rem; }
.brand { flex-shrink: 0; }
.brand-icon { display: grid; place-items: center; background: #7951ba; border-radius: .65rem; width: 2rem; height: 2rem; font-size: 1.4rem; }
.top-actions { flex-wrap: wrap; font-size: .88rem; }
#connection i { width: .56rem; height: .56rem; border-radius: 50%; background: #f5bb78; }
#connection.online i { background: #68d9a6; }
.quiet { background: #422951; color: #fff; padding: .35rem .7rem; }
main { max-width: 1480px; margin: auto; padding: 1.75rem clamp(1rem, 4vw, 3.5rem) 2.5rem; }
.heading { display: flex; justify-content: space-between; align-items: end; gap: .75rem; margin-bottom: 1.35rem; }
.eyebrow { color: #593490; font-size: .95rem; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 1.15rem; box-shadow: 0 8px 26px #33195508; }
.primary, .outline, .danger { padding: .65rem 1rem; }
.primary { background: var(--purple); color: #fff; font-weight: bold; }
.primary:hover:enabled { background: var(--purple-dark); }
.outline { background: #fff; color: var(--purple-dark); border: 1px solid #ded2ee; }
.outline:hover:enabled { background: #f3ecfd; }
.danger { background: #f9e9ee; color: #902c4e; }
.login-view { display: grid; place-items: center; padding: min(9vh, 6rem) 0; }
.login { width: min(100%, 410px); display: grid; padding: 2rem; gap: 1rem; }
.login h1 { margin-bottom: .35rem; }
.pos-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(315px, .56fr); gap: 1.2rem; align-items: start; }
.search { display: flex; align-items: center; position: relative; }
.search span { position: absolute; inset-inline-start: .85rem; color: #6740aa; font-size: 1.7rem; line-height: 1; pointer-events: none; }
.search input { padding-inline-start: 2.5rem; }
.tabs { display: flex; flex-wrap: wrap; gap: .5rem; padding: .8rem 0; }
.tabs button { color: var(--muted); background: #fff; border: 1px solid var(--line); padding: .4rem .8rem; }
.tabs button[aria-pressed="true"] { color: #4b2788; background: #ebe0fc; border-color: #dfcdf8; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: .7rem; }
.product { color: var(--ink); background: #fff; border: 1px solid #e8e1ef; border-top: 3px solid #75b6a7; min-height: 126px; padding: .75rem; text-align: start; display: flex; flex-direction: column; justify-content: space-between; gap: .35rem; }
.product.service { border-top-color: #a17bd7; }
.product:hover:enabled { background: #fcfaff; border-inline-color: #b69bd9; }
.product small { color: var(--muted); font-size: .85rem; }
.product strong { font-size: 1rem; }
.price { color: var(--purple-dark); font-weight: bold; white-space: nowrap; }
.cart { position: sticky; top: .8rem; display: grid; grid-template-rows: auto minmax(200px, 1fr) auto; min-height: 470px; }
.cart header, .cart footer { padding: 1rem; }
.cart header { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); }
.cart footer { background: #faf8fd; border-radius: 0 0 1.15rem 1.15rem; border-top: 1px solid var(--line); }
.cart footer button { width: 100%; }
.cart-total { display: flex; justify-content: space-between; align-items: center; gap: .4rem; margin-bottom: .7rem; }
.cart-total strong { font-size: 1.15rem; }
.cart-lines { padding: 0 1rem; max-height: 52vh; overflow-y: auto; }
.line { padding: .68rem 0; display: grid; gap: .45rem; border-bottom: 1px solid var(--line); }
.line > div { display: flex; align-items: center; justify-content: space-between; gap: .42rem; }
.line input { width: 5rem; padding: .23rem .4rem; text-align: center; }
.remove { color: #8e3156; background: #faedf2; padding: .26rem .55rem; }
.empty { color: var(--muted); padding: 1.25rem 0; }
.muted { color: var(--muted); font-size: .9rem; }
#notice { padding: .7rem 1rem; text-align: center; color: #355446; background: #e7f6ec; }
#notice.error, .form-error { color: #8b2246; background: #fcebf0; }
dialog { color: var(--ink); border: 1px solid var(--line); border-radius: 1rem; width: min(510px, calc(100% - 1.5rem)); max-height: 85vh; padding: 1.2rem; }
dialog::backdrop { background: #21143199; }
.dialog-head, .button-row { display: flex; justify-content: space-between; align-items: center; gap: .55rem; }
.dialog-head { margin-bottom: 1rem; }
.form-grid, .receipt, .history-list { display: grid; gap: .85rem; }
.form-error { padding: .5rem .7rem; border-radius: .5rem; }
.history-list button { display: flex; justify-content: space-between; gap: .5rem; text-align: start; }
.receipt-row { display: flex; justify-content: space-between; gap: .8rem; border-bottom: 1px dashed #bbafcb; padding-bottom: .4rem; }
.admin-content { padding: 1.2rem; min-height: 250px; overflow-x: auto; }
.admin-head { display: flex; justify-content: space-between; gap: .7rem; align-items: center; margin-bottom: 1rem; }
.admin-head label { width: max-content; }
table { width: 100%; border-collapse: collapse; text-align: start; }
td, th { text-align: start; padding: .6rem; border-bottom: 1px solid var(--line); }
th { background: #f4effa; color: #4b3663; }
td .outline, td .danger { padding: .3rem .6rem; margin-block: .15rem; }
.metrics { display: flex; flex-wrap: wrap; gap: .65rem; margin-bottom: 1rem; }
.metric { background: #f6f0fc; padding: .6rem 1rem; border-radius: .65rem; display: grid; gap: .2rem; }
#receipt-print { display: none; }
@media (max-width: 800px) {
  .pos-grid { grid-template-columns: 1fr; }
  .cart { position: static; min-height: 330px; }
  .cart-lines { max-height: none; }
}
@media (max-width: 520px) {
  .topbar { align-items: start; flex-direction: column; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media print {
  body { background: #fff; color: #000; }
  body > :not(#receipt-print) { display: none !important; }
  #receipt-print { display: block; width: 100%; max-width: 78mm; margin-inline: auto; }
}
