@font-face {
  font-family: Vazirmatn;
  src: url("../vendor/Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
:root {
  --ivory: #f8f6ef;
  --surface: #fffefa;
  --soft: #f4f0e5;
  --ink: #27251f;
  --muted: #6e6759;
  --line: #e6e0d3;
  --charcoal: #23231f;
  --gold: #dec17d;
  --gold-hover: #e8c985;
  --gold-ink: #694d1e;
  --green: #285e48;
  --radius: 14px;
  --rail: 244px;
  --mobile-nav: 66px;
  font-family: Vazirmatn, system-ui, sans-serif;
  background: var(--ivory);
  color: var(--ink);
  line-height: 1.6;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
img { display: block; max-width: 100%; }
p, h1, h2, h3 { margin: 0; }
h1 { font-size: clamp(1.65rem, 3vw, 2.35rem); font-weight: 780; line-height: 1.25; letter-spacing: -.024em; }
h2 { font-size: 1.15rem; font-weight: 760; }
h3 { font-size: 1rem; font-weight: 740; }
small, .muted { color: var(--muted); }
[hidden] { display: none !important; }
.icon { display: inline-block; width: 20px; height: 20px; flex: 0 0 auto; vertical-align: middle; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: fixed; z-index: 20; inset: 10px 10px auto auto; background: var(--surface); padding: 8px 16px; border: 1px solid var(--ink); }
:focus-visible { outline: 3px solid #a27329; outline-offset: 3px; }
.nowrap { white-space: nowrap; }
.code { direction: ltr; unicode-bidi: isolate; display: inline-block; font: 600 .82rem/1.5 ui-monospace, monospace; letter-spacing: .025em; color: #6f5529; }
.code.prominent { font-size: 1rem; }
.back, .text-link { color: var(--gold-ink); font-weight: 690; }
.back { display: inline-block; margin-block-end: 9px; font-size: .9rem; }
.text-link:hover, .back:hover { text-decoration: underline; }
button.text-link { background: none; border: 0; padding: 0; }
.rail { position: fixed; inset: 0 0 0 auto; width: var(--rail); background: var(--charcoal); color: #f7f4e9; display: flex; flex-direction: column; padding: 29px 17px 17px; z-index: 5; }
.brand { display: flex; align-items: center; gap: 12px; margin: 0 8px 39px; }
.brand strong { display: block; font-size: 1.48rem; line-height: 1.2; font-weight: 790; }
.brand small { display: block; color: #bdb5a5; margin-block-start: 5px; font-size: .75rem; }
.brand-mark { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 1px solid #77633c; color: #f0d79d; background: #393225; border-radius: 13px; flex: 0 0 auto; }
.brand-mark .icon { width: 26px; height: 26px; }
.nav { display: grid; gap: 5px; }
.nav a { position: relative; color: #ded7c8; display: flex; align-items: center; gap: 11px; min-height: 47px; padding: 10px 12px; border: 1px solid transparent; border-radius: 9px; font-size: .875rem; font-weight: 600; }
.nav a:hover, .nav a.active { color: #f4da9c; background: #3a3429; border-color: #504535; }
.nav a.active::before { content: ""; width: 3px; height: 22px; border-radius: 3px; background: #ddbc72; position: absolute; inset-inline-start: -1px; }
.rail-footer { margin-block-start: auto; border-top: 1px solid #454138; display: flex; justify-content: space-between; gap: 5px; align-items: center; padding: 14px 7px 0; overflow-wrap: anywhere; }
.rail-footer strong { font-size: .875rem; }
.rail-footer small { display: block; color: #beb6a7; font-size: .72rem; }
.rail-footer .icon-button { color: #ded7c8; }
.workspace { margin-inline-start: var(--rail); min-height: 100vh; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 62px; padding: 8px clamp(20px, 4vw, 56px); background: #fbfaf5; border-bottom: 1px solid var(--line); }
.top-section { font-size: .84rem; color: var(--muted); font-weight: 650; }
.top-tools { display: flex; align-items: center; gap: 12px; }
.top-search { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.top-search input { border: 0; border-radius: 8px; width: 125px; min-height: 34px; padding: 4px 0 4px 8px; font-size: .82rem; }
.mobile-brand, .mobile-logout { display: none; }
.main { max-width: 1520px; margin: auto; padding: 36px clamp(20px, 4vw, 56px) 45px; }
.heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-block-end: 24px; }
.heading p { color: var(--muted); margin-block-start: 8px; font-size: .95rem; }
.heading .prominent { margin-block-start: 8px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; max-width: 100%; padding: 8px 14px; border: 1px solid transparent; border-radius: 8px; font-weight: 735; font-size: .86rem; line-height: 1.35; text-align: center; }
.button.primary { color: #322710; background: var(--gold); border-color: #c6a962; }
.button.primary:hover:not(:disabled) { background: var(--gold-hover); }
.button.secondary { background: var(--surface); border-color: #ded6c4; }
.button.secondary:hover { background: var(--soft); border-color: #cbbf9f; }
.button.quiet { background: #f7f2e7; color: var(--gold-ink); }
.icon-button, .arrow-link { display: inline-grid; place-items: center; border: 0; background: transparent; padding: 6px; min-width: 34px; min-height: 34px; border-radius: 6px; color: var(--gold-ink); }
.arrow-link:hover, .icon-button:hover { background: #e8ddbd35; }
.badge { display: inline-block; width: max-content; max-width: 100%; border-radius: 6px; background: #eeebe4; color: #5f584b; padding: 3px 8px; font-weight: 700; font-size: .73rem; line-height: 1.5; }
.badge.gold { background: #f4ead0; color: #694d1e; }
.badge.green { background: #e9f2ea; color: var(--green); }
.search-panel { background: #f1ecdf; border: 1px solid #e6dcc5; border-radius: var(--radius); margin-block-end: 20px; padding: 16px; }
.search-row { display: flex; align-items: stretch; gap: 8px; }
.search-input { display: flex; flex: 1; min-width: 0; align-items: center; color: #82663e; background: var(--surface); border: 1px solid #ddd2bb; border-radius: 8px; padding-inline-start: 12px; }
.search-input input { width: 100%; min-width: 0; border: 0; background: transparent; padding: 10px; }
.search-input:focus-within { outline: 2px solid #a27329; outline-offset: 1px; }
.search-input input:focus { outline: 0; }
.search-hint { display: flex; align-items: center; gap: 7px; width: fit-content; padding: 8px 11px; margin-block-start: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-block: 20px; }
.metrics.count-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric { display: flex; align-items: flex-start; gap: 10px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; }
.metric > div > span { display: block; color: var(--muted); font-size: .82rem; font-weight: 620; }
.metric strong { display: block; font-size: clamp(1.1rem, 2.4vw, 1.58rem); font-weight: 780; line-height: 1.25; margin-block-start: 4px; }
.metric strong small { font-size: .73rem; font-weight: 600; }
.metric-icon { display: inline-grid; place-items: center; background: #f5ecd6; color: #7c612f; border-radius: 8px; width: 36px; height: 36px; flex: 0 0 auto; }
.metric-icon .icon { width: 18px; height: 18px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.panel + .panel { margin-block-start: 16px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 15px 18px; }
.panel-heading .muted { font-size: .82rem; }
.simple-panel { padding: 18px; }
.simple-panel > h2 { margin-block-end: 12px; }
.simple-panel > form.search-row { margin-block-end: 4px; }
.inline-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 9px; margin-block-end: 10px; }
.empty { display: grid; justify-items: center; text-align: center; gap: 9px; padding: 34px 15px; color: var(--muted); }
.empty h2, .empty h3 { color: var(--ink); }
.empty .button { margin-block-start: 5px; }
.start-empty { padding-block: 50px; }
.empty-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: #f3ebd6; color: #82663b; }
.empty-icon .icon { width: 27px; height: 27px; }
.filters { display: flex; flex-wrap: wrap; gap: 9px 12px; align-items: end; padding: 0 18px 15px; }
.filters.in-panel { padding-inline: 0; }
.filters > label { min-width: 108px; font-size: .82rem; font-weight: 650; }
.filters .check { min-height: 42px; }
.filters input:not([type=checkbox]), .filters select { display: block; margin-block-start: 3px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: start; }
th { background: #f6f3ea; color: #625946; font-weight: 730; font-size: .8rem; text-align: start; }
td { font-size: .89rem; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { padding-inline-start: 18px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #faf7ef; }
td .badge { margin-block: 2px; }
.piece-link { display: flex; gap: 10px; align-items: center; min-width: 132px; }
.piece-link strong, .count-piece strong { display: block; line-height: 1.4; }
.piece-link:hover strong { text-decoration: underline; }
.thumb { width: 49px; height: 49px; flex: 0 0 auto; object-fit: cover; border-radius: 7px; background: #eee8da; }
.thumb.placeholder, .photo-empty { display: grid; place-content: center; place-items: center; color: #7b694b; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 15px; }
.pagination span { font-size: .85rem; color: var(--muted); }
.stack { display: grid; gap: 13px; }
.narrow { max-width: 660px; }
label:not(.check, .search-input, .sr-only) { font-weight: 660; }
.stack label, .field-grid label, .price-panel label { display: block; margin-block-end: 4px; }
input:not([type=checkbox], [type=hidden]), select, textarea { background: var(--surface); border: 1px solid #d7cebc; border-radius: 8px; min-height: 42px; padding: 8px 10px; }
.stack input:not([type=checkbox], [type=hidden]), .stack select, .stack textarea, .field-grid input:not([type=checkbox]), .field-grid select, .price-panel input { display: block; width: 100%; }
input[type=checkbox] { width: 17px; height: 17px; accent-color: #896727; }
input[type=file] { max-width: 100%; font-size: .82rem; }
.search-input input, .top-search input { border: 0 !important; }
input[readonly] { background: #f4f1e8 !important; }
.check { display: inline-flex; gap: 6px; align-items: center; }
.errorlist { margin: 0 0 6px; padding-inline-start: 20px; color: #812e24; }
.helptext { display: block; font-size: .8rem; color: var(--muted); }
.messages { display: grid; gap: 6px; margin-block-end: 14px; }
.notice { margin-block: 5px; border: 1px solid #dfd6c0; background: #f7efd9; color: #62491c; padding: 9px 12px; border-radius: 8px; font-size: .9rem; }
.notice.success { background: #eaf2e9; border-color: #d0e3d3; color: var(--green); }
.notice.error { background: #faede8; border-color: #edcfc5; color: #812e24; }
.location-grid { display: grid; gap: 15px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.location-grid .panel { margin: 0; }
.location-card { overflow: hidden; transition: border-color 120ms; }
.location-card:hover { border-color: #b9a16b; }
.location-card img, .location-card .photo-empty { width: 100%; height: clamp(130px, 17vw, 245px); object-fit: cover; background: #f1ebdb; }
.location-card-body { padding: 12px 14px; }
.location-card-body .list-row { border: 0; padding: 0; justify-content: space-between; }
.location-card-body h2 { margin-block: 7px 2px; }
.place-description { color: var(--muted); font-size: .85rem; }
.place-count { margin-block-start: 10px; border-top: 1px solid var(--line); padding-block-start: 9px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: space-between; font-size: .81rem; }
.place-count .icon { color: var(--gold-ink); width: 17px; }
.detail-layout { display: grid; grid-template-columns: minmax(235px, 1fr) minmax(0, 1.7fr); gap: 15px; align-items: start; margin-block-end: 16px; }
.detail-layout .panel { margin: 0; }
.photo-panel { overflow: hidden; }
.photo-panel > img, .photo-panel > .photo-empty { width: 100%; aspect-ratio: 1.3; object-fit: cover; background: #f1ebdb; }
.photo-empty .icon { width: 30px; height: 30px; }
.photo-empty span { font-size: .8rem; margin-top: 5px; }
.facts { margin: 0 0 13px; }
.facts > div { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; column-gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.facts > div:last-child { border-bottom: 0; }
.facts dt { color: var(--muted); font-size: .86rem; }
.facts dd { margin: 0; font-size: .9rem; font-weight: 650; }
.group-line { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding-block: 5px; }
.disclosure { margin-block-start: 10px; }
.disclosure > summary { color: var(--gold-ink); font-weight: 700; }
.disclosure form, .disclosure p { margin-block-start: 9px; }
.list-row { border-bottom: 1px solid var(--line); padding: 10px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: .9rem; }
.list-row:last-child { border-bottom: 0; }
.count-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.count-row:last-child { border: 0; }
.count-piece { flex: 1 1 85px; min-width: 0; }
.count-piece small { display: block; }
.checkout-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(270px, 1fr); gap: 15px; align-items: start; }
.checkout-layout .panel { margin-block-start: 0; }
.checkout-main { display: grid; gap: 15px; min-width: 0; }
.price-panel { display: grid; gap: 13px; }
.price-panel h2 { margin-block-end: 0; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 13px; }
.field-grid > div > label, .price-panel label, .field-grid > label { font-size: .86rem; }
.form-feedback { color: var(--gold-ink); font-size: .83rem; margin-block: 6px; }
.form-feedback:empty { display: none; }
.sale-empty { padding-block: 11px 2px; font-size: .88rem; }
.sale-piece { background: #faf8f1; border: 1px solid #e8e0cf; border-radius: 9px; margin-block-start: 9px; padding: 9px; }
.sale-piece-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.sale-piece .line-total { font-size: .86rem; }
.sale-extra { margin-block-start: 6px; padding-block-start: 6px; border-top: 1px solid var(--line); align-items: center; }
.linked-options { display: flex; flex-wrap: wrap; gap: 6px; margin-block-start: 10px; align-items: center; font-size: .83rem; }
.totals > div, .checkout-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.totals { padding-block: 7px; border-block: 1px solid var(--line); font-size: .88rem; }
.totals .text-link { font-size: .8rem; }
.checkout-bar { position: sticky; bottom: 0; z-index: 3; background: var(--surface); border: 1px solid #d8c8a4; border-radius: 10px; margin-block-start: 15px; padding: 10px 14px; box-shadow: 0 4px 20px #31261110; }
.checkout-bar span { display: block; color: var(--muted); font-size: .78rem; }
.checkout-bar strong { display: block; font-size: 1.02rem; }
.tabs { display: flex; gap: 5px; margin-block-end: 12px; }
.tabs a { padding: 7px 14px; border: 1px solid var(--line); border-radius: 8px; font-weight: 700; background: var(--surface); }
.tabs a.selected { background: #f2e7ca; border-color: #ddc897; color: var(--gold-ink); }
.receipt { max-width: 1050px; }
.receipt-total { max-width: 370px; margin-inline-start: auto; }
.receipt-total .facts { margin: 0; }
.print-label { display: flex; align-items: center; overflow-wrap: anywhere; width: 45mm; min-height: 25mm; font: 700 10px ui-monospace, monospace; background: #fff; color: #000; }
.print-label img { width: 21mm; flex: 0 0 21mm; }
.auth-workspace .main { display: grid; min-height: 100svh; place-items: center; padding: 20px; }
.login-card { max-width: 420px; width: 100%; padding: 28px; border: 1px solid var(--line); background: var(--surface); border-radius: 16px; }
.login-card h1 { margin-block: 13px 19px; font-size: 1.7rem; }
.scanner-dialog { width: min(92vw, 500px); border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--surface); color: var(--ink); }
.scanner-dialog::backdrop { background: #201b12bb; }
.scanner-dialog .panel-heading { padding: 0 0 8px; }
.scanner-dialog video { display: block; width: 100%; min-height: 100px; max-height: 52vh; border-radius: 8px; background: #27241e; }
.scanner-dialog p { padding-block-start: 8px; }
@media (max-width: 1080px) {
  :root { --rail: 208px; }
  .metric { padding: 10px; gap: 6px; }
  .metric-icon { width: 29px; height: 29px; }
}
@media (max-width: 790px) {
  .rail { inset: auto 0 0; width: 100%; height: calc(var(--mobile-nav) + env(safe-area-inset-bottom)); padding: 3px 3px env(safe-area-inset-bottom); }
  .brand, .rail-footer { display: none; }
  .nav { display: grid; height: 100%; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; }
  .nav a { flex-direction: column; gap: 3px; justify-content: center; line-height: 1.15; padding: 4px 2px; min-height: 52px; text-align: center; font-size: .66rem; }
  .nav a.active::before { inset: 0 32% auto; height: 2px; width: auto; }
  .nav .icon { width: 19px; height: 19px; }
  .workspace { margin: 0; }
  .workspace > .main { padding: 18px 14px calc(var(--mobile-nav) + env(safe-area-inset-bottom) + 18px); }
  .topbar { min-height: 53px; padding: 5px 14px; }
  .top-tools { gap: 5px; }
  .top-search input { width: 86px; padding: 5px; font-size: .74rem; min-height: 32px; }
  .top-search button { min-width: 28px; padding: 4px; }
  .mobile-brand { display: inline-flex; align-items: center; gap: 6px; font-weight: 810; }
  .mobile-brand .brand-mark { width: 29px; height: 29px; border-radius: 8px; }
  .mobile-brand .brand-mark .icon { width: 18px; height: 18px; }
  .mobile-logout { display: block; }
  .top-section { display: none; }
  .heading { gap: 10px; margin-block-end: 14px; flex-wrap: wrap; align-items: start; }
  .heading p { font-size: .85rem; margin-block-start: 5px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-block: 12px; }
  .search-panel { margin-block-end: 12px; padding: 8px; }
  .search-row { gap: 5px; }
  .search-row .button { padding-inline: 8px; min-height: 44px; }
  .search-input { padding-inline-start: 5px; }
  .search-input input { padding: 8px 5px; font-size: .86rem; }
  .scan-button span { display: none; }
  .scan-button { min-width: 44px; }
  .panel-heading, .simple-panel { padding: 12px; }
  .filters { padding: 0 10px 10px; gap: 6px 8px; }
  .filters label { min-width: 75px; }
  .location-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .location-card-body { padding: 8px; }
  .location-card-body h2 { font-size: .94rem; }
  .place-description { font-size: .73rem; }
  .place-count { font-size: .74rem; }
  .detail-layout { grid-template-columns: 1fr; gap: 9px; }
  .photo-panel > img, .photo-panel > .photo-empty { max-height: 260px; }
  .checkout-layout { grid-template-columns: 1fr; gap: 10px; }
  .checkout-main { gap: 10px; }
  .checkout-bar { position: fixed; bottom: calc(var(--mobile-nav) + env(safe-area-inset-bottom)); inset-inline: 0; margin: 0; border-radius: 0; padding: 7px 12px; }
  #checkout { padding-block-end: 62px; }
}
@media (max-width: 500px) {
  .location-grid .code { font-size: .7rem; }
  th, td { padding: 8px 7px; }
  th:first-child, td:first-child { padding-inline-start: 8px; }
  .piece-link { gap: 5px; min-width: 105px; }
  .piece-link .thumb { width: 38px; height: 38px; }
  .table-wrap table { min-width: 460px; }
  .count-row .button { padding-inline: 6px; }
}
@media print {
  :root, body { background: #fff; color: #000; }
  .rail, .topbar, .no-print, .messages, dialog, .skip { display: none !important; }
  .workspace, .main, .workspace > .main { margin: 0; padding: 0; }
  .panel { border: 0; }
  .table-wrap { overflow: visible; }
  table, .table-wrap table { min-width: 0; break-inside: auto; }
  tr { break-inside: avoid; }
}

.current-photo { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--muted); font-size: .84rem; }
.photo-pickers .field-grid label { margin-block-end: 0; }
@media screen and (max-width: 600px) {
  .piece-table { display: block; min-width: 0 !important; }
  .piece-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .piece-table tbody { display: block; }
  .piece-table tr { display: grid; grid-template-columns: 1fr 1fr; padding: 9px 11px; gap: 5px 8px; border-bottom: 1px solid var(--line); }
  .piece-table tr:last-child { border-bottom: 0; }
  .piece-table td { display: block; padding: 0; border: 0; font-size: .82rem; }
  .piece-table td:first-child { grid-column: 1 / -1; padding: 0 0 3px; }
  .piece-table td:last-child { display: none; }
  .piece-table td[data-label]::before { content: attr(data-label) " "; color: var(--muted); font-size: .7rem; margin-inline-end: 4px; }
}
