/* ===== فونت ===== */
@font-face {
    font-family: 'IRANSans';
    src: url('../fonts/IRANSansWeb_Light.woff2') format('woff2');
    font-weight: 300;
    font-display: swap;
}

@font-face {
    font-family: 'IRANSans';
    src: url('../fonts/IRANSansWeb.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: 'IRANSans';
    src: url('../fonts/IRANSansWeb_Medium.woff2') format('woff2');
    font-weight: 500;
    font-display: swap;
}

@font-face {
    font-family: 'IRANSans';
    src: url('../fonts/IRANSansWeb_Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}

/* ===== متغیرها ===== */
:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-2: #fafbfc;
    --border: #e4e7ec;
    --border-strong: #d0d5dd;
    --text: #101828;
    --text-2: #475467;
    --muted: #98a2b3;
    --accent: #4338ca;
    --accent-soft: #eef2ff;
    --accent-text: #ffffff;
    --success: #067647;
    --success-soft: #ecfdf3;
    --danger: #b42318;
    --danger-soft: #fef3f2;
    --warning: #b54708;
    --warning-soft: #fffaeb;
    --info: #175cd3;
    --info-soft: #eff8ff;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .16);
    --radius: 10px;
    --radius-sm: 7px;
    --sidebar-width: 256px;
}

/* پوسته تیره ویندوز/مرورگر، مگر اینکه مدیر صریحاً پوسته روشن را انتخاب کرده باشد */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0e1116;
        --surface: #161b22;
        --surface-2: #1c222b;
        --border: #262d38;
        --border-strong: #353d4a;
        --text: #e6edf3;
        --text-2: #9aa5b1;
        --muted: #6e7781;
        --accent: #7c74ff;
        --accent-soft: #221f45;
        --accent-text: #0e1116;
        --success: #4ade80;
        --success-soft: #12261c;
        --danger: #f87171;
        --danger-soft: #2a1618;
        --warning: #fbbf24;
        --warning-soft: #2a2011;
        --info: #60a5fa;
        --info-soft: #14243b;
        --shadow: 0 1px 2px rgba(0, 0, 0, .4);
        --shadow-lg: 0 12px 32px -8px rgba(0, 0, 0, .6);
    }
}

/* انتخاب صریح پوسته تیره از دکمه بالای صفحه */
:root[data-theme="dark"] {
    --bg: #0e1116;
    --surface: #161b22;
    --surface-2: #1c222b;
    --border: #262d38;
    --border-strong: #353d4a;
    --text: #e6edf3;
    --text-2: #9aa5b1;
    --muted: #6e7781;
    --accent: #7c74ff;
    --accent-soft: #221f45;
    --accent-text: #0e1116;
    --success: #4ade80;
    --success-soft: #12261c;
    --danger: #f87171;
    --danger-soft: #2a1618;
    --warning: #fbbf24;
    --warning-soft: #2a2011;
    --info: #60a5fa;
    --info-soft: #14243b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 12px 32px -8px rgba(0, 0, 0, .6);
}

/* ===== پایه ===== */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'IRANSans', 'Segoe UI', Tahoma, sans-serif;
    font-size: 13.5px;
    line-height: 1.85;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1, h2, h3, h4, h5 {
    margin: 0;
    font-weight: 700;
    line-height: 1.6;
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 99px;
    border: 3px solid transparent;
    background-clip: content-box;
}

/* ===== چیدمان ===== */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    background: var(--surface);
    border-inline-start: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    min-height: 66px;
}

.sidebar__mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 13px;
    flex: none;
}

.sidebar__mark svg {
    width: 32px;
    height: 32px;
}

.sidebar__logo {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    object-fit: contain;
    flex: none;
    background: var(--surface-2);
}

.sidebar__brand-text {
    min-width: 0;
}

.sidebar__title {
    font-weight: 700;
    font-size: 12.5px;
    line-height: 1.6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar__subtitle {
    font-size: 11px;
    color: var(--muted);
    font-weight: 400;
    line-height: 1.5;
}

.sidebar__nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px 24px;
}

.nav-group {
    margin-bottom: 14px;
}

.nav-group__label {
    font-size: 10.5px;
    font-weight: 500;
    color: var(--muted);
    padding: 6px 10px;
    letter-spacing: .02em;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-size: 12.5px;
    transition: background .12s, color .12s;
}

.nav-link:hover {
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
}

.nav-link.is-active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 500;
}

.nav-link svg {
    width: 16px;
    height: 16px;
    flex: none;
    opacity: .85;
}

.nav-link__badge {
    margin-inline-start: auto;
    background: var(--danger-soft);
    color: var(--danger);
    border-radius: 99px;
    font-size: 10.5px;
    font-weight: 700;
    padding: 1px 7px;
    line-height: 1.7;
}

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    min-height: 65px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 24px;
}

.topbar__titles {
    min-width: 0;
}

.topbar__title {
    font-size: 15px;
    font-weight: 700;
}

.topbar__crumb {
    font-size: 11.5px;
    color: var(--muted);
}

.topbar__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* فروشگاه مشتری و کاربر واردشده، بالا سمت چپ */
.topbar__store {
    order: 3;
    display: flex;
    align-items: center;
    gap: 9px;
    padding-inline-end: 12px;
    border-inline-end: 1px solid var(--border);
    min-width: 0;
}

.topbar__store-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: contain;
    background: var(--surface-2);
    flex: none;
}

.topbar__store-text {
    min-width: 0;
    line-height: 1.5;
}

.topbar__store-name {
    font-size: 12.5px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar__store-user {
    font-size: 11px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar__titles {
    order: 1;
    min-width: 0;
}

.topbar__actions {
    order: 2;
    margin-inline-start: auto;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 12px;
    flex: none;
}

.avatar--store {
    border-radius: 8px;
}

.content {
    padding: 22px 24px 60px;
    max-width: 1500px;
    width: 100%;
}

/* ===== کارت ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 18px;
    overflow: hidden;
}

.card__head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.card__title {
    font-size: 13px;
    font-weight: 700;
}

.card__hint {
    font-size: 11.5px;
    color: var(--muted);
    font-weight: 400;
}

.card__actions {
    margin-inline-start: auto;
    display: flex;
    gap: 8px;
    align-items: center;
}

.card__body {
    padding: 18px;
}

.card__body--flush {
    padding: 0;
}

.card__foot {
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ===== آمار ===== */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 15px 16px;
    box-shadow: var(--shadow);
    display: block;
    color: inherit;
}

.stat:hover {
    text-decoration: none;
    border-color: var(--border-strong);
}

.stat__label {
    font-size: 11.5px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat__value {
    font-size: 22px;
    font-weight: 700;
    margin-top: 4px;
    letter-spacing: -.01em;
}

.stat__meta {
    font-size: 11px;
    color: var(--text-2);
}

/* ===== جدول ===== */
.table-wrap {
    overflow-x: auto;
}

table.grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

table.grid th {
    text-align: right;
    font-weight: 500;
    font-size: 11.5px;
    color: var(--text-2);
    background: var(--surface-2);
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table.grid td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table.grid tbody tr:last-child td {
    border-bottom: 0;
}

table.grid tbody tr:hover {
    background: var(--surface-2);
}

/* ردیفی که هست ولی روی سایت دیده نمی‌شود (مثلاً بیرون از سقف یک بخش ویترین) */
table.grid tbody tr.is-muted td {
    opacity: .55;
}

table.grid tbody tr.is-muted:hover td {
    opacity: 1;
}

table.grid td.num,
table.grid th.num {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

table.grid td.actions {
    text-align: left;
    white-space: nowrap;
}

.row-title {
    font-weight: 500;
    color: var(--text);
}

.row-sub {
    font-size: 11px;
    color: var(--muted);
}

.empty {
    padding: 44px 20px;
    text-align: center;
    color: var(--muted);
}

.empty svg {
    width: 34px;
    height: 34px;
    opacity: .4;
    margin-bottom: 8px;
}

/* ===== دکمه ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 7px 13px;
    font: inherit;
    font-size: 12.5px;
    line-height: 1.5;
    cursor: pointer;
    transition: background .12s, border-color .12s, opacity .12s;
    white-space: nowrap;
}

.btn:hover {
    background: var(--surface-2);
    border-color: var(--muted);
    text-decoration: none;
}

.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.btn svg {
    width: 15px;
    height: 15px;
}

.btn--primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-text);
    font-weight: 500;
}

.btn--primary:hover {
    background: color-mix(in srgb, var(--accent) 85%, #000);
    border-color: color-mix(in srgb, var(--accent) 85%, #000);
    color: var(--accent-text);
}

.btn--danger {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 35%, transparent);
}

.btn--danger:hover {
    background: var(--danger-soft);
    border-color: var(--danger);
}

.btn--ghost {
    border-color: transparent;
    background: transparent;
    color: var(--text-2);
}

.btn--ghost:hover {
    background: var(--surface-2);
}

.btn--sm {
    padding: 4px 9px;
    font-size: 11.5px;
    border-radius: 6px;
}

.btn--icon {
    padding: 6px;
    width: 30px;
    height: 30px;
}

.btn-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

/* ===== فرم ===== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 15px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.field--full {
    grid-column: 1 / -1;
}

.field > label,
.field-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-2);
}

.field__hint {
    font-size: 11px;
    color: var(--muted);
    line-height: 1.7;
}

input[type="text"],
input[type="search"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="tel"],
input[type="date"],
select,
textarea {
    width: 100%;
    font: inherit;
    font-size: 12.5px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 7px 11px;
    transition: border-color .12s, box-shadow .12s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

input:disabled,
select:disabled,
textarea:disabled {
    background: var(--surface-2);
    color: var(--muted);
}

textarea {
    resize: vertical;
    min-height: 74px;
    line-height: 1.9;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 9px center;
    background-size: 15px;
    padding-inline-start: 30px;
}

input[type="number"] {
    font-variant-numeric: tabular-nums;
}

.input-ltr {
    direction: ltr;
    text-align: left;
}

/* سوییچ */
.switch {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    font-size: 12.5px;
    user-select: none;
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.switch__track {
    width: 38px;
    height: 22px;
    border-radius: 99px;
    background: var(--border-strong);
    position: relative;
    transition: background .15s;
    flex: none;
}

/*
  چیدمان راست‌به‌چپ: خاموش یعنی دستگیره سمت راست (inset-inline-start) و روشن یعنی به چپ برود.
  transform همیشه فیزیکی است، پس جابه‌جایی منفی درست همان حرکت راست به چپ است.
*/
.switch__track::after {
    content: '';
    position: absolute;
    inset-inline-start: 3px;
    top: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform .15s;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .3);
}

.switch input:checked ~ .switch__track {
    background: var(--accent);
}

.switch input:checked ~ .switch__track::after {
    transform: translateX(-16px);
}

.switch input:disabled ~ .switch__track {
    opacity: .5;
}

.switch input:focus-visible ~ .switch__track {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

/* چک‌باکس ساده */
.check {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    cursor: pointer;
}

.check input {
    width: 15px;
    height: 15px;
    accent-color: var(--accent);
}

/* چند چک‌باکس کنار هم، مثل فهرست صفحه‌های یک نقش */
.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: 8px 14px;
}

/* ===== نشان ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 99px;
    padding: 2px 9px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.75;
    white-space: nowrap;
}

.badge--on {
    background: var(--success-soft);
    color: var(--success);
}

.badge--off {
    background: var(--surface-2);
    color: var(--muted);
    border: 1px solid var(--border);
}

.badge--danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.badge--warn {
    background: var(--warning-soft);
    color: var(--warning);
}

.badge--info {
    background: var(--info-soft);
    color: var(--info);
}

.badge--accent {
    background: var(--accent-soft);
    color: var(--accent);
}

/* ===== پیام ===== */
.alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.alert svg {
    width: 17px;
    height: 17px;
    flex: none;
    margin-top: 2px;
}

.alert--success {
    background: var(--success-soft);
    color: var(--success);
    border-color: color-mix(in srgb, var(--success) 25%, transparent);
}

.alert--error {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 25%, transparent);
}

.alert--info {
    background: var(--info-soft);
    color: var(--info);
    border-color: color-mix(in srgb, var(--info) 25%, transparent);
}

.validation-summary-errors ul {
    margin: 0;
    padding-inline-start: 18px;
}

.field-validation-error {
    color: var(--danger);
    font-size: 11px;
}

input.input-validation-error,
select.input-validation-error,
textarea.input-validation-error {
    border-color: var(--danger);
}

/* ===== نوار جست‌وجو ===== */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.toolbar .field {
    min-width: 160px;
}

.toolbar__grow {
    flex: 1;
    min-width: 220px;
}

.toolbar__end {
    margin-inline-start: auto;
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.search-box {
    position: relative;
}

.search-box svg {
    position: absolute;
    inset-inline-start: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: var(--muted);
    pointer-events: none;
}

.search-box input {
    padding-inline-start: 32px;
}

/* ===== صفحه‌بندی ===== */
.pager {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-2);
    flex-wrap: wrap;
}

.pager__pages {
    margin-inline-start: auto;
    display: flex;
    gap: 4px;
}

.pager__page {
    min-width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    color: var(--text-2);
    font-size: 12px;
    padding: 0 7px;
}

.pager__page:hover {
    background: var(--surface-2);
    text-decoration: none;
}

.pager__page.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-text);
    font-weight: 500;
}

.pager__page.is-disabled {
    opacity: .4;
    pointer-events: none;
}

/* ===== بخش دوستونه ===== */
.split {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 18px;
    align-items: start;
}

.split--even {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

/* ===== زبانه ===== */
.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    padding: 0 18px;
    background: var(--surface-2);
    overflow-x: auto;
}

.tabs__item {
    padding: 11px 13px;
    font-size: 12.5px;
    color: var(--text-2);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
}

.tabs__item:hover {
    color: var(--text);
    text-decoration: none;
}

.tabs__item.is-active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 500;
}

/*
  زبانه‌های پرش درون‌صفحه‌ای: در صفحه‌های بلند (مثل تنظیمات پشتیبانی) جای رفتن به
  صفحه دیگر، به بخش‌های همین صفحه می‌پرند، پس مثل یک نوار مستقل قاب می‌گیرند.
*/
.tabs--jump {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 18px;
}

/* بخشی که هدف یک پیوند لنگر است، زیر نوار بالای صفحه نمی‌افتد */
.anchor-target {
    scroll-margin-top: 18px;
}

/* ===== تصویر ===== */
.thumb {
    width: 38px;
    height: 52px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    flex: none;
}

.thumb--square {
    width: 42px;
    height: 42px;
    border-radius: 50%;
}

.thumb--wide {
    width: 90px;
    height: 46px;
}

.cell-media {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.image-preview {
    display: block;
    max-width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
}

/* ===== ویرایشگر متن ===== */
.editor {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface);
}

.editor:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

/*
  نوار ابزار چسبان نیست: کارت‌ها overflow:hidden دارند و همین باعث می‌شود کارت (نه صفحه)
  ظرف اسکرولِ sticky شود؛ آن‌وقت نوار ابزار به اندازه مقدار top به پایین هل داده می‌شود،
  بالای کادر فاصله می‌افتد و روی متن سوار می‌شود. خود کادر متن اسکرول داخلی دارد، پس
  نوار ابزار بدون sticky هم همیشه بالای متن دیده می‌شود.
*/
.editor__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px;
    padding: 7px 8px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.editor__btn {
    min-width: 30px;
    height: 30px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 6px;
    color: var(--text-2);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 7px;
    font: inherit;
    font-size: 11.5px;
    line-height: 1;
    white-space: nowrap;
    flex: none;
}

.editor__btn:hover {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

.editor__btn.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}

.editor__btn svg {
    width: 15px;
    height: 15px;
}

.editor__sep {
    width: 1px;
    align-self: stretch;
    background: var(--border);
    margin: 3px 4px;
    flex: none;
}

.editor__area {
    min-height: 300px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 16px 18px;
    line-height: 2.1;
    font-size: 13.5px;
    outline: none;
    /* متن چسبانده‌شده نباید کادر را بترکاند */
    overflow-wrap: anywhere;
}

.editor__area > *:first-child {
    margin-top: 0;
}

.editor__area > *:last-child {
    margin-bottom: 0;
}

.editor__area:empty::before {
    content: attr(data-placeholder);
    color: var(--muted);
}

.editor__area h2 {
    font-size: 17px;
    margin: 18px 0 8px;
}

.editor__area h3 {
    font-size: 15px;
    margin: 16px 0 7px;
}

.editor__area h4 {
    font-size: 13.5px;
    margin: 14px 0 6px;
}

.editor__area p {
    margin: 0 0 10px;
}

.editor__area img,
.editor__area video,
.editor__area iframe {
    max-width: 100%;
    border-radius: 6px;
}

.editor__area blockquote {
    margin: 12px 0;
    padding: 4px 14px;
    border-inline-start: 3px solid var(--accent);
    color: var(--text-2);
    background: var(--surface-2);
    border-radius: 0 6px 6px 0;
}

.editor__area table {
    border-collapse: collapse;
    width: 100%;
    margin: 12px 0;
}

.editor__area th,
.editor__area td {
    border: 1px solid var(--border-strong);
    padding: 6px 10px;
}

.editor__area ul,
.editor__area ol {
    padding-inline-start: 22px;
}

/* Only the three site-information editors use native author formatting. */
.editor__area.editor__area--authored {
    font-family: sans-serif;
    font-size: 16px;
    line-height: normal;
    color: var(--text);
    text-align: start;
    white-space: pre-wrap;
}

.editor__area.editor__area--authored :where(*) {
    all: revert-layer;
}

.editor__foot {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    padding: 7px 12px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    font-size: 11px;
    color: var(--muted);
}

.editor__foot span:first-child {
    font-variant-numeric: tabular-nums;
    flex: none;
}

/* ===== انتخاب کالا ===== */
.picker {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.picker__search {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.picker__list {
    max-height: 330px;
    overflow-y: auto;
}

.picker__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 12.5px;
}

.picker__item:last-child {
    border-bottom: 0;
}

.picker__item:hover {
    background: var(--surface-2);
}

.picker__empty {
    padding: 22px;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
}

/* ===== فهرست توضیح ===== */
.desc-list {
    display: grid;
    gap: 6px;
    font-size: 12.5px;
}

.desc-list__row {
    display: flex;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px dashed var(--border);
}

.desc-list__row:last-child {
    border-bottom: 0;
}

.desc-list__key {
    color: var(--muted);
    min-width: 120px;
    flex: none;
}

.desc-list__value {
    color: var(--text);
    min-width: 0;
    word-break: break-word;
}

/* ===== تقویم شمسی ===== */
.jdp {
    position: absolute;
    z-index: 60;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 10px;
    width: 268px;
}

.jdp__head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.jdp__selects {
    display: flex;
    gap: 5px;
    flex: 1;
    min-width: 0;
}

.jdp__select {
    flex: 1;
    min-width: 0;
    padding: 4px 22px 4px 6px;
    font-size: 12px;
    background-position: left 5px center;
    background-size: 13px;
    border-radius: 6px;
    cursor: pointer;
}

.jdp__select:focus {
    box-shadow: none;
}

.jdp__nav {
    width: 27px;
    height: 27px;
    flex: none;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    color: var(--text-2);
    font: inherit;
    font-size: 15px;
    line-height: 1;
    display: grid;
    place-items: center;
}

.jdp__nav:hover {
    background: var(--surface-2);
    color: var(--text);
}

.jdp__grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.jdp__dow {
    font-size: 10.5px;
    color: var(--muted);
    text-align: center;
    padding: 4px 0;
}

.jdp__day {
    height: 29px;
    border: 0;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    color: var(--text);
}

.jdp__day:hover {
    background: var(--surface-2);
}

.jdp__day.is-today {
    border: 1px solid var(--accent);
}

.jdp__day.is-selected {
    background: var(--accent);
    color: var(--accent-text);
    font-weight: 500;
}

.jdp__day.is-empty {
    visibility: hidden;
    display: block;
}

.jdp__foot {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

/* ===== ورود ===== */
.login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(900px 500px at 80% -10%, color-mix(in srgb, var(--accent) 12%, transparent), transparent),
        var(--bg);
}

.login__card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 30px 28px;
}

.login__brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
    text-align: center;
}

.login__brand .sidebar__mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 15px;
}

.login__logo {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    object-fit: contain;
    background: var(--surface-2);
}

.login__vendor {
    margin-top: 14px;
    font-size: 11px;
    color: var(--muted);
}

/* ===== کد امنیتی و کد تأیید ===== */
.captcha {
    display: flex;
    align-items: center;
    gap: 8px;
}

.captcha__image {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #f4f5f7;
    flex: none;
}

.captcha input {
    flex: 1;
    min-width: 0;
    text-transform: uppercase;
    letter-spacing: .18em;
}

.code-input {
    font-size: 19px;
    letter-spacing: .5em;
    text-align: center;
    padding-inline-start: 11px;
    font-variant-numeric: tabular-nums;
}

/* ===== ریز ===== */
.muted {
    color: var(--muted);
}

.small {
    font-size: 11.5px;
}

.nowrap {
    white-space: nowrap;
}

.text-left {
    text-align: left;
}

.text-center {
    text-align: center;
}

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }

.stack {
    display: grid;
    gap: 14px;
}

.inline {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* کادر ورودی کنار دکمه: ورودی جای خالی را می‌گیرد و دکمه اندازه خودش می‌ماند */
.inline--grow {
    flex-wrap: nowrap;
}

.inline--grow > input,
.inline--grow > select {
    flex: 1 1 auto;
    min-width: 0;
}

.divider {
    height: 1px;
    background: var(--border);
    margin: 16px 0;
}

/* ===== واکنش‌گرا ===== */
@media (max-width: 1000px) {
    .split {
        grid-template-columns: 1fr;
    }
}

/*
  نوار کناری همیشه باز است و دکمه باز/بسته ندارد. روی صفحه باریک به یک ریل آیکونی
  جمع می‌شود تا هم دیده شود و هم جای محتوا را نگیرد.
*/
@media (max-width: 900px) {
    :root {
        --sidebar-width: 58px;
    }

    .sidebar__brand {
        justify-content: center;
        padding: 14px 8px;
    }

    .sidebar__brand-text,
    .nav-group__label {
        display: none;
    }

    .sidebar__nav {
        padding: 10px 6px 24px;
    }

    .nav-link {
        justify-content: center;
        padding: 9px 0;
        font-size: 0;
        gap: 0;
    }

    .nav-link svg {
        width: 18px;
        height: 18px;
    }

    .nav-link__badge {
        display: none;
    }

    .nav-group {
        margin-bottom: 10px;
        padding-top: 10px;
        border-top: 1px solid var(--border);
    }

    .nav-group:first-child {
        padding-top: 0;
        border-top: 0;
    }

    .content {
        padding: 16px 14px 50px;
    }

    .topbar {
        padding: 10px 14px;
        gap: 10px;
    }

    .topbar__store-text {
        display: none;
    }

    .topbar__store {
        padding-inline-end: 10px;
    }
}

@media (max-width: 600px) {
    .topbar__crumb {
        display: none;
    }
}

/* ===== صفحه تنظیمات ===== */
.settings {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

/* تنظیم‌های کم‌تعداد فهرست کناری ندارند و تمام عرض را می‌گیرند */
.settings--plain {
    grid-template-columns: minmax(0, 1fr);
}

/* فهرست گروه‌ها کنار صفحه می‌ماند تا پیمایش میان بخش‌ها کوتاه باشد */
.settings__nav {
    position: sticky;
    top: 18px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 8px;
}

.settings__nav a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 12.5px;
    color: var(--text-2);
    text-decoration: none;
    transition: background .12s, color .12s;
}

.settings__nav a:hover {
    background: var(--surface-2);
    color: var(--text);
}

.settings__nav svg {
    width: 16px;
    height: 16px;
    flex: none;
    opacity: .7;
}

.settings__group {
    scroll-margin-top: 18px;
}

.settings__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--accent-soft);
    color: var(--accent);
    flex: none;
}

.settings__icon svg {
    width: 17px;
    height: 17px;
}

/* یک تنظیم: توضیح سمت شروع، کنترل سمت پایان */
.setting {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 320px);
    gap: 10px 24px;
    align-items: center;
    padding: 15px 18px;
    border-bottom: 1px solid var(--border);
}

.setting:last-child {
    border-bottom: 0;
}

.setting--block {
    grid-template-columns: minmax(0, 1fr);
}

.setting__info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.setting__title {
    font-size: 12.5px;
    font-weight: 500;
}

.setting__hint {
    font-size: 11px;
    color: var(--muted);
    line-height: 1.75;
}

.setting__control {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.setting__control--end {
    align-items: flex-end;
}

/* بارگذاری تصویر: پیش‌نمایش کنار دکمه انتخاب فایل */
.setting__image {
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting__image img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-2);
    padding: 4px;
    flex: none;
}

/* تنظیم چندانتخابی: چند تیک کنار هم، مثل «کالاها بر چه اساسی مرتبط‌اند؟» */
.setting__choices {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
}

.setting__choices .choice {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12.5px;
    user-select: none;
    padding: 5px 9px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-2);
}

.setting__choices .choice:has(input:checked) {
    border-color: var(--accent);
    color: var(--accent);
}

.setting__choices .choice input {
    accent-color: var(--accent);
    margin: 0;
}

/* نوار ذخیره همیشه پایین صفحه می‌ماند تا برای ذخیره لازم نباشد تا ته صفحه رفت */
.settings__save {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
    padding: 12px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(6px);
    box-shadow: var(--shadow);
}

@media (max-width: 900px) {
    .settings {
        grid-template-columns: minmax(0, 1fr);
    }

    .settings__nav {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .setting {
        grid-template-columns: minmax(0, 1fr);
    }

    .setting__control--end {
        align-items: flex-start;
    }
}

.tabs-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border, #e2e8f0);
    padding-bottom: 12px;
    overflow-x: auto;
}

@media print {
    .sidebar, .topbar, .btn, .pager, .toolbar {
        display: none !important;
    }

    .content {
        padding: 0;
    }

    .card {
        border: 0;
        box-shadow: none;
    }
}
