@font-face { font-family: Vazirmatn; font-weight: 400; font-display: swap; src: url(fonts/Vazirmatn-FD-Regular.woff2) format('woff2'); }
@font-face { font-family: Vazirmatn; font-weight: 500; font-display: swap; src: url(fonts/Vazirmatn-FD-Medium.woff2) format('woff2'); }
@font-face { font-family: Vazirmatn; font-weight: 700; font-display: swap; src: url(fonts/Vazirmatn-FD-Bold.woff2) format('woff2'); }
@font-face { font-family: Vazirmatn; font-weight: 800; font-display: swap; src: url(fonts/Vazirmatn-FD-ExtraBold.woff2) format('woff2'); }

/* ioio palette (from ioioapp.com): black/white base, soft green; amber marks partial orders. */
:root {
  --ground: #F4F4F2; --surface: #FFFFFF; --ink: #191919; --ink-soft: #454545; --muted: #6B6B6B;
  --line: #E7E7E4; --field: #D9D9D6;
  --green: #00B887; --green-soft: #C3EBBC; --green-bg: #EDF9EB; --green-ink: #0B6448;
  --soft2: #F6D98B; --warn-bg: #FFF4DA; --warn-ink: #7A4B00;
  --primary: #191919; --on-primary: #FFFFFF;
  --danger: #B3261E;
  --nav-h: 68px; --r: 18px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font-family: Vazirmatn, system-ui, sans-serif; }
body { min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
b { font-weight: 700; color: var(--ink); }
.ltr { direction: ltr; unicode-bidi: plaintext; text-align: right; }
.logo { display: block; height: 22px; width: auto; color: var(--ink); }
.logo path { fill: currentColor; }

/* ---------- layout ---------- */
#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.page { flex: 1; padding: 0 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); }
.page.has-footer { padding-bottom: calc(var(--nav-h) + 150px + env(safe-area-inset-bottom)); }
.brandbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 4px 0; }
.brandbar .tag { font-size: 12px; font-weight: 500; color: var(--muted); background: var(--surface); padding: 4px 12px; border-radius: 999px; }
.top { padding: 14px 4px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top .sub { font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.top h1 { font-size: 24px; font-weight: 800; letter-spacing: -.2px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }
.center { text-align: center; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; display: flex; flex-direction: column; align-items: center; gap: 14px; }

/* brand geometry (i/o shapes) — decorative only, never the logo */
.shapes { display: flex; gap: 6px; align-items: flex-end; }
.shapes .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--primary); }
.shapes .ring { width: 34px; height: 34px; border-radius: 50%; border: 9px solid var(--primary); }
.shapes .bar { width: 12px; height: 18px; border-radius: 3px; background: var(--soft2); }

/* ---------- nav ---------- */
nav.tabs { position: fixed; inset: auto 0 0 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 96%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); display: flex; justify-content: center; z-index: 20; }
nav.tabs .inner { width: 100%; max-width: 560px; display: flex; }
nav.tabs button { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11.5px; font-weight: 500; color: var(--muted); cursor: pointer; }
nav.tabs button svg { width: 22px; height: 22px; }
nav.tabs .pill { width: 52px; height: 30px; border-radius: 999px; display: flex; align-items: center; justify-content: center; transition: background .15s; }
nav.tabs button.on { color: var(--ink); font-weight: 700; }
nav.tabs button.on .pill { background: var(--primary); color: var(--on-primary); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.card.tap { cursor: pointer; transition: transform .08s; }
.card.tap:active { transform: scale(.985); }
.card.warn { background: var(--warn-bg); border-color: var(--warn-bg); color: var(--warn-ink); }
.card.ok { background: var(--green-bg); border-color: var(--green-bg); color: var(--green-ink); }
.card.soft { background: var(--ground); border-color: var(--ground); }
.hero { position: relative; overflow: hidden; background: var(--primary); color: var(--on-primary); border-radius: 22px; padding: 18px; }
.hero .muted { color: var(--on-primary); opacity: .72; }
.hero::before { content: ''; position: absolute; width: 150px; height: 150px; border-radius: 50%; border: 34px solid color-mix(in srgb, var(--on-primary) 14%, transparent); left: -48px; top: -56px; }
.hero::after { content: ''; position: absolute; width: 22px; height: 22px; border-radius: 50%; background: var(--soft2); left: 92px; bottom: 18px; opacity: .9; }
.hero > * { position: relative; }
.hero .big { font-size: 34px; font-weight: 800; line-height: 1.1; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .n { font-size: 26px; font-weight: 800; line-height: 1.2; }
.stat.warn { background: var(--warn-bg); border-color: var(--warn-bg); }
.stat.warn .n, .stat.warn .muted { color: var(--warn-ink); }
.stat.ok { background: var(--green-bg); border-color: var(--green-bg); }
.stat.ok .n, .stat.ok .muted { color: var(--green-ink); }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 999px; background: var(--green-bg); color: var(--green-ink); white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge.warn::before { background: #E8A317; }
.badge.plain { background: var(--ground); color: var(--ink-soft); }
.badge.plain::before { display: none; }
.title { font-size: 15px; font-weight: 700; }
.section-title { font-size: 16px; font-weight: 800; margin-top: 10px; }

/* ---------- forms ---------- */
label.f { display: flex; flex-direction: column; gap: 6px; }
label.f > span, .f-label { font-size: 13px; font-weight: 500; color: var(--ink-soft); }
input.in, select.in, textarea.in { width: 100%; height: 52px; border: 1.5px solid var(--field); border-radius: 14px; background: var(--surface); padding: 0 14px; font-size: 17px; outline: none; transition: border-color .15s; }
textarea.in { height: auto; min-height: 64px; padding: 10px 14px; font-size: 15px; }
input.in:focus, textarea.in:focus, select.in:focus { border-color: var(--primary); }
input.in.big { height: 58px; font-size: 22px; font-weight: 800; letter-spacing: 1px; }
input.in.err { border-color: var(--danger); }
input.in::placeholder, textarea.in::placeholder { color: #A3A3A3; font-weight: 400; }
.err-text { color: var(--danger); font-size: 12px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.seg button { height: 50px; border-radius: 14px; border: 1.5px solid var(--field); background: var(--surface); font-size: 15px; font-weight: 500; cursor: pointer; transition: background .12s, color .12s; }
.seg button.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); font-weight: 700; }
.tabseg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; background: var(--line); border-radius: 16px; padding: 4px; }
.tabseg button { height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--ink-soft); font-size: 14px; font-weight: 500; cursor: pointer; }
.tabseg button.on { background: var(--surface); color: var(--ink); font-weight: 800; box-shadow: 0 1px 3px rgba(0,0,0,.1); }

.btn { height: 56px; width: 100%; border-radius: 16px; border: 0; background: var(--primary); color: var(--on-primary); font-size: 16px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; transition: opacity .15s, transform .08s; }
.btn:active:not(:disabled) { transform: scale(.985); }
.btn:disabled { opacity: .35; cursor: default; }
.btn.secondary { background: var(--surface); color: var(--ink); border: 1.5px solid var(--field); height: 52px; font-size: 15px; }
.btn.ghost { background: none; color: var(--ink); height: 40px; width: auto; padding: 0 8px; font-size: 14px; font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
.btn.danger-ghost { background: none; color: var(--danger); height: 40px; width: auto; padding: 0 8px; font-size: 14px; font-weight: 500; }
.icon-btn { width: 58px; height: 58px; flex: none; border-radius: 16px; border: 0; background: var(--primary); color: var(--on-primary); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn svg { width: 26px; height: 26px; }
.back { width: 44px; height: 44px; border-radius: 14px; border: 0; background: var(--surface); display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }

.photo-drop { height: 104px; width: 100%; border-radius: var(--r); border: 1.5px dashed #BDBDBA; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--ink-soft); cursor: pointer; font-weight: 500; }
.photo-preview { position: relative; }
.photo-preview img { width: 100%; height: 200px; object-fit: cover; border-radius: var(--r); display: block; }
.photo-preview button { position: absolute; top: 10px; left: 10px; }
.chip { height: 36px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--field); background: var(--surface); font-size: 13px; font-weight: 500; cursor: pointer; }
.chip.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 700; }

/* ---------- lists ---------- */
.pkg { display: flex; gap: 12px; align-items: center; }
.thumb { width: 54px; height: 54px; flex: none; border-radius: 14px; background: var(--ground); display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--muted); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.check input[type=checkbox] { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--primary); flex: none; }
.check.sel { border-color: var(--primary); }
.big-photo { width: 100%; max-height: 280px; object-fit: cover; border-radius: 14px; display: block; background: var(--ground); cursor: zoom-in; }
.order-no { font-size: 17px; font-weight: 800; letter-spacing: .3px; }

.footer-bar { position: fixed; inset: auto 0 calc(var(--nav-h) + env(safe-area-inset-bottom)) 0; background: color-mix(in srgb, var(--ground) 97%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); z-index: 15; display: flex; justify-content: center; }
.footer-bar .inner { width: 100%; max-width: 560px; padding: 10px 16px 12px; display: flex; flex-direction: column; gap: 8px; }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: flex; flex-direction: column; padding: 0 20px 32px; position: relative; overflow: hidden; }
.login .art { position: absolute; inset: 0 0 auto 0; height: 300px; pointer-events: none; }
.login .art .o1 { position: absolute; width: 220px; height: 220px; border-radius: 50%; border: 54px solid var(--primary); top: -70px; left: -60px; }
.login .art .o2 { position: absolute; width: 40px; height: 40px; border-radius: 50%; background: var(--soft2); top: 150px; left: 150px; }
.login .art .i1 { position: absolute; width: 22px; height: 54px; border-radius: 6px; background: var(--primary); top: 120px; left: 40px; }
.login .art .i1::before { content: ''; position: absolute; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); top: -32px; left: 0; }
.login .head { margin-top: 250px; position: relative; display: flex; flex-direction: column; gap: 10px; }
.login .head .logo { height: 40px; }
.login .head h1 { font-size: 26px; font-weight: 800; }

/* ---------- overlays ---------- */
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); max-width: 528px; margin: 0 auto;
  padding: 14px 16px; border-radius: 14px; background: var(--primary); color: var(--on-primary); font-size: 14px; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; pointer-events: none; display: flex; align-items: center; gap: 10px; }
.toast::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--green); flex: none; }
.toast.show { opacity: 1; transform: none; }
.toast.err { background: var(--danger); }
.toast.err::before { background: #fff; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.modal { background: var(--surface); width: 100%; max-width: 560px; border-radius: 24px 24px 0 0; padding: 22px 18px calc(20px + env(safe-area-inset-bottom)); max-height: 90dvh; overflow: auto; animation: up .2s ease-out; }
.modal::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--field); margin: -8px auto 16px; }
.modal h2 { font-size: 19px; font-weight: 800; margin-bottom: 8px; }
.modal p { color: var(--ink-soft); line-height: 1.8; margin: 0 0 18px; font-size: 14px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .6; } }
.scanner { position: fixed; inset: 0; background: #000; z-index: 70; display: flex; flex-direction: column; }
.scanner video { flex: 1; width: 100%; object-fit: cover; }
.scanner .frame { position: absolute; top: 50%; left: 50%; width: 270px; height: 170px; transform: translate(-50%, -50%); border: 3px solid #fff; border-radius: 20px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
.scanner .bar { position: absolute; top: 0; left: 0; right: 0; padding: 16px; display: flex; justify-content: space-between; align-items: center; color: #fff; z-index: 1; }
.scanner .bar button { background: rgba(255,255,255,.18); color: #fff; border: 0; border-radius: 12px; padding: 10px 16px; font-size: 15px; }
.viewer { position: fixed; inset: 0; background: #000; z-index: 70; display: flex; align-items: center; justify-content: center; }
.viewer img { max-width: 100%; max-height: 100%; }
.spinner { width: 22px; height: 22px; border: 3px solid color-mix(in srgb, var(--on-primary) 35%, transparent); border-top-color: var(--on-primary); border-radius: 50%; animation: spin .8s linear infinite; }
.spinner.dark { border-color: rgba(0,0,0,.1); border-top-color: var(--primary); margin: 56px auto; width: 30px; height: 30px; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { height: 4px; background: var(--green-bg); border-radius: 2px; overflow: hidden; }
.progress::after { content: ''; display: block; height: 100%; width: 40%; background: var(--green); border-radius: 2px; animation: slide 1s infinite ease-in-out; }
@keyframes slide { from { transform: translateX(150%); } to { transform: translateX(-250%); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- palettes (chosen per device in «بیشتر ← رنگ‌بندی») ---------- */
:root[data-palette="purple"] { --primary: #4B2A86; --ground: #F5F3F9; --line: #E6E1EF; --field: #D6CFE3; }
:root[data-palette="navy"]   { --primary: #1F2D4D; --ground: #F2F4F7; --line: #E1E5EC; --field: #CFD6E0; }
:root[data-palette="dark"]   {
  --ground: #111214; --surface: #1B1C1F; --ink: #F1F1F1; --ink-soft: #CFCFCF; --muted: #A0A0A0;
  --line: #2A2B2F; --field: #3A3B40; --primary: #F1F1F1; --on-primary: #111214;
  --green-soft: #2E5E3F; --green-bg: #12352A; --green-ink: #86E3C3;
  --soft2: #6B5320; --warn-bg: #362A0F; --warn-ink: #F3C66A; color-scheme: dark;
}
.swatches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; font-size: 12px; font-weight: 500; color: var(--ink); }
.swatch .chipc { width: 34px; height: 34px; border-radius: 50%; box-shadow: inset 0 0 0 3px rgba(255,255,255,.6); }
.swatch.on { border-color: var(--primary); border-width: 2px; font-weight: 800; }
