/* ============================================================
   pages/account.css — вход, регистрация, кабинет, панель.
   Подключается только на этих страницах.
   ============================================================ */

/* ---- карточка формы входа/регистрации -------------------- */
.auth-card {
    max-width: 460px;
    margin-inline: auto;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: clamp(28px, 4vw, 44px);
}

.auth-card__head {
    margin-bottom: var(--s-6);
}

.auth-card__head h1 {
    font-size: clamp(26px, 3vw, 34px);
}

.auth-card__foot {
    margin-top: var(--s-6);
    padding-top: var(--s-5);
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: var(--fs-sm);
    color: var(--gray);
}

.auth-card__foot a {
    color: var(--magenta);
}

.auth-card__foot a:hover {
    text-decoration: underline;
}

.field__hint {
    font-size: var(--fs-xs);
    color: var(--gray);
    line-height: 1.5;
}

.field__hint ul {
    padding-left: 16px;
    list-style: disc;
}

.alert {
    padding: 13px 18px;
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
    line-height: 1.5;
}

.alert--error {
    background: rgba(233, 66, 66, .09);
    color: #b32b2b;
}

.alert--ok {
    background: rgba(34, 160, 107, .1);
    color: #1a7d53;
}

/* ---- личный кабинет -------------------------------------- */
.cabinet {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: clamp(28px, 4vw, 56px);
    align-items: start;
}

/* ---- заказы в личном кабинете ---------------------------- */

.cabinet-orders__head {
    margin-bottom: var(--s-5);
}

.cabinet-orders__head h3 {
    margin: 0 0 var(--s-4);
}

.cabinet-orders__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cabinet-orders__actions .btn {
    white-space: nowrap;
}

.order-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--s-4);
    padding: var(--s-4) 0;
    border-bottom: 1px solid var(--line);
}

.order-row:last-child {
    border-bottom: 0;
}

.order-row__num {
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    font-weight: 500;
}

.order-row__num:hover {
    color: var(--magenta);
}

.order-row__date {
    font-size: var(--fs-xs);
    color: var(--gray);
    margin-top: 4px;
}

.order-row__right {
    text-align: right;
}

.order-row__sum {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 17px;
}

/* ---- метка статуса --------------------------------------- */
.chip {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 12px;
    border-radius: var(--r-pill);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .1em;
    text-transform: uppercase;
    background: var(--mist);
    color: var(--gray);
}

.chip--lg {
    font-size: 12px;
    padding: 8px 18px;
}

.chip--new {
    background: var(--magenta-wash);
    color: var(--magenta);
}

.chip--confirmed {
    background: rgba(80, 92, 253, .12);
    color: var(--violet);
}

.chip--shipped {
    background: rgba(240, 160, 32, .14);
    color: #b8790f;
}

.chip--done {
    background: rgba(34, 160, 107, .12);
    color: var(--success);
}

.chip--canceled {
    background: rgba(233, 66, 66, .1);
    color: var(--danger);
}

/* ============================================================
   Панель управления
   ============================================================ */
body.dash {
    background: var(--mist);
}

body.dash .site-header, body.dash .site-footer, body.dash .to-top {
    display: none;
}

body.dash #main {
    padding-top: 0;
}

.dash-top {
    background: var(--ink);
    color: var(--white);
    position: sticky;
    top: 0;
    z-index: 50;
}

.dash-top__in {
    display: flex;
    align-items: center;
    gap: var(--s-6);
    height: 68px;
}

.dash-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: none;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 16px;
    letter-spacing: -.02em;
}

.dash-nav {
    display: flex;
    gap: 4px;
    margin-left: var(--s-5);
}

.dash-nav__link {
    padding: 9px 16px;
    border-radius: var(--r-pill);
    font-size: var(--fs-sm);
    font-weight: 600;
    color: rgba(255, 255, 255, .68);
    transition: background var(--t-fast), color var(--t-fast);
}

.dash-nav__link:hover {
    background: rgba(255, 255, 255, .09);
    color: var(--white);
}

.dash-nav__link.is-active {
    background: var(--magenta);
    color: var(--white);
}

.dash-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: var(--fs-sm);
    color: rgba(255, 255, 255, .6);
}

.dash-user a {
    color: rgba(255, 255, 255, .6);
    display: grid;
    place-items: center;
}

.dash-user a:hover {
    color: var(--magenta);
}

/* ---- фильтры --------------------------------------------- */
.dash-filters {
    display: flex;
    gap: var(--s-3);
    flex-wrap: wrap;
    align-items: center;
}

.dash-filters .input {
    max-width: 340px;
}

.dash-filters select.input {
    max-width: 240px;
}

/* ---- таблица заказов ------------------------------------- */
.dash-table {
    background: var(--white);
    border-radius: var(--r-md);
    overflow: hidden;
    border: 1px solid var(--line);
}

.dash-table__head,
.dash-row {
    display: grid;
    grid-template-columns: 150px 1.1fr 1.4fr 120px 180px;
    gap: var(--s-4);
    padding: var(--s-4) var(--s-5);
    align-items: center;
}

.dash-table__head {
    background: var(--ink);
    color: rgba(255, 255, 255, .55);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.dash-row {
    border-top: 1px solid var(--line);
    font-size: var(--fs-sm);
}

.dash-row:hover {
    background: rgba(255, 0, 120, .03);
}

.dash-row__num {
    font-family: var(--font-mono);
    font-weight: 500;
}

.dash-row__num:hover {
    color: var(--magenta);
}

.dash-row__name {
    font-weight: 700;
}

.dash-row__meta {
    font-size: var(--fs-xs);
    color: var(--gray);
    margin-top: 4px;
}

.dash-row__meta a:hover {
    color: var(--magenta);
}

.dash-row__items {
    font-size: var(--fs-xs);
    line-height: 1.7;
}

.dash-row__sum {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 17px;
    white-space: nowrap;
}

.dash-row__sum i {
    font-style: normal;
    font-size: 12px;
    color: var(--gray);
    margin-left: 3px;
}

.chip-select {
    width: 100%;
    padding: 9px 14px;
    border-radius: var(--r-pill);
    border: 1.5px solid transparent;
    font-size: var(--fs-xs);
    font-weight: 700;
    cursor: pointer;
    appearance: none;
    background-image: none;
}

.chip-select:focus-visible {
    outline: 2px solid var(--magenta);
    outline-offset: 2px;
}

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-4);
}

/* ---- карточка заказа ------------------------------------- */
.dash-detail {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: clamp(24px, 3vw, 40px);
    align-items: start;
}

.dash-card, .panel {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: var(--s-6);
}

.dash-card h4 {
    margin: 0 0 var(--s-4);
    font-size: 16px;
}

.note {
    background: var(--mist);
    border-radius: var(--r-sm);
    padding: var(--s-4);
    font-size: var(--fs-sm);
    line-height: 1.6;
}

.status-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.status-btn {
    padding: 12px 22px;
    border-radius: var(--r-pill);
    border: 1.5px solid var(--line);
    background: var(--white);
    font-size: var(--fs-sm);
    font-weight: 700;
    transition: border-color var(--t-fast), background var(--t-fast), color var(--t-fast);
}

.status-btn:hover {
    border-color: var(--magenta);
    color: var(--magenta);
}

.status-btn.is-current {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--white);
    cursor: default;
}

/* ---- статистика ------------------------------------------ */
.period-switch {
    display: flex;
    gap: 4px;
    background: var(--white);
    padding: 4px;
    border-radius: var(--r-pill);
    border: 1px solid var(--line);
}

.period-switch__item {
    padding: 8px 16px;
    border-radius: var(--r-pill);
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--gray);
    transition: background var(--t-fast), color var(--t-fast);
}

.period-switch__item:hover {
    color: var(--graphite);
}

.period-switch__item.is-active {
    background: var(--magenta);
    color: var(--white);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--s-4);
}

.kpi {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: var(--s-5);
}

.kpi--accent {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--white);
    position: relative;
    overflow: hidden;
}

.kpi--accent::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: var(--spectrum);
}

.kpi__label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--gray);
}

.kpi--accent .kpi__label {
    color: rgba(255, 255, 255, .5);
}

.kpi__value {
    font-family: var(--font-display);
    font-size: clamp(26px, 3vw, 36px);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.1;
    margin: 10px 0 6px;
}

.kpi__value i {
    font-style: normal;
    font-size: 14px;
    font-weight: 400;
    color: var(--gray);
    margin-left: 5px;
}

.kpi--accent .kpi__value i {
    color: rgba(255, 255, 255, .5);
}

.kpi__note {
    font-size: var(--fs-xs);
    color: var(--gray);
}

.kpi--accent .kpi__note {
    color: rgba(255, 255, 255, .45);
}

/* столбчатый график без библиотек */
.chart {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 190px;
}

.chart__col {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: flex-end;
    position: relative;
    min-width: 4px;
}

.chart__bar {
    width: 100%;
    min-height: 2px;
    border-radius: 3px 3px 0 0;
    background: linear-gradient(180deg, var(--magenta), rgba(255, 0, 120, .35));
    transition: filter var(--t-fast);
}

.chart__col:hover .chart__bar {
    filter: brightness(1.15);
}

.chart__tip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--ink);
    color: var(--white);
    padding: 7px 11px;
    border-radius: var(--r-sm);
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.5;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-fast);
    z-index: 3;
}

.chart__col:hover .chart__tip {
    opacity: 1;
}

.chart__axis {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--gray);
}

/* рейтинг товаров */
.rank + .rank {
    margin-top: var(--s-4);
}

.rank__top {
    display: flex;
    justify-content: space-between;
    gap: var(--s-3);
    font-size: var(--fs-sm);
}

.rank__name {
    font-weight: 700;
}

.rank__value {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--magenta);
    white-space: nowrap;
}

.rank__bar {
    height: 6px;
    border-radius: 3px;
    background: var(--mist);
    margin: 8px 0 5px;
    overflow: hidden;
}

.rank__bar span {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: var(--spectrum);
}

.rank__meta {
    font-size: var(--fs-xs);
    color: var(--gray);
}

.specs .status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 8px;
    box-shadow: none;
}

/* ---- адаптив --------------------------------------------- */
@media (max-width: 1100px) {
    .cabinet, .dash-detail {
        grid-template-columns: 1fr;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dash-table__head {
        display: none;
    }

    .dash-row {
        grid-template-columns: 1fr 1fr;
        row-gap: var(--s-3);
    }

    .dash-row__items {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .dash-nav {
        margin-left: 0;
        overflow-x: auto;
    }

    .dash-top__in {
        height: auto;
        padding-block: var(--s-3);
        flex-wrap: wrap;
        gap: var(--s-3);
    }

    .dash-row {
        grid-template-columns: 1fr;
    }

    .period-switch {
        width: 100%;
        overflow-x: auto;
    }
}

/* alert внутри формы оформления */
.checkout .alert a {
    text-decoration: underline;
}

/* ---- вкладка «Товары» ------------------------------------ */
.goods-grid {
    grid-template-columns: 56px 1fr 150px 110px 120px 100px;
}

.goods-pic {
    width: 56px;
    height: 56px;
    border-radius: var(--r-sm);
    overflow: hidden;
    background: linear-gradient(155deg, #fff, var(--mist));
    border: 1px solid var(--line);
}

.goods-pic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.goods-num {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 17px;
}

.goods-num .dash-row__meta {
    font-family: var(--font-body);
    font-weight: 400;
}

.dash-row.is-alert {
    background: rgba(255, 0, 120, .04);
}

.dash-row.is-alert:hover {
    background: rgba(255, 0, 120, .07);
}

.tag-order {
    display: inline-block;
    padding: 2px 9px;
    border-radius: var(--r-pill);
    background: rgba(240, 160, 32, .16);
    color: #a9700d;
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.ok-mark {
    font-family: var(--font-body);
    font-size: var(--fs-xs);
    font-weight: 400;
    color: var(--gray);
}

.qty--sm {
    height: 38px;
}

.qty--sm button {
    width: 32px;
    height: 36px;
    font-size: 16px;
}

.qty--sm input {
    width: 52px;
    height: 36px;
    font-size: 15px;
}

.stock-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stock-saved {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--success);
    animation: fade-up .3s var(--ease) both;
}

/* плашка способа доставки в карточке заказа */
.ship-badge {
    padding: 12px 16px;
    border-radius: var(--r-sm);
    font-weight: 700;
    font-size: var(--fs-sm);
    background: var(--mist);
    color: var(--graphite);
}

.ship-badge--pickup {
    background: rgba(34, 160, 107, .12);
    color: #1a7d53;
}

.ship-badge--bishkek {
    background: rgba(80, 92, 253, .12);
    color: var(--violet);
}

.ship-badge--kg {
    background: rgba(240, 160, 32, .16);
    color: #a9700d;
}

@media (max-width: 1100px) {
    .goods-grid {
        grid-template-columns: 48px 1fr 130px;
    }

    .goods-grid > :nth-child(n+4) {
        display: none;
    }

    .dash-table__head.goods-grid {
        display: none;
    }
}
