/* r730 — the seller panel's desktop dashboard (seller-dash.js).
 * From 1180px: a sticky column on the right (the start side in RTL) with the
 * shop, the four numbers and every tab, in place of the hero's stat cards and
 * the floating PC dock. Below 1180px nothing here applies and the page is
 * exactly as before (hero, dock, phone bar).
 *
 * r734: the column is one of the panel's own cards (.form-card: white,
 * gray-100 border, --shadow-card), thin type, design tokens (tokens.css);
 * only the four number squares carry a tint of their colour. Nothing moves. */

.sd { display: none; }

@media (min-width: 1180px) {
    body.has-sd .page-hero,
    body.has-sd .pcd,
    body.has-sd .pcd-home { display: none !important; }
    /* The body's overflow-x:hidden made it a scroll container that never
       scrolls, so position:sticky below had nothing to stick to. clip cuts
       the same sideways overflow without being a scroll container. */
    body.has-sd { overflow-x: clip; }

    .sd-layout {
        /* The body is a flex column: without this the grid shrinks to its
           content and the products fall to one column. */
        width: 100%; box-sizing: border-box;
        display: grid;
        grid-template-columns: 272px minmax(0, 1fr);
        gap: 28px;
        align-items: start;
        max-width: 1360px;
        margin: 0 auto;
        padding: 112px 24px 0;
    }
    .sd-layout > .content-area { max-width: none; margin: 0; padding: 0 0 80px; min-width: 0; }
    /* r734: the dock's home slot (76px) and the tab's own top padding made a
       gap under the header; the open tab's title now lines up with the
       column's top edge. */
    .sd-layout > .content-area > .tab-content { padding-top: 0; }
    /* The column shows which tab is open, so the title that stands on the
       page (محصولات, کیف پول) goes and the content starts at the top. Titles
       inside a card stay. */
    .sd-layout > .content-area > .tab-content > .tab-head { display: none; }
    /* r736: the open tab is at least as tall as the column (--sd-h, set by
       seller-dash.js) and its last card stretches to fill it, so a short tab
       (orders, detect, referral) ends level with the column. The cards only
       have top margins, so the column flow keeps their spacing. */
    .sd-layout > .content-area > .tab-content.active {
        display: flex; flex-direction: column; min-height: var(--sd-h, 0px);
    }
    .sd-layout > .content-area > .tab-content.active > .form-card:last-child { flex: 1 0 auto; }

    /* The column: a panel card */
    .sd {
        position: sticky; top: 112px;
        display: flex; flex-direction: column; gap: 12px;
        max-height: calc(100vh - 128px); max-height: calc(100dvh - 128px);
        overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
        padding: 14px;
        background: var(--white);
        border: 1px solid var(--gray-100);
        border-radius: var(--r-card);
        box-shadow: var(--shadow-card);
    }

    /* «محصول جدید»: the brand-gold button — its name and «+» on the right,
       the small pixel story (static/img/sd-new-author.svg) on the left. The
       story moves inside the image; nothing here animates. */
    .sd-new {
        display: flex; align-items: center; justify-content: space-between; gap: 4px;
        width: 100%; min-height: 56px; padding: 4px 14px 4px 8px; box-sizing: border-box; overflow: hidden;
        border: 1px solid var(--gold-primary); border-radius: var(--r-btn); cursor: pointer;
        background: var(--gold-primary); color: var(--dark-primary);
        font-family: inherit; font-size: var(--fs-body); font-weight: 800;
        box-shadow: var(--shadow-btn);
        transition: background-color .2s;
    }
    .sd-new:hover { background: var(--gold-light); }
    .sd-new.is-on { outline: 2px solid var(--dark-primary); outline-offset: 2px; }
    .sd-new-t { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
    .sd-new-t b {
        display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px;
        background: var(--white);
    }
    .sd-new-t b svg { display: block; width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
    .sd-new img { flex: none; width: 96px; height: auto; margin-inline-end: -2px; image-rendering: pixelated; }

    /* The four numbers: two by two, as on the phone. Each square is tinted
       in its own colour from the hero's palette, fading to white from the
       tile's corner; the only gradients in the column. Tile on top, then
       the label, then the value — stacked, a seven-digit sum fits (73 of
       92px at 1440). */
    .sd-k1 { --t1: #f3e8ff; --t2: #e9d5ff; --tc: #6d28d9; }
    .sd-k2 { --t1: var(--green-light); --t2: #a7f3d0; --tc: var(--green-dark); }
    .sd-k3 { --t1: var(--gold-lighter); --t2: #fde68a; --tc: var(--gold-deep); }
    .sd-k4 { --t1: var(--blue-light); --t2: #bfdbfe; --tc: var(--blue-dark); }
    .sd-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .sd-stat {
        display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 10px;
        aspect-ratio: 1 / 1; min-width: 0; padding: 12px; border-radius: var(--r-sm); cursor: pointer;
        background: linear-gradient(160deg, var(--t1) 0%, rgba(255, 255, 255, 0) 90%), var(--white);
        border: 1px solid var(--t2);
        transition: border-color .2s;
    }
    .sd-stat:hover { border-color: var(--tc); }
    .sd-ic {
        flex: none; width: 34px; height: 34px; border-radius: var(--r-sm);
        display: grid; place-items: center;
        background: var(--white); color: var(--tc); --ic-acc: var(--tc); --ic-sw: .9px;
        box-shadow: 0 2px 6px -2px var(--t2), inset 0 0 0 1px var(--t2);
    }
    .sd-ic svg { width: 20px; height: 20px; overflow: visible; color: var(--tc); }
    .sd-tx { width: 100%; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
    .sd-stat .sd-tx span { order: -1; max-width: 100%; font-size: var(--fs-meta); font-weight: 600; color: var(--dark-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .sd-stat b { max-width: 100%; font-size: var(--fs-lead); font-weight: 800; line-height: 1.4; color: var(--tc); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }

    /* Every tab, under a hairline; the open one in the brand's soft gold */
    .sd-nav { display: flex; flex-direction: column; gap: 2px; padding-top: 10px; border-top: 1px solid var(--gray-100); }
    .sd-item {
        display: flex; align-items: center; gap: 10px; width: 100%;
        min-height: 42px; padding: 0 8px; border: 0; border-radius: var(--r-sm);
        background: none; cursor: pointer; text-align: start;
        font-family: inherit; font-size: var(--fs-small); font-weight: 600; color: var(--dark-secondary);
        transition: background-color .15s, color .15s;
    }
    .sd-item .ic {
        flex: none; width: 30px; height: 30px; border-radius: var(--r-xs);
        display: grid; place-items: center;
        background: var(--gray-50); color: var(--dark-muted); --ic-acc: var(--dark-muted);
    }
    .sd-item .ic svg { width: 18px; height: 18px; overflow: visible; }
    .sd-item:hover { background: var(--gray-50); color: var(--dark-primary); }
    .sd-item.is-on { background: var(--gold-bg); color: var(--dark-primary); font-weight: 800; }
    .sd-item.is-on .ic { background: var(--gold-lighter); color: var(--gold-deep); --ic-acc: var(--gold-deep); }
    .sd-item .sd-lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .sd-item .sd-badge {
        min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill);
        background: var(--red-primary, #dc2626); color: var(--white);
        font-size: var(--fs-caption); font-weight: 700; display: grid; place-items: center;
    }
    .sd-item .sd-badge[hidden] { display: none; }

    .sd :focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 2px; }
}

@media (min-width: 1180px) and (prefers-reduced-motion: reduce) {
    .sd-new, .sd-item, .sd-stat { transition: none; }
}

/* r745 (was r741): the open tab is at least as tall as the column (r736's
   min-height: --sd-h stays) and grows freely past it - no fixed height, no
   inner scroll box, so long tabs (settings, wallet, the new-product form)
   scroll with the page and the products pager is never hidden (owner).
   A short tab stretches its last card, or a wrapper's last card (e.g.
   #smsSection), to the column's bottom edge. The column is untouched. */
@media (min-width: 1180px) {
    .sd-layout > .content-area > .tab-content.active > :last-child:not(.form-card):has(> .form-card:last-child) {
        flex: 1 0 auto; display: flex; flex-direction: column;
    }
    .sd-layout > .content-area > .tab-content.active > :last-child:not(.form-card) > .form-card:last-child { flex: 1 0 auto; }
}

/* r742: the tab's scroll box cut the cards' soft shadow off at its edges, which
   showed as a grey band round the card. Inside the box the cards keep only
   their hairline border. */
@media (min-width: 1180px) {
    .sd-layout > .content-area > .tab-content.active .form-card { box-shadow: none; }
}

/* r743: the four number squares stay exactly square and equal: with a larger
   browser text size their content pushed the height past the width (117x138
   at 150%). min-height 0 lets aspect-ratio win; text may overflow, never cut. */
@media (min-width: 1180px) {
    .sd .sd-stats .sd-stat { min-height: 0; gap: 4px; }
}
