/*
 * VisionPart — "daftar e gheymat": minimal, faghat Vazirmatn, motarakez.
 * Tanha onsor e por-rang: adad e gheymat (ragham e jadvali, porrang). Baghiye aram.
 * Rang ha: ink / graphite / line / canvas + yek abi e "signal" faghat baraye
 * amal e asli va halat e faal; ghermez/sabz faghat baraye taghir e gheymat.
 * Gooshe ha be tartib e salsele: 4 (badge) / 6 (control) / 8 (zarf).
 */

@font-face { font-family: "Vazirmatn"; src: url("../../admin/fonts/Vazirmatn-Regular.cdc140628f11.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../../admin/fonts/Vazirmatn-Medium.dd2193b32cbe.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../../admin/fonts/Vazirmatn-Bold.7958481fe611.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../../admin/fonts/Vazirmatn-ExtraBold.a0f99309cd35.woff2") format("woff2"); font-weight: 800; font-display: swap; }

:root {
  --canvas: #f7f8fa;
  --surface: #ffffff;
  --sunken: #f1f3f5;
  --line: #e4e6ea;
  --line-strong: #cfd3d9;
  --ink: #15171c;
  --ink-2: #3a3f48;
  --graphite: #5e6470;
  --signal: #1d4ed8;
  --signal-hover: #1a43bb;
  --signal-tint: #eef2fd;
  --up: #b42318;
  --up-tint: #fdeeec;
  --down: #13734a;
  --down-tint: #e8f5ee;
  --warn: #9a5b00;
  --warn-tint: #fdf4e3;
  --focus: 0 0 0 3px rgba(29, 78, 216, .25);
  --r-badge: 4px;
  --r-control: 6px;
  --r-box: 8px;
  --side: 216px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #0f1115;
    --surface: #161920;
    --sunken: #1c2029;
    --line: #262b35;
    --line-strong: #353b47;
    --ink: #eceef2;
    --ink-2: #c6cad2;
    --graphite: #8f96a3;
    --signal: #7b9cff;
    --signal-hover: #95b0ff;
    --signal-tint: #1b2440;
    --up: #ff8a7a;
    --up-tint: #36181a;
    --down: #5fd39a;
    --down-tint: #12291f;
    --warn: #f2b45a;
    --warn-tint: #2c2210;
    --focus: 0 0 0 3px rgba(123, 156, 255, .35);
    color-scheme: dark;
  }
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.4; }
h1 { font-size: 20px; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
p { margin: 0; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-control); }
.ltr { direction: ltr; unicode-bidi: isolate; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--graphite); }
.small { font-size: 13px; }
.xsmall { font-size: 12px; }
.bold { font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-lg { width: 20px; height: 20px; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.end-row { justify-content: flex-end; }
.grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 12px; }
.stack > * { min-width: 0; }
.sep { color: var(--line-strong); margin: 0 6px; }

/* ---------------------------------------------------------------- brand */
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 16px; color: var(--ink); }
.brand-mark { width: 26px; height: 26px; border-radius: var(--r-control); display: grid; place-items: center; background: var(--ink); color: var(--canvas); }
.brand-mark svg { width: 16px; height: 16px; }

/* ---------------------------------------------------------------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--r-control);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--graphite); }
.btn-primary { background: var(--signal); border-color: var(--signal); color: #fff; }
.btn-primary:hover { background: var(--signal-hover); border-color: var(--signal-hover); }
.btn-soft { background: var(--signal-tint); border-color: transparent; color: var(--signal); }
.btn-soft:hover { border-color: var(--signal); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--sunken); border-color: transparent; }
.btn-danger { color: var(--up); }
.btn-danger:hover { border-color: var(--up); }
.btn-success { background: var(--down); border-color: var(--down); color: #fff; }
.btn-success:hover { filter: brightness(1.08); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 30px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.field { display: grid; gap: 4px; }
.field > label, .label { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 10px; border-radius: var(--r-control);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px;
}
.textarea { height: auto; min-height: 80px; padding: 8px 10px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--signal); box-shadow: var(--focus); }
.input-sm { height: 32px; font-size: 13px; }
.input[disabled] { background: var(--sunken); color: var(--graphite); }
.input-group { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: var(--r-control); background: var(--surface); overflow: hidden; }
.input-group:focus-within { border-color: var(--signal); box-shadow: var(--focus); }
.input-group .input { border: 0; box-shadow: none; border-radius: 0; }
.input-group .addon { display: grid; place-items: center; padding: 0 10px; color: var(--graphite); background: var(--sunken); font-size: 13px; }
.input-group .addon.plain { background: none; padding-inline-end: 0; }
.hint { font-size: 12px; color: var(--graphite); }
.check { width: 16px; height: 16px; accent-color: var(--signal); flex: none; margin: 0; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------------------------------------------------------------- feedback */
.alert { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-control); font-size: 13px; }
.alert .icon { margin-top: 2px; }
.alert-error { background: var(--up-tint); color: var(--up); }
.alert-success { background: var(--down-tint); color: var(--down); }
.alert-info { background: var(--sunken); color: var(--ink-2); }
.alert-warning { background: var(--warn-tint); color: var(--warn); }
.alert > span { flex: 1; }
.alert-action { margin-inline-start: auto; flex: none; align-self: center; }
.alert-action .btn { background: var(--surface); }
.toasts { position: fixed; inset-inline: 0; top: 12px; z-index: 60; display: grid; justify-items: center; gap: 6px; padding: 0 16px; pointer-events: none; }
.toast { pointer-events: auto; max-width: 480px; width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); box-shadow: 0 6px 24px -8px rgba(20, 23, 28, .25); animation: toast-out .25s ease-in 4.5s forwards; }
.toast.alert-error .icon { color: var(--up); }
.toast.alert-success .icon { color: var(--down); }
@keyframes toast-out { to { opacity: 0; visibility: hidden; } }

.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: var(--r-badge); font-size: 12px; font-weight: 500; background: var(--sunken); color: var(--ink-2); white-space: nowrap; }
.badge-review, .badge-pending { background: var(--warn-tint); color: var(--warn); }
.badge-published, .badge-ok, .badge-verified, .badge-down { background: var(--down-tint); color: var(--down); }
.badge-failed, .badge-up { background: var(--up-tint); color: var(--up); }
.badge-processing, .badge-uploaded, .badge-publishing, .badge-unpublishing, .badge-new { background: var(--signal-tint); color: var(--signal); }
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: var(--r-badge); font-size: 12px; background: var(--sunken); color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
/* Barand: tag e ghors e aram kenar e nam (D023) — faghat khat e nazok + noghte, bedun e rang e jadid */
.brand-tag { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px 0 9px; margin-inline-start: 4px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: 11.5px; font-weight: 500; line-height: 1; white-space: nowrap; vertical-align: 1px; letter-spacing: .01em; }
.brand-tag::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .55; flex: none; }
.brand-tag-lg { height: 26px; padding: 0 11px 0 12px; font-size: 13px; gap: 6px; vertical-align: 4px; }
.brand-tag-lg::before { width: 6px; height: 6px; }
/* Na-mojud: be jaye gheymat (D022) — aram, na hoshdar */
.out-of-stock { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--r-badge); background: var(--sunken); color: var(--graphite); font-size: 12px; font-weight: 700; white-space: nowrap; }
.out-of-stock-lg { height: 34px; padding: 0 14px; font-size: 16px; border-radius: var(--r-control); }
.flag { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: var(--r-badge); font-size: 11.5px; background: var(--warn-tint); color: var(--warn); }
.delta { font-size: 12px; font-weight: 700; padding: 1px 6px; border-radius: var(--r-badge); }
.delta.up { color: var(--up); background: var(--up-tint); }
.delta.down { color: var(--down); background: var(--down-tint); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--sunken); color: var(--ink-2); flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------------------------------------------------------------- surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-box); min-width: 0; }
.card-pad { padding: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.card-head > * { min-width: 0; }
.card-body { padding: 16px; }
.card-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); }

/* Yek navar e kholase be jaye chand kart e amar: har bakhsh yek adad */
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-box); overflow: hidden; }
.summary > * { padding: 12px 16px; border-inline-start: 1px solid var(--line); margin-inline-start: -1px; display: grid; gap: 2px; min-width: 0; }
.summary .s-label { font-size: 12px; color: var(--graphite); }
.summary .s-value { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.3; }
.summary .s-note { font-size: 12px; color: var(--graphite); }
.summary a:hover { background: var(--sunken); }
.summary .is-warn .s-value { color: var(--warn); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: start; font-size: 12px; font-weight: 500; color: var(--graphite); padding: 8px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--canvas); }
.table .end { text-align: end; }
.table a.link { font-weight: 500; }
.table a.link:hover { color: var(--signal); }
.table .price-cell { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.excluded td { opacity: .5; }
.excluded td.actions { opacity: 1; }
@media (max-width: 760px) {
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .table.responsive tbody tr:last-child { border-bottom: 0; }
  .table.responsive td { border: 0; padding: 2px 0; display: flex; justify-content: space-between; gap: 12px; }
  .table.responsive td::before { content: attr(data-label); color: var(--graphite); font-size: 12px; flex: none; }
  .table.responsive td.primary { font-size: 14px; font-weight: 700; padding-bottom: 4px; }
  .table.responsive td.primary::before, .table.responsive td.actions::before { display: none; }
  .table.responsive .end { text-align: start; }
}

/* ---------------------------------------------------------------- tabs / pagination / empty */
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: var(--r-control); font-size: 13px; color: var(--graphite); white-space: nowrap; border: 0; background: none; font-family: inherit; cursor: pointer; }
.tab:hover { color: var(--ink); background: var(--sunken); }
.tab.active { color: var(--ink); background: var(--sunken); font-weight: 700; }
.tab .count { font-size: 11px; color: var(--graphite); font-weight: 500; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--graphite); }
.empty { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 32px 16px; color: var(--graphite); }
.empty h3 { color: var(--ink); }
.empty .empty-icon { color: var(--line-strong); }

/* =================================================================== panel shell */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 14px 10px; background: var(--surface); border-inline-end: 1px solid var(--line); }
.sidebar > a:first-child { padding: 2px 8px 14px; }
.nav { display: grid; gap: 1px; }
.nav-title { font-size: 12px; color: var(--graphite); padding: 12px 8px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 8px; border-radius: var(--r-control); font-size: 13px; color: var(--ink-2); }
.nav a:hover { background: var(--sunken); color: var(--ink); }
.nav a.active { background: var(--signal-tint); color: var(--signal); font-weight: 700; }
.sidebar-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.user-card { display: flex; align-items: center; gap: 8px; padding: 4px; }
.user-card .who { min-width: 0; }
.user-card .who b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card .who span { display: block; font-size: 11.5px; color: var(--graphite); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 24px; }
.topbar .crumbs { font-size: 12px; color: var(--graphite); display: flex; gap: 6px; }
.topbar .crumbs a:hover { color: var(--signal); }
.content { padding: 0 24px 32px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; max-width: 1240px; width: 100%; align-content: start; }
.content > * { min-width: 0; }
.menu-toggle, .scrim { display: none; }
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(80vw, 260px); z-index: 50; transform: translateX(100%); transition: transform .2s ease; }
  [dir="ltr"] .sidebar { transform: translateX(-100%); }
  #nav-open:checked ~ .shell .sidebar { transform: none; }
  #nav-open:checked ~ .shell .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(15, 17, 21, .4); }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 8px 12px; }
  .content { padding: 0 12px 24px; }
}

/* =================================================================== public site */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px; }
.site-header .wrap { height: 64px; display: flex; align-items: center; gap: 12px; }
/* Saf-he ye omumi: nam va logo kami bozorg tar (faghat inja — panel va vorud dast nemikhorand) */
.site-header .brand { gap: 10px; font-size: 19px; letter-spacing: -.01em; }
.site-header .brand-mark { width: 34px; height: 34px; border-radius: 8px; }
.site-header .brand-mark svg { width: 20px; height: 20px; }
.ledger-head { padding: 20px 0 12px; display: grid; gap: 12px; }
.ledger-head h1 { font-size: 22px; }
.ledger-head .lead { color: var(--graphite); font-size: 13px; }
.searchbar { display: flex; gap: 8px; }
.searchbar .input-group { flex: 1; }
.searchbar .input { height: 42px; font-size: 15px; }
.searchbar .btn { height: 44px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 8px 12px; border-bottom: 1px solid var(--line); }
/* Daftar e gheymat: nam ruberu ye gheymat (tanha onsor e porrang e safhe) */
.ledger { display: grid; }
.ledger-row { display: grid; grid-template-columns: auto minmax(16px, 1fr) auto; align-items: baseline; gap: 2px 10px; padding: 9px 16px; border-bottom: 1px solid var(--line); }
.ledger-row:last-child { border-bottom: 0; }
.ledger-row:hover { background: var(--canvas); }
.ledger-row .l-name { font-weight: 500; font-size: 14px; }
.ledger-row:hover .l-name { color: var(--signal); }
.ledger-row .l-name { grid-column: 1; max-width: 62ch; }
.ledger-row .l-dots { grid-column: 2; align-self: end; margin-bottom: .45em; border-bottom: 1px dotted var(--line-strong); }
.ledger-row .l-price { grid-column: 3; text-align: end; }
.ledger-row .l-meta { grid-column: 1 / -1; font-size: 12px; color: var(--graphite); }
.ledger-row.is-out .l-name { color: var(--graphite); }
.price { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.price .unit { font-size: 11.5px; font-weight: 400; color: var(--graphite); margin-inline-start: 4px; }
.site-footer { padding: 16px 0 28px; color: var(--graphite); font-size: 12px; }
@media (max-width: 560px) {
  .wrap { padding: 0 12px; }
  .ledger-row { padding: 10px 12px; grid-template-columns: minmax(0, 1fr) auto; }
  .ledger-row .l-dots { display: none; }
  .ledger-row .l-price { grid-column: 2; }
  .price { font-size: 15px; }
}

/* product detail */
.product-head { padding: 16px 0; display: grid; gap: 6px; }
.product-head h1 { font-size: 20px; }
.big-price { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 900px) { .detail-grid, .two-col { grid-template-columns: minmax(0, 1fr); } }
.chart { width: 100%; height: auto; display: block; }
.chart .grid-line { stroke: var(--line); }
.chart .line { fill: none; stroke: var(--signal); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: url(#chart-fill); }
.chart .dot { fill: var(--surface); stroke: var(--signal); stroke-width: 2; }
.timeline .t-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 16px; border-bottom: 1px solid var(--line); }
.timeline .t-item:last-child { border-bottom: 0; }

/* =================================================================== login */
/* Yek tarkib e vasat chin: form + akharin gheymat ha kenar e ham (bedun e sotun e tamam-ghad e khali) */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 520px); justify-content: center; align-content: center; gap: 24px; padding: 32px 20px; }
.auth.solo { grid-template-columns: minmax(0, 380px); }
.auth-main { display: grid; gap: 16px; align-content: start; }
.auth-card { display: grid; gap: 16px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-box); }
.auth-card h1 { font-size: 20px; }
.auth-card .sub { color: var(--graphite); margin-top: 2px; font-size: 13px; }
.auth-links { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--graphite); }
.auth-links a { color: var(--signal); }
.otp-input { letter-spacing: .4em; text-align: center; font-size: 20px; font-weight: 700; height: 48px; direction: ltr; }
.auth-side { display: grid; gap: 8px; align-content: start; padding-top: 44px; }
.auth-side h2 { font-size: 12px; font-weight: 500; color: var(--graphite); }
.btn-lg { height: 42px; font-size: 14px; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; font-size: 13px; color: var(--signal); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.auth-step { display: grid; gap: 16px; }
.auth-step:not([hidden]) { animation: step-in .22s ease-out; }
@keyframes step-in { from { opacity: 0; transform: translateY(6px); } }
.otp-boxes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.otp-box { width: 100%; height: 52px; text-align: center; font: inherit; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-control); caret-color: var(--signal); }
.otp-box:focus { outline: none; border-color: var(--signal); box-shadow: var(--focus); }
.otp-box.filled { border-color: var(--ink-2); }
.otp-boxes.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.no-js .otp-boxes, .no-js [data-resend], .no-js [data-countdown-wrap] { display: none !important; }
.resend { display: flex; justify-content: center; font-size: 13px; min-height: 20px; }

@keyframes spin { to { transform: rotate(360deg); } }
.auth-card.is-done { opacity: .6; pointer-events: none; transition: opacity .2s; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; gap: 3px; border-radius: var(--r-control); background: var(--sunken); }
.segmented .tab { justify-content: center; height: 30px; }
.segmented .tab.active { background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
@media (max-width: 960px) {
  .auth { grid-template-columns: minmax(0, 420px); align-content: start; padding: 20px 12px; }
  .auth-side { padding-top: 0; }
}

/* =================================================================== price list review */
.upload-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 150px) auto; gap: 12px; align-items: end; }
@media (max-width: 900px) { .upload-grid { grid-template-columns: minmax(0, 1fr); } }
.dropzone { position: relative; display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border: 1px dashed var(--line-strong); border-radius: var(--r-control); color: var(--graphite); cursor: pointer; font-size: 13px; }
.dropzone:hover, .dropzone.drag { border-color: var(--signal); color: var(--signal); background: var(--signal-tint); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .file-name { color: var(--ink); font-weight: 500; direction: ltr; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Marahel e gardesh: vaghean yek tavali ast, pas shomare dar an ma'na darad */
.steps { display: flex; align-items: center; gap: 0; overflow-x: auto; scrollbar-width: none; font-size: 12px; }
.step { display: inline-flex; align-items: center; gap: 6px; color: var(--graphite); white-space: nowrap; }
.step .bullet { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; border: 1px solid var(--line-strong); background: var(--surface); }
.step.done { color: var(--ink-2); }
.step.done .bullet { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.step.current { color: var(--signal); font-weight: 700; }
.step.current .bullet { border-color: var(--signal); color: var(--signal); }
.step-sep { flex: 1; min-width: 16px; max-width: 64px; height: 1px; background: var(--line); margin: 0 8px; }

.frag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1px; background: var(--line); }
.frag { display: grid; gap: 6px; padding: 10px 12px; background: var(--surface); transition: opacity .25s; }
.frag .frag-img { height: 38px; display: flex; align-items: center; justify-content: center; background: #fff; border-radius: var(--r-badge); overflow: hidden; }
.frag .frag-img img { max-height: 30px; width: auto; }
.frag form { display: flex; gap: 6px; }
.frag-alt { display: flex; align-items: center; gap: 6px; }
.frag-alt .chip { border: 1px dashed var(--warn); background: var(--warn-tint); color: var(--ink); cursor: pointer; font: inherit; }
.frag-alt .chip:hover { border-style: solid; }
.frag.done { opacity: 0; }
/* Radif e bazbini: nam، tasvir va flag ha hame az HAMAN labe ye shoru */
.name-cell { display: grid; justify-items: start; gap: 4px; min-width: 0; }
.flags { display: flex; flex-wrap: wrap; gap: 4px; }
.row-img { display: block; height: 28px; width: min(100%, 320px); background: #fff; border-radius: var(--r-badge); border: 1px solid var(--line); padding: 2px 4px; overflow: hidden; }
.row-img img { height: 100%; width: auto; max-width: 100%; object-fit: contain; object-position: right center; }
/* Action ha yek goruh e ham-andaze dar yek khat، chasbide be labe ye payan */
.table td.actions { width: 1%; white-space: nowrap; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.row-actions form { display: contents; }
details.edit > summary { list-style: none; }
details.edit > summary::-webkit-details-marker { display: none; }
details.edit[open] > summary { display: none; }
.edit-form { display: grid; grid-template-columns: minmax(0, 1fr) 130px auto; gap: 6px; margin-top: 6px; min-width: 320px; }
.edit-form.partner-edit { grid-template-columns: minmax(0, 1fr) 120px minmax(0, 1fr) auto; min-width: 460px; }
.edit-form.price-edit { grid-template-columns: minmax(0, 1fr) auto; }
@media (max-width: 760px) {
  .edit-form, .edit-form.partner-edit { grid-template-columns: minmax(0, 1fr); min-width: 0; }
  .table.responsive td.actions { width: 100%; padding-top: 8px; }
  .table.responsive .row-actions { justify-content: flex-start; width: 100%; }
  /* Lams: dokme ye boland tar ba kadr ⇒ labe ye dokme ba labe ye matn e kart yeki */
  .row-actions .btn { height: 34px; padding: 0 12px; font-size: 13px; }
  .row-actions .btn-ghost { border-color: var(--line-strong); }
}
/* Adad e LTR dar form e RTL: az HAMAN labe ye label shoru mishavad */
[dir="rtl"] .modal .input.ltr { text-align: right; }
/* Radif e taze be-ruz shode: yek lahze rang e zamine (bedun e jabejayi) */
.table tr.flash td { animation: row-flash 1.2s ease-out; }
@keyframes row-flash { from { background: var(--signal-tint); } to { background: transparent; } }
.table tr.leaving td { transition: opacity .25s; opacity: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Dokme dar hal e anjam (hame ye form ha، login ham): hamun andaze، matn penhan، spinner vasat */
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy > * { visibility: hidden; }
.btn.is-busy::after { content: ""; position: absolute; inset-inline-start: 50%; top: 50%; width: 14px; height: 14px; margin: -7px; border: 2px solid var(--line-strong); border-top-color: var(--signal); border-radius: 50%; animation: spin .7s linear infinite; }
.btn-primary.is-busy::after, .btn-success.is-busy::after { border-color: rgba(255, 255, 255, .45); border-top-color: #fff; }

/* Modal e virayesh e radif (<dialog> e bumi: focus، Esc va backdrop ba khod e morurgar) */
.modal { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--line); border-radius: var(--r-box); background: var(--surface); color: var(--ink); box-shadow: 0 18px 48px -12px rgba(20, 23, 28, .35); }
.modal::backdrop { background: rgba(20, 23, 28, .45); }
.modal-body { display: grid; gap: 12px; padding: 16px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h2 { font-size: 16px; }
.modal-img { height: 40px; max-width: 100%; }
.modal .textarea { min-height: 72px; font-size: 14px; line-height: 1.7; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; }
.field-error { font-size: 12px; color: var(--up); }
.publish-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 16px; border: 1px solid var(--line); border-inline-start: 3px solid var(--signal); border-radius: var(--r-box); background: var(--surface); }
.publish-bar.ready { border-inline-start-color: var(--down); }

/* =================================================================== roles & users */
/* Matris e dastresi: radif = dastresi (goruh be bakhsh e registry), sotun = naghsh */
.matrix th, .matrix td { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: start; position: sticky; inset-inline-start: 0; background: var(--surface); min-width: 220px; }
.matrix thead th { vertical-align: bottom; white-space: normal; min-width: 96px; }
.matrix thead th a { color: var(--ink); font-weight: 700; }
.matrix thead th a:hover { color: var(--signal); }
.matrix .section-row td { background: var(--canvas); font-size: 12px; font-weight: 700; color: var(--ink-2); text-align: start; }
.matrix .yes { color: var(--down); }
.matrix .no { color: var(--line-strong); }
.check-list { display: grid; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.check-row:last-child { border-bottom: 0; }
.check-row:hover { background: var(--canvas); }
.perm-group { border: 0; margin: 0; padding: 12px 16px; min-width: 0; border-bottom: 1px solid var(--line); }
.perm-group:last-of-type { border-bottom: 0; }
.perm-group legend { float: right; width: 100%; padding: 0; margin-bottom: 6px; }
[dir="ltr"] .perm-group legend { float: left; }
.perm-group legend + * { clear: both; }
.perm-group h4 { font-size: 13px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2px 12px; }
.perm-check { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13px; cursor: pointer; }

@media (max-width: 560px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary > *:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .summary > * { border-top: 1px solid var(--line); margin-top: -1px; }
  .summary .s-value { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.link-btn.is-busy { position: relative; color: transparent !important; }
.link-btn.is-busy::after { content: ""; position: absolute; inset-inline-start: 50%; top: 50%; width: 14px; height: 14px; margin: -7px; border: 2px solid var(--line-strong); border-top-color: var(--signal); border-radius: 50%; animation: spin .7s linear infinite; }
/* Sotun e barik e kenar e form: nam ha mishkanand ⇒ bedun e noghte chin, do sotun */
.auth-side .ledger-row { grid-template-columns: minmax(0, 1fr) auto; }
.auth-side .ledger-row .l-dots { display: none; }
.auth-side .ledger-row .l-price { grid-column: 2; }
.frag.uncertain { box-shadow: inset 3px 0 0 var(--warn); }
[dir="rtl"] .frag.uncertain { box-shadow: inset -3px 0 0 var(--warn); }

/* Jostoju ye zende: dokme ye «جست‌وجو» ba JS lazem nist؛ icon ⇒ spinner faghat agar javab kond bashad */
.js [data-search-submit] { display: none; }
form[data-live-search] .addon { position: relative; }
form[data-live-search].is-searching .addon .icon { visibility: hidden; }
form[data-live-search].is-searching .addon::after { content: ""; position: absolute; inset-inline-start: 50%; top: 50%; width: 14px; height: 14px; margin: -7px; border: 2px solid var(--line-strong); border-top-color: var(--signal); border-radius: 50%; animation: spin .7s linear infinite; }

/* Scroll e bi-payan: navar e safhe bandi faghat bedun e JS؛ spinner e payan e list */
.js [data-pager] { display: none; }
.feed-more { display: flex; justify-content: center; align-items: center; min-height: 56px; padding: 12px; border-top: 1px solid var(--line); }
.feed-more .spinner { width: 20px; height: 20px; border: 2px solid var(--line-strong); border-top-color: var(--signal); border-radius: 50%; animation: spin .7s linear infinite; }

