/* TENS: warm paper ground, teal-ink, one saffron accent. Mobile-first, logical properties so RTL is free. */
:root {
  --ground: #F4F0E8; --surface: #FFFFFF; --ink: #0F2B44; --muted: #5B6668; --line: #DDD6C8;
  --brand: #0F2B44; --brand-gold: #C8952E; --brand-tan: #8A7A5A;
  --accent: #B8681A; --accent-soft: #F6E7D2; --pos: #2E7D5B; --pos-soft: #DFEFE6; --warn: #B9482B; --warn-soft: #F7E4DC;
  --font-latin: Manrope, Vazirmatn, system-ui, sans-serif; --font-fa: Vazirmatn, Manrope, system-ui, sans-serif;
  --radius: 14px; --radius-s: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--ground); color: var(--ink); font-family: var(--font-latin); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; font-size: 15px; line-height: 1.35; }
body.is-fa { font-family: var(--font-fa); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }

/* ---- app shell ---- */
.app { min-height: 100dvh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; }
.main { flex: 1 1 auto; display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; min-height: 0; }
.hdr { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 10px; }
.hdr__brand { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; letter-spacing: .14em; color: var(--brand-tan); font-family: var(--font-latin); }
.mark { display: inline-block; flex: 0 0 auto; }
.hdr__title { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.1; }
.hdr__sub { font-size: 12px; color: var(--muted); }
.hdr__right { display: flex; align-items: center; gap: 8px; }
.nav { position: sticky; bottom: 0; display: flex; border-top: 1px solid var(--line); background: var(--surface); padding: 4px 4px calc(8px + env(safe-area-inset-bottom)); }
.nav__item { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; text-decoration: none; color: var(--muted); font-size: 10px; font-weight: 700; }
.nav__item--on { color: var(--accent); }

/* ---- segmented control (language, currency) ---- */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--surface); }
.seg__btn { min-width: 44px; height: 32px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-weight: 700; font-size: 13px; font-family: var(--font-latin); padding: 0 10px; }
.seg__btn--fa { font-family: var(--font-fa); font-weight: 600; font-size: 14px; }
.seg__btn--on { background: var(--ink); color: #fff; }
.seg--small .seg__btn { height: 28px; font-size: 12px; }
.inline { display: inline; }
.block { display: block; }
.block > button { width: 100%; }

/* ---- primitives ---- */
.pad-x { padding-inline: 16px; }
.row { display: flex; align-items: center; gap: 8px; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.gap-0 { gap: 0 } .gap-2 { gap: 2px } .gap-6 { gap: 6px } .gap-8 { gap: 8px } .gap-10 { gap: 10px } .gap-14 { gap: 14px }
.grow { flex: 1 1 auto; } .grow2 { flex: 2 1 auto; } .min0 { min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.small { font-size: 12px; } .big { font-size: 22px; font-weight: 800; }
.muted { color: var(--muted); } .warn { color: var(--warn); } .pos { color: var(--pos); } .accent { color: var(--accent); }
.end { text-align: end; align-items: flex-end; } .start { text-align: start; align-items: flex-start; } .center { text-align: center; }
.w44 { min-width: 44px; display: inline-block; } .w64 { min-width: 64px; display: inline-block; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
body.is-fa .eyebrow { letter-spacing: 0; text-transform: none; font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.top-line { border-top: 1px solid var(--line); padding-top: 8px; }
.scroll { overflow-y: auto; }
.empty { padding: 18px; text-align: center; }
.list { display: flex; flex-direction: column; gap: 6px; }
.list--tight { gap: 4px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; color: inherit; text-decoration: none; }
.card--row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card--tight { padding: 9px 12px; }
.card--warn { border-color: var(--warn); }
a.card:hover, button.card:hover { border-color: var(--ink); }
button.card { width: 100%; text-align: start; }

.tile { display: flex; flex-direction: column; gap: 2px; }
.tile--flat { background: var(--ground); border-radius: 8px; padding: 6px 8px; }
.tile__label { font-size: 11px; color: var(--muted); font-weight: 700; }
.tile__value { font-size: 22px; font-weight: 800; }
.tile__num { font-size: 15px; font-weight: 800; }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar__fill { height: 6px; background: var(--accent); }

.pill { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.pill--accent { background: var(--accent-soft); color: var(--accent); }
.pill--warn { background: var(--warn-soft); color: var(--warn); }
.pill--pos { background: var(--pos-soft); color: var(--pos); }
.pill--neutral { background: var(--ground); color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips--scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
.chips--fill .chip { flex: 1 1 0; justify-content: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-weight: 700; font-size: 12px; white-space: nowrap; text-decoration: none; }
.chip--on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip--radio input, .chip--check input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip--radio:has(input:checked), .chip--check:has(input:checked) { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---- forms ---- */
.field { display: flex; flex-direction: column; gap: 4px; }
.field__label { font-size: 12px; font-weight: 700; color: var(--muted); }
.input { min-height: 44px; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; background: var(--surface); width: 100%; }
textarea.input { padding: 10px 12px; }
.input--big { min-height: 48px; font-size: 18px; font-weight: 800; background: var(--ground); }
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.searchbox { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 14px; height: 48px; color: var(--muted); }
.searchbox__input { flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; font-weight: 600; color: var(--ink); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 16px; border: 1px solid transparent; border-radius: 12px; font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer; }
.btn--primary { background: var(--ink); color: #fff; }
.btn--warn { background: var(--warn); color: #fff; }
.btn--ghost { background: var(--surface); border-color: var(--line); color: var(--ink); min-height: 44px; font-size: 14px; }
.btn--dashed { background: transparent; border: 1px dashed var(--line); color: var(--muted); font-weight: 600; min-height: 44px; font-size: 14px; width: 100%; }
.btn--block { width: 100%; }
.btn[disabled] { background: var(--line); color: var(--muted); border-color: var(--line); cursor: default; }
.link-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; border: 0; background: none; color: var(--accent); font-weight: 700; font-size: 13px; text-decoration: none; }
.iconbtn { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }

/* ---- sell screen ---- */
.results { display: flex; flex-direction: column; gap: 6px; max-height: 40dvh; overflow-y: auto; }
.result { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 56px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-align: start; }
.result[disabled] { opacity: .55; }
.result__main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.result__name { font-size: 14px; font-weight: 700; }
.result__price { font-size: 15px; font-weight: 800; white-space: nowrap; }
.cart { display: flex; flex-direction: column; gap: 6px; }
.cartline { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.cartline__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.cartline__name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cartline__total { min-width: 64px; text-align: end; font-weight: 800; font-size: 14px; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper__btn { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.stepper__qty { min-width: 22px; text-align: center; font-weight: 800; font-size: 15px; }
.stepper__input { width: 52px; height: 40px; text-align: center; font-weight: 800; font-size: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--ground); -moz-appearance: textfield; }
.stepper__input::-webkit-inner-spin-button, .stepper__input::-webkit-outer-spin-button { -webkit-appearance: none; }

.footerbar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 12px; padding: 10px 16px 12px; border-top: 1px solid var(--line); background: var(--surface); margin-top: auto; }
.footerbar--col { flex-direction: column; align-items: stretch; gap: 6px; }
.flash { margin: 0 16px; padding: 10px 12px; border-radius: var(--radius-s); font-size: 13px; font-weight: 600; }
.flash--ok { background: var(--pos-soft); color: var(--pos); }
.flash--warn { background: var(--warn-soft); color: var(--warn); }

/* ---- brand ---- */
.wordmark { display: flex; flex-direction: column; align-items: center; gap: 2px; font-family: var(--font-latin); }
.wordmark__name { font-weight: 500; letter-spacing: .04em; color: var(--brand); line-height: 1; }
.wordmark__group { display: flex; align-items: center; gap: 10px; font-size: 12px; letter-spacing: .28em; color: var(--brand-tan); font-weight: 500; }
.wordmark__group::before, .wordmark__group::after { content: ""; width: 40px; height: 1px; background: var(--brand-gold); }
.wordmark--lg .wordmark__name { font-size: 40px; }
.wordmark--md .wordmark__name { font-size: 24px; }
.wordmark--md .wordmark__group { font-size: 10px; letter-spacing: .22em; }
.wordmark--md .wordmark__group::before, .wordmark--md .wordmark__group::after { width: 24px; }

/* ---- login ---- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100dvh; padding: 24px; }
.login { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }
.login__logo { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 8px 0 4px; }
.login__title { margin: 0; font-size: 22px; font-weight: 800; text-align: center; }
.chips--users { justify-content: center; }
.chip--user { min-height: 52px; padding: 0 20px; font-size: 16px; border-radius: 14px; }
.input--pin { text-align: center; letter-spacing: .4em; font-size: 24px; }
.login__lang { display: flex; justify-content: center; gap: 4px; }

/* ---- wider screens: same pages, more room ---- */
@media (min-width: 900px) {
  .app { max-width: 1100px; }
  .results { max-height: 50dvh; }
  .nav { position: static; border-top: 0; border-bottom: 1px solid var(--line); order: -1; }
  .nav__item { flex-direction: row; gap: 8px; font-size: 13px; min-height: 48px; }
  .list--tight .card--tight { padding: 8px 14px; }
}
