/* ===========================================================
   Огонёк — Админка / Менеджер
   Zen Admin — Apple-style minimalism, glassmorphism
   =========================================================== */

/* ============ Дизайн-токены ============ */
:root {
    --zen-radius:    20px;
    --zen-radius-lg: 28px;
    --zen-radius-sm: 14px;
    --zen-shadow-sm: 0 1px 2px rgba(0,0,0,.2), 0 2px 8px rgba(0,0,0,.18);
    --zen-shadow-md: 0 4px 16px rgba(0,0,0,.25), 0 1px 3px rgba(0,0,0,.15);
    --zen-shadow-lg: 0 12px 40px rgba(0,0,0,.4), 0 2px 8px rgba(0,0,0,.18);
    --zen-glass:     rgba(20, 17, 15, 0.72);
    --zen-glass-strong: rgba(14, 12, 11, 0.92);
    --zen-spring:    cubic-bezier(0.34, 1.56, 0.64, 1);
    --zen-ease:      cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* ============ Layout ============ */
.admin-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
    background: var(--bg);
}

/* ============ Sidebar ============ */
.admin-sidebar {
    background: var(--bg-2);
    border-right: 1px solid var(--line-2);
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.admin-sidebar .brand {
    margin-bottom: 1.5rem;
    padding: .5rem .65rem;
    font-size: 1.5rem;
}
.admin-sidebar nav {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    flex: 1;
}
.admin-sidebar nav a {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem .9rem;
    border-radius: 10px;
    color: var(--muted);
    transition: background .15s, color .15s;
    font-weight: 500;
    font-size: .92rem;
    border: 1px solid transparent;
}
.admin-sidebar nav a:hover {
    background: var(--bg-3);
    color: var(--text);
}
.admin-sidebar nav a.active {
    background: linear-gradient(135deg, rgba(255,107,53,.18), rgba(255,138,61,.06));
    color: var(--primary);
    border-color: var(--line);
    font-weight: 600;
}
.admin-sidebar nav .nav-divider {
    height: 1px;
    background: var(--line-2);
    margin: .5rem 0;
}
.admin-sidebar nav .nav-section-title {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .15em;
    color: var(--muted);
    padding: .75rem .9rem .25rem;
    font-weight: 600;
}
.user-box {
    padding: .85rem 1rem;
    background: var(--bg-3);
    border-radius: 12px;
    margin-top: 1rem;
    border: 1px solid var(--line-2);
}
.user-box .user-row {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin-bottom: .65rem;
}
.user-box .avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--gold));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}
.user-box .name { font-weight: 600; margin: 0; font-size: .9rem; }
.user-box .role {
    color: var(--gold);
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    margin: 0;
}
.user-box .logout-btn {
    display: block;
    text-align: center;
    padding: .5rem;
    background: transparent;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    color: var(--muted);
    font-size: .85rem;
    transition: all .2s;
    text-decoration: none;
}
.user-box .logout-btn:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* ============ Main ============ */
.admin-main {
    padding: 2rem 2.5rem;
    /* safe-area снизу для iPhone home indicator */
    padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
    overflow-x: auto;
    min-width: 0;
}
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--line-2);
}
.page-header h1 {
    font-family: 'Playfair Display', serif;
    margin: 0 0 .25rem;
    font-size: 2rem;
    line-height: 1.1;
}
.page-header .subtitle {
    color: var(--muted);
    margin: 0;
    font-size: .95rem;
}
.page-header .actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

/* Старые .admin-main h1 / .subtitle — поддерживаем для обратной совместимости */
.admin-main h1 {
    font-family: 'Playfair Display', serif;
    margin: 0 0 .25rem;
    font-size: 2rem;
    line-height: 1.1;
}
.admin-main .subtitle {
    color: var(--muted);
    margin: 0 0 2rem;
    font-size: .95rem;
}

/* ============ KPI карточки ============ */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: var(--bg-3);
    border: 1px solid var(--line-2);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    transition: transform .2s, border-color .2s;
    position: relative;
    overflow: hidden;
}
.stat-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}
.stat-card .icon {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    opacity: .25;
}
.stat-card .label {
    color: var(--muted);
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    margin: 0 0 .5rem;
    font-weight: 600;
}
.stat-card .value {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary);
    margin: 0;
    line-height: 1.1;
}
.stat-card .hint {
    color: var(--muted);
    font-size: .8rem;
    margin: .35rem 0 0;
}
.stat-card.accent { border-color: var(--primary); }
.stat-card.accent .value { background: linear-gradient(135deg, var(--primary), var(--gold)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* ============ Карточки/секции ============ */
.card {
    background: var(--bg-3);
    border: 1px solid var(--line-2);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--line-2);
    background: rgba(0,0,0,.1);
    flex-wrap: wrap;
    gap: .5rem;
}
.card-head h2, .card-head h3 {
    margin: 0;
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    font-weight: 700;
}
.card-head .head-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}
.card-body { padding: 1.5rem; }

/* Алиасы для совместимости */
.table-wrap {
    background: var(--bg-3);
    border: 1px solid var(--line-2);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.table-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--line-2);
    background: rgba(0,0,0,.1);
    flex-wrap: wrap;
    gap: .5rem;
}
.table-head h2 {
    margin: 0;
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
}

/* ============ Таблицы ============ */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
table.data th,
table.data td {
    padding: .85rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--line-2);
    vertical-align: middle;
}
table.data th {
    background: var(--bg-2);
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: .72rem;
    letter-spacing: .1em;
    position: sticky;
    top: 0;
    z-index: 1;
}
table.data tbody tr {
    transition: background .12s;
}
table.data tbody tr:hover {
    background: rgba(255,107,53,.04);
}
table.data tbody tr:last-child td { border-bottom: none; }

/* Бейджи статусов */
.badge-status {
    display: inline-block;
    padding: .22rem .7rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
}
.badge-new        { background: rgba(255,107,53,.15);  color: var(--primary); }
.badge-confirmed  { background: rgba(45,212,166,.15);  color: var(--ok); }
.badge-completed  { background: rgba(45,212,166,.15);  color: var(--ok); }
.badge-preparing  { background: rgba(255,209,102,.15); color: var(--gold); }
.badge-delivered  { background: rgba(45,212,166,.15);  color: var(--ok); }
.badge-cancelled  { background: rgba(227,75,58,.15);   color: var(--danger); }

/* Пустое состояние */
.empty {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--muted);
}
.empty .empty-icon {
    font-size: 3rem;
    opacity: .35;
    margin-bottom: .75rem;
}
.empty .empty-title {
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 .35rem;
}
.empty .empty-hint {
    margin: 0;
    font-size: .9rem;
}

/* ============ Формы ============ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem 1.25rem;
}
.form-grid label {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    font-size: .82rem;
    color: var(--muted);
    font-weight: 500;
}
.form-grid label .hint-text {
    color: var(--muted);
    font-size: .75rem;
    font-weight: 400;
    opacity: .8;
}
.form-grid input,
.form-grid select,
.form-grid textarea {
    background: var(--bg-2);
    border: 1px solid var(--line-2);
    color: var(--text);
    padding: .7rem .9rem;
    border-radius: 10px;
    font: inherit;
    width: 100%;
    transition: border-color .15s;
}
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255,107,53,.1);
}
.form-grid textarea { min-height: 90px; resize: vertical; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .checkbox-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: .65rem;
    color: var(--text);
    cursor: pointer;
    grid-column: 1/-1;
    padding: .65rem .85rem;
    background: var(--bg-2);
    border-radius: 10px;
    border: 1px solid var(--line-2);
    transition: border-color .15s;
}
.form-grid .checkbox-row:hover { border-color: var(--primary); }
.form-grid .checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
    margin: 0;
}
.form-grid > label > input[type="file"] {
    padding: .85rem;
    border: 1px dashed var(--line);
    border-radius: 10px;
    cursor: pointer;
    background: var(--bg-2);
}
.form-grid > label > input[type="file"]:hover { border-color: var(--primary); }

.form-actions {
    display: flex;
    gap: .75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line-2);
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.field-group-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    color: var(--gold);
    margin: 1.5rem 0 .75rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--line-2);
}
.field-group-title:first-child { margin-top: 0; }

/* ============ Алерты ============ */
.alert {
    padding: .85rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.25rem;
    font-size: .92rem;
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    border: 1px solid;
}
.alert::before {
    font-size: 1.1rem;
    flex-shrink: 0;
}
.alert-ok    { background: rgba(45,212,166,.1);  color: var(--ok);      border-color: rgba(45,212,166,.3); }
.alert-ok::before { content: '✓'; }
.alert-err   { background: rgba(227,75,58,.1);   color: var(--danger);  border-color: rgba(227,75,58,.3); }
.alert-err::before { content: '⚠'; }
.alert-info  { background: rgba(255,209,102,.1); color: var(--gold);    border-color: rgba(255,209,102,.3); }
.alert-info::before { content: 'ℹ'; }

/* ============ Действия в строках ============ */
.row-actions {
    display: inline-flex;
    gap: .35rem;
    flex-wrap: wrap;
    align-items: center;
}
.row-actions form { display: inline; }

.btn-mini {
    padding: .4rem .75rem;
    font-size: .8rem;
    border-radius: 8px;
    border: 1px solid var(--line-2);
    background: var(--bg-2);
    color: var(--text);
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    line-height: 1;
    white-space: nowrap;
    font-family: inherit;
}
.btn-mini:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.btn-mini.ok        { color: var(--ok); border-color: rgba(45,212,166,.3); }
.btn-mini.ok:hover  { background: rgba(45,212,166,.1); }
.btn-mini.danger    { color: var(--danger); border-color: rgba(227,75,58,.3); }
.btn-mini.danger:hover { background: rgba(227,75,58,.1); }
.btn-mini.primary   { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: white; border-color: transparent; }
.btn-mini.primary:hover { transform: translateY(-1px); }

/* Селект как мини-кнопка */
select.btn-mini {
    padding: .4rem .55rem;
    cursor: pointer;
}

/* ============ Чипы фильтров ============ */
.filter-chips {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: .25rem 0;
}
.chip {
    padding: .4rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--line-2);
    background: var(--bg-2);
    color: var(--muted);
    cursor: pointer;
    font-size: .85rem;
    text-decoration: none;
    transition: all .15s;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-weight: 500;
}
.chip:hover {
    border-color: var(--primary);
    color: var(--text);
}
.chip.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: white;
    border-color: transparent;
}
.chip .count {
    background: rgba(0,0,0,.25);
    padding: .1rem .45rem;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 700;
}
.chip.active .count { background: rgba(255,255,255,.25); }

/* ============ Поиск ============ */
.search-bar {
    display: flex;
    gap: .5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.search-bar input {
    flex: 1 1 220px;
    background: var(--bg-3);
    border: 1px solid var(--line-2);
    color: var(--text);
    padding: .65rem 1rem;
    border-radius: 10px;
    font: inherit;
}
.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ============ Login страница ============ */
.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(60% 60% at 50% 30%, rgba(255,107,53,.18), transparent 60%),
        var(--bg);
    /* Safe-area для iPhone */
    padding: max(1rem, env(safe-area-inset-top, 1rem))
             max(1rem, env(safe-area-inset-right, 1rem))
             max(1rem, env(safe-area-inset-bottom, 1rem))
             max(1rem, env(safe-area-inset-left, 1rem));
}
.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-3);
    border: 1px solid var(--line-2);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: var(--shadow);
}
.login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 1rem;
}
.login-card h1 {
    font-family: 'Playfair Display', serif;
    text-align: center;
    margin: 0 0 1.5rem;
    font-size: 1.5rem;
}
.login-card form {
    display: grid;
    gap: 1rem;
}
.login-card label {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    color: var(--muted);
    font-size: .85rem;
}
.login-card input {
    background: var(--bg-2);
    border: 1px solid var(--line-2);
    color: var(--text);
    padding: .9rem 1rem;
    border-radius: 10px;
    font: inherit;
}
.login-card input:focus { outline: none; border-color: var(--primary); }
.login-card .btn { width: 100%; }
.login-hint {
    text-align: center;
    margin: 1.5rem 0 0;
    color: var(--muted);
    font-size: .9rem;
}
.login-hint a { color: var(--primary); }

/* ============ Иконки в строках ============ */
.thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
    background: var(--bg-2);
    flex-shrink: 0;
}
.thumb-empty {
    width: 48px;
    height: 48px;
    background: var(--bg-2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 1.2rem;
    border: 1px dashed var(--line-2);
}

/* ============ Toggle (старый бургер) — десктоп fallback, скрыт ============ */
.sidebar-toggle {
    display: none; /* полностью скрыт — заменён topbar */
}

/* ============ Адаптив ============ */
@media (max-width: 1024px) {
    .admin-main { padding: 1.5rem; }
}

@media (max-width: 880px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }
    /* === Glassmorphism полноэкранное меню === */
    .admin-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100dvh;
        height: 100vh;
        max-width: none;
        z-index: 55;

        /* Glass эффект */
        background: var(--zen-glass);
        -webkit-backdrop-filter: blur(28px) saturate(1.8);
        backdrop-filter: blur(28px) saturate(1.8);
        border-right: none;

        /* Safe-area */
        padding-top: calc(5rem + env(safe-area-inset-top, 0px));
        padding-left: max(2rem, env(safe-area-inset-left, 0px));
        padding-right: max(2rem, env(safe-area-inset-right, 0px));
        padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));

        /* Анимация — fade + slight scale */
        opacity: 0;
        visibility: hidden;
        transform: scale(1.03);
        transition: opacity .3s var(--zen-ease),
                    transform .35s var(--zen-spring),
                    visibility .35s;
        box-shadow: none;

        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .admin-sidebar.open {
        opacity: 1;
        visibility: visible;
        transform: scale(1);
    }

    /* Brand-логотип в полноэкранном меню */
    .admin-sidebar .brand {
        font-size: 2rem;
        margin-bottom: 2.5rem;
        text-align: center;
        justify-content: center;
        padding: 0;
    }

    /* Навигация — крупные центрированные пункты */
    .admin-sidebar nav {
        gap: .35rem;
        flex: 1;
    }
    .admin-sidebar nav a {
        padding: 1.1rem 1.25rem;
        font-size: 1.05rem;
        border-radius: 16px;
        font-weight: 500;
        /* Cascade-анимация */
        opacity: 0;
        transform: translateY(20px);
        transition: opacity .4s var(--zen-ease), transform .5s var(--zen-spring), background .15s;
    }
    .admin-sidebar.open nav a {
        opacity: 1;
        transform: translateY(0);
    }
    /* Каскад: задержка для каждого пункта */
    .admin-sidebar.open nav a:nth-child(1)  { transition-delay: .05s; }
    .admin-sidebar.open nav a:nth-child(2)  { transition-delay: .08s; }
    .admin-sidebar.open nav a:nth-child(3)  { transition-delay: .11s; }
    .admin-sidebar.open nav a:nth-child(4)  { transition-delay: .14s; }
    .admin-sidebar.open nav a:nth-child(5)  { transition-delay: .17s; }
    .admin-sidebar.open nav a:nth-child(6)  { transition-delay: .20s; }
    .admin-sidebar.open nav a:nth-child(7)  { transition-delay: .23s; }
    .admin-sidebar.open nav a:nth-child(8)  { transition-delay: .26s; }
    .admin-sidebar.open nav a:nth-child(9)  { transition-delay: .29s; }
    .admin-sidebar.open nav a:nth-child(10) { transition-delay: .32s; }
    .admin-sidebar.open nav a:nth-child(11) { transition-delay: .35s; }

    .admin-sidebar nav .nav-section-title {
        text-align: center;
        font-size: .65rem;
        padding: 1rem 0 .5rem;
        opacity: 0;
        transition: opacity .4s var(--zen-ease) .15s;
    }
    .admin-sidebar.open nav .nav-section-title { opacity: .6; }

    .admin-sidebar nav .nav-divider {
        margin: 1rem auto;
        max-width: 60px;
    }

    /* User-box тоже с задержкой */
    .user-box {
        background: rgba(255,255,255,.04);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid rgba(255,255,255,.08);
        border-radius: 18px;
        margin-top: 1.5rem;
        opacity: 0;
        transform: translateY(20px);
        transition: opacity .4s var(--zen-ease) .4s, transform .5s var(--zen-spring) .4s;
    }
    .admin-sidebar.open .user-box {
        opacity: 1;
        transform: translateY(0);
    }

    /* Overlay не нужен в полноэкранном режиме — само меню фуллскрин */
    .admin-sidebar-overlay { display: none !important; }

    .sidebar-toggle { display: inline-flex; }

    /* Когда меню открыто — кнопка остаётся видимой и меняется на крест */
    .admin-sidebar.open ~ .sidebar-toggle,
    body.sidebar-open .sidebar-toggle {
        background: rgba(255,255,255,.08);
    }

    /* admin-main padding задаётся в @media (max-width: 880px) секции topbar */

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
    .page-header h1 { font-size: 1.5rem; }
    .admin-main h1 { font-size: 1.5rem; }

    table.data { font-size: .82rem; }
    table.data th, table.data td { padding: .65rem .75rem; }

    .form-grid { grid-template-columns: 1fr; }
    .stats { grid-template-columns: 1fr 1fr; gap: .75rem; }
    .stat-card { padding: 1rem; border-radius: var(--zen-radius); }
    .stat-card .value { font-size: 1.5rem; }

    .card {
        border-radius: var(--zen-radius);
        box-shadow: var(--zen-shadow-sm);
    }
    .card-head, .table-head {
        padding: 1rem 1.25rem;
    }
    .card-body { padding: 1.25rem; }
}

@media (max-width: 480px) {
    .stats { grid-template-columns: 1fr 1fr; gap: .65rem; }
    .row-actions { gap: .25rem; }
    .btn-mini { padding: .35rem .55rem; font-size: .75rem; }
    .page-header h1, .admin-main h1 { font-size: 1.25rem; }
    .page-header { gap: .5rem; padding-bottom: 1rem; margin-bottom: 1.25rem; }
    .card-body { padding: .85rem; }
    .field-group-title { font-size: 1rem; }

    /* Таблица: скрываем второстепенные колонки */
    table.data { font-size: .78rem; }
    table.data th, table.data td { padding: .55rem .5rem; }
    .stat-card { padding: .85rem 1rem; }
    .stat-card .value { font-size: 1.35rem; }
    .stat-card .icon { font-size: 1.2rem; }

    /* Кнопка выхода — полная ширина */
    .user-box .logout-btn { padding: .65rem; }

    /* Фильтр-чипы — горизонтальный скролл */
    .filter-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }
    .filter-chips::-webkit-scrollbar { display: none; }
    .chip { flex-shrink: 0; }

    /* Действия в строках — вертикально */
    .row-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Алерты */
    .alert { font-size: .85rem; padding: .75rem 1rem; }
}

@media (max-width: 360px) {
    .page-header h1, .admin-main h1 { font-size: 1.1rem; }
    .stat-card .label { font-size: .7rem; }
    .filter-chips { gap: .35rem; }
    .chip { padding: .3rem .65rem; font-size: .8rem; }
    .stats { grid-template-columns: 1fr; }
}

/* Landscape на маленьких экранах — sidebar по кнопке */
@media (max-height: 500px) and (orientation: landscape) {
    .admin-sidebar {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Тач-устройства: тач-зоны */
@media (hover: none) and (pointer: coarse) {
    .btn-mini {
        min-height: 40px;
        padding: .5rem .9rem;
        -webkit-tap-highlight-color: transparent;
    }
    .chip { min-height: 40px; }
    .admin-sidebar nav a {
        padding: .9rem 1rem;
        min-height: 48px;
    }
    select.btn-mini { min-height: 40px; }
    table.data th, table.data td {
        /* Увеличенные зоны на тач */
        padding: .75rem .75rem;
    }
}


/* =============================================================
   Страница настроек — аккордеон с анимацией
   ============================================================= */
.settings-form { padding-bottom: 100px; }

/* Обёртка содержимого — анимируем height */
.settings-body-wrap {
    overflow: hidden;
    transition: height .38s cubic-bezier(.4, 0, .2, 1);
    will-change: height;
}

/* Само тело (padding даём внутри) */
.settings-body {
    /* padding берём из .card-body */
}

/* Кнопка-заголовок */
.settings-summary {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-family: inherit;
    color: inherit;
    padding: 1.1rem 1.5rem;
    /* Переопределяем card-head */
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    border-bottom: 1px solid transparent;
    transition: background .15s, border-color .25s;
    -webkit-tap-highlight-color: transparent;
}
.settings-summary:hover {
    background: rgba(255,107,53,.04);
}
/* Когда открыто — граница снизу */
.settings-group[data-open="1"] > .settings-summary {
    border-bottom-color: var(--line-2);
}

.settings-summary h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
    flex: 1;
    pointer-events: none;
}

/* Шеврон — анимируется вращением */
.settings-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255,255,255,.04);
    color: var(--muted);
    flex-shrink: 0;
    transition: transform .38s cubic-bezier(.4, 0, .2, 1),
                color .2s,
                background .2s;
    pointer-events: none;
}
/* Открытое состояние — шеврон смотрит вверх */
.settings-group[data-open="1"] > .settings-summary .settings-chevron {
    transform: rotate(180deg);
    color: var(--primary);
    background: rgba(255,107,53,.1);
}

/* Залипающая панель сохранения — определение ниже в premium блоке */

@media (max-width: 600px) {
    .settings-summary { padding: .9rem 1rem; }
    .settings-summary h2 { font-size: 1rem; }
}

/* =============================================================
   Стилизованный загрузчик изображений
   ============================================================= */
.image-field {
    background: var(--bg-2);
    border: 1px solid var(--line-2);
    border-radius: 14px;
    padding: 1rem;
    grid-column: 1/-1;
    transition: border-color .2s;
}
.image-field:hover {
    border-color: var(--line);
}
.image-field-label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: .85rem;
    letter-spacing: .02em;
}

.image-field-body {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 1rem;
    align-items: start;
}

/* Превью */
.image-preview {
    width: 160px;
    height: 120px;
    background: var(--bg-3);
    border: 2px dashed var(--line-2);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color .2s, transform .2s;
    position: relative;
}
.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.image-preview.has-new {
    border-style: solid;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255,107,53,.15);
}
.image-preview-empty {
    color: var(--muted);
    text-align: center;
    padding: .5rem;
}
.image-preview-icon {
    display: block;
    font-size: 2rem;
    opacity: .5;
    margin-bottom: .25rem;
}
.image-preview-empty small {
    font-size: .75rem;
    opacity: .7;
}

/* Контролы справа */
.image-field-controls {
    display: flex;
    flex-direction: column;
    gap: .65rem;
    min-width: 0;
}

/* Кнопка "Загрузить новую" */
.image-upload-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .75rem 1.25rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: white;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: .9rem;
    border: 1px solid transparent;
    transition: transform .15s, box-shadow .2s;
    text-align: center;
    box-shadow: 0 4px 14px rgba(255,107,53,.25);
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
}
.image-upload-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(255,107,53,.35);
}
.image-upload-btn input[type="file"] {
    /* Полностью скрываем системный input */
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none !important;
    padding: 0 !important;
    background: transparent !important;
    font-size: 0;
}
.image-upload-btn span {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    pointer-events: none;
}

/* URL "продвинутая" опция */
.image-url-details {
    background: var(--bg-3);
    border: 1px solid var(--line-2);
    border-radius: 10px;
    padding: .5rem .75rem;
    transition: border-color .2s;
}
.image-url-details[open] {
    padding: .5rem .75rem .75rem;
    border-color: var(--line);
}
.image-url-summary {
    cursor: pointer;
    list-style: none;
    color: var(--muted);
    font-size: .85rem;
    user-select: none;
    -webkit-user-select: none;
    padding: .25rem 0;
    transition: color .15s;
}
.image-url-summary::-webkit-details-marker { display: none; }
.image-url-summary:hover { color: var(--text); }
.image-url-details[open] .image-url-summary {
    color: var(--primary);
    margin-bottom: .5rem;
}
.image-url-details input[type="text"] {
    background: var(--bg-2);
    border: 1px solid var(--line-2);
    color: var(--text);
    padding: .55rem .75rem;
    border-radius: 8px;
    font: inherit;
    width: 100%;
    font-size: .85rem;
}
.image-url-details input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
}

/* Кнопка очистки */
.image-clear-btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .55rem .85rem;
    background: var(--bg-3);
    border: 1px solid rgba(227,75,58,.3);
    border-radius: 10px;
    cursor: pointer;
    color: var(--danger);
    font-size: .85rem;
    transition: all .15s;
    -webkit-tap-highlight-color: transparent;
}
.image-clear-btn:hover {
    background: rgba(227,75,58,.1);
    border-color: var(--danger);
}
.image-clear-btn input[type="checkbox"] {
    accent-color: var(--danger);
    margin: 0;
}
.image-clear-btn input[type="checkbox"]:checked + span {
    text-decoration: line-through;
}

/* Hint текст */
.image-field .hint-text {
    margin: .85rem 0 0;
    color: var(--muted);
    font-size: .75rem;
}

/* Эмодзи-инпут */
.emoji-input {
    text-align: center;
    font-size: 1.5rem !important;
    letter-spacing: .1em;
    max-width: 120px;
}

/* Адаптив для мобилы */
@media (max-width: 600px) {
    .image-field-body {
        grid-template-columns: 1fr;
    }
    .image-preview {
        width: 100%;
        max-width: 280px;
        height: 160px;
        margin: 0 auto;
    }
    .settings-summary h2 {
        font-size: 1rem;
    }
    .settings-save-bar {
        margin: 0 -1rem;
        padding: 1rem;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    }
}

/* Стилизованный input[type=file] для меню (страница "Меню") */
/* Не трогает .sf-upload-btn — у него свой стиль (скрытый input) */
.form-grid > label > input[type="file"],
.form-grid > input[type="file"] {
    position: relative;
    cursor: pointer;
    background: var(--bg-2);
    border: 1px dashed var(--line);
    border-radius: 10px;
    padding: .85rem 1rem;
    color: var(--muted);
    font-size: .9rem;
    transition: all .2s;
}
.form-grid > label > input[type="file"]:hover,
.form-grid > input[type="file"]:hover {
    border-color: var(--primary);
    background: rgba(255,107,53,.05);
    color: var(--text);
}
.form-grid > label > input[type="file"]::-webkit-file-upload-button,
.form-grid > input[type="file"]::-webkit-file-upload-button {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: white;
    border: none;
    padding: .45rem .9rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: .85rem;
    margin-right: .75rem;
    transition: transform .15s;
}
.form-grid > label > input[type="file"]::-webkit-file-upload-button:hover,
.form-grid > input[type="file"]::-webkit-file-upload-button:hover {
    transform: translateY(-1px);
}
.form-grid > label > input[type="file"]::file-selector-button,
.form-grid > input[type="file"]::file-selector-button {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: white;
    border: none;
    padding: .45rem .9rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: .85rem;
    margin-right: .75rem;
    transition: transform .15s;
}
.form-grid > label > input[type="file"]::file-selector-button:hover,
.form-grid > input[type="file"]::file-selector-button:hover {
    transform: translateY(-1px);
}


/* =============================================================
   Zen Admin — премиум-компоненты
   ============================================================= */

/* === Live View — компактная пилюля === */
.zen-live-view {
    display: none;
    position: fixed;
    top: calc(.85rem + env(safe-area-inset-top, 0px));
    right: calc(.85rem + env(safe-area-inset-right, 0px));
    z-index: 60;
    align-items: center;
    gap: .4rem;
    height: 44px;
    padding: 0 .9rem;
    border-radius: 14px;
    background: var(--zen-glass-strong);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    backdrop-filter: blur(20px) saturate(1.6);
    border: 1px solid rgba(255,255,255,.08);
    color: var(--text);
    font-size: .85rem;
    font-weight: 500;
    text-decoration: none;
    box-shadow: var(--zen-shadow-md);
    -webkit-tap-highlight-color: transparent;
    transition: transform .15s, background .2s;
}
.zen-live-view:active { transform: scale(.94); }
.zen-live-view-text {
    color: var(--gold);
    font-weight: 600;
    letter-spacing: .02em;
}

@media (max-width: 880px) {
    .zen-live-view { display: inline-flex; }
}

/* === Premium grid карточек блюд для мобилы === */
.zen-menu-grid {
    display: none;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 1rem 0 6rem;
}

@media (max-width: 768px) {
    /* На мобиле — показываем плитки, скрываем таблицу */
    .zen-menu-grid { display: grid; }
    .zen-table-card { display: none; }
    /* Чипы фильтров скрываем на мобиле — вместо них Zen-сегменты */
    .filter-chips { display: none; }
}

@media (max-width: 380px) {
    .zen-menu-grid { gap: .75rem; }
}

/* Категория — заголовок группы */
.zen-cat-block {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: 1.25rem .25rem .25rem;
}
.zen-cat-block:first-child { padding-top: .25rem; }
.zen-cat-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
    color: var(--text);
}
.zen-cat-count {
    font-size: .75rem;
    color: var(--muted);
    background: rgba(255,255,255,.05);
    padding: .25rem .65rem;
    border-radius: 999px;
    font-weight: 500;
}

/* Карточка-плитка */
.zen-tile {
    position: relative;
    background: var(--bg-3);
    border: 1px solid var(--line-2);
    border-radius: var(--zen-radius);
    overflow: hidden;
    box-shadow: var(--zen-shadow-sm);
    transition: transform .25s var(--zen-spring), border-color .2s, box-shadow .25s;
    -webkit-tap-highlight-color: transparent;
    touch-action: pan-y;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}
.zen-tile:active {
    transform: scale(.97);
}
.zen-tile.is-hidden {
    opacity: .55;
}

/* Картинка или градиент */
.zen-tile-media {
    aspect-ratio: 1 / 1;
    position: relative;
    overflow: hidden;
    background: var(--bg-2);
}
.zen-tile-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Premium градиент-плейсхолдер вместо уродливой "Нет фото" */
.zen-tile-media.is-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,.92);
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    padding: 1rem;
    line-height: 1.2;
    letter-spacing: -.01em;
}
/* Различные градиенты для разных категорий */
.zen-tile-media.is-empty[data-hue="0"]   { background: linear-gradient(135deg, #ff6b35, #ff8a3d); }
.zen-tile-media.is-empty[data-hue="1"]   { background: linear-gradient(135deg, #2c1810, #5a3a26); }
.zen-tile-media.is-empty[data-hue="2"]   { background: linear-gradient(135deg, #4a2c1a, #8b4513); }
.zen-tile-media.is-empty[data-hue="3"]   { background: linear-gradient(135deg, #ffd166, #ff8a3d); color: #1a1209; }
.zen-tile-media.is-empty[data-hue="4"]   { background: linear-gradient(135deg, #1a472a, #2d5e3e); }
.zen-tile-media.is-empty[data-hue="5"]   { background: linear-gradient(135deg, #4a1942, #7a2858); }
.zen-tile-media.is-empty[data-hue="6"]   { background: linear-gradient(135deg, #1f3a5f, #3b5d8c); }
.zen-tile-media.is-empty[data-hue="7"]   { background: linear-gradient(135deg, #5c2a1e, #8c3e2c); }

/* Кнопка добавления фото поверх плейсхолдера */
.zen-tile-add-photo {
    position: absolute;
    bottom: .55rem;
    right: .55rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0,0,0,.55);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    text-decoration: none;
    transition: transform .15s, background .2s;
    -webkit-tap-highlight-color: transparent;
}
.zen-tile-add-photo:active {
    transform: scale(.92);
    background: var(--primary);
}

/* Featured-метка */
.zen-tile-star {
    position: absolute;
    top: .5rem;
    left: .5rem;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(0,0,0,.55);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: var(--gold);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    pointer-events: none;
}

/* Скидка */
.zen-tile-discount {
    position: absolute;
    top: .5rem;
    right: .5rem;
    background: var(--danger);
    color: white;
    font-size: .65rem;
    padding: .15rem .5rem;
    border-radius: 999px;
    font-weight: 700;
    letter-spacing: .02em;
}

/* Тело карточки */
.zen-tile-body {
    padding: .75rem .85rem .85rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
    flex: 1;
}
.zen-tile-name {
    font-size: .92rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.25;
    color: var(--text);
    /* 2 строки максимум */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.zen-tile-price {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    gap: .5rem;
}
.zen-tile-price strong {
    font-size: 1rem;
    color: var(--text);
    font-weight: 700;
}
.zen-tile-price-old {
    font-size: .7rem;
    color: var(--muted);
    text-decoration: line-through;
    margin-right: .25rem;
}

/* iOS-style toggle для доступности */
.zen-toggle {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 22px;
    flex-shrink: 0;
}
.zen-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.zen-toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.15);
    border-radius: 999px;
    transition: background .25s;
    cursor: pointer;
}
.zen-toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform .25s var(--zen-spring);
    box-shadow: 0 2px 4px rgba(0,0,0,.25);
}
.zen-toggle input:checked + .zen-toggle-slider {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
}
.zen-toggle input:checked + .zen-toggle-slider::before {
    transform: translateX(14px);
}
.zen-toggle input:focus-visible + .zen-toggle-slider {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* === Floating Action Button (FAB) === */
.zen-fab {
    display: none;
    position: fixed;
    right: calc(1.25rem + env(safe-area-inset-right, 0px));
    bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: white;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.8rem;
    font-weight: 300;
    line-height: 1;
    box-shadow: 0 8px 24px rgba(255,107,53,.4),
                0 2px 8px rgba(0,0,0,.3);
    z-index: 50;
    transition: transform .2s var(--zen-spring), box-shadow .2s;
    -webkit-tap-highlight-color: transparent;
    border: none;
    cursor: pointer;
}
.zen-fab:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 32px rgba(255,107,53,.5);
}
.zen-fab:active {
    transform: scale(.92);
}

@media (max-width: 768px) {
    .zen-fab { display: inline-flex; }
}

/* === Сегментированный фильтр (iOS-style) === */
.zen-segments {
    display: flex;
    background: var(--bg-3);
    border: 1px solid var(--line-2);
    border-radius: 12px;
    padding: 3px;
    gap: 2px;
    margin-bottom: 1.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.zen-segments::-webkit-scrollbar { display: none; }
.zen-segments a {
    flex: 1 1 auto;
    padding: .55rem .75rem;
    text-align: center;
    border-radius: 9px;
    color: var(--muted);
    text-decoration: none;
    font-size: .82rem;
    font-weight: 500;
    transition: background .2s, color .2s;
    white-space: nowrap;
    min-width: max-content;
}
.zen-segments a.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: white;
    box-shadow: 0 2px 6px rgba(255,107,53,.3);
}

/* === Bottom Sheet — действия по карточке === */
.zen-sheet {
    position: fixed;
    inset: 0;
    z-index: 200;
    visibility: hidden;
    pointer-events: none;
}
.zen-sheet[aria-hidden="false"] {
    visibility: visible;
    pointer-events: auto;
}
.zen-sheet-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity .3s var(--zen-ease);
}
.zen-sheet[aria-hidden="false"] .zen-sheet-overlay { opacity: 1; }

.zen-sheet-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-2);
    border-top-left-radius: 28px;
    border-top-right-radius: 28px;
    padding: .65rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%);
    transition: transform .35s var(--zen-spring);
    box-shadow: 0 -8px 30px rgba(0,0,0,.3);
}
.zen-sheet[aria-hidden="false"] .zen-sheet-panel {
    transform: translateY(0);
}
.zen-sheet-grabber {
    width: 36px;
    height: 4px;
    background: rgba(255,255,255,.2);
    border-radius: 999px;
    margin: 0 auto .85rem;
}
.zen-sheet-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem;
    margin: 0 0 .85rem;
    text-align: center;
    color: var(--text);
}
.zen-sheet-actions {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.zen-sheet-action {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .9rem 1rem;
    background: var(--bg-3);
    border: none;
    border-radius: 14px;
    color: var(--text);
    font-size: 1rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, transform .1s;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
}
.zen-sheet-action:active {
    transform: scale(.98);
    background: rgba(255,255,255,.05);
}
.zen-sheet-action.danger {
    color: var(--danger);
}
.zen-sheet-action-icon {
    font-size: 1.2rem;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}
.zen-sheet-action form {
    display: contents;
}
.zen-sheet-action button {
    all: unset;
    flex: 1;
    cursor: pointer;
}

/* На широких экранах FAB и сегменты неактуальны */
@media (min-width: 769px) {
    .zen-segments { display: none; }
}


/* =============================================================
   Admin Topbar — sticky navbar с hide-on-scroll
   ============================================================= */

/* Топбар виден ВСЕГДА — и на десктопе, и на мобиле */
.admin-topbar {
    position: fixed;
    top: 0;
    /* На десктопе — правее сайдбара */
    left: 260px;
    right: 0;
    z-index: 40;
    padding-top: env(safe-area-inset-top, 0px);

    background: var(--bg); /* полностью глухой фон, никакого просвечивания */
    border-bottom: 1px solid var(--line-2);
    box-shadow: 0 1px 0 rgba(0,0,0,.3);

    transform: translateY(0);
    transition: transform .32s var(--zen-ease, cubic-bezier(.4,0,.2,1));
    will-change: transform;
}

/* Скрыт при скролле вниз */
.admin-topbar.topbar-hidden {
    transform: translateY(-110%);
    box-shadow: none;
}

.admin-topbar-inner {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    height: 54px;
    padding: 0 1.25rem;
}

/* На десктопе бургер скрыт — занимаем всё пространство для заголовка */
@media (min-width: 881px) {
    .admin-topbar-inner {
        grid-template-columns: 1fr 44px;
    }
}

/* Бургер — скрыт на десктопе, виден на мобиле */
.topbar-burger {
    display: none; /* скрыт на десктопе */
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: transparent;
    border: none;
    color: var(--text);
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background .2s;
    flex-shrink: 0;
}
.topbar-burger:active {
    background: rgba(255,255,255,.06);
}
/* Три полоски */
.topbar-burger .tb-line {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform .32s cubic-bezier(.34,1.56,.64,1),
                opacity .2s,
                width .25s;
}
.topbar-burger .tb-mid { width: 13px; }

/* Крестик при открытом меню */
.topbar-burger.open .tb-line:first-child {
    transform: translateY(7px) rotate(45deg);
    width: 20px;
}
.topbar-burger.open .tb-mid {
    opacity: 0;
    transform: translateX(-8px);
}
.topbar-burger.open .tb-line:last-child {
    transform: translateY(-7px) rotate(-45deg);
    width: 20px;
}

/* Заголовок по центру */
.topbar-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    overflow: hidden;
    min-width: 0;
}

/* На десктопе — по левому краю */
@media (min-width: 881px) {
    .topbar-title {
        justify-content: flex-start;
        padding-left: .25rem;
    }
}
.topbar-admin-label {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    letter-spacing: -.01em;
}
.topbar-sep {
    color: var(--muted);
    font-size: .9rem;
    opacity: .4;
    flex-shrink: 0;
}
.topbar-page {
    font-size: .82rem;
    font-weight: 500;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Иконка сайта справа */
.topbar-live {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    justify-self: end;
    -webkit-tap-highlight-color: transparent;
    transition: color .2s, background .2s;
}
.topbar-live:hover { color: var(--text); }
.topbar-live:active {
    background: rgba(255,255,255,.06);
    color: var(--text);
}

/* admin-main делает отступ сверху под topbar */
.admin-main {
    padding-top: calc(54px + env(safe-area-inset-top, 0px) + 1.5rem) !important;
}

/* ── Мобиле (≤880px): бургер появляется, topbar растягивается на весь экран ── */
@media (max-width: 880px) {
    .admin-topbar {
        left: 0; /* полная ширина */
        padding-left: env(safe-area-inset-left, 0px);
        padding-right: env(safe-area-inset-right, 0px);
        background: var(--zen-glass-strong);
        -webkit-backdrop-filter: blur(20px) saturate(1.6);
        backdrop-filter: blur(20px) saturate(1.6);
        border-bottom: 1px solid rgba(255,255,255,.06);
    }
    .admin-topbar-inner {
        padding: 0 .75rem;
    }
    .topbar-burger {
        display: flex; /* показываем бургер */
    }
    /* Когда сайдбар открыт — topbar уходит под него */
    body.sidebar-open .admin-topbar {
        z-index: 54;
    }
}

/* Zen Live View — убираем старый, заменён topbar */
.zen-live-view { display: none !important; }


/* =============================================================
   Settings Form — премиум-компоненты
   ============================================================= */

/* Единый текст-лейбл над полями */
.sf-field-label {
    display: block;
    font-size: .72rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: .5rem;
}

/* ── Бренд: Название + Эмодзи в одну строку ── */
.sf-brand-pair {
    display: grid;
    grid-template-columns: 1fr 88px;
    gap: .75rem;
    align-items: end;
}
.sf-brand-pair input { width: 100%; }
.sf-brand-pair-emoji .emoji-input {
    text-align: center;
    font-size: 1.5rem !important;
    padding: .55rem .5rem !important;
    height: 100%;
}

/* ── Статистика: 3 строки вертикально, каждая со своей нумерацией ── */
.sf-stats-stack {
    display: flex;
    flex-direction: column;
    gap: .85rem;
}

.sf-stat-row {
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: .85rem;
    align-items: center;
    padding: .75rem;
    background: var(--bg-2);
    border: 1px solid var(--line-2);
    border-radius: 12px;
    transition: border-color .15s;
}
.sf-stat-row:hover {
    border-color: var(--line);
}

.sf-stat-row .sf-stat-num {
    width: 36px;
    height: 44px;
    background: rgba(255,107,53,.15);
    color: var(--primary);
    border-radius: 10px;
    font-size: .95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sf-stat-fields {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: .65rem;
    align-items: end;
    min-width: 0;
}
.sf-stat-field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    min-width: 0;
}
.sf-stat-field input { width: 100%; }
.sf-stat-field .sf-field-label { margin-bottom: 0; }

/* СТАРЫЕ inline пары — оставляю на случай совместимости, но не используются */
.sf-stat-pair {
    display: grid;
    grid-template-columns: 28px 1fr 1.4fr;
    gap: .65rem;
    align-items: end;
}

/* ── Преимущества: всё в одну строку, без лейблов сверху ── */
.sf-feature-pair {
    display: grid;
    grid-template-columns: 28px 64px 1fr;
    gap: .65rem;
    align-items: center;
    padding: .35rem 0;
}
.sf-feature-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 44px;
    background: rgba(255,209,102,.12);
    color: var(--gold);
    border-radius: 8px;
    font-size: .78rem;
    font-weight: 700;
    flex-shrink: 0;
}
.sf-feature-emoji-input {
    text-align: center !important;
    font-size: 1.4rem !important;
    padding: .55rem !important;
    width: 64px !important;
    height: 44px;
}
.sf-feature-text-input {
    width: 100%;
    height: 44px;
}

/* ── Поле картинки: единые размеры превью + кнопок ── */
.sf-image-field {
    grid-column: 1 / -1 !important;
    width: 100%;
}
.sf-image-inner {
    display: grid !important;
    grid-template-columns: 220px 1fr;
    gap: 1.25rem;
    align-items: stretch;
    margin-top: .5rem;
    width: 100%;
}
.sf-image-preview {
    width: 220px !important;
    height: 165px !important;
    background: var(--bg-2);
    border: 2px dashed var(--line-2);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color .2s, box-shadow .2s;
    position: relative;
}
.sf-image-preview img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    max-width: 100% !important;
}
.sf-image-preview.has-new {
    border-style: solid;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255,107,53,.15);
}
.sf-image-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 500;
}

/* Контролы справа от превью — выровнены по высоте превью */
.sf-image-controls {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    justify-content: flex-start;
    height: 165px;
}

/* Кнопки — одинакового размера */
.sf-upload-btn,
.sf-clear-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    height: 44px;
    padding: 0 1.25rem;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 600;
    font-size: .9rem;
    cursor: pointer;
    transition: transform .15s, box-shadow .2s, background .2s, border-color .2s, filter .2s;
    -webkit-tap-highlight-color: transparent;
    width: fit-content;
    min-width: 180px;
    box-sizing: border-box;
    line-height: 1;
    white-space: nowrap;
    letter-spacing: .01em;
}

.sf-upload-btn {
    position: relative;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    border: none;
    box-shadow: 0 2px 8px rgba(255,107,53,.2);
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.sf-upload-btn:hover {
    filter: brightness(1.08);
    box-shadow: 0 4px 14px rgba(255,107,53,.32);
}
.sf-upload-btn:active { transform: scale(.97); }
.sf-upload-btn svg {
    flex-shrink: 0;
    color: #fff;
    opacity: 1;
}

/* Скрытый input файла — поверх всей кнопки */
.sf-upload-btn input[type="file"],
.form-grid .sf-upload-btn input[type="file"] {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    opacity: 0 !important;
    cursor: pointer !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    font-size: 0 !important;
    z-index: 1;
}

/* Кнопка удаления — обёртка <label> */
.sf-clear-btn {
    background: rgba(227,75,58,.06);
    border: 1px solid rgba(227,75,58,.4);
    color: var(--danger);
    font-weight: 600;
}
.sf-clear-btn:hover {
    background: rgba(227,75,58,.14);
    border-color: var(--danger);
}
.sf-clear-btn:active { transform: scale(.97); }
.sf-clear-btn svg {
    flex-shrink: 0;
    color: var(--danger);
    opacity: 1;
}
.sf-clear-btn input[type="checkbox"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
/* Когда чекбокс активен — кнопка ярче (показывает что галочка стоит) */
.sf-clear-btn:has(input[type="checkbox"]:checked) {
    background: rgba(227,75,58,.2);
    border-color: var(--danger);
    color: var(--danger);
}

.sf-hint {
    margin: auto 0 0;
    color: var(--muted);
    font-size: .72rem;
    line-height: 1.4;
}

/* === SAVE BAR — премиум sticky панель снизу === */
.settings-save-bar {
    position: sticky;
    bottom: 0;
    background: linear-gradient(180deg,
        rgba(14, 12, 11, 0) 0%,
        rgba(14, 12, 11, .85) 30%,
        var(--bg) 100%);
    border-top: 1px solid var(--line-2);
    padding: 1.25rem 0 1rem;
    margin: 1.5rem 0 0;
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    justify-content: flex-start;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    z-index: 10;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
.settings-save-bar .btn {
    flex: 0 1 auto;
    min-width: 220px;
}

/* ── Мобильная адаптация ── */
@media (max-width: 768px) {
    .sf-image-inner {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
    .sf-image-preview {
        width: 100% !important;
        max-width: 100% !important;
        height: 200px !important;
    }
    .sf-image-controls {
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        gap: .65rem;
    }
    .sf-upload-btn,
    .sf-clear-btn {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
    }
    .sf-hint {
        flex: 1 0 100%;
        text-align: left;
        margin: 0;
    }
}

@media (max-width: 600px) {
    .sf-brand-pair {
        grid-template-columns: 1fr 76px;
        gap: .55rem;
    }
    .sf-stat-row {
        grid-template-columns: 32px 1fr;
        gap: .65rem;
        padding: .65rem;
    }
    .sf-stat-row .sf-stat-num {
        width: 32px;
        height: 40px;
        font-size: .85rem;
    }
    .sf-stat-fields {
        grid-template-columns: 1fr 1.3fr;
        gap: .5rem;
    }
    .sf-feature-pair {
        grid-template-columns: 24px 56px 1fr;
        gap: .5rem;
    }
    .sf-feature-emoji-input {
        font-size: 1.2rem !important;
        width: 56px !important;
    }
    .settings-save-bar {
        margin: 0 -1rem;
        padding: 1rem;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
        justify-content: stretch;
    }
    .settings-save-bar .btn {
        flex: 1 1 100%;
        min-width: 0;
    }
}

@media (max-width: 380px) {
    .sf-feature-pair {
        grid-template-columns: 22px 50px 1fr;
        gap: .4rem;
    }
    .sf-feature-emoji-input {
        width: 50px !important;
        font-size: 1.1rem !important;
        padding: .4rem !important;
    }
    .sf-stat-row .sf-stat-num,
    .sf-feature-num { width: 28px; height: 36px; font-size: .75rem; }
    .sf-stat-fields { grid-template-columns: 1fr 1.2fr; }
    .sf-feature-text-input,
    .sf-feature-emoji-input { height: 40px; }
}


/* =============================================================
   Управление категориями меню
   ============================================================= */

.cat-manage-grid {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.cat-manage-item {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.cat-rename-form {
    flex: 1;
    min-width: 0;
}

.cat-manage-row {
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* Число блюд в категории */
.cat-manage-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 .4rem;
    background: rgba(255,107,53,.1);
    color: var(--primary);
    border-radius: 8px;
    font-size: .75rem;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: -.01em;
}

/* Инпут названия категории */
.cat-name-input {
    flex: 1;
    background: var(--bg-2);
    border: 1px solid var(--line-2);
    color: var(--text);
    padding: .55rem .85rem;
    border-radius: 10px;
    font: inherit;
    font-size: .9rem;
    transition: border-color .15s;
    min-width: 0;
}
.cat-name-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255,107,53,.08);
}

.cat-delete-form {
    flex-shrink: 0;
}

/* Мобиле — чуть крупнее тач-зоны */
@media (hover: none) and (pointer: coarse) {
    .cat-name-input { padding: .7rem .85rem; font-size: 1rem; }
    .cat-manage-count { min-width: 32px; height: 32px; font-size: .8rem; }
}


/* === Форма добавления новой категории === */
.cat-add-wrap {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line-2);
}
.cat-add-form .cat-manage-row {
    gap: .65rem;
}
.cat-add-form .cat-name-input {
    flex: 1;
}
.cat-add-form .btn-mini.primary {
    white-space: nowrap;
    flex-shrink: 0;
}


/* =============================================================
   Адаптивные таблицы → премиум-карточки (мобила/iPad)
   ============================================================= */

/* iPad — компактные таблицы (горизонтальный скролл) */
@media (max-width: 1024px) and (min-width: 769px) {
    table.data { font-size: .82rem; }
    table.data th,
    table.data td { padding: .65rem .85rem; }
    table.data select.btn-mini { font-size: .78rem; padding: .35rem .5rem; }
}

/* Мобила (≤768px) — скрываем таблицы, показываем мобильные карты */
@media (max-width: 768px) {
    /* Скрываем десктопную таблицу */
    .table-scroll table.data { display: none; }
    .table-scroll { overflow: visible; padding: 0; }
    /* Скрываем заголовок таблицы-обёртки на мобиле, чтобы был только список карточек */
    .table-scroll + .empty,
    .empty-mobile { padding: 3rem 1rem; }
}

@media (min-width: 769px) {
    /* Скрываем мобильные карты на десктопе */
    .m-cards { display: none !important; }
}

/* === Премиум мобильные карточки === */
.m-cards {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    padding: 0;
}
/* Только если карточки находятся внутри table-scroll или другого контейнера */
.card .m-cards { padding: .75rem; }

.m-card {
    --m-accent: var(--primary);
    background: var(--bg-2);
    border: 1px solid var(--line-2);
    border-radius: 18px;
    padding: 1rem 1.1rem 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    position: relative;
    overflow: hidden;
    transition: border-color .2s, transform .15s, box-shadow .25s;
    /* Цветная полоса слева в зависимости от статуса */
    box-shadow: inset 4px 0 0 0 var(--m-accent), 0 1px 2px rgba(0,0,0,.15);
    /* Анимация появления */
    animation: mCardIn .4s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes mCardIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
/* Каскад появления */
.m-card:nth-child(1) { animation-delay: .02s; }
.m-card:nth-child(2) { animation-delay: .04s; }
.m-card:nth-child(3) { animation-delay: .06s; }
.m-card:nth-child(4) { animation-delay: .08s; }
.m-card:nth-child(5) { animation-delay: .10s; }
.m-card:nth-child(6) { animation-delay: .12s; }
.m-card:nth-child(7) { animation-delay: .14s; }
.m-card:nth-child(8) { animation-delay: .16s; }

.m-card:active { transform: scale(.99); }

/* Цвета акцентов по статусу — вертикальная полоса слева */
.m-card[data-status="new"]        { --m-accent: var(--primary); }
.m-card[data-status="confirmed"]  { --m-accent: var(--ok); }
.m-card[data-status="completed"]  { --m-accent: var(--ok); }
.m-card[data-status="preparing"]  { --m-accent: var(--gold); }
.m-card[data-status="delivered"]  { --m-accent: var(--ok); }
.m-card[data-status="cancelled"]  { --m-accent: var(--danger); opacity: .7; }

/* Хедер карточки — имя + статус справа */
.m-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
}
.m-card-title {
    flex: 1;
    min-width: 0;
}
.m-card-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 .25rem;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -.01em;
}
.m-card-id {
    color: var(--muted);
    font-size: .7rem;
    font-weight: 600;
    opacity: .65;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.m-card-phone {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: var(--text);
    font-size: .85rem;
    text-decoration: none;
    font-weight: 500;
    margin-top: .15rem;
    padding: .25rem 0;
    transition: color .15s;
}
.m-card-phone:active { color: var(--primary); }
.m-card-phone-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: .55;
    color: var(--primary);
}

/* Большая дата-плашка для бронирования — Apple Calendar стиль */
.m-card-date-tile {
    flex-shrink: 0;
    width: 56px;
    background: var(--bg-3);
    border: 1px solid var(--line-2);
    border-radius: 12px;
    overflow: hidden;
    text-align: center;
    line-height: 1;
}
.m-card-date-month {
    background: var(--m-accent);
    color: white;
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    padding: .25rem 0;
}
.m-card-date-day {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text);
    padding: .35rem 0 .15rem;
    line-height: 1;
}
.m-card-date-time {
    font-size: .7rem;
    color: var(--muted);
    padding: 0 0 .35rem;
    font-weight: 500;
    letter-spacing: .03em;
}

/* Метаданные (гости и т.д.) — пилюли */
.m-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}
.m-card-meta-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--line-2);
    border-radius: 999px;
    padding: .3rem .7rem;
    font-size: .78rem;
    color: var(--text);
    font-weight: 500;
}
.m-card-meta-pill-icon {
    opacity: .55;
    flex-shrink: 0;
}

/* Комментарий */
.m-card-comment {
    background: rgba(255,255,255,.025);
    border-left: 3px solid var(--m-accent);
    border-radius: 8px;
    padding: .65rem .85rem;
    color: var(--text);
    font-size: .87rem;
    line-height: 1.5;
}
.m-card-comment-label {
    display: block;
    color: var(--muted);
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: .25rem;
}

/* Состав заказа — премиум-список */
.m-card-items {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: rgba(255,255,255,.025);
    border-radius: 12px;
    overflow: hidden;
}
.m-card-items-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .55rem .85rem;
    border-bottom: 1px solid var(--line-2);
    font-size: .87rem;
}
.m-card-items-item:last-child { border-bottom: none; }
.m-card-items-item-name {
    color: var(--text);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.m-card-items-item-qty {
    color: var(--primary);
    font-weight: 700;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* Сумма + количество позиций */
.m-card-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: .25rem;
}
.m-card-summary-meta {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}
.m-card-summary-label {
    color: var(--muted);
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.m-card-summary-time {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 500;
}
.m-card-total {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--primary);
    line-height: 1;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}

/* Действия — премиум 2-кнопки */
.m-card-actions {
    display: flex;
    gap: .5rem;
    padding-top: .5rem;
}
.m-card-action {
    flex: 1;
    height: 44px;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--line-2);
    border-radius: 12px;
    color: var(--text);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    -webkit-tap-highlight-color: transparent;
    transition: background .15s, border-color .15s, transform .1s;
    text-decoration: none;
    font-family: inherit;
}
.m-card-action:active { transform: scale(.97); background: rgba(255,255,255,.08); }
.m-card-action.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(255,107,53,.2);
}
.m-card-action.primary:active { filter: brightness(.95); }
.m-card-action.danger {
    flex: 0 0 44px;
    color: var(--danger);
    border-color: rgba(227,75,58,.25);
}
.m-card-action.danger:active { background: rgba(227,75,58,.1); }
.m-card-action svg {
    flex-shrink: 0;
    opacity: .85;
}

/* Action sheet — выбор статуса (всплывает снизу) */
.m-status-sheet {
    position: fixed;
    inset: 0;
    z-index: 200;
    visibility: hidden;
    pointer-events: none;
}
.m-status-sheet[data-open="true"] {
    visibility: visible;
    pointer-events: auto;
}
.m-status-sheet-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity .25s;
}
.m-status-sheet[data-open="true"] .m-status-sheet-overlay { opacity: 1; }

.m-status-sheet-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-2);
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    padding: .65rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%);
    transition: transform .35s cubic-bezier(.34,1.56,.64,1);
    box-shadow: 0 -10px 40px rgba(0,0,0,.4);
}
.m-status-sheet[data-open="true"] .m-status-sheet-panel {
    transform: translateY(0);
}
.m-status-sheet-grabber {
    width: 36px;
    height: 4px;
    background: rgba(255,255,255,.2);
    border-radius: 999px;
    margin: 0 auto .85rem;
}
.m-status-sheet-title {
    text-align: center;
    margin: 0 0 .85rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}
.m-status-list {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
.m-status-option {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .9rem 1rem;
    background: var(--bg-3);
    border: 1px solid transparent;
    border-radius: 14px;
    color: var(--text);
    font-size: .95rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
    transition: background .15s;
    font-family: inherit;
}
.m-status-option:active { transform: scale(.98); }
.m-status-option.active {
    background: rgba(255,107,53,.12);
    border-color: var(--primary);
    color: var(--primary);
}
.m-status-option-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.05);
    flex-shrink: 0;
    font-size: .85rem;
}
.m-status-option.active .m-status-option-icon {
    background: var(--primary);
}

/* Иконка-аватар */
.m-card-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--gold));
    color: white;
    font-weight: 700;
    font-size: 1.05rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: -.02em;
}

.m-card-stars {
    color: var(--gold);
    font-size: 1.05rem;
    letter-spacing: 2px;
    margin-top: .1rem;
}

.m-card-with-avatar {
    display: flex;
    gap: .85rem;
    align-items: flex-start;
}
.m-card-with-avatar > .m-card-content { flex: 1; min-width: 0; }

.m-card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    object-fit: cover;
    background: var(--bg-3);
    display: block;
    margin: -.25rem 0 .25rem;
}

/* Empty state */
.m-empty {
    background: var(--bg-2);
    border: 1px solid var(--line-2);
    border-radius: 18px;
    padding: 3rem 1rem;
    text-align: center;
}
.m-empty-icon { font-size: 3rem; opacity: .35; margin-bottom: .75rem; line-height: 1; }
.m-empty-title { font-size: 1.05rem; font-weight: 600; margin: 0 0 .35rem; }
.m-empty-hint { color: var(--muted); font-size: .85rem; margin: 0; line-height: 1.5; }

/* Search & Chips на мобиле */
@media (max-width: 600px) {
    .search-bar {
        flex-direction: column;
        align-items: stretch;
        gap: .5rem;
    }
    .search-bar input { width: 100%; }
    .search-bar .btn { width: 100%; }
    .search-bar .btn-outline { width: 100%; }

    .filter-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .filter-chips::-webkit-scrollbar { display: none; }
    .chip { flex-shrink: 0; }
}


/* =============================================================
   Компактный поиск + чипы фильтров (iOS стиль)
   ============================================================= */

@media (max-width: 768px) {
    /* Контейнер с поиском и чипами — компактно */
    .search-bar {
        flex-direction: row !important;
        gap: .4rem !important;
        margin-bottom: .75rem;
    }

    /* Поле поиска: иконка + текст внутри + крестик */
    .search-bar input[type="search"] {
        flex: 1;
        height: 40px;
        padding: 0 .85rem 0 2.25rem;
        background: var(--bg-3);
        border: 1px solid var(--line-2);
        border-radius: 12px;
        color: var(--text);
        font-size: .9rem;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a89c92' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: .75rem center;
        background-size: 14px;
        -webkit-appearance: none;
        appearance: none;
        font: inherit;
    }
    /* Удаляем нативный X у Chrome/Edge — у нас своя кнопка сброса */
    .search-bar input[type="search"]::-webkit-search-cancel-button {
        -webkit-appearance: none;
        appearance: none;
    }

    /* Кнопка «Найти» — компактная иконочная */
    .search-bar > .btn,
    .search-bar > .btn-primary {
        height: 40px !important;
        padding: 0 .9rem !important;
        font-size: .82rem !important;
        flex-shrink: 0;
        width: auto !important;
        min-width: 0;
    }

    /* Сброс — крестик 40×40 */
    .search-bar > .btn-outline {
        height: 40px !important;
        width: 40px !important;
        padding: 0 !important;
        font-size: 0 !important;
        position: relative;
        flex-shrink: 0;
        min-width: 0;
    }
    .search-bar > .btn-outline::before {
        content: '✕';
        font-size: 1rem;
        color: var(--muted);
        position: absolute;
        inset: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* === Чипы фильтров — премиум iOS-стиль === */
    .filter-chips {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: .4rem;
        padding: .25rem 1rem .65rem;
        margin: 0 -1rem 1rem;
        scroll-snap-type: x proximity;
    }
    .filter-chips::-webkit-scrollbar { display: none; }

    .filter-chips .chip {
        flex-shrink: 0;
        scroll-snap-align: start;
        height: 34px;
        padding: 0 .85rem;
        background: var(--bg-3);
        border: 1px solid var(--line-2);
        border-radius: 999px;
        color: var(--muted);
        font-size: .82rem;
        font-weight: 600;
        display: inline-flex;
        align-items: center;
        gap: .4rem;
        text-decoration: none;
        white-space: nowrap;
        transition: all .15s;
    }
    .filter-chips .chip:active { transform: scale(.96); }
    .filter-chips .chip.active {
        background: linear-gradient(135deg, var(--primary), var(--primary-2));
        color: #fff;
        border-color: transparent;
        box-shadow: 0 2px 6px rgba(255,107,53,.25);
    }
    .filter-chips .chip .count {
        background: rgba(0,0,0,.25);
        color: inherit;
        padding: .05rem .4rem;
        border-radius: 999px;
        font-size: .68rem;
        font-weight: 700;
        line-height: 1.4;
        min-width: 18px;
        text-align: center;
    }
    .filter-chips .chip:not(.active) .count {
        background: rgba(255,255,255,.06);
        color: var(--text);
    }
    .filter-chips .chip.active .count {
        background: rgba(255,255,255,.25);
    }

    /* Заголовок страницы — компактнее */
    .page-header {
        margin-bottom: 1rem !important;
        padding-bottom: .85rem !important;
    }
    .page-header h1 { font-size: 1.35rem !important; }
    .page-header .subtitle { font-size: .82rem !important; }
}

/* На очень узких экранах (≤380) — поиск компактнее */
@media (max-width: 380px) {
    .search-bar > .btn {
        padding: 0 .65rem !important;
        font-size: .78rem !important;
    }
}
