.app-shell {
    min-height: 100vh;
    padding: 0;
}

.app-shell--guest {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--space-4);
}

.app-shell__frame {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--shell-sidebar-width);
    /* هدر حذف شده — فقط محتوا و سایدبار. فریم تمام‌عرض و بدونِ padding/gap است تا سایدبار
       کاملاً به لبهٔ صفحه بچسبد و ارتفاعِ کاملِ viewport را بگیرد؛ padding/سقفِ عرض به خودِ محتوا منتقل شد. */
    grid-template-areas:
        "content sidebar";
    gap: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    align-items: start;
    direction: ltr;
}

.shell-header,
.shell-sidebar,
.card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    background: var(--color-panel);
    box-shadow: var(--shadow-soft);
}

.shell-header {
    grid-area: header;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 34rem) auto;
    align-items: center;
    gap: var(--space-3);
    padding: 0.95rem 1.15rem;
    position: sticky;
    top: var(--shell-sticky-offset);
    z-index: 80;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(18px);
    direction: rtl;
}

.shell-header__brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.shell-header__brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.9rem;
    background: linear-gradient(135deg, rgba(45, 108, 223, 0.16), rgba(31, 79, 152, 0.22));
    color: var(--color-accent-strong);
    font-weight: 800;
}

.shell-header__brand-copy {
    display: grid;
    gap: 0.1rem;
    min-width: 0;
}

.shell-header__brand-copy strong {
    color: var(--color-ink);
    font-size: 1rem;
}

.shell-header__brand-copy span {
    color: var(--color-ink-soft);
    font-size: 0.86rem;
}

.shell-header__search {
    width: 100%;
}

.shell-header__search input {
    width: 100%;
    padding: 0.86rem 1rem;
    border: 1px solid rgba(91, 103, 120, 0.14);
    border-radius: 999px;
    background: rgba(247, 249, 252, 0.92);
}

.shell-header__meta {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-shrink: 0;
}

.shell-header__meta .button {
    padding: 0.62rem 0.9rem;
    background: rgba(255, 255, 255, 0.76);
}

.shell-header__profile {
    display: inline-flex;
}

.shell-header__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.65rem;
    height: 2.65rem;
    border-radius: 999px;
    border: 1px solid rgba(45, 108, 223, 0.12);
    background: linear-gradient(135deg, rgba(45, 108, 223, 0.14), rgba(31, 79, 152, 0.2));
    color: var(--color-accent-strong);
    font-weight: 800;
    overflow: hidden;
}

.shell-header__avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.shell-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.55rem;
    direction: ltr;
    min-height: 0;
    margin: 0 0 0.55rem;
    position: sticky;
    top: calc(var(--shell-sticky-offset) + var(--shell-header-height) - 0.65rem);
    z-index: 90;
    /* نوارِ ابزار شفاف و تمام‌عرض است ولی فقط یک‌دو آیکن دارد؛ بدونِ این، کلِ باندِ ۳۹پیکسلیِ
       شفاف کلیک‌ها را می‌بلعد و دکمه‌های محتوای زیرش کلیک‌ناپذیر می‌شوند. کلیک از باندِ خالی
       رد شود؛ فقط خودِ آیکن‌ها (shell-toolbar__action) کلیک بگیرند. */
    pointer-events: none;
}

.shell-toolbar__action {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid rgba(91, 103, 120, 0.16);
    border-radius: 0.95rem;
    background: rgba(255, 255, 255, 0.86);
    color: var(--color-accent-strong);
    box-shadow: var(--shadow-soft);
}

.shell-toolbar__action:disabled,
.shell-toolbar__action.is-disabled {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

.shell-toolbar__action svg {
    width: 1.05rem;
    height: 1.05rem;
}

/* WI-436 — نوارِ ابزارِ صفحه‌ای که عنوان/کنترلِ خودش را روی نوار گذاشته، کادری هم‌سبکِ کارت‌های پوسته می‌گیرد؛
   سطحِ کادر دیگر شفاف نیست، پس کلیک را خودش می‌گیرد (محتوای زیرش پوشیده است). */
.shell-toolbar--framed {
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--color-border);
    border-right: 3px solid var(--color-accent);
    border-radius: var(--radius-card);
    background: linear-gradient(270deg, rgba(45, 108, 223, 0.06), var(--color-panel) 45%);
    background-color: var(--color-panel);
    box-shadow: var(--shadow-soft);
    pointer-events: auto;
}

.shell-toolbar--framed .shell-toolbar__action::after {
    top: calc(100% + 0.9rem);
}

/* WI-436 — عنوانِ صفحه در ابتدای راستِ همان خطِ نوارِ ابزار (نوار چپ‌به‌راست است ⇒ margin-left: auto). */
.shell-toolbar__title {
    margin: 0 0 0 auto;
    padding-inline: 0.25rem;
    direction: rtl;
    color: var(--color-ink);
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.4;
    white-space: nowrap;
}

/* WI-436 — کنترل‌های صفحه کنارِ دکمه‌های نوار؛ نوار خودش کلیک را رد می‌کند، پس این ظرف کلیک می‌گیرد. */
.shell-toolbar__extra {
    display: inline-flex;
    /* نوار چپ‌به‌راست و این ظرف راست‌به‌چپ است: آخرین کنترلِ صفحه کنارِ آخرین دکمهٔ نوار می‌نشیند. */
    align-items: center;
    gap: 0.55rem;
    direction: rtl;
    pointer-events: auto;
}

/* ⭐ WI-436 — نوارِ ابزار درست زیرِ هدر می‌چسبد؛ Tooltipِ رو به بالا زیرِ هدر یا بیرونِ صفحه گم می‌شد. همیشه زیرِ دکمه. */
.shell-toolbar__action::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 0.45rem);
    left: 50%;
    transform: translateX(-50%) translateY(-0.2rem);
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    background: rgba(22, 32, 45, 0.9);
    color: #fff;
    font-size: 0.76rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    z-index: 95;
    transition: opacity 140ms ease, transform 140ms ease;
}

.shell-toolbar__action:hover::after,
.shell-toolbar__action:focus-visible::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ⭐ WI-580 — منوی کناری تازه، عینِ پیش نمایش تاییدشده: سربرگ یک خطی، سنجاق ها، هفت بخش رنگی (فقط یکی باز)،
   «جدید»ها اول، و تنظیمات/ابزارها/خروج در همان جریانِ اسکرول. پوسته خودش اسکرول نمی شود؛ فقط `.shell-sidebar__scroll`. */
.shell-sidebar {
    --nav-brand: #4f46e5; --nav-soft: #eef2ff; --nav-line: #eef1f6; --nav-ink: #1e293b; --nav-muted: #94a3b8;
    --shell-sidebar-bg: #fff;
    grid-area: sidebar;
    align-self: start;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    overscroll-behavior: contain;
    border: 0;
    border-left: 1px solid var(--nav-line);
    background: var(--color-surface, #fff);
    direction: rtl;
}
.shell-sidebar__brand.shell-sidebar__user { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 8px 10px 6px; position: relative; }
.shell-sidebar__brand h2 { margin: 0; font-size: 0.92rem; line-height: 1.3; flex: 1; }
.shell-sidebar__user-trigger {
    flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 7px; padding: 3px 6px 3px 4px;
    border: 1px solid var(--nav-line); border-radius: 10px; background: linear-gradient(180deg, #fafbff, #f5f7fd);
    color: inherit; font: inherit; text-align: start; cursor: pointer;
}
.shell-sidebar__user-trigger:hover { border-color: #c7d2fe; }
.shell-sidebar__user-trigger:focus-visible { outline: 2px solid #c7d2fe; outline-offset: 1px; }
.shell-sidebar__avatar { position: relative; flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; background: #c7d2fe; }
.shell-sidebar__avatar img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.shell-sidebar__presence { position: absolute; bottom: -1px; inset-inline-start: -1px; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; border: 2px solid #fff; box-sizing: border-box; }
.shell-sidebar__user-meta { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.shell-sidebar__user-name { font-size: 0.893rem; font-weight: 500; color: var(--color-ink, #0f172a); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell-sidebar__user-role { font-size: 0.72rem; color: #b45309; }
.shell-sidebar__user-caret { width: 12px; height: 12px; flex: 0 0 auto; color: var(--nav-muted); transition: transform .15s; }
.shell-sidebar__user-trigger[aria-expanded="true"] .shell-sidebar__user-caret { transform: rotate(180deg); }

/* نوار سه دکمه (کارهای من · واگذار شده · اعلان ها) + دکمه ریز جمع شدن (my_tasks_shell_button_v1) */
.shell-sidebar__qa { flex: none; display: flex; align-items: center; padding: 2px; border: 1px solid var(--nav-line); border-radius: 10px; background: #fff; }
.shell-sidebar__mytasks {
    position: relative; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; padding: 0; color: #475569; text-decoration: none; cursor: pointer;
}
.shell-sidebar__qa .shell-sidebar__mytasks, .shell-sidebar__qa .shell-sidebar__bell { border: 0; border-radius: 8px; background: transparent; color: #475569; }
.shell-sidebar__qa .shell-sidebar__mytasks:hover, .shell-sidebar__qa .shell-sidebar__bell:hover { background: #f5f7fd; color: var(--nav-brand); }
.shell-sidebar__qa > * + * { border-inline-start: 1px solid var(--nav-line); }
.shell-sidebar__qa .shell-sidebar__bellwrap { display: inline-flex; }
.shell-sidebar__mytasks:focus-visible { outline: 2px solid #c7d2fe; outline-offset: -2px; }
.shell-sidebar__mytasks-icon, .shell-sidebar__qa .shell-sidebar__bell svg { width: 15px; height: 15px; flex: 0 0 auto; }
.shell-sidebar__qa .shell-sidebar__bell-badge, .shell-sidebar__mytasks-count {
    position: absolute; top: -5px; inset-inline-end: -2px; inset-inline-start: auto; min-width: 15px; height: 15px; padding: 0 4px;
    display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; border: 2px solid #fff; box-shadow: none;
    background: #ea580c; color: #fff; font-size: 9.5px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; pointer-events: none; box-sizing: content-box;
}
.shell-sidebar__qa .shell-sidebar__bell-badge { background: #ef4444; }
.shell-sidebar__mytasks--delegated .shell-sidebar__mytasks-count { background: #1d4ed8; }
.shell-sidebar__mytasks-count[hidden] { display: none; }
.shell-sidebar__mytasks.is-overdue .shell-sidebar__mytasks-count { background: #b91c1c; }
.shell-sidebar__collapse {
    display: none; flex: none; width: 20px; height: 20px; margin: 4px; padding: 0; place-items: center; cursor: pointer;
    border: 1px solid var(--nav-line); border-radius: 7px; background: #fff; color: var(--nav-muted); transition: color .15s, border-color .15s, transform .2s;
}
.shell-sidebar__qa > .shell-sidebar__collapse { border-inline-start: 1px solid var(--nav-line); }
.shell-sidebar__collapse svg { width: 12px; height: 12px; }
.shell-sidebar__collapse:hover { color: var(--nav-brand); border-color: #c7d2fe; }
.shell-sidebar__collapse:focus-visible { outline: 2px solid #c7d2fe; outline-offset: 1px; }

/* منوی حساب (popover) */
.shell-account { position: absolute; z-index: 1300; top: 2.8rem; inset-inline: 0.4rem; background: var(--color-surface, #fff); border: 1px solid var(--color-border, #e5e7eb); border-radius: 0.7rem; box-shadow: 0 14px 40px rgba(15, 23, 42, .18); padding: 0.55rem; font-size: 0.82rem; }
.shell-account[hidden] { display: none; }
.shell-account__head { display: flex; flex-direction: column; gap: 0.12rem; padding: 0.15rem 0.3rem 0.5rem; border-bottom: 1px solid var(--nav-line); margin-bottom: 0.35rem; }
.shell-account__name { font-size: 0.88rem; }
.shell-account__email, .shell-account__last { font-size: 0.7rem; color: var(--color-ink-soft, #8a93a3); }
.shell-account__role { font-size: 0.71rem; color: #3730a3; }
.shell-account__note { font-size: 0.69rem; color: #15803d; margin-top: 0.2rem; }
.shell-account__nav { display: flex; flex-direction: column; }
.shell-account__nav a { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.35rem; border-radius: 0.45rem; color: inherit; text-decoration: none; }
.shell-account__nav a:hover { background: var(--nav-soft); }
.shell-account__nav svg, .shell-account__logout svg { width: 1.05rem; height: 1.05rem; flex: 0 0 auto; }
/* ⭐ WI-598 — حالت نمایش در منوی حساب: سه گزینه هم اندازه */
.shell-account__theme { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.35rem; border-top: 1px solid var(--nav-line); padding: 0.45rem 0.35rem 0; }
.shell-account__theme-label { font-size: 0.857rem; color: var(--nav-muted); white-space: nowrap; }
.shell-account__theme-options { display: inline-flex; padding: 2px; border: 1px solid var(--nav-line); border-radius: 0.55rem; background: #f8fafc; }
.shell-account__theme-options button { border: 0; background: none; padding: 0.25rem 0.55rem; border-radius: 0.4rem; font: inherit; font-size: 0.857rem; color: var(--nav-ink); cursor: pointer; white-space: nowrap; }
.shell-account__theme-options button:hover { background: var(--nav-soft); }
.shell-account__theme-options button.is-active { background: #fff; color: var(--nav-brand); font-weight: 700; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12); }
.shell-account__theme-options button:focus-visible { outline: 2px solid var(--nav-brand); outline-offset: 1px; }
.shell-account__logout { margin-top: 0.35rem; border-top: 1px solid var(--nav-line); padding-top: 0.4rem; }
.shell-account__logout button { width: 100%; display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.5rem; border: 0; border-radius: 0.5rem; cursor: pointer; background: #fef2f2; color: #b91c1c; font: inherit; font-weight: 700; }
.shell-account__logout button:hover { background: #fee2e2; }

/* یک جریان پیوسته: سنجاق ها، منو، تنظیمات/ابزارها، خروج */
.shell-sidebar__scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; padding: 0 8px 8px; }
.shell-nav-label { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 4px; font-size: 0.786rem; font-weight: 500; color: var(--nav-muted); }
.shell-pins__edit { border: 0; background: none; padding: 0; font: inherit; color: var(--nav-muted); cursor: pointer; }
.shell-pins__edit:hover { color: var(--nav-brand); }
.shell-pins__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 0 2px 6px; }
.shell-pin { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 6px 8px; border: 1px solid var(--nav-line); border-radius: 10px; background: #f8fafc; color: var(--nav-ink); font-size: 0.893rem; font-weight: 500; line-height: 1.5; text-decoration: none; }
.shell-pin:hover { border-color: #c7d2fe; background: var(--nav-soft); }
.shell-pin .shell-nav__icon { width: 16px; height: 16px; color: var(--tone); }
.shell-pin__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell-sec--sales, .shell-pin--sales { --tone: #2563eb; }
.shell-sec--buy, .shell-pin--buy { --tone: #d97706; }
.shell-sec--stock, .shell-pin--stock { --tone: #0891b2; }
.shell-sec--people, .shell-pin--people { --tone: #7c3aed; }
.shell-sec--acc, .shell-pin--acc { --tone: #059669; }
.shell-sec--work, .shell-pin--work { --tone: #db2777; }
.shell-sec--rep, .shell-pin--rep { --tone: #475569; }
.shell-sec--slate, .shell-pin--slate { --tone: #64748b; }

.shell-nav { display: grid; gap: 2px; align-content: start; font-size: 0.893rem; }
.shell-nav__item, .shell-nav__subitem, .shell-nav__summary { display: flex; align-items: center; gap: 8px; color: var(--nav-ink); text-decoration: none; border-radius: 10px; }
.shell-nav__summary { cursor: pointer; list-style: none; padding: 5px 6px; position: relative; }
.shell-nav__summary::-webkit-details-marker { display: none; }
.shell-sidebar .shell-nav__item, .shell-sidebar .shell-nav__summary { font-size: 0.964rem; font-weight: 500; }
.shell-nav__item { padding: 5px 6px; }
.shell-nav__item:hover, .shell-nav__summary:hover { background: #f8fafc; }
.shell-nav__title { flex: 1; min-width: 0; text-align: start; }
.shell-sec__caret { width: 14px; height: 14px; flex: none; color: var(--nav-muted); transition: transform .2s; }
.shell-sec[open] > .shell-nav__summary .shell-sec__caret { transform: rotate(180deg); }
.shell-nav__icon { display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 8px; background: #f1f5f9; color: #475569; }
.shell-nav__icon svg { width: 15px; height: 15px; }
.shell-sec > .shell-nav__summary .shell-nav__icon { background: var(--tone); color: #fff; }
.shell-sec.is-active > .shell-nav__summary { background: #f8fafc; box-shadow: inset -3px 0 0 var(--nav-brand); }
.shell-nav__subnav { display: grid; gap: 1px; margin: 0 0 4px; margin-inline-start: 18px; padding-inline-start: 14px; border-inline-start: 2px solid var(--nav-line); }
.shell-sidebar .shell-nav__subitem { font-size: 0.893rem; }
.shell-nav__subitem { justify-content: flex-start; gap: 8px; min-height: 28px; box-sizing: border-box; padding: 4px 8px; border-radius: 7px; font-weight: 400; line-height: 1.55; color: #334155; }
.shell-nav__subitem > span:not([class]) { flex: 1; min-width: 0; }
.shell-nav__subitem:hover { background: #f8fafc; color: var(--color-ink, #0f172a); }
.shell-nav__subitem.is-active, .shell-nav__item.is-active { background: var(--nav-soft); color: var(--nav-brand); font-weight: 500; }
/* WI-589 — یک شکل برای همه زیرگزینه ها: کاشی ۲۰px؛ «+» بنفش برای ساختن، آیکن خطی خاکستری برای فهرست؛ باز ⇒ کاشی آبی. */
.shell-nav__plus, .shell-nav__tile { display: inline-grid; place-items: center; flex: none; width: 20px; height: 20px; border-radius: 6px; line-height: 1; }
.shell-nav__plus { background: var(--nav-soft); color: var(--nav-brand); font-size: 13px; font-weight: 700; }
.shell-nav__tile { background: #f1f5f9; color: #64748b; }
.shell-nav__tile svg { width: 13px; height: 13px; }
.shell-nav__subitem.is-active .shell-nav__tile, .shell-nav__summary.is-current .shell-nav__tile { background: #dbeafe; color: #1d4ed8; }
/* WI-586 — دکمه «سبد انتقال» بالای منو (کاشی همان زیرگزینه ها). */
.shell-cart { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 32px; margin: 0 0 6px; padding: 4px 8px; border: 1px solid #bcd0fb; border-radius: 10px; background: #eaf1ff; color: #1d4ed8; font: inherit; font-weight: 500; cursor: pointer; }
.shell-cart:hover { background: #dbe7ff; }
.shell-cart[hidden] { display: none; }
.shell-cart .shell-nav__tile { background: #fff; color: #1d4ed8; }
.shell-cart__label { flex: 1; text-align: start; }
.shell-sec__sep, .shell-nav__separator { display: block; height: 1px; margin: 3px 8px; background: var(--nav-line); }
.shell-nav__group--nested > .shell-nav__summary { min-height: 28px; box-sizing: border-box; padding: 4px 8px; font-weight: 400; }
.shell-nav__subnav--nested { margin-inline-start: 8px; padding-inline-start: 8px; }
.shell-nav__item:focus-visible, .shell-nav__subitem:focus-visible, .shell-nav__summary:focus-visible { outline: 2px solid #c7d2fe; outline-offset: -2px; }
.shell-nav__badge, .shell-nav__count { margin-inline-start: auto; flex: none; padding: 1px 7px; border-radius: 999px; background: #fef3c7; color: #92400e; font-size: 0.786rem; font-weight: 700; line-height: 1.5; font-variant-numeric: tabular-nums; }
.shell-nav__count--sum { background: #fee2e2; color: #b91c1c; }
.shell-nav__count[hidden] { display: none; }
.shell-nav__badge--danger { background: #fee2e2; color: #b91c1c; }
.shell-nav__badge--muted { background: #f1f5f9; color: #64748b; }
@media (prefers-reduced-motion: no-preference) {
    details.shell-nav__group[open] > .shell-nav__subnav { animation: shellNavReveal .18s ease; }
}
@keyframes shellNavReveal { from { opacity: 0; transform: translateY(-0.25rem); } to { opacity: 1; transform: none; } }

.shell-sidebar__foot { display: grid; gap: 2px; }
.shell-sidebar__foot::before { content: ""; display: block; height: 1px; margin: 4px 6px 6px; background: var(--nav-line); }
.shell-sidebar__foot .shell-nav__item { font-size: 0.929rem; color: #334155; }
.shell-sidebar__logout { margin: 0; }
.shell-sidebar__logout-btn { width: 100%; display: flex; align-items: center; gap: 8px; padding: 5px 6px; border: 0; border-radius: 10px; background: none; color: #b91c1c; font: inherit; font-size: 0.929rem; font-weight: 500; cursor: pointer; }
.shell-sidebar__logout-btn .shell-nav__icon { background: #fee2e2; color: #b91c1c; }
.shell-sidebar__logout-btn:hover { background: #fef2f2; }
.shell-sidebar__logout-btn:focus-visible { outline: 2px solid #fecaca; outline-offset: -2px; }

/* پنجره ویرایش سنجاق ها */
.shell-pins-dialog { width: min(560px, calc(100vw - 2rem)); max-height: min(80vh, 640px); padding: 0; border: 1px solid var(--nav-line); border-radius: 14px; box-shadow: 0 24px 60px rgba(15, 23, 42, .25); direction: rtl; }
.shell-pins-dialog::backdrop { background: rgba(15, 23, 42, .35); }
.shell-pins-dialog__card { display: flex; flex-direction: column; max-height: inherit; margin: 0; }
.shell-pins-dialog__head, .shell-pins-dialog__foot { display: flex; align-items: center; gap: 8px; padding: 10px 14px; }
.shell-pins-dialog__head { border-bottom: 1px solid var(--nav-line); }
.shell-pins-dialog__head strong { font-weight: 500; font-size: 1rem; }
.shell-pins-dialog__count { color: var(--nav-muted); font-size: 0.857rem; }
.shell-pins-dialog__x { margin-inline-start: auto; width: 28px; height: 28px; border: 1px solid var(--nav-line); border-radius: 8px; background: #fff; font-size: 18px; line-height: 1; cursor: pointer; color: #475569; }
.shell-pins-dialog__body { overflow-y: auto; padding: 10px 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.shell-pins-dialog__group { margin: 0; padding: 8px 10px; border: 1px solid var(--nav-line); border-radius: 10px; }
.shell-pins-dialog__group legend { display: flex; align-items: center; gap: 6px; padding: 0 4px; font-weight: 500; font-size: 0.893rem; }
.shell-pins-dialog__group .shell-pin__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tone); }
.shell-pins-dialog__opt { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: 0.893rem; font-weight: 300; cursor: pointer; }
.shell-pins-dialog__opt input { accent-color: var(--nav-brand); }
.shell-pins-dialog__foot { border-top: 1px solid var(--nav-line); justify-content: flex-end; }
.shell-pins-dialog__error { margin-inline-end: auto; color: #b91c1c; font-size: 0.857rem; }
.shell-pins-dialog__btn { height: 32px; padding: 0 14px; border: 1px solid var(--nav-line); border-radius: 9px; background: #fff; font: inherit; font-weight: 500; cursor: pointer; }
.shell-pins-dialog__btn--primary { background: var(--nav-brand); border-color: var(--nav-brand); color: #fff; }
.shell-pins-dialog__btn[disabled] { opacity: .5; cursor: progress; }
@media (max-width: 640px) { .shell-pins-dialog__body { grid-template-columns: 1fr; } }

.app-shell__content {
    grid-area: content;
    /* محتوا باید کلِ ستونِ گریدِ خود را پر کند (تمام‌عرض، بدونِ فضای خالیِ بی‌دلیل در عرضِ زیاد).
       سقفِ عرض + margin-inline:auto حذف شد چون روی صفحاتِ دارایِ container-type (مثلِ کارت کالا)
       آیتمِ گرید با مارجینِ خودکار به min-content (~۱۱۳px) جمع می‌شد و صفحه را خراب می‌کرد.
       min-width:0 لازم است تا جدول‌های پهن ستون را بیرون نزنند و فقط داخلِ رَپِرِ خود اسکرولِ افقی بگیرند. */
    padding: var(--space-3);
    min-width: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    direction: rtl;
}

.app-shell__content > section:first-of-type,
.app-shell__content > .stack-lg:first-of-type {
    margin-top: 0;
}

.app-shell__content > .notice + .notice,
.app-shell__content > .notice + section,
.app-shell__content > section + .notice {
    margin-top: var(--space-2);
}

.app-shell__content > .notice {
    margin: 0 0 var(--space-2);
}

.app-shell__content .stack-lg > * + * {
    margin-top: 0.9rem;
}

.app-shell__content > .stack-lg > .card:first-child:not(:only-child) {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.1rem 0 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.app-shell__content > .stack-lg > .card:first-child:not(:only-child) > .eyebrow,
.app-shell__content > .stack-lg > .card:first-child:not(:only-child) > .lede {
    display: none;
}

.app-shell__content > .stack-lg > .card:first-child:not(:only-child) > h2 {
    margin: 0;
    font-size: clamp(1.28rem, 1.7vw, 1.7rem);
}

.app-shell__content > .stack-lg > .card:first-child:not(:only-child) > .button-row {
    gap: 0.55rem;
    margin-top: 0.15rem;
}

.app-shell__content > .stack-lg > .card:first-child:not(:only-child) > .button-row .button,
.app-shell__content > .stack-lg > .card:first-child:not(:only-child) > .button-row .pill {
    padding: 0.42rem 0.78rem;
    font-size: 0.88rem;
}

.guest-shell {
    width: min(100%, 36rem);
}

.guest-shell__intro {
    background: linear-gradient(180deg, rgba(45, 108, 223, 0.08), rgba(45, 108, 223, 0.02)), var(--color-panel);
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: var(--space-3);
}

.module-meta {
    display: grid;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.module-meta div {
    display: grid;
    gap: 0.15rem;
}

.module-meta dt {
    color: var(--color-accent);
    font-size: 0.86rem;
    font-weight: 700;
}

.module-meta dd {
    margin: 0;
}

.toast {
    position: fixed;
    top: calc(var(--shell-sticky-offset) + var(--shell-header-height) - 0.35rem);
    right: var(--space-3);
    z-index: 120;
    min-width: 12rem;
    max-width: min(24rem, calc(100vw - 2rem));
    padding: 0.9rem 1rem;
    border: 1px solid rgba(58, 124, 93, 0.22);
    border-radius: 1rem;
    background: rgba(241, 251, 245, 0.96);
    color: #246043;
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.12);
    opacity: 0;
    transform: translateX(120%);
    transition: opacity 180ms ease, transform 220ms ease;
    direction: rtl;
}

.toast--runtime {
    pointer-events: none;
}

.toast--success {
    border-color: rgba(58, 124, 93, 0.22);
    background: rgba(241, 251, 245, 0.98);
    color: #246043;
}

.toast--error {
    border-color: rgba(190, 78, 78, 0.26);
    background: rgba(253, 243, 243, 0.98);
    color: #a83f3f;
}

.toast__inline-form {
    margin-top: 0.55rem;
}

.toast__inline-form button {
    min-height: 2rem;
    padding: 0.25rem 0.72rem;
    border: 1px solid rgba(5, 150, 105, 0.24);
    border-radius: 0.72rem;
    background: #fff;
    color: #047857;
    cursor: pointer;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 900;
}

.toast.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.toast.is-leaving {
    opacity: 0;
    transform: translateX(120%);
}

.app-shell--embedded {
    overflow-x: hidden;
    background: #fff;
}

.app-shell--embedded .app-shell__frame {
    display: block;
    width: 100%;
    max-width: none;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

.app-shell--embedded .app-shell__content {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    overflow-x: hidden;
    padding: 0;
}

.app-shell--embedded .shell-header,
.app-shell--embedded .shell-sidebar,
.app-shell--embedded .shell-toolbar {
    display: none !important;
}

.app-shell--embedded .notice {
    margin: 0.75rem;
}

.app-shell--embedded .stack-lg,
.app-shell--embedded .page-sales-show,
.app-shell--embedded .page-product-show,
.app-shell--embedded .person-profile-v2,
.app-shell--embedded .page-waste-show {
    width: 100%;
    max-width: none;
    margin: 0;
    overflow-x: hidden;
}

.app-shell--embedded .card {
    max-width: 100%;
}

.app-shell--embedded table {
    max-width: 100%;
}

.app-shell--embedded .table-shell,
.app-shell--embedded .page-sales-form__table-wrap,
.app-shell--embedded .page-sales-show__money-table-wrap,
.app-shell--embedded .page-product-show__table-shell,
.app-shell--embedded .person-profile-v2__table-wrap {
    max-width: 100%;
    overflow-x: auto;
}

.app-shell--embedded table {
    width: 100%;
    min-width: 0 !important;
    table-layout: fixed;
}

.app-shell--embedded th,
.app-shell--embedded td,
.app-shell--embedded th > *,
.app-shell--embedded td > * {
    min-width: 0 !important;
    max-width: 100%;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: break-word;
}

@media (max-width: 960px) {
    .app-shell--guest {
        align-items: flex-start;
        padding: var(--space-3);
    }

    .app-shell__frame {
        grid-template-columns: 1fr;
        grid-template-areas:
            "content";
        padding: var(--space-2);
        direction: rtl;
    }

    .shell-toolbar {
        position: static;
        min-height: auto;
    }
}

/* --- دکمهٔ همبرگرِ هدر (فقط موبایل) --- */
.shell-header__nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    flex: 0 0 auto;
    border: 1px solid var(--color-border);
    border-radius: 0.7rem;
    background: var(--color-panel);
    color: var(--color-text);
    cursor: pointer;
}
.shell-header__nav-toggle svg { width: 1.25rem; height: 1.25rem; }
.shell-header__nav-toggle:focus-visible { outline: 2px solid var(--color-accent-strong); outline-offset: 2px; }

/* --- دکمهٔ شناورِ منو (جایگزینِ همبرگرِ هدر؛ فقط موبایل) --- */
.shell-menu-fab {
    display: none;
    position: fixed;
    top: 0.75rem;
    inset-inline-end: 0.75rem;
    z-index: 1310;
    width: 2.75rem;
    height: 2.75rem;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    border-radius: 0.85rem;
    background: var(--color-panel);
    color: var(--color-text);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
}
.shell-menu-fab svg { width: 1.3rem; height: 1.3rem; }
.shell-menu-fab:focus-visible { outline: 2px solid var(--color-accent-strong); outline-offset: 2px; }

/* دکمهٔ بستنِ منو (فقط در حالتِ کشویِ موبایل دیده می‌شود) */
.shell-sidebar__brand { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.shell-sidebar__close {
    display: none;
    width: 1.65rem; height: 1.65rem;
    border: 0; border-radius: 0.5rem;
    background: rgba(91, 103, 120, 0.12); color: var(--color-text-muted);
    font-size: 1.1rem; line-height: 1; cursor: pointer;
}

/* پس‌زمینهٔ تیرهٔ پشتِ منوی موبایل */
.shell-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1290;
    background: rgba(15, 23, 42, 0.42);
    opacity: 0;
    transition: opacity 0.2s ease;
}
.shell-sidebar-backdrop[hidden] { display: none; }
body.shell-sidebar-open .shell-sidebar-backdrop { opacity: 1; }
body.shell-sidebar-open { overflow: hidden; }

/* --- رفتارِ کشویِ موبایل (بعد از قواعدِ پایه تا ترتیبِ منبع درست باشد) --- */
@media (max-width: 960px) {
    .shell-menu-fab {
        display: inline-flex;
    }

    .shell-sidebar__close {
        display: inline-flex;
    }

    .shell-sidebar {
        position: fixed;
        inset-block: 0;
        /* لنگرِ فیزیکیِ راست (نه inset-inline-end که زیرِ direction:rtl به left می‌رسد
           و کشو را نیمه‌بازِ روی محتوا می‌گذاشت). */
        right: 0;
        left: auto;
        z-index: 1300;
        width: min(300px, 86vw);
        max-height: 100vh;
        border-radius: 0;
        /* بسته = کاملاً بیرونِ لبهٔ راست. */
        transform: translateX(100%);
        transition: transform 0.24s ease;
        box-shadow: -16px 0 48px rgba(15, 23, 42, 0.22);
        overscroll-behavior: contain;
    }

    body.shell-sidebar-open .shell-sidebar {
        transform: translateX(0);
    }

    /* محتوا هرگز افقی از عرضِ نمایه بیرون نزند (دفاع در عمق؛ جدول‌ها رَپِرِ
       اسکرولِ مخصوصِ خود را دارند، پس clip امن است و sticky را نمی‌شکند). */
    .app-shell__content {
        overflow-x: clip;
        max-width: 100%;
    }
}

@media (min-width: 961px) {
    /* در دسکتاپ هرگز حالتِ کشو فعال نشود. */
    body.shell-sidebar-open { overflow: visible; }
    .shell-sidebar-backdrop { display: none; }
}

/* ===== حالت باریک دسکتاپ (فقط آیکن) + Flyout ===== */
@media (min-width: 961px) {
    .shell-sidebar__collapse { display: inline-grid; }
    body.shell-sidebar-collapsed { --shell-sidebar-width: 64px; }
    body.shell-sidebar-collapsed .shell-sidebar { overflow: visible; }
    body.shell-sidebar-collapsed .shell-sidebar__collapse { transform: rotate(180deg); }
    body.shell-sidebar-collapsed .shell-sidebar__brand.shell-sidebar__user { flex-direction: column; gap: 8px; padding-inline: 6px; }
    body.shell-sidebar-collapsed .shell-sidebar__user-trigger { flex: none; padding: 4px; justify-content: center; border-color: transparent; background: none; }
    body.shell-sidebar-collapsed .shell-sidebar__user-meta,
    body.shell-sidebar-collapsed .shell-sidebar__user-caret,
    body.shell-sidebar-collapsed .shell-sidebar .shell-nav-label,
    body.shell-sidebar-collapsed .shell-sidebar .shell-pins,
    body.shell-sidebar-collapsed .shell-sidebar .shell-nav__item > span:not(.shell-nav__icon),
    body.shell-sidebar-collapsed .shell-sidebar .shell-nav__summary > :not(.shell-nav__icon):not(.shell-nav__count--sum),
    body.shell-sidebar-collapsed .shell-sidebar__logout-btn > span:not(.shell-nav__icon),
    body.shell-sidebar-collapsed .shell-sidebar .shell-nav__subnav { display: none; }
    body.shell-sidebar-collapsed .shell-sidebar__qa { flex-direction: column; border: 0; padding: 0; gap: 4px; }
    body.shell-sidebar-collapsed .shell-sidebar__qa > * + * { border-inline-start: 0; }
    body.shell-sidebar-collapsed .shell-sidebar__scroll { overflow: visible; padding-inline: 6px; }
    body.shell-sidebar-collapsed .shell-sidebar .shell-nav__item,
    body.shell-sidebar-collapsed .shell-sidebar .shell-nav__summary,
    body.shell-sidebar-collapsed .shell-sidebar__logout-btn { justify-content: center; }
    body.shell-sidebar-collapsed .shell-sidebar .shell-nav__count--sum { position: absolute; top: 0; inset-inline-end: 2px; padding: 0 5px; font-size: 10px; }
    body.shell-sidebar-collapsed .shell-sidebar .has-flyout > .shell-nav__summary,
    body.shell-sidebar-collapsed .shell-sidebar .shell-nav__item.has-flyout { background: #f1f5f9; }
}

/* پنلِ Flyout (به body پیوست می‌شود؛ fixed). */
.shell-flyout {
    --nav-brand: #4f46e5; --nav-soft: #eef2ff; --nav-line: #eef1f6; --nav-ink: #1e293b;
    position: fixed; z-index: 1300; min-width: 12rem; max-width: min(18rem, calc(100vw - 1.5rem)); max-height: 80vh; overflow-y: auto;
    padding: 8px; border: 1px solid var(--nav-line); border-radius: 12px; background: #fff; box-shadow: 0 18px 44px rgba(15, 23, 42, .2);
    direction: rtl; animation: shellFlyoutReveal .13s ease;
}
.shell-flyout__close { position: absolute; inset-inline-start: 6px; top: 6px; width: 24px; height: 24px; display: inline-grid; place-items: center; border: 1px solid var(--nav-line); border-radius: 7px; background: #fff; color: #475569; font-size: 16px; line-height: 1; cursor: pointer; }
.shell-flyout--tip { min-width: 0; padding: 5px 9px; background: #0f172a; border-color: #0f172a; }
.shell-flyout--tip .shell-flyout__close { display: none; }
.shell-flyout__title { font-weight: 500; font-size: 0.929rem; color: var(--nav-ink); padding: 2px 6px 6px; padding-inline-start: 34px; }
.shell-flyout--tip .shell-flyout__title { padding: 0; color: #fff; font-size: 0.857rem; white-space: nowrap; }
.shell-flyout__list { display: grid; gap: 1px; margin: 0; padding: 0; border: 0; }
.shell-flyout .shell-nav__subitem, .shell-flyout .shell-nav__summary { padding: 5px 8px; }
.shell-flyout a:focus-visible, .shell-flyout summary:focus-visible { outline: 2px solid #c7d2fe; outline-offset: -2px; }
@keyframes shellFlyoutReveal { from { opacity: 0; transform: translateX(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .shell-flyout { animation: none; } }

/* --- صفحه‌بندیِ مشترکِ حرفه‌ای (partials/_pagination.php) --- */
.app-pager {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 0.6rem 1rem; margin-top: 1rem; padding: 0.6rem 0.2rem;
    border-top: 1px solid var(--color-border, #e5e7eb); direction: rtl;
}
.app-pager__sizes { display: inline-flex; align-items: center; gap: 0.25rem; }
.app-pager__sizes-label { color: var(--color-ink-muted, #94a3b8); font-size: 0.78rem; margin-inline-end: 0.15rem; }
.app-pager__size {
    min-width: 2rem; text-align: center; padding: 0.32rem 0.55rem;
    border: 1px solid var(--color-border, #e5e7eb); border-radius: 0.5rem;
    color: var(--color-ink-muted, #475569); text-decoration: none; font-size: 0.82rem; background: #fff;
}
.app-pager__size:hover { background: var(--color-surface-muted, #f1f5f9); }
.app-pager__size.is-active { background: #2563eb; border-color: #2563eb; color: #fff; font-weight: 700; }
.app-pager__nav { display: inline-flex; align-items: center; gap: 0.2rem; flex-wrap: wrap; }
.app-pager__pages { display: inline-flex; align-items: center; gap: 0.2rem; }
.app-pager__current { display: none; color: var(--color-ink-muted, #64748b); font-size: 0.82rem; padding: 0 0.4rem; white-space: nowrap; }
.app-pager__btn, .app-pager__page {
    min-width: 2.1rem; height: 2.1rem; padding: 0 0.45rem;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--color-border, #e5e7eb); border-radius: 0.5rem;
    background: #fff; color: var(--color-ink, #0f172a); text-decoration: none; font-size: 0.9rem; line-height: 1;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.app-pager__btn:hover, .app-pager__page:hover { background: var(--color-surface-muted, #f1f5f9); }
.app-pager__btn:focus-visible, .app-pager__page:focus-visible, .app-pager__size:focus-visible {
    outline: 0; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}
.app-pager__page.is-active { background: #2563eb; border-color: #2563eb; color: #fff; font-weight: 700; }
.app-pager__btn.is-disabled { opacity: 0.4; pointer-events: none; }
.app-pager__gap { padding: 0 0.2rem; color: var(--color-ink-muted, #94a3b8); }
.app-pager__info { color: var(--color-ink-muted, #64748b); font-size: 0.82rem; white-space: nowrap; }
.app-pager--single { justify-content: flex-start; }
/* نسخهٔ compact برای عرضِ کم: شماره‌های میانی پنهان؛ فقط اول/قبلی/«صفحه X از Y»/بعدی/آخر + بازه */
@media (max-width: 640px) {
    .app-pager { justify-content: center; gap: 0.5rem 0.7rem; }
    .app-pager__pages { display: none; }
    .app-pager__current { display: inline-flex; }
    .app-pager__info { width: 100%; text-align: center; }
}

/* ============================================================
   8.85 — «ورود موقت به‌عنوان کاربر» (impersonation)
   ============================================================ */

/* نوارِ ثابتِ بالای محتوا — امبر/کهربایی برای تمایزِ آشکارِ «حالتِ خاص» (نه قرمزِ خطا). */
.impersonation-bar {
    position: sticky;
    top: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem 0.9rem;
    flex-wrap: wrap;
    padding: 0.42rem 0.85rem;
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
    color: #452a04;
    font-weight: 700;
    font-size: 0.82rem;
    border-bottom: 1px solid rgba(120, 53, 15, 0.35);
    box-shadow: 0 3px 10px rgba(120, 53, 15, 0.18);
    direction: rtl;
}
.impersonation-bar__info { display: flex; align-items: center; gap: 0.55rem; min-width: 0; flex: 1 1 auto; }
.impersonation-bar__pill {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.14rem 0.55rem; border-radius: 999px;
    background: rgba(69, 42, 4, 0.92); color: #fde68a; font-size: 0.72rem; white-space: nowrap; flex: 0 0 auto;
}
.impersonation-bar__pill svg { width: 0.9rem; height: 0.9rem; }
.impersonation-bar__text { min-width: 0; line-height: 1.5; }
.impersonation-bar__text strong { font-weight: 800; }
.impersonation-bar__muted { color: #6b4708; font-weight: 600; }
.impersonation-bar__return { margin: 0; flex: 0 0 auto; }
.impersonation-bar__btn {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.32rem 0.75rem; border-radius: 0.55rem; border: 0; cursor: pointer;
    background: #452a04; color: #fff; font: inherit; font-weight: 700; font-size: 0.8rem;
    transition: background 140ms ease;
}
.impersonation-bar__btn svg { width: 1rem; height: 1rem; }
.impersonation-bar__btn:hover { background: #6b4708; }
.impersonation-bar__btn:focus-visible { outline: 2px solid #452a04; outline-offset: 2px; }
@media (max-width: 640px) {
    .impersonation-bar { font-size: 0.76rem; padding: 0.38rem 0.6rem; }
    .impersonation-bar__muted { display: none; }
    .impersonation-bar__btn span { white-space: nowrap; }
}

/* نشانِ «ورود موقت» روی آواتار/متاِ سایدبار. */
.shell-sidebar__avatar.is-impersonating { box-shadow: 0 0 0 2px #f59e0b, 0 0 0 3px rgba(245, 158, 11, 0.35); }
.shell-sidebar__imp-badge {
    display: inline-block; padding: 0.02rem 0.4rem; border-radius: 999px;
    background: #f59e0b; color: #452a04; font-size: 0.66rem; font-weight: 800;
}
.shell-account__admin { display: block; font-size: 0.78rem; color: #6b4708; }
.shell-account__admin strong { color: #452a04; }
.shell-account__return { margin: 0.15rem 0 0.35rem; }
.shell-account__return button {
    display: flex; align-items: center; justify-content: center; gap: 0.4rem; width: 100%;
    padding: 0.42rem 0.6rem; border: 1px solid #f59e0b; border-radius: 0.55rem; cursor: pointer;
    background: #fffbeb; color: #7c4a03; font: inherit; font-weight: 700; font-size: 0.82rem;
    transition: background 140ms ease;
}
.shell-account__return button svg { width: 1rem; height: 1rem; }
.shell-account__return button:hover { background: #fef3c7; }

/* WI-407/WI-408 — پیش‌بارگذارِ صفحه (قالبِ «Pulse Balls»): تا آمادگیِ صفحه و ستون‌های جدول.
   فقط transform/opacity؛ بدونِ JS هم پس از ۸ ثانیه خودش کنار می‌رود (Failsafe). */
.app-preloader {
    position: fixed;
    inset: 0;
    z-index: 2147483600;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eee;
    opacity: 1;
    visibility: visible;
    animation: app-preloader-failsafe 0.22s ease-out 8s forwards;
}

.app-preloader.is-done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.app-preloader__balls {
    position: relative;
    width: 80px;
    height: 80px;
    direction: ltr;
    opacity: 0;
    animation: app-preloader-rotate 8s linear infinite, app-preloader-reveal 1ms linear 250ms forwards;
}

.app-preloader__balls > span {
    position: absolute;
    width: 50%;
    height: 50%;
    border-radius: 50%;
    opacity: 0.1;
    transform: scale(0.1);
    animation: app-preloader-pulse-1 1s ease infinite alternate;
}

.app-preloader__balls > span:nth-child(1) { top: 0; left: 0; background: #03a9f4; }
.app-preloader__balls > span:nth-child(2) { top: 0; left: 50%; background: #f44336; animation-name: app-preloader-pulse-2; animation-delay: 0.25s; }
.app-preloader__balls > span:nth-child(3) { top: 50%; left: 0; background: #8bc34a; animation-name: app-preloader-pulse-3; animation-delay: 0.5s; }
.app-preloader__balls > span:nth-child(4) { top: 50%; left: 50%; background: #ffc107; animation-name: app-preloader-pulse-4; animation-delay: 0.75s; }

/* هم‌ارزِ top/left: -50%ِ قالب با translate (درصدِ translate نسبت به خودِ توپ = نصفِ قاب). */
@keyframes app-preloader-pulse-1 { from { transform: translate(-100%, -100%) scale(1); opacity: 0; } to { transform: translate(0, 0) scale(0.2); opacity: 0.8; } }
@keyframes app-preloader-pulse-2 { from { transform: translate(-200%, -100%) scale(1); opacity: 0; } to { transform: translate(0, 0) scale(0.2); opacity: 0.8; } }
@keyframes app-preloader-pulse-3 { from { transform: translate(-100%, -200%) scale(1); opacity: 0; } to { transform: translate(0, 0) scale(0.2); opacity: 0.8; } }
@keyframes app-preloader-pulse-4 { from { transform: translate(-200%, -200%) scale(1); opacity: 0; } to { transform: translate(0, 0) scale(0.2); opacity: 0.8; } }

@keyframes app-preloader-rotate {
    from { transform: rotate(-180deg); }
    to { transform: rotate(180deg); }
}

@keyframes app-preloader-reveal { to { opacity: 1; } }

@keyframes app-preloader-failsafe {
    to { opacity: 0; visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
    .app-preloader__balls { animation: app-preloader-reveal 1ms linear 250ms forwards; }
    .app-preloader__balls > span { animation: none; opacity: 0.8; transform: scale(0.5); }
}

/* WI-532 — محیطِ شاد (happy_workplace_v1): تزئینِ مناسبت، حالتِ خالیِ بامزه، جشن */
.shell-occasion { display: flex; align-items: center; gap: .35rem; margin: .35rem 0 .1rem; padding: .3rem .6rem; border-radius: 8px; background: #fef3c7; color: #92400e; font-size: .74rem; font-weight: 700; white-space: nowrap; overflow: hidden; }
.shell-occasion--yalda { background: #fee2e2; color: #991b1b; }
.shell-occasion--chaharshanbe_suri { background: #ffedd5; color: #9a3412; }
.shell-occasion__icon { width: .95rem; height: .95rem; flex: none; }
.shell-occasion__text { overflow: hidden; text-overflow: ellipsis; }
body.shell-sidebar-collapsed .shell-occasion { justify-content: center; padding: .3rem 0; }
body.shell-sidebar-collapsed .shell-occasion__text { display: none; }
:is(html[data-happy-empty], .happy-preview__empty) :is(.sheet-grid__empty:not(.sheet-grid__server-message), .notif-panel__empty, .tc-empty)::before { content: ""; display: block; width: 4rem; height: 4rem; margin: 0 auto .5rem; background: url("../../img/happy/mascot.svg") center / contain no-repeat; }
.happy-confetti { position: fixed; inset: 0; z-index: 9999; pointer-events: none; overflow: hidden; }
.happy-confetti i { position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px; }
