*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: var(--t-body);
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
}

img { max-width: 100%; display: block; }

button, input, textarea, select { font: inherit; color: inherit; }

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

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.mono { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.hidden { display: none !important; }

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }

.app {
    min-height: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--header-h) minmax(0, 1fr);
    grid-template-areas: "header" "main";
    max-width: var(--page-max);
    margin: 0 auto;
}

.app-header {
    grid-area: header;
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: 0 var(--s-5);
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: var(--s-3); flex: none; min-width: 0; }
.brand__logo { width: 36px; height: 36px; border-radius: var(--r-sm); object-fit: cover; box-shadow: var(--shadow-1); }
.brand__title { font: var(--t-h3); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.brand__sub { font: var(--t-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }

.header-actions { display: flex; align-items: center; gap: var(--s-2); flex: none; }

.search {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 720px;
    margin: 0 auto;
}
.search__field {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    height: 46px;
    padding: 0 var(--s-2) 0 var(--s-4);
    background: var(--surface);
    border: 1px solid transparent;
    border-radius: var(--r-pill);
    box-shadow: var(--shadow-1);
    transition: box-shadow var(--norm), border-color var(--norm);
}
.search__field:focus-within { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.search__input {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    border: 0;
    background: none;
    outline: none;
}
.search__input::placeholder { color: var(--text-muted); }
.search__clear {
    flex: none;
    cursor: pointer;
    background: var(--surface-2);
    box-shadow: none;
}
.search__clear:hover { background: var(--surface-3); box-shadow: none; }

.suggest {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    z-index: 60;
    padding: var(--s-2);
    background: var(--surface-float);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-3);
    max-height: min(60vh, 520px);
    overflow: auto;
}
.suggest__row {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    width: 100%;
    padding: var(--s-2) var(--s-3);
    border: 0;
    background: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    text-align: left;
}
.suggest__row:hover, .suggest__row.is-active { background: var(--surface-2); }
.suggest__thumb { width: 38px; height: 38px; border-radius: var(--r-xs); background: var(--surface-2); object-fit: cover; flex: none; }
.suggest__body { min-width: 0; flex: 1 1 auto; display: block; }
.suggest__name { display: block; font: var(--t-body); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest__meta { display: block; font: var(--t-xs); color: var(--text-muted); margin-top: var(--s-1); }
.suggest__price { font: var(--t-sm); font-weight: 600; white-space: nowrap; }
.suggest__all {
    display: flex; align-items: center; gap: var(--s-3);
    width: 100%; margin-top: var(--s-2); padding: var(--s-3);
    border: 0; border-top: 1px solid var(--border); background: none;
    border-radius: 0 0 var(--r-md) var(--r-md);
    font: var(--t-body); font-weight: 500; color: var(--text); cursor: pointer; text-align: left;
}
.suggest__all:hover { background: var(--surface-2); }
.suggest__future {
    display: flex; align-items: center; gap: var(--s-2);
    padding: var(--s-3);
    border-top: 1px solid var(--border);
    font: var(--t-xs); color: var(--text-muted);
}

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 80;
    width: min(var(--sidebar-w), 86vw);
    height: 100%;
    padding: 0;
    background: var(--surface-float);
    box-shadow: var(--shadow-3);
    overflow: auto;
    transform: translateX(-104%);
    transition: transform var(--norm);
}
.app-sidebar.is-open { transform: none; }

.sidebar-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: var(--s-2);
    padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4);
    background: var(--surface-float);
    border-bottom: 1px solid var(--border);
}
.sidebar-card { padding: var(--s-2); }
.sidebar-title {
    font: var(--t-h3);
    flex: 1 1 auto;
}

.group-item { display: block; }
.group-item__head {
    display: flex; align-items: center; gap: var(--s-2);
    width: 100%; padding: var(--s-3);
    border: 0; background: none; border-radius: var(--r-md);
    cursor: pointer; text-align: left; color: var(--text-2);
    transition: background var(--fast), color var(--fast);
}
.group-item__head:hover { background: var(--surface-2); color: var(--text); }
.group-item.is-open > .group-item__head { color: var(--text); font-weight: 500; }
.group-item__chevron { margin-left: auto; transition: transform var(--norm); color: var(--text-muted); }
.group-item.is-open > .group-item__head .group-item__chevron { transform: rotate(90deg); }
.group-item__children { display: none; padding: var(--s-1) 0 var(--s-2) var(--s-5); }
.group-item.is-open > .group-item__children { display: block; }
.subgroup-item {
    display: flex; align-items: baseline; gap: var(--s-2);
    width: 100%; padding: var(--s-2) var(--s-3);
    border: 0; background: none; border-radius: var(--r-sm);
    cursor: pointer; text-align: left;
    font: var(--t-sm); color: var(--text-2);
}
.subgroup-item:hover { background: var(--surface-2); color: var(--text); }
.subgroup-item.is-active { background: var(--accent-soft); color: var(--accent-text); font-weight: 500; }
.subgroup-item__count { margin-left: auto; font: var(--t-xs); color: var(--text-muted); }

.app-main {
    grid-area: main;
    min-width: 0;
    padding: var(--s-2) var(--s-5) var(--s-8);
}
.screen { display: none; }
.screen.is-active { display: block; animation: rise .24s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--s-3);
    margin: var(--s-4) 0 var(--s-5);
}
.page-head__text { min-width: 0; }
.page-title { font: var(--t-display); letter-spacing: -.02em; margin: 0; }
.page-sub { font: var(--t-sm); color: var(--text-muted); margin: var(--s-2) 0 0; }
.page-head__actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }

.crumbs { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; font: var(--t-sm); color: var(--text-muted); }
.crumbs__link { border: 0; background: none; padding: 0; cursor: pointer; color: var(--text-muted); }
.crumbs__link:hover { color: var(--text); text-decoration: underline; }
.crumbs__sep { opacity: .5; }
.crumbs__current { color: var(--text-2); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-2);
    height: 44px;
    padding: 0 var(--s-5);
    border: 1px solid transparent;
    border-radius: var(--r-pill);
    background: var(--surface);
    color: var(--text);
    font: var(--t-body);
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: var(--shadow-1);
    transition: transform var(--fast), background var(--fast), box-shadow var(--fast), color var(--fast), border-color var(--fast);
}
.btn:hover { box-shadow: var(--shadow-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }

.btn--primary { background: var(--pill); color: var(--pill-text); }
.btn--primary:hover { background: var(--pill-hover); }
.btn--accent { background: var(--accent); color: var(--text-on-accent); }
.btn--accent:hover { background: var(--accent-hover); }
.btn--ghost { background: transparent; border-color: var(--border-strong); box-shadow: none; }
.btn--ghost:hover { background: var(--surface-2); box-shadow: none; }
.btn--quiet { background: transparent; box-shadow: none; color: var(--text-2); }
.btn--quiet:hover { background: var(--surface-2); color: var(--text); box-shadow: none; }
.btn--sm { height: 36px; padding: 0 var(--s-4); font: var(--t-sm); font-weight: 500; }
.btn--lg { height: 52px; padding: 0 var(--s-6); font-size: 16px; }
.btn--block { width: 100%; }

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: none;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--r-pill);
    background: var(--surface);
    color: var(--text-2);
    cursor: pointer;
    box-shadow: var(--shadow-1);
    position: relative;
    transition: background var(--fast), color var(--fast), box-shadow var(--fast), transform var(--fast);
}
.btn-icon:hover { color: var(--text); box-shadow: var(--shadow-2); }
.btn-icon:active { transform: translateY(1px); }
.btn-icon--sm { width: 36px; height: 36px; }
.btn-icon--bare { background: none; box-shadow: none; }
.btn-icon--bare:hover { background: var(--surface-2); box-shadow: none; }
.btn-icon--dark { background: var(--pill); color: var(--pill-text); }
.btn-icon--dark:hover { background: var(--pill-hover); color: var(--pill-text); }

.btn__dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin-right: calc(var(--s-3) * -1 + 2px);
    margin-left: var(--s-2);
    border-radius: var(--r-pill);
    background: var(--accent);
    color: var(--text-on-accent);
    flex: none;
}
.btn--primary .btn__dot { background: var(--surface); color: var(--text); }

.badge-count {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: var(--r-pill);
    background: var(--accent);
    color: var(--text-on-accent);
    font: var(--t-xs);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg);
}

.theme-switch {
    display: inline-flex;
    align-items: center;
    padding: 3px;
    gap: 2px;
    background: var(--surface);
    border-radius: var(--r-pill);
    box-shadow: var(--shadow-1);
    flex: none;
}
.theme-switch__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: var(--r-pill);
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--fast), color var(--fast);
}
.theme-switch__btn.is-active { background: var(--pill); color: var(--pill-text); }

.field { display: block; margin-bottom: var(--s-4); }
.field__label { display: block; font: var(--t-sm); font-weight: 500; color: var(--text-2); margin-bottom: var(--s-2); }
.field__hint { font: var(--t-xs); color: var(--text-muted); margin-top: var(--s-2); }
.field__control {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    width: 100%;
    min-height: 50px;
    padding: 0 var(--s-4);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    transition: border-color var(--norm), background var(--norm), box-shadow var(--norm);
}
.field__control:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
.field__control { min-width: 0; }
.field__control input, .field__control textarea, .field__control select {
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border: 0;
    background: none;
    outline: none;
    padding: var(--s-3) 0;
}
.field__control textarea { resize: vertical; min-height: 88px; }
.field--error .field__control { border-color: var(--err); }
.field--error .field__hint { color: var(--err); }

.select__control { cursor: pointer; }
.select__control select { appearance: none; cursor: pointer; }

.stepper {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
}
.stepper__btn {
    width: 34px;
    height: 34px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--r-pill);
    background: none;
    color: var(--text-2);
    cursor: pointer;
    transition: background var(--fast), color var(--fast);
}
.stepper__btn:hover { background: var(--surface-3); color: var(--text); }
.stepper__input {
    width: 62px;
    height: 34px;
    border: 0;
    background: none;
    outline: none;
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    -moz-appearance: textfield;
}
.stepper__input::-webkit-outer-spin-button, .stepper__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper--lg .stepper__btn { width: 42px; height: 42px; }
.stepper--lg .stepper__input { width: 84px; height: 42px; font-size: 17px; }

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-1);
    padding: var(--s-5);
}
.panel--flush { padding: 0; overflow: hidden; }
.panel__body { padding: var(--s-5); }

.chip {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    height: 28px;
    padding: 0 var(--s-3);
    border-radius: var(--r-pill);
    background: var(--surface-2);
    color: var(--text-2);
    font: var(--t-xs);
    font-weight: 500;
    white-space: nowrap;
}
.chip--ok { background: var(--ok-soft); color: var(--ok); }
.chip--warn { background: var(--warn-soft); color: var(--warn); }
.chip--err { background: var(--err-soft); color: var(--err); }
.chip--accent { background: var(--accent-soft); color: var(--accent-text); }

.group-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
    gap: var(--s-3);
    margin-bottom: var(--s-6);
}
.group-tile {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    padding: var(--s-5);
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
    cursor: pointer;
    transition: transform var(--norm), box-shadow var(--norm);
}
.group-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.group-tile__name { font: var(--t-h3); }
.group-tile__meta { font: var(--t-xs); color: var(--text-muted); }
.group-tile__arrow { margin-top: var(--s-3); align-self: flex-end; color: var(--text-muted); }

.section-title {
    display: flex;
    align-items: baseline;
    gap: var(--s-2);
    font: var(--t-h2);
    margin: var(--s-6) 0 var(--s-3);
}
.section-title:first-child { margin-top: 0; }
.section-title span {
    font: var(--t-xs);
    color: var(--text-muted);
    padding: 2px var(--s-2);
    background: var(--surface-2);
    border-radius: var(--r-pill);
}

.goods-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
    gap: var(--s-3);
}
.good-card {
    display: flex;
    flex-direction: column;
    padding: var(--s-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
    transition: box-shadow var(--norm), border-color var(--norm);
}
.good-card:hover { box-shadow: var(--shadow-2); }
.good-card.is-in-order { border-color: var(--accent); }
.good-card__media {
    position: relative;
    overflow: hidden;
    border-radius: var(--r-md);
    background: var(--surface-2);
    cursor: pointer;
    aspect-ratio: 1 / 1;
}
.good-card__img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--norm); }
.good-card__media:hover .good-card__img { transform: scale(1.06); }
.good-card__body { display: flex; flex-direction: column; flex: 1 1 auto; padding: var(--s-3) var(--s-2) 0; }
.good-card__name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    border: 0; background: none; padding: 0; margin: 0 0 var(--s-2);
    font: var(--t-sm); font-weight: 500; color: var(--text); text-align: left; cursor: pointer;
    min-height: 2.9em;
}
.good-card__name:hover { color: var(--accent-text); }
.good-card__art { font: var(--t-xs); font-family: var(--font-num); color: var(--text-muted); margin-bottom: var(--s-2); }
.good-card__price { font: 600 20px/1.1 var(--font); font-variant-numeric: tabular-nums; margin-bottom: var(--s-1); }
.good-card__price span { font: var(--t-xs); font-weight: 400; color: var(--text-muted); }
.good-card__foot { margin-top: auto; padding-top: var(--s-3); }
.good-card__stock { font: var(--t-xs); color: var(--text-muted); text-align: center; margin-top: var(--s-2); }
.good-card__stock--none { color: var(--warn); }
.good-card .stepper { width: 100%; justify-content: space-between; }
.good-card .stepper__input { width: 100%; }

.goods-list { display: flex; flex-direction: column; gap: var(--s-2); }

.switch {
    display: inline-flex;
    align-items: center;
    width: 34px;
    height: 20px;
    padding: 2px;
    border-radius: var(--r-pill);
    background: var(--surface-3);
    transition: background var(--norm);
    flex: none;
}
.switch__knob {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: var(--shadow-1);
    transition: transform var(--norm);
}
.switch.is-on { background: var(--accent); }
.switch.is-on .switch__knob { transform: translateX(14px); }

.login__note {
    display: flex;
    align-items: flex-start;
    gap: var(--s-3);
    margin: calc(var(--s-5) * -1 + var(--s-2)) 0 var(--s-5);
    padding: var(--s-3) var(--s-4);
    background: var(--surface-2);
    border-radius: var(--r-md);
    font: var(--t-sm);
    color: var(--text-muted);
}

.view-switch { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface); border-radius: var(--r-pill); box-shadow: var(--shadow-1); }
.view-switch__btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
    height: 34px; padding: 0 var(--s-3);
    border: 0; border-radius: var(--r-pill); background: none;
    color: var(--text-muted); font: var(--t-sm); cursor: pointer;
    transition: background var(--fast), color var(--fast);
}
.view-switch__btn.is-active { background: var(--pill); color: var(--pill-text); }
.good-row {
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr) 132px 150px auto;
    align-items: center;
    gap: var(--s-4);
    padding: var(--s-3) var(--s-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
    transition: transform var(--fast), box-shadow var(--fast), border-color var(--fast);
}
.good-row:hover { box-shadow: var(--shadow-2); border-color: var(--border-strong); }
.good-row.is-in-order { border-color: var(--accent); }
.good-row__thumb {
    width: 60px; height: 60px;
    border-radius: var(--r-sm);
    background: var(--surface-2);
    object-fit: cover;
    cursor: pointer;
}
.good-row__body { min-width: 0; }
.good-row__name {
    display: block;
    font: var(--t-body);
    font-weight: 500;
    text-align: left;
    border: 0;
    background: none;
    padding: 0;
    cursor: pointer;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.good-row__name:hover { color: var(--accent-text); }
.good-row__meta { display: flex; gap: var(--s-3); flex-wrap: wrap; font: var(--t-xs); color: var(--text-muted); margin-top: var(--s-1); }
.good-row__art { font-family: var(--font-num); }
.good-row__stock { text-align: right; font: var(--t-sm); color: var(--text-2); }
.good-row__stock b { display: block; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.good-row__price { text-align: right; }
.good-row__price b { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.good-row__price span { display: block; font: var(--t-xs); color: var(--text-muted); }
.good-row__actions { display: flex; align-items: center; gap: var(--s-2); }
.good-row__foot, .order-line__foot { display: contents; }

.stock-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 6px; vertical-align: 1px; }
.stock-dot--low { background: var(--warn); }
.stock-dot--none { background: var(--text-muted); }

.product-panel {
    display: grid;
    grid-template-columns: minmax(260px, 420px) minmax(0, 1fr);
    gap: var(--s-6);
    align-items: start;
    padding: var(--s-5);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-1);
}
.product__image { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--r-lg); background: var(--surface-2); }
.product__title { font: var(--t-display); margin: 0 0 var(--s-4); letter-spacing: -.02em; }
.product__full { font: var(--t-sm); color: var(--text-2); margin: 0 0 var(--s-4); }
.product__chips { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-bottom: var(--s-5); }
.product__buy {
    display: flex;
    align-items: center;
    gap: var(--s-4);
    flex-wrap: wrap;
    padding: var(--s-4);
    background: var(--surface-2);
    border-radius: var(--r-lg);
    margin-bottom: var(--s-5);
}
.product__price { font: 600 30px/1.1 var(--font); font-variant-numeric: tabular-nums; }
.product__price small { display: block; font: var(--t-xs); color: var(--text-muted); font-weight: 400; margin-top: var(--s-1); }
.product__buy-actions { display: flex; align-items: center; gap: var(--s-3); margin-left: auto; flex-wrap: wrap; }
.product__buy-hint { font: var(--t-sm); color: var(--text-muted); }
.product__section-title { font: var(--t-h3); margin: var(--s-5) 0 var(--s-2); }
.product__description { font: var(--t-body); color: var(--text-2); margin: 0; }
.spec-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s-3); margin: var(--s-4) 0 0; }
.spec { padding: var(--s-3) var(--s-4); background: var(--surface-2); border-radius: var(--r-md); }
.spec__key { font: var(--t-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.spec__val { font: var(--t-body); font-weight: 500; margin-top: var(--s-1); }

.order-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--s-5); align-items: start; }
.order-lines { display: flex; flex-direction: column; gap: var(--s-2); }
.order-line {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) auto 130px 40px;
    align-items: center;
    gap: var(--s-4);
    padding: var(--s-3) var(--s-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
}
.order-line__thumb { width: 56px; height: 56px; border-radius: var(--r-sm); object-fit: cover; background: var(--surface-2); }
.order-line__name {
    display: block;
    max-width: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text);
    font: var(--t-body);
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.order-line__name:hover { color: var(--accent-text); }
.order-line__thumb { cursor: pointer; }
.order-line__meta { font: var(--t-xs); color: var(--text-muted); margin-top: var(--s-1); }
.order-line__sum { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.order-line__sum span { display: block; font: var(--t-xs); font-weight: 400; color: var(--text-muted); }

.order-summary { position: sticky; top: calc(var(--header-h) + var(--s-3)); }
.summary-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); padding: var(--s-2) 0; font: var(--t-sm); color: var(--text-2); }
.summary-row b { font-variant-numeric: tabular-nums; color: var(--text); }
.summary-total { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); margin-top: var(--s-3); padding-top: var(--s-4); border-top: 1px solid var(--border); }
.summary-total__label { font: var(--t-h3); }
.summary-total__value { font: 600 26px/1.1 var(--font); font-variant-numeric: tabular-nums; }
.progress { height: 6px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; margin: var(--s-2) 0 var(--s-3); }
.progress__bar { height: 100%; background: var(--accent); border-radius: var(--r-pill); transition: width var(--norm); }

.history-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: var(--s-5); align-items: start; }
.history-aside { position: sticky; top: calc(var(--header-h) + var(--s-3)); display: flex; flex-direction: column; gap: var(--s-3); }
.filter-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-3); }
.filter-grid .field--wide { grid-column: 1 / -1; }
.filter-grid .field { margin-bottom: 0; min-width: 0; }
.filter-grid .field__control { min-height: 42px; padding: 0 var(--s-3); }
.filter-grid input[type="date"] { font-size: 13px; }
.history-aside, .history-detail { min-width: 0; }

.order-pick-list { display: flex; flex-direction: column; gap: var(--s-2); max-height: 46vh; overflow: auto; padding-right: 2px; }
.order-pick {
    display: block;
    width: 100%;
    padding: var(--s-3) var(--s-4);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface-2);
    text-align: left;
    cursor: pointer;
    color: inherit;
    transition: border-color var(--fast), background var(--fast);
}
.order-pick:hover { border-color: var(--border-strong); }
.order-pick.is-active { border-color: var(--accent); background: var(--accent-soft); }
.order-pick__no { font: var(--t-h3); }
.order-pick__meta { display: flex; justify-content: space-between; gap: var(--s-2); font: var(--t-xs); color: var(--text-muted); margin-top: var(--s-1); }
.order-pick__sum { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-2); }
.history-total { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); padding: var(--s-4); font: var(--t-sm); }
.history-total b { font: var(--t-h3); font-variant-numeric: tabular-nums; }

.history-head {
    display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
    margin-bottom: var(--s-4);
}
.history-head__no { font: var(--t-h1); }
.history-head__meta { font: var(--t-sm); color: var(--text-muted); margin-top: var(--s-1); }
.history-head__actions { margin-left: auto; display: flex; gap: var(--s-2); flex-wrap: wrap; }
.order-comment {
    display: flex; gap: var(--s-2); align-items: flex-start;
    margin-top: var(--s-4); padding: var(--s-3) var(--s-4);
    background: var(--surface-2); border-radius: var(--r-md);
    font: var(--t-sm); color: var(--text-2);
}

.login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: var(--s-5);
    background:
        radial-gradient(900px 480px at 15% -10%, var(--accent-soft), transparent 70%),
        radial-gradient(760px 420px at 110% 110%, var(--surface-3), transparent 65%);
}
.login__card {
    width: min(420px, 100%);
    padding: var(--s-7) var(--s-6) var(--s-6);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-3);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
.login__demo {
    display: flex;
    align-items: flex-start;
    gap: var(--s-3);
    padding: var(--s-3) var(--s-4);
    margin-bottom: var(--s-5);
    background: var(--accent-soft);
    border-radius: var(--r-md);
    font: var(--t-sm);
    color: var(--accent-text);
}
.login__demo b { font-family: var(--font-num); }
.login__theme { position: fixed; top: var(--s-5); right: var(--s-5); }

.toasts {
    position: fixed;
    right: var(--s-5);
    top: calc(var(--header-h) + var(--s-3));
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    width: min(380px, calc(100vw - var(--s-6)));
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--s-3);
    padding: var(--s-4);
    background: var(--surface-float);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-3);
    animation: toast-in .26s var(--ease);
}
.toast.is-leaving { animation: toast-out .2s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px) scale(.98); } }
.toast__icon { width: 32px; height: 32px; border-radius: var(--r-pill); display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text-2); }
.toast--ok .toast__icon { background: var(--ok-soft); color: var(--ok); }
.toast--warn .toast__icon { background: var(--warn-soft); color: var(--warn); }
.toast--err .toast__icon { background: var(--err-soft); color: var(--err); }
.toast__body { min-width: 0; flex: 1 1 auto; }
.toast__title { font: var(--t-h3); }
.toast__text { font: var(--t-sm); color: var(--text-2); margin-top: 2px; }

.empty {
    display: grid;
    place-items: center;
    gap: var(--s-3);
    padding: var(--s-8) var(--s-5);
    text-align: center;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-xl);
}
.empty__icon { width: 56px; height: 56px; border-radius: var(--r-pill); display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.empty__title { font: var(--t-h2); color: var(--text); }
.empty__text { max-width: 52ch; }

.tree-empty { padding: var(--s-3) var(--s-4); font: var(--t-sm); color: var(--text-muted); }

.tabbar {
    display: none;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 50;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
}
.tabbar__inner { display: grid; grid-template-columns: repeat(4, 1fr); height: var(--tabbar-h); }
.tabbar__btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    background: none;
    color: var(--text-muted);
    font: var(--t-xs);
    cursor: pointer;
    position: relative;
}
.tabbar__btn.is-active { color: var(--text); }
.tabbar__btn .badge-count { top: 6px; right: 22%; }

.drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: var(--overlay);
    display: none;
}
.drawer-backdrop.is-open { display: block; }
.drawer-backdrop.is-settled {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

@media (max-width: 1023px) {
    .tabbar { display: block; }
    .app-main { padding-bottom: calc(var(--tabbar-h) + var(--s-7)); }
    .order-layout { grid-template-columns: minmax(0, 1fr); }
    .order-summary { position: static; }
    .product-panel { grid-template-columns: minmax(0, 1fr); }
    .product__image { max-width: 420px; }
    .history-layout { grid-template-columns: minmax(0, 1fr); }
    .history-aside { position: static; }
}

@media (min-width: 1024px) {
    .only-mobile { display: none !important; }
}

@media (max-width: 860px) {
    .good-row {
        grid-template-columns: 56px minmax(0, 1fr);
        grid-template-areas: "thumb body" "foot foot";
        row-gap: var(--s-3);
    }
    .good-row__thumb { grid-area: thumb; width: 56px; height: 56px; }
    .good-row__body { grid-area: body; }
    .good-row__foot {
        grid-area: foot;
        display: flex;
        align-items: center;
        gap: var(--s-4);
        flex-wrap: wrap;
    }
    .good-row__stock, .good-row__price { text-align: left; white-space: nowrap; }
    .good-row__actions { margin-left: auto; }

    .order-line {
        grid-template-columns: 48px minmax(0, 1fr) 40px;
        grid-template-areas: "thumb body remove" "foot foot foot";
        row-gap: var(--s-3);
    }
    .order-line__thumb { grid-area: thumb; width: 48px; height: 48px; }
    .order-line__body { grid-area: body; }
    .order-line__remove { grid-area: remove; }
    .order-line__foot {
        grid-area: foot;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--s-3);
    }
    .order-line__sum { text-align: right; white-space: nowrap; }
    .order-line__sum span { white-space: nowrap; }

    .filter-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    :root { --header-h: 62px; }
    .btn-icon, .btn-icon--sm { min-width: 44px; min-height: 44px; }
    .theme-switch__btn { min-width: 44px; min-height: 44px; }
    .btn, .btn--sm, .view-switch__btn { min-height: 44px; }
    .order-line__name { min-height: 32px; display: flex; align-items: center; }
    .crumbs__link, .crumbs__current { min-height: 44px; display: inline-flex; align-items: center; }
    .crumbs { gap: var(--s-1); }
    .app-header { padding: 0 var(--s-3); gap: var(--s-2); }
    .brand, .header-actions, #menuBtn { display: none; }
    .search { margin: 0; max-width: none; }
    .toasts { top: calc(var(--header-h) + var(--s-2)); }
    .goods-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-2); }
    .app-main { padding: var(--s-2) var(--s-3) calc(var(--tabbar-h) + var(--s-7)); }
    .page-title { font-size: 26px; }
    .panel { padding: var(--s-4); border-radius: var(--r-lg); }
    .panel__body { padding: var(--s-4); }
    .group-tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-2); }
    .group-tile { padding: var(--s-4); border-radius: var(--r-md); }
    .product__buy { flex-direction: column; align-items: stretch; }
    .product__buy-actions { margin-left: 0; }
    .toasts { right: var(--s-3); left: var(--s-3); width: auto; }
}

@media (min-width: 721px) {
    .only-narrow { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

.mode-dot {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    flex: 0 0 auto;
    padding: var(--s-2);
    border: 0;
    border-radius: var(--r-pill);
    background: none;
    cursor: pointer;
}
.mode-dot:hover { background: var(--surface-2); }
.mode-dot__light {
    width: 12px;
    height: 12px;
    border-radius: var(--r-pill);
    background: #2FA36B;
    box-shadow: 0 0 0 3px rgba(47, 163, 107, .18);
}
.mode-dot.is-offline .mode-dot__light {
    background: #E0A32E;
    box-shadow: 0 0 0 3px rgba(224, 163, 46, .20);
}

.mode-strip {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    flex-wrap: wrap;
    padding: var(--s-2) var(--s-5);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    font: var(--t-sm);
    color: var(--text-2);
}
.mode-strip__dot { width: 10px; height: 10px; border-radius: var(--r-pill); background: #E0A32E; }
.mode-strip__grow { flex: 1 1 auto; }

.pending {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    flex-wrap: wrap;
    padding: var(--s-2) var(--s-5);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    font: var(--t-sm);
    color: var(--text-2);
}
.pending__why { color: var(--text-muted); }

.search__hint { padding: var(--s-1) var(--s-2) 0; font: var(--t-xs); color: var(--text-muted); }

.storage {
    padding: var(--s-4) var(--s-5);
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
}
.storage__head { font: var(--t-h3); color: var(--text); }
.storage__bar {
    height: 10px;
    margin: var(--s-3) 0 var(--s-2);
    border-radius: var(--r-pill);
    background: var(--surface-2);
    overflow: hidden;
}
.storage__bar > span { display: block; height: 100%; background: var(--accent); border-radius: var(--r-pill); }
.storage__note { font: var(--t-sm); }
.storage__note.is-ok { color: var(--text-2); }
.storage__note.is-warn { color: var(--warn-text, var(--text-2)); }

.offline-clients { display: flex; flex-direction: column; gap: var(--s-3); }
.offline-clients.is-locked { opacity: .55; pointer-events: none; }
.offline-client {
    display: flex;
    align-items: center;
    gap: var(--s-4);
    flex-wrap: wrap;
    padding: var(--s-4) var(--s-5);
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
}
.offline-client__body { flex: 1 1 260px; min-width: 0; }
.offline-client__name { font: var(--t-h3); color: var(--text); }
.offline-client__meta { font: var(--t-sm); color: var(--text-muted); margin-top: var(--s-1); }
.offline-client__history { margin-top: var(--s-2); }
.offline-client__actions { display: flex; gap: var(--s-2); flex: 0 0 auto; }

.offline-queue { padding: var(--s-2) 0; border-bottom: 1px solid var(--border); }
.offline-queue:last-child { border-bottom: 0; }
.offline-queue__meta { font: var(--t-sm); color: var(--text-muted); }

.offline-intro { margin: 0; padding-left: var(--s-5); color: var(--text-2); }
.offline-intro li { margin-bottom: var(--s-2); }

.notice {
    display: grid;
    gap: var(--s-2);
    padding: var(--s-4) var(--s-5);
    border-radius: var(--r-lg);
    background: var(--surface-2);
    color: var(--text-2);
    margin-bottom: var(--s-4);
}
.notice--warn { border: 1px solid var(--border-strong); }

.toast--hold { border: 1px solid var(--border-strong); }
.toast__action { margin-top: var(--s-3); }

@media (max-width: 720px) {
    .mode-strip, .pending { padding: var(--s-2) var(--s-3); }
    .mode-dot { min-width: 44px; min-height: 44px; justify-content: center; }
    .offline-client__actions { width: 100%; }
    .offline-client__actions .btn { flex: 1 1 auto; }
}

.offline-switch { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; margin: var(--s-4) 0; }
.offline-switch__note { flex: 1 1 280px; font: var(--t-sm); color: var(--text-muted); }
.offline-queue__error { font: var(--t-sm); color: var(--text); }

.client-pick__name { color: var(--text-2); }
.select--inline { position: relative; display: inline-flex; align-items: center; }
.select--inline select {
    appearance: none;
    max-width: 220px;
    padding: 2px 22px 2px 0;
    border: 0;
    background: none;
    color: var(--text-2);
    font: inherit;
    cursor: pointer;
    text-overflow: ellipsis;
}
.select--inline select:hover { color: var(--text); }
.select--inline .select__caret {
    position: absolute;
    right: 2px;
    pointer-events: none;
    color: var(--text-muted);
    transform: rotate(90deg);
}
.sidebar-client { padding: 0 var(--s-4) var(--s-3); }
.sidebar-client .select--inline select { max-width: 100%; width: 100%; }
