/* =========================================================
   Дизайн-система кондитерской — пудрово-розовая палитра
   ========================================================= */

:root {
    /* Акцент — пудровая роза / малина */
    --pink-50:  #FFF5F8;
    --pink-100: #FDE8EF;
    --pink-200: #FAD1E0;
    --pink-300: #F5AFC8;
    --pink-400: #EE85AB;
    --pink-500: #E2618F;
    --pink-600: #CE4776;
    --pink-700: #AE3560;
    --pink-800: #8C2A4D;
    --pink-900: #6E2340;

    /* Тёплые нейтральные */
    --cream:    #FFFBFC;
    --surface:  #FFFFFF;
    --sand:     #FBF3F6;
    --ink:      #3A2A31;
    --ink-soft: #6B545E;
    --muted:    #9A8590;
    --line:     #F2E3EA;
    --line-alt: #E9D6DF;

    /* Служебные */
    --mint:     #3F9277;
    --mint-bg:  #E7F4EF;
    --caramel:  #B77A3A;
    --caramel-bg: #FBF0E2;
    --berry:    #C33B57;
    --berry-bg: #FCEAEE;

    --radius-sm: 10px;
    --radius:    16px;
    --radius-lg: 22px;
    --radius-xl: 28px;

    --shadow-sm: 0 1px 2px rgba(110, 35, 64, .05), 0 1px 3px rgba(110, 35, 64, .04);
    --shadow:    0 2px 6px rgba(110, 35, 64, .06), 0 8px 20px -8px rgba(110, 35, 64, .12);
    --shadow-lg: 0 4px 12px rgba(110, 35, 64, .08), 0 18px 40px -14px rgba(110, 35, 64, .22);

    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Playfair Display', 'Times New Roman', Georgia, serif;

    --shell: 460px;
    --app-safe-bottom: max(
        env(safe-area-inset-bottom, 0px),
        var(--tg-content-safe-area-inset-bottom, 0px),
        var(--tg-safe-area-inset-bottom, 0px)
    );
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--cream);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }

a { color: inherit; text-decoration: none; }

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

button { font: inherit; cursor: pointer; border: 0; background: none; }

/* ---------- Иконки ---------- */

.icon {
    width: 22px;
    height: 22px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-sm { width: 17px; height: 17px; stroke-width: 1.9; }
.icon-lg { width: 28px; height: 28px; stroke-width: 1.5; }
.icon-xl { width: 40px; height: 40px; stroke-width: 1.3; }

/* ---------- Типографика ---------- */

.display {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -.015em;
    line-height: 1.15;
}

.title    { font-size: 21px; font-weight: 650; letter-spacing: -.02em; }
.subtitle { font-size: 13px; color: var(--muted); }
.eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--pink-600);
}

.muted     { color: var(--muted); }
.ink-soft  { color: var(--ink-soft); }
.text-sm   { font-size: 13px; }
.text-xs   { font-size: 12px; }
.strong    { font-weight: 600; }
.price     { font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* ---------- Каркас ---------- */

.shell {
    max-width: var(--shell);
    margin: 0 auto;
    min-height: 100vh;
    min-height: var(--tg-viewport-stable-height, 100dvh);
    background: var(--cream);
    position: relative;
}

.shell-pad  { padding: 0 18px; }
.pt         { padding-top: 20px; }
.pb-nav     { padding-bottom: calc(96px + var(--app-safe-bottom)); }

.stack   { display: flex; flex-direction: column; gap: 14px; }
.stack-s { display: flex; flex-direction: column; gap: 8px; }
.stack-l { display: flex; flex-direction: column; gap: 22px; }

.row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grow { flex: 1; min-width: 0; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

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

/* ---------- Шапка ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: rgba(255, 251, 252, .88);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}

.topbar-title { font-size: 17px; font-weight: 650; letter-spacing: -.01em; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-soft);
    transition: background .15s, color .15s;
}
.icon-btn:active { background: var(--pink-50); color: var(--pink-700); }
.icon-btn-ghost { border-color: transparent; background: transparent; }

/* ---------- Карточки ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card-pad { padding: 18px; }
.card-flat { box-shadow: none; }

.card-link {
    display: block;
    transition: transform .16s ease, box-shadow .16s ease;
}
.card-link:active { transform: scale(.985); box-shadow: var(--shadow); }

/* ---------- Кнопки ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 20px;
    border: 1px solid transparent;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -.005em;
    transition: filter .15s, transform .12s, background .15s;
    white-space: nowrap;
}
.btn:active { transform: scale(.98); }

.btn-primary {
    background: linear-gradient(135deg, var(--pink-500), var(--pink-700));
    color: #fff;
    box-shadow: 0 6px 16px -6px rgba(174, 53, 96, .55);
}
.btn-primary:active { filter: brightness(.95); }

.btn-soft   { background: var(--pink-100); color: var(--pink-800); }
.btn-ghost  { background: var(--surface); border-color: var(--line-alt); color: var(--ink-soft); }
.btn-danger { background: var(--berry-bg); color: var(--berry); border-color: #F3D3DA; }

.btn-block { display: flex; width: 100%; }
.btn-sm    { padding: 8px 13px; font-size: 13px; border-radius: 11px; gap: 6px; }

/* ---------- Бейджи и чипы ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .01em;
    white-space: nowrap;
}

.badge-new           { background: var(--pink-100);   color: var(--pink-800); }
.badge-confirmed     { background: #E8EEF9;           color: #33538F; }
.badge-in_production { background: var(--caramel-bg); color: var(--caramel); }
.badge-ready         { background: var(--mint-bg);    color: var(--mint); }
.badge-given         { background: #EFEAF2;           color: #6B5878; }
.badge-cancelled     { background: #F1EDEF;           color: var(--muted); }
.badge-muted     { background: var(--sand);       color: var(--ink-soft); }
.badge-alert     { background: var(--berry-bg);   color: var(--berry); }

.chip-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 18px 6px;
    margin: 0 -18px;
    scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 15px;
    border-radius: 999px;
    border: 1px solid var(--line-alt);
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 550;
    white-space: nowrap;
}
.chip-active {
    background: var(--pink-600);
    border-color: var(--pink-600);
    color: #fff;
}

/* ---------- Формы ---------- */

.field { display: block; }
.field[hidden] { display: none; }

.field-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-soft);
    margin-bottom: 6px;
}

.input,
input[type="text"], input[type="tel"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="time"], input[type="datetime-local"],
input[type="url"], input[type="search"], select, textarea {
    width: 100%;
    padding: 12px 14px;
    font: inherit;
    font-size: 15px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-alt);
    border-radius: 13px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    appearance: none;
}

textarea { resize: vertical; min-height: 84px; line-height: 1.5; }

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239A8590' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    padding-right: 38px;
}

.input:focus,
input:focus, select:focus, textarea:focus {
    border-color: var(--pink-400);
    box-shadow: 0 0 0 3.5px var(--pink-100);
}

input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }

/* Убираем системный крестик поиска — он рисуется серым и ломает палитру */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button { -webkit-appearance: none; appearance: none; }

/* Поле пароля с кнопкой-глазком справа */
.pw { position: relative; }
.pw > input { padding-right: 46px; }
.pw-toggle {
    position: absolute;
    right: 7px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    color: var(--muted);
    background: transparent;
    transition: background .14s, color .14s;
}
.pw-toggle:hover { background: var(--pink-50); color: var(--pink-700); }
.pw-toggle:focus-visible { outline: 2px solid var(--pink-400); outline-offset: 1px; }

/* Поле поиска с иконкой слева */
.search-field { position: relative; }
.search-field .search-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}
.search-field input { padding-left: 40px; }

/* ---------- Загрузка файлов ---------- */

.filedrop {
    display: flex;
    align-items: center;
    gap: 13px;
    width: 100%;
    padding: 14px 16px;
    background: var(--sand);
    border: 1.5px dashed var(--line-alt);
    border-radius: 14px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.filedrop:hover { border-color: var(--pink-300); background: var(--pink-50); }
.filedrop:focus-within { border-color: var(--pink-400); box-shadow: 0 0 0 3.5px var(--pink-100); }

.filedrop-filled {
    border-style: solid;
    border-color: var(--pink-200);
    background: var(--pink-50);
}

.filedrop-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--surface);
    color: var(--pink-600);
    flex: none;
    border: 1px solid var(--line);
}

.filedrop-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.filedrop-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.filedrop-hint { font-size: 11.5px; color: var(--muted); }

/* Нативный контрол прячем — кликом работает вся область .filedrop */
.filedrop-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.file-current {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 9px;
}
.file-current-thumb {
    width: 96px;
    height: 96px;
    object-fit: cover;
    background: var(--pink-50);
    border: 1px solid var(--line);
    border-radius: 12px;
}
.file-clear { margin-bottom: 9px; font-size: 13px; }

input[type="checkbox"] {
    width: 19px;
    height: 19px;
    accent-color: var(--pink-600);
    flex: none;
    margin: 0;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--ink-soft);
    padding: 4px 0;
}

.field-error { font-size: 12px; color: var(--berry); margin-top: 5px; }
.field-help  { font-size: 12px; color: var(--muted); margin-top: 5px; }

/* ---------- Кастомный выпадающий список ---------- */

.sel { position: relative; }

/* Нативный select остаётся в DOM ради отправки формы, но скрыт от глаз. */
.sel > select {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.sel-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    text-align: left;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-alt);
    border-radius: 13px;
    transition: border-color .15s, box-shadow .15s;
}
.sel-btn:focus-visible,
.sel-open .sel-btn {
    outline: none;
    border-color: var(--pink-400);
    box-shadow: 0 0 0 3.5px var(--pink-100);
}

.sel-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-value-empty { color: var(--muted); }

.sel-caret { color: var(--muted); flex: none; transition: transform .18s ease; }
.sel-open .sel-caret { transform: rotate(180deg); }

.sel-menu {
    display: none;
    position: absolute;
    z-index: 60;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 264px;
    overflow-y: auto;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--line-alt);
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
}
.sel-open .sel-menu { display: block; }

.sel-opt {
    display: block;
    width: 100%;
    padding: 10px 12px;
    font-size: 14.5px;
    text-align: left;
    color: var(--ink);
    background: transparent;
    border: 0;
    border-radius: 10px;
    transition: background .12s, color .12s;
}
.sel-opt:hover:not(:disabled) { background: var(--pink-50); color: var(--pink-800); }
.sel-opt:disabled { color: var(--muted); cursor: default; }

.sel-opt-active {
    background: var(--pink-600);
    color: #fff;
    font-weight: 600;
}
.sel-opt-active:hover:not(:disabled) { background: var(--pink-600); color: #fff; }

/* ---------- Кастомный выбор даты и времени ---------- */

.dt { position: relative; }

/* Нативный input остаётся для отправки и браузерной валидации, но невидим.
   Не display:none — иначе Chrome не сможет показать подсказку required. */
.dt > input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}

.dt-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    text-align: left;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-alt);
    border-radius: 13px;
    transition: border-color .15s, box-shadow .15s;
}
.dt-btn:focus-visible,
.dt-open .dt-btn {
    outline: none;
    border-color: var(--pink-400);
    box-shadow: 0 0 0 3.5px var(--pink-100);
}

.dt-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-value-empty { color: var(--muted); }
.dt-caret { color: var(--pink-500); flex: none; }

.dt-pop {
    display: none;
    position: absolute;
    z-index: 70;
    top: calc(100% + 6px);
    left: 0;
    width: min(320px, 100%);
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--line-alt);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
}
.dt-open .dt-pop { display: block; }

.dt-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}
.dt-title { font-size: 14.5px; font-weight: 650; }

.dt-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-soft);
    flex: none;
}
.dt-nav:hover { background: var(--pink-50); color: var(--pink-700); border-color: var(--pink-200); }

.dt-week, .dt-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.dt-week {
    margin-bottom: 4px;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    text-align: center;
}

.dt-day {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ink);
    font-size: 13.5px;
    font-variant-numeric: tabular-nums;
    transition: background .12s, color .12s;
}
.dt-day:hover { background: var(--pink-50); color: var(--pink-800); }
.dt-day-out { color: var(--line-alt); }
.dt-day-past { color: var(--line-alt); cursor: default; }
.dt-day-past:hover { background: transparent; color: var(--line-alt); }
.dt-day-today { box-shadow: inset 0 0 0 1.5px var(--pink-300); font-weight: 650; }
.dt-day-active,
.dt-day-active:hover {
    background: var(--pink-600);
    color: #fff;
    font-weight: 650;
    box-shadow: none;
}

.dt-section {
    margin: 14px 0 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}

.dt-slots {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    max-height: 148px;
    overflow-y: auto;
    padding-right: 3px;
    scrollbar-width: thin;
}

.dt-slot {
    padding: 7px 4px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
    transition: background .12s, color .12s, border-color .12s;
}
.dt-slots-empty {
    grid-column: 1 / -1;
    padding: 14px 4px;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
}
.dt-slot:hover { background: var(--pink-50); color: var(--pink-800); border-color: var(--pink-200); }
.dt-slot-active,
.dt-slot-active:hover {
    background: var(--pink-600);
    border-color: var(--pink-600);
    color: #fff;
    font-weight: 650;
}

.dt-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}
.dt-link {
    border: 0;
    background: transparent;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--pink-700);
    padding: 4px 2px;
}
.dt-link-muted { color: var(--muted); }
.dt-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Поле телефона — моноширинные цифры, чтобы маска не «прыгала» */
input[data-phone] {
    font-variant-numeric: tabular-nums;
    letter-spacing: .01em;
}

/* Степпер количества в корзине: «−  1  +», где на единице минус превращается
   в удаление позиции. */
.qty-stepper {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-top: 9px;
    padding: 3px;
    background: var(--pink-50);
    border-radius: 12px;
}
.qty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--surface);
    color: var(--pink-500);
    box-shadow: var(--shadow-sm);
    transition: background .15s, color .15s;
}
.qty-btn:hover { background: var(--pink-50); color: var(--pink-700); }
.qty-btn:active { background: var(--pink-100); color: var(--pink-700); }
.qty-btn-danger { color: var(--pink-600); }

/* Пока ответ сервера в пути, элемент приглушён: нажатие видно сразу,
   а повторные клики блокируются. */
.is-cart-busy { opacity: .55; pointer-events: none; transition: opacity .12s; }

/* В карточке каталога степпер занимает место кнопки «В корзину» целиком. */
.qty-stepper-wide {
    display: flex;
    width: 100%;
    justify-content: space-between;
    margin-top: 0;
}
.qty-value {
    min-width: 34px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.stepper {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    border: 1px solid var(--line-alt);
    border-radius: 12px;
    background: var(--surface);
    overflow: hidden;
}
.stepper button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 38px;
    border: 0;
    background: transparent;
    color: var(--pink-700);
}
.stepper button:active { background: var(--pink-50); }
.stepper input {
    width: 44px;
    border: 0;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    border-radius: 0;
    text-align: center;
    font-weight: 600;
    padding: 9px 0;
}
.stepper input:focus { box-shadow: none; }

/* ---------- Сообщения ---------- */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 15px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.45;
}
.alert-success { background: var(--mint-bg);  color: var(--mint); }
.alert-error   { background: var(--berry-bg); color: var(--berry); }
.alert-info    { background: var(--pink-50);  color: var(--pink-800); }

/* ---------- Нижняя навигация ---------- */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--shell);
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    background: rgba(255, 255, 255, .93);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    padding-bottom: var(--app-safe-bottom);
    z-index: 40;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 10px 4px 11px;
    font-size: 10.5px;
    font-weight: 550;
    color: var(--muted);
    position: relative;
    transition: color .15s;
}
.nav-item .icon { width: 23px; height: 23px; }
.nav-item-active { color: var(--pink-600); }

/* display у бейджа задан явно, поэтому атрибут hidden сам по себе не сработает. */
.nav-badge[hidden] { display: none; }
.nav-badge {
    position: absolute;
    top: 6px;
    left: 50%;
    margin-left: 5px;
    min-width: 17px;
    height: 17px;
    padding: 0 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pink-600);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 999px;
    border: 2px solid var(--cream);
}

/* ---------- Витрина: главная ---------- */

.home-popular .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.home-popular-all {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--pink-600);
    font-size: 13px;
    font-weight: 650;
}
.home-popular-all:focus-visible {
    outline: 2px solid var(--pink-500);
    outline-offset: 3px;
    border-radius: 6px;
}

.brand-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: transparent;
    color: var(--pink-600);
    box-shadow: none;
    overflow: hidden;
}
.brand-mark img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.action-tile {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 17px;
    border-radius: var(--radius-lg);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    transition: transform .16s, box-shadow .16s;
}
.action-tile:active { transform: scale(.985); box-shadow: var(--shadow); }

.tile-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 16px;
    background: var(--pink-50);
    color: var(--pink-600);
    flex: none;
}
.tile-icon-alt { background: var(--caramel-bg); color: var(--caramel); }
.tile-icon-mint { background: var(--mint-bg); color: var(--mint); }

.action-tile-soon { opacity: .62; }

.contact-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}
.contact-row:last-child { border-bottom: 0; }
.contact-row .icon { color: var(--pink-500); }

/* ---------- Каталог ---------- */

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.product-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: transform .16s, box-shadow .16s;
}
.product-card:active { transform: scale(.985); }
.product-card.is-gallery-swiping,
.product-card.is-gallery-swiping:active { transform: none; }

.product-media {
    position: relative;
    aspect-ratio: 1 / 1;
    background: linear-gradient(160deg, var(--pink-50), var(--sand));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pink-300);
}
.product-media img { width: 100%; height: 100%; object-fit: cover; }
@supports not (aspect-ratio: 1 / 1) {
    .product-media::before { content: ""; display: block; padding-top: 100%; }
}

.product-card-gallery { overflow: hidden; }
/* Абсолютное позиционирование вместо height:100%: цепочка процентных высот
   внутри aspect-ratio-контейнера схлопывается в WebKit, и карточка на iPhone
   остаётся без фотографии. У абсолютного блока высота всегда определена. */
.product-card-gallery-viewport {
    position: absolute;
    inset: 0;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.product-card-gallery-viewport::-webkit-scrollbar { display: none; }
.product-card-gallery-viewport:focus-visible {
    outline: 3px solid var(--pink-400);
    outline-offset: -3px;
}
.product-card-gallery-slide {
    width: 100%;
    height: 100%;
    flex: 0 0 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}
.product-card-gallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    user-select: none;
    -webkit-user-drag: none;
}
.product-card-gallery-empty { color: var(--pink-300); }
.product-card-gallery-dots {
    position: absolute;
    left: 50%;
    bottom: 7px;
    z-index: 3;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 17px;
    padding: 4px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .8);
    box-shadow: 0 2px 8px rgba(58, 42, 49, .14);
    backdrop-filter: blur(6px);
}
.product-card-gallery-dot {
    width: 5px;
    height: 5px;
    padding: 0;
    border-radius: 999px;
    background: var(--muted);
    opacity: .55;
    transition: width .16s ease, opacity .16s ease, background .16s ease;
}
.product-card-gallery-dot.is-active {
    width: 14px;
    background: var(--pink-600);
    opacity: 1;
}
.product-card-gallery-dot:focus-visible {
    outline: 2px solid var(--pink-700);
    outline-offset: 2px;
}
.product-discount-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 3;
    padding: 5px 8px;
    border-radius: 9px;
    background: var(--berry);
    color: #fff;
    font-size: 11px;
    font-weight: 750;
    line-height: 1;
    box-shadow: 0 4px 12px rgba(110, 35, 64, .24);
    pointer-events: none;
}

.product-body { padding: 12px 13px 13px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.product-name { font-size: 14px; font-weight: 600; line-height: 1.3; }
.product-meta { font-size: 11.5px; color: var(--muted); }
.product-price { font-size: 15px; font-weight: 650; margin-top: 3px; font-variant-numeric: tabular-nums; }
.product-price-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
.product-price-line .product-price { margin-top: 0; }
.product-price-sale { color: var(--pink-700); font-weight: 700; }
.product-old-price {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    text-decoration: line-through;
    text-decoration-thickness: 1px;
    font-variant-numeric: tabular-nums;
}
.product-old-price-small { font-size: 11px; }
.product-detail-price { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.product-detail-price .price { color: var(--pink-700); }
.product-foot { padding: 0 13px 13px; }

.allergen-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 12px;
    border-radius: 12px;
    background: var(--berry-bg);
    color: var(--berry);
    font-size: 12.5px;
    font-weight: 550;
}

/* Галерея на странице товара */
.product-detail-gallery {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background: linear-gradient(160deg, var(--pink-50), var(--sand));
}
.product-detail-gallery [hidden] { display: none; }
.product-detail-gallery-viewport {
    width: 100%;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.product-detail-gallery-viewport::-webkit-scrollbar { display: none; }
.product-detail-gallery-viewport:focus-visible {
    outline: 3px solid var(--pink-500);
    outline-offset: -3px;
}
.product-detail-gallery-slide {
    width: 100%;
    min-width: 0;
    aspect-ratio: 4 / 3;
    flex: 0 0 100%;
    padding: 0;
    border: 0;
    background: transparent;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    cursor: zoom-in;
}
.product-detail-gallery-slide img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    user-select: none;
    -webkit-user-drag: none;
}
.product-detail-gallery-view-hint {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .88);
    box-shadow: 0 3px 14px rgba(58, 42, 49, .18);
    color: var(--ink);
    font-size: 12px;
    font-weight: 650;
    backdrop-filter: blur(8px);
    pointer-events: none;
}
.product-detail-gallery-arrow {
    position: absolute;
    top: 50%;
    z-index: 3;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, .88);
    box-shadow: 0 3px 16px rgba(58, 42, 49, .2);
    color: var(--ink);
    backdrop-filter: blur(8px);
}
.product-detail-gallery-arrow-prev { left: 10px; }
.product-detail-gallery-arrow-next { right: 10px; }
.product-detail-gallery-arrow:disabled {
    opacity: .36;
    cursor: default;
}
.product-detail-gallery-arrow:focus-visible,
.product-detail-gallery-dot:focus-visible {
    outline: 3px solid var(--pink-600);
    outline-offset: 2px;
}
.product-detail-gallery-dots {
    position: absolute;
    left: 50%;
    bottom: 11px;
    z-index: 3;
    min-height: 34px;
    padding: 1px 4px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 0;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, .86);
    box-shadow: 0 3px 14px rgba(58, 42, 49, .16);
    backdrop-filter: blur(8px);
}
.product-detail-gallery-dot {
    position: relative;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
}
.product-detail-gallery-dot::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--pink-600);
    opacity: .45;
    transform: translate(-50%, -50%);
    transition: width .16s ease, opacity .16s ease, background .16s ease;
}
.product-detail-gallery-dot.is-active::before {
    width: 19px;
    opacity: 1;
}

/* Полноэкранный просмотр фотографий */
.product-gallery-lightbox {
    position: fixed;
    inset: 0;
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(18, 14, 16, .97);
    color: #fff;
    overflow: hidden;
}
.product-gallery-lightbox::backdrop { background: rgba(18, 14, 16, .9); }
.product-gallery-lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.product-gallery-lightbox-image {
    width: auto;
    height: auto;
    max-width: calc(100% - 24px);
    max-height: calc(100% - 120px);
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: auto;
}
.product-gallery-lightbox-close,
.product-gallery-lightbox-arrow {
    position: absolute;
    z-index: 2;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    backdrop-filter: blur(8px);
    pointer-events: auto;
}
.product-gallery-lightbox-close {
    top: max(12px, env(safe-area-inset-top));
    right: 12px;
}
.product-gallery-lightbox-arrow { top: 50%; transform: translateY(-50%); }
.product-gallery-lightbox-prev { left: 8px; }
.product-gallery-lightbox-next { right: 8px; }
.product-gallery-lightbox-arrow:disabled { opacity: .32; }
.product-gallery-lightbox-close:focus-visible,
.product-gallery-lightbox-arrow:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}
.product-gallery-lightbox-counter {
    position: absolute;
    left: 50%;
    bottom: max(16px, var(--app-safe-bottom));
    transform: translateX(-50%);
    padding: 7px 11px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-size: 13px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}
body.has-gallery-lightbox { overflow: hidden; }

.gallery-empty {
    aspect-ratio: 4 / 3;
    background: linear-gradient(160deg, var(--pink-50), var(--sand));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pink-300);
}

.spec-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}
.spec-row:last-child { border-bottom: 0; }
.spec-row dt { color: var(--muted); font-size: 13px; flex: none; }
.spec-row dd { margin: 0; text-align: right; }

/* Липкая панель покупки */
.buy-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--shell);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 18px calc(13px + var(--app-safe-bottom));
    background: rgba(255, 255, 255, .95);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    z-index: 40;
}

/* ---------- Корзина ---------- */

.cart-item {
    display: flex;
    gap: 13px;
    padding: 13px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.cart-thumb {
    width: 66px;
    height: 66px;
    border-radius: 13px;
    object-fit: cover;
    flex: none;
    background: var(--pink-50);
}
.cart-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pink-300);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 14px;
    padding: 6px 0;
}
.summary-total {
    font-size: 19px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.empty-state {
    text-align: center;
    padding: 56px 24px;
    color: var(--muted);
}
.empty-state .icon { color: var(--pink-200); margin: 0 auto 14px; }

/* ---------- Успешный заказ ---------- */

.success-mark {
    width: 82px;
    height: 82px;
    margin: 0 auto;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mint-bg);
    color: var(--mint);
}
.success-mark .icon { width: 42px; height: 42px; stroke-width: 1.6; }

/* Переключатель наличия товара в списке панели */
.stock-switch {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 9px 4px 5px;
    border-radius: 999px;
    background: var(--line);
    color: var(--ink-soft);
    font-size: 11.5px;
    font-weight: 650;
    line-height: 1;
    white-space: nowrap;
    transition: background .16s, color .16s;
}
.stock-switch:disabled { opacity: .6; }
.stock-switch.is-on { background: var(--mint-bg); color: var(--mint); }

.stock-switch-track {
    position: relative;
    display: block;
    width: 30px;
    height: 17px;
    flex: none;
    border-radius: 999px;
    background: var(--muted);
    transition: background .16s;
}
.stock-switch.is-on .stock-switch-track { background: var(--mint); }

.stock-switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(58, 42, 49, .3);
    transition: transform .16s ease;
}
.stock-switch.is-on .stock-switch-thumb { transform: translateX(13px); }

.stock-switch:focus-visible {
    outline: 2px solid var(--pink-500);
    outline-offset: 2px;
}

/* ---------- Telegram Mini App / аккаунт покупателя ---------- */

.telegram-auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: var(--tg-viewport-stable-height, 100dvh);
    padding: 24px;
    background: var(--cream);
}
.telegram-auth-overlay[hidden] { display: none; }
.telegram-auth-card {
    width: min(100%, 340px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 28px 22px;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}
.telegram-auth-card p { margin: 0; }
.telegram-auth-spinner {
    width: 36px;
    height: 36px;
    margin-bottom: 4px;
    border: 3px solid var(--pink-100);
    border-top-color: var(--pink-600);
    border-radius: 50%;
    animation: telegram-auth-spin .8s linear infinite;
}
.telegram-auth-error-icon { color: var(--pink-600); }
@keyframes telegram-auth-spin { to { transform: rotate(360deg); } }

.account-head {
    display: flex;
    align-items: center;
    gap: 13px;
}
.account-avatar {
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--pink-400), var(--pink-700));
    color: #fff;
    font-size: 19px;
    font-weight: 700;
}
.account-telegram-cta {
    min-height: calc(var(--tg-viewport-stable-height, 100dvh) - 150px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 24px;
    padding-bottom: 24px;
}
.account-telegram-mark {
    width: 66px;
    height: 66px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 22px;
    color: #fff;
    background: #2AABEE;
}
.order-history-card { overflow: hidden; }
.order-history-link { display: block; padding: 16px; }
.order-history-head,
.order-history-total,
.account-pagination,
.account-order-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.order-history-products {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 13px 0;
}
.order-history-total {
    padding-top: 12px;
    border-top: 1px solid var(--line);
}
.order-repeat-form {
    padding: 10px 16px 14px;
    border-top: 1px solid var(--line);
}
.account-pagination { padding: 8px 0 2px; }
.account-order-item { align-items: flex-start; padding: 9px 0; }
.account-order-item + .account-order-item { border-top: 1px solid var(--line); }

@media (prefers-reduced-motion: reduce) {
    .telegram-auth-spinner { animation: none; }
}

/* =========================================================
   ПАНЕЛЬ КОНДИТЕРА
   ========================================================= */

.panel-body { background: var(--sand); }

.panel-shell {
    max-width: 1160px;
    margin: 0 auto;
    display: flex;
    min-height: 100vh;
}

/* Сайдбар (десктоп) */
.sidebar {
    display: none;
    width: 244px;
    flex: none;
    padding: 22px 14px;
    background: var(--surface);
    border-right: 1px solid var(--line);
    flex-direction: column;
    gap: 4px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 4px 8px 18px;
}
.sidebar-brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 13px;
    background: linear-gradient(140deg, var(--pink-500), var(--pink-700));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    overflow: hidden;
}
.sidebar-brand-mark img { width: 100%; height: 100%; object-fit: cover; }

.side-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 550;
    color: var(--ink-soft);
    transition: background .14s, color .14s;
}
.side-link:hover { background: var(--pink-50); color: var(--pink-800); }
.side-link .icon { width: 20px; height: 20px; color: var(--muted); }
.side-link-active { background: var(--pink-600); color: #fff; }
.side-link-active:hover { background: var(--pink-600); color: #fff; }
.side-link-active .icon { color: #fff; }

.side-group {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 16px 12px 6px;
}

.panel-main {
    flex: 1;
    min-width: 0;
    padding: 0 0 96px;
}

.panel-inner { padding: 0 18px; max-width: 900px; }
.panel-inner-form { max-width: 760px; }

/* Статистика */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}
.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pink-50);
    color: var(--pink-600);
}
.stat-icon .icon { width: 19px; height: 19px; }
.stat-value {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.025em;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.stat-label { font-size: 12px; color: var(--muted); }

/* График */
.chart {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 128px;
    padding-top: 8px;
}
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.chart-bar {
    width: 100%;
    max-width: 30px;
    min-height: 4px;
    border-radius: 7px 7px 3px 3px;
    background: linear-gradient(180deg, var(--pink-400), var(--pink-600));
}
.chart-bar-empty { background: var(--line); }
.chart-label { font-size: 10.5px; color: var(--muted); white-space: nowrap; }

/* Списки-строки */
.list { display: flex; flex-direction: column; }

.list-row {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px 15px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: transform .15s, border-color .15s;
}
.list-row + .list-row { margin-top: 9px; }
.list-row:active { transform: scale(.99); }

.row-thumb {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    object-fit: cover;
    flex: none;
    background: var(--pink-50);
}
.row-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pink-300);
}
.row-title { font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.row-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.row-side { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 11px;
}
.section-title { font-size: 15.5px; font-weight: 650; letter-spacing: -.01em; }

/* Таблица ингредиентов рецепта */
.mini-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mini-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 0 8px 8px 0;
}
.mini-table td { padding: 9px 8px 9px 0; border-top: 1px solid var(--line); vertical-align: middle; }
.mini-table td:last-child, .mini-table th:last-child { text-align: right; padding-right: 0; }

/* Формсеты */
.formset-row {
    display: grid;
    grid-template-columns: 1fr 96px 42px;
    gap: 9px;
    align-items: center;
    padding: 11px 0;
    border-top: 1px solid var(--line);
}
.formset-row:first-of-type { border-top: 0; }
.formset-row .field-label { display: none; }

/* FAB */
.fab {
    position: fixed;
    right: max(18px, calc(50% - var(--shell) / 2 + 18px));
    bottom: calc(88px + var(--app-safe-bottom));
    width: 56px;
    height: 56px;
    border-radius: 19px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--pink-500), var(--pink-700));
    color: #fff;
    border: 0;
    box-shadow: 0 10px 26px -8px rgba(174, 53, 96, .7);
    z-index: 45;
}
.fab:active { transform: scale(.95); }

/* Вход */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 24px 20px 40px;
    max-width: var(--shell);
    margin: 0 auto;
}

/* ---------- Актуальное / сторис ---------- */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.story-highlight-list {
    display: flex;
    gap: 12px;
    margin: 0 -18px;
    padding: 2px 18px 6px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
}
.story-highlight-list::-webkit-scrollbar { display: none; }

.story-highlight {
    width: 78px;
    flex: 0 0 78px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 0;
    color: var(--ink);
    text-align: center;
}
.story-highlight-ring {
    width: 74px;
    height: 74px;
    padding: 3px;
    border-radius: 50%;
    display: flex;
    background: linear-gradient(145deg, var(--pink-400), var(--pink-700));
    box-shadow: 0 7px 18px -10px rgba(174, 53, 96, .8);
    transition: transform .16s ease, background .2s ease;
}
.story-highlight-cover {
    width: 100%;
    height: 100%;
    padding: 3px;
    overflow: hidden;
    border-radius: 50%;
    background: var(--cream);
}
.story-highlight-cover img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}
.story-highlight-title {
    width: 100%;
    min-height: 32px;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 12.5px;
    font-weight: 550;
    line-height: 1.25;
}
.story-highlight:active .story-highlight-ring { transform: scale(.94); }
.story-highlight:focus-visible { outline: none; }
.story-highlight:focus-visible .story-highlight-ring {
    box-shadow: 0 0 0 3px var(--cream), 0 0 0 5px var(--pink-500);
}
.story-highlight.is-viewed .story-highlight-ring {
    background: var(--line-alt);
    box-shadow: none;
}

.story-viewer {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #090608;
    opacity: 0;
    overscroll-behavior: contain;
    transition: opacity .16s ease;
}
.story-viewer[hidden] { display: none; }
.story-viewer.is-open { opacity: 1; }
.story-viewer-open { overflow: hidden; }

.story-viewer-frame {
    position: relative;
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    background: #000;
    isolation: isolate;
    touch-action: pan-y;
}
.story-viewer-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    user-select: none;
    -webkit-user-drag: none;
}
.story-viewer-shade {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(0, 0, 0, .62) 0%, transparent 24%, transparent 65%, rgba(0, 0, 0, .7) 100%);
}
.story-viewer-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 5;
    padding: max(12px, env(safe-area-inset-top)) 14px 12px;
}
.story-progress {
    display: flex;
    gap: 4px;
    width: 100%;
}
.story-progress-track {
    height: 3px;
    flex: 1;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, .35);
}
.story-progress-fill {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: #fff;
    transform: scaleX(0);
    transform-origin: left center;
}
.story-progress-fill.is-complete { transform: scaleX(1); }
.story-progress-fill.is-current { animation: story-progress linear forwards; }
@keyframes story-progress { to { transform: scaleX(1); } }

.story-viewer-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 11px;
    color: #fff;
    text-shadow: 0 1px 8px rgba(0, 0, 0, .65);
}
.story-viewer-title { font-size: 14px; font-weight: 650; }
.story-viewer-counter { margin-top: 1px; font-size: 11px; opacity: .75; }
.story-viewer-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    border-radius: 50%;
    color: #fff;
    background: rgba(0, 0, 0, .25);
    backdrop-filter: blur(8px);
}
.story-viewer-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.story-viewer-nav {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 3;
    width: 50%;
    display: flex;
    align-items: center;
    color: #fff;
}
.story-viewer-prev { left: 0; justify-content: flex-start; padding-left: 12px; }
.story-viewer-next { right: 0; justify-content: flex-end; padding-right: 12px; }
.story-viewer-nav > span {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, .28);
    opacity: 0;
    transition: opacity .15s ease, transform .15s ease;
}
.story-viewer-nav:hover > span,
.story-viewer-nav:focus-visible > span { opacity: 1; }
.story-viewer-nav:active > span { transform: scale(.92); }
.story-viewer-nav:focus-visible { outline: none; }
.story-viewer-nav:disabled { pointer-events: none; }

.story-viewer-bottom {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 24px 18px max(20px, var(--app-safe-bottom));
    pointer-events: none;
}
.story-viewer-caption {
    color: #fff;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    text-shadow: 0 2px 12px rgba(0, 0, 0, .8);
}
.story-viewer-cta {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 13px 20px;
    border-radius: 16px;
    background: #fff;
    color: var(--pink-700);
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
    pointer-events: auto;
}
.story-viewer-cta[hidden] { display: none; }
.story-viewer-cta:active { transform: scale(.98); }
.story-viewer-cta:focus-visible { outline: 3px solid var(--pink-300); outline-offset: 2px; }

/* Формы сторис в панели */
.story-admin-cover { border-radius: 50%; }
.story-slide-form {
    display: flex;
    flex-direction: column;
    gap: 13px;
    padding-top: 17px;
    border-top: 1px solid var(--line);
}
.story-slide-form + .story-slide-form { margin-top: 3px; }
.story-delete-check { color: var(--berry); }

/* Выбор популярных товаров в панели */
.popular-product-form {
    display: flex;
    flex-direction: column;
    gap: 13px;
    padding-top: 17px;
    border-top: 1px solid var(--line);
}
.popular-product-form + .popular-product-form { margin-top: 3px; }
.popular-product-delete { color: var(--berry); }

@media (min-width: 600px) {
    .story-viewer { background: rgba(9, 6, 8, .94); padding: 16px; }
    .story-viewer-frame {
        width: min(100%, 500px);
        height: min(900px, calc(100dvh - 32px));
        border-radius: 24px;
        box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
    }
}

@media (max-width: 480px) {
    .story-slide-form .grid-2,
    .popular-product-form .grid-2 { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .story-highlight-ring,
    .story-viewer,
    .story-viewer-nav > span { transition: none; }
    .story-progress-fill.is-current { animation: none; transform: scaleX(1); }
}

/* ---------- Десктоп ---------- */

@media (min-width: 900px) {
    .sidebar { display: flex; }
    .panel-nav { display: none; }
    .panel-main { padding-bottom: 40px; }
    .panel-inner { padding: 0 30px; }
    .panel-topbar { position: static; background: transparent; backdrop-filter: none; border-bottom: 0; padding-left: 30px; padding-right: 30px; }
    .fab { display: none; }
    .grid-2-desk { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
    .panel-shell { max-width: 1560px; }
    .sidebar { width: 268px; padding: 26px 16px; }
    .panel-inner { padding: 0 38px; }
    .panel-inner:not(.panel-inner-form) { max-width: none; }
    .panel-topbar { padding-left: 38px; padding-right: 38px; }

    /* Строка списка во всю ширину монитора нечитаема: глаз теряет связь между
       названием слева и ценой справа. Разводим в две колонки. */
    .panel-main .list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        align-items: start;
    }
    .panel-main .list-row + .list-row { margin-top: 0; }
}

@media (min-width: 620px) {
    .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    :root { --shell: 560px; }
}
