/* Shared base: font, reset, sheet, toast, form controls. Used by storefront + panels. */
@font-face { font-family: Vazirmatn; src: url("/fonts/Vazirmatn%5Bwght%5D.woff2") format('woff2'); font-weight: 100 900; font-display: swap; }
:root {
  --ink: #1d1a17; --ink-2: #57514b; --ink-3: #8f877e; --line: #e7e2dc; --bg: #fff; --bg-2: #f6f3ef;
  --accent: #1d1a17; --on-accent: #fff; --ok: #1f7a4d; --ok-bg: #e5f3ea; --warn: #9a5b00; --warn-bg: #fdf0d9;
  --err: #b42318; --err-bg: #fde8e6; --info: #1f5c99; --info-bg: #e5eef8;
  --r-sm: 8px; --r: 14px; --r-lg: 22px; --sheet-shadow: 0 -10px 40px rgba(29,26,23,.18);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Vazirmatn, Tahoma, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.75; font-size: 15px; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { direction: ltr; unicode-bidi: isolate; }
.ltr { direction: ltr; unicode-bidi: isolate; text-align: left; }
.muted { color: var(--ink-3); }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent; background: var(--accent); color: var(--on-accent); font-weight: 700; text-decoration: none; transition: transform .12s, opacity .12s; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.soft { background: var(--bg-2); color: var(--ink); }
.btn.danger { background: var(--err); color: #fff; }
.btn.ok { background: var(--ok); color: #fff; }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn .spin { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* fields */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input, .select, .textarea { width: 100%; min-height: 48px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: var(--r); background: #fff; outline: none; transition: border-color .15s; }
.textarea { min-height: 110px; resize: vertical; line-height: 1.8; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--ink); }
.field.has-err .input, .field.has-err .select { border-color: var(--err); }
.field .err { color: var(--err); font-size: 12.5px; }
.field .hint { color: var(--ink-3); font-size: 12.5px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 38px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.chip[aria-pressed="true"], .chip.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.chip[disabled] { opacity: .35; text-decoration: line-through; pointer-events: none; }

/* bottom sheet (mobile) / dialog (desktop) */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(29,26,23,.42); z-index: 90; opacity: 0; transition: opacity .2s; }
.sheet-backdrop.open { opacity: 1; }
.sheet { position: fixed; z-index: 91; inset-inline: 0; bottom: 0; max-height: 92dvh; overflow: auto; background: #fff; border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--sheet-shadow); padding: 10px 20px calc(20px + var(--safe-b)); transform: translateY(100%); transition: transform .28s cubic-bezier(.2,.8,.2,1); }
.sheet.open { transform: none; }
.sheet .grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 12px; }
.sheet h3 { margin: 0 0 4px; font-size: 19px; font-weight: 800; }
.sheet .sub { color: var(--ink-3); margin: 0 0 18px; font-size: 14px; }
.sheet .x { position: absolute; top: 14px; left: 14px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--bg-2); font-size: 20px; line-height: 1; }
@media (min-width: 720px) {
  .sheet { inset: auto; left: 50%; top: 50%; bottom: auto; width: min(460px, 92vw); border-radius: var(--r-lg); transform: translate(-50%, -46%) scale(.98); opacity: 0; transition: transform .2s, opacity .2s; padding: 26px 26px 24px; }
  .sheet.open { transform: translate(-50%, -50%); opacity: 1; }
  .sheet .grab { display: none; }
}
@media (prefers-reduced-motion: reduce) { .sheet, .sheet-backdrop { transition: none; } }

/* toast */
#toasts { position: fixed; z-index: 120; top: 14px; inset-inline: 0; display: grid; justify-items: center; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; max-width: min(92vw, 420px); padding: 11px 18px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.18); animation: toast-in .25s ease; }
.toast.err { background: var(--err); } .toast.ok { background: var(--ok); }
@keyframes toast-in { from { transform: translateY(-10px); opacity: 0; } }

/* OTP boxes */
.otp { display: flex; gap: 8px; justify-content: center; direction: ltr; margin: 6px 0 14px; }
.otp input { width: 52px; height: 58px; text-align: center; font-size: 24px; font-weight: 800; border: 1.5px solid var(--line); border-radius: var(--r); outline: none; }
.otp input:focus { border-color: var(--ink); }
.login-alt { display: grid; gap: 10px; margin-top: 14px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 13px; margin: 16px 0 4px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.channel-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.channel-pick button { border: 1.5px solid var(--line); background: #fff; border-radius: var(--r); padding: 10px 6px; display: grid; justify-items: center; gap: 2px; font-size: 13px; }
.channel-pick button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.channel-pick small { color: var(--ink-3); font-size: 11px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--bg-2); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); } .badge.info { background: var(--info-bg); color: var(--info); }

/* Jalali date picker */
.jdate { display: grid; grid-template-columns: 1.1fr 1.4fr 1fr; gap: 8px; }
.copyable { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: var(--r-sm); background: #fff; }
.copyable .v { font-weight: 800; letter-spacing: .5px; direction: ltr; }
.copyable button { border: 0; background: var(--bg-2); border-radius: 999px; padding: 4px 12px; font-size: 12.5px; font-weight: 700; }
/* grid children with selects must be allowed to shrink (prevents horizontal overflow on phones) */
.row2 > *, .jdate > *, [data-jtime] > *, .field { min-width: 0; }
.select { min-width: 0; padding-inline-end: 8px; }
