* { box-sizing: border-box; margin: 0; padding: 0; }

:root, body.theme-dark {
    --bg: #0e0e10;
    --card: #1a1a1e;
    --accent: #4ea1ff;
    --text: #ffffff;
    --muted: #8e8e93;
    --border: #2a2a30;
    --modal-bg: #ffffff;
    --modal-text: #1a1a1e;
    --modal-muted: #8e8e93;
}

body.theme-light {
    --bg: #f5f5f7;
    --card: #ffffff;
    --accent: #4ea1ff;
    --text: #1a1a1e;
    --muted: #8e8e93;
    --border: #e0e0e5;
    --modal-bg: #ffffff;
    --modal-text: #1a1a1e;
    --modal-muted: #8e8e93;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
    padding-bottom: 80px;
    overflow-x: hidden;
    transition: background 0.3s, color 0.3s;
}

.top-bar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px; background: var(--bg);
    position: sticky; top: 0; z-index: 10; font-size: 14px;
    transition: background 0.3s;
}
#city-label { color: var(--muted); }
.logo { color: var(--accent); font-weight: 700; letter-spacing: 1px; }
#content { padding: 10px 14px; }

.categories { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 18px; scrollbar-width: none; }
.categories::-webkit-scrollbar { display: none; }
.cat-btn {
    background: var(--card); color: var(--text); border: 1px solid var(--border);
    padding: 8px 16px; border-radius: 20px; font-size: 13px;
    white-space: nowrap; cursor: pointer; transition: 0.2s;
}
.cat-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.products-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.product-card {
    background: var(--card); border-radius: 16px; overflow: hidden;
    display: flex; flex-direction: column; border: 1px solid var(--border);
}
.product-card img { width: 100%; height: 150px; object-fit: cover; background: #232328; }
.product-info {
    padding: 10px 12px; flex-grow: 1;
    display: flex; flex-direction: column; justify-content: space-between;
}
.product-name { font-size: 13px; font-weight: 500; line-height: 1.3; margin-bottom: 8px; }
.product-price { color: var(--accent); font-size: 17px; font-weight: 700; }
.product-actions { display: flex; gap: 6px; padding: 0 12px 12px; }
.btn-buy, .btn-fav {
    flex: 1; padding: 9px; border-radius: 10px; border: none;
    font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn-buy { background: var(--accent); color: #fff; }
.btn-fav { background: var(--border); color: var(--text); max-width: 42px; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); font-size: 15px; }
.empty-icon { font-size: 60px; margin-bottom: 16px; opacity: 0.4; }

.cart-item {
    display: flex; background: var(--card); border-radius: 14px;
    padding: 10px; margin-bottom: 10px; gap: 10px; border: 1px solid var(--border);
}
.cart-item-info { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.cart-item-name { font-size: 14px; margin-bottom: 4px; }
.cart-item-price { color: var(--accent); font-weight: 600; font-size: 14px; }
.cart-remove { background: transparent; border: none; color: #ff5c5c; font-size: 22px; padding: 8px; cursor: pointer; align-self: center; }
.cart-total { background: var(--card); border-radius: 14px; padding: 16px; margin-top: 14px; border: 1px solid var(--border); }
.cart-total-row { display: flex; justify-content: space-between; font-size: 18px; font-weight: 700; margin-bottom: 14px; }
.cart-total-row span:last-child { color: var(--accent); }
.btn-checkout {
    width: 100%; background: var(--accent); color: #fff; border: none;
    padding: 14px; border-radius: 12px; font-size: 15px; font-weight: 700; cursor: pointer;
}

/* ===== ПРОФИЛЬ ===== */
.profile-header {
    display: flex; align-items: center; gap: 14px;
    background: var(--card); border-radius: 16px;
    padding: 16px; margin-bottom: 14px; border: 1px solid var(--border);
}
.profile-avatar-img {
    width: 64px; height: 64px; border-radius: 50%;
    background: var(--accent); color: #fff;
    font-size: 26px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; flex-shrink: 0;
}
.profile-avatar-img img { width: 100%; height: 100%; object-fit: cover; }
.profile-info { flex: 1; }
.profile-name { font-size: 17px; font-weight: 700; margin-bottom: 2px; }
.profile-id { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.profile-phone { color: var(--muted); font-size: 12px; }

.profile-menu {
    background: var(--card); border-radius: 16px;
    padding: 14px 16px; margin-bottom: 12px;
    border: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
    cursor: pointer;
}
.profile-menu-icon {
    width: 40px; height: 40px; border-radius: 10px;
    background: rgba(78, 161, 255, 0.15);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}
.profile-menu-text { flex: 1; }
.profile-menu-title { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.profile-menu-sub { font-size: 12px; color: var(--muted); }

.profile-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
    margin-bottom: 16px;
}
.profile-tile {
    background: var(--card); border-radius: 16px;
    padding: 18px 12px; border: 1px solid var(--border);
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    cursor: pointer;
}
.profile-tile-icon { font-size: 26px; }
.profile-tile-label { font-size: 13px; font-weight: 500; }

.recent-title { font-size: 15px; font-weight: 700; margin: 18px 0 10px; color: var(--muted); }
.recent-scroll { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.recent-scroll::-webkit-scrollbar { display: none; }
.recent-card {
    background: var(--card); border-radius: 14px;
    min-width: 120px; height: 120px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); font-size: 40px;
}

/* ===== МОДАЛЬНОЕ ОКНО НАСТРОЕК ===== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex; align-items: flex-end;
    z-index: 100;
    animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
    background: var(--modal-bg);
    color: var(--modal-text);
    width: 100%;
    border-radius: 24px 24px 0 0;
    padding: 24px 20px;
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.25s;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 6px;
}
.modal-header h2 { font-size: 20px; font-weight: 700; }
.modal-close {
    background: transparent; border: none;
    font-size: 22px; cursor: pointer;
    color: var(--modal-text); padding: 4px 8px;
}
.modal-subtitle {
    color: var(--modal-muted); font-size: 14px;
    margin-bottom: 24px;
}
.modal-section { margin-bottom: 24px; }
.modal-label {
    font-size: 12px; font-weight: 700;
    color: var(--modal-muted); letter-spacing: 1px;
    margin-bottom: 12px;
}
.theme-switch {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.theme-btn {
    background: #f5f5f7; color: #1a1a1e;
    border: 2px solid #e0e0e5;
    border-radius: 16px; padding: 18px 12px;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    cursor: pointer; font-family: inherit; font-size: 14px; font-weight: 500;
    transition: 0.2s;
}
.theme-btn .theme-icon { font-size: 28px; }
.theme-btn.active {
    border-color: var(--accent);
    background: rgba(78, 161, 255, 0.1);
    color: var(--accent);
}
.contact-row {
    background: #f5f5f7; color: #1a1a1e;
    border: 1px solid #e0e0e5;
    border-radius: 14px; padding: 14px 16px;
    display: flex; align-items: center; gap: 10px;
    font-size: 15px;
}

/* ===== НИЖНЯЯ НАВИГАЦИЯ ===== */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--card);
    display: grid; grid-template-columns: repeat(4, 1fr);
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    z-index: 50;
}
.nav-btn {
    background: none; border: none; color: var(--muted);
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px; cursor: pointer; font-family: inherit;
}
.nav-btn span { font-size: 20px; }
.nav-btn small { font-size: 10px; }
.nav-btn.active { color: var(--accent); }

.pickup-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: flex; align-items: flex-end; z-index: 100; }
.pickup-content {
    background: var(--card); width: 100%; border-radius: 20px 20px 0 0;
    padding: 24px 20px; padding-bottom: calc(24px + env(safe-area-inset-bottom));
    color: var(--text);
}
.pickup-title { font-size: 17px; font-weight: 700; margin-bottom: 18px; text-align: center; }
.pickup-btn {
    display: block; width: 100%; background: var(--bg); color: var(--text);
    border: 1px solid var(--border); padding: 14px; border-radius: 12px;
    margin-bottom: 10px; font-size: 15px; text-align: left; cursor: pointer;
}
.toast {
    position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
    background: var(--accent); color: #fff; padding: 12px 24px;
    border-radius: 12px; font-size: 14px; z-index: 200;
}
.admin-entry{display:flex;align-items:center;gap:14px;background:linear-gradient(135deg,#1e1b4b 0%,#312e81 100%);border:1px solid rgba(139,92,246,.35);border-radius:18px;padding:16px 18px;margin-top:22px;cursor:pointer;box-shadow:0 8px 24px rgba(99,102,241,.15)}
.admin-entry:active{transform:scale(.98)}
.admin-entry-icon{width:46px;height:46px;border-radius:14px;background:linear-gradient(135deg,#8b5cf6,#6366f1);display:flex;align-items:center;justify-content:center;font-size:22px;box-shadow:0 4px 12px rgba(139,92,246,.4)}
.admin-entry-text{flex:1}
.admin-entry-title{font-size:15px;font-weight:700;color:#fff}
.admin-entry-sub{font-size:12px;color:rgba(255,255,255,.6);margin-top:2px}
.admin-entry-arrow{font-size:24px;color:#a78bfa;font-weight:300}
.admin-topbar{display:flex;align-items:center;gap:14px;margin-bottom:24px}
.admin-back{width:42px;height:42px;border-radius:14px;background:var(--card);border:1px solid var(--border);color:var(--text);font-size:20px;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0}
.admin-back:active{background:var(--border)}
.admin-title-wrap{flex:1}
.admin-title{font-size:22px;font-weight:800;letter-spacing:-.5px}
.admin-subtitle{font-size:12px;color:var(--muted);margin-top:2px}
.admin-hero{background:linear-gradient(135deg,#6366f1 0%,#8b5cf6 50%,#a855f7 100%);border-radius:22px;padding:26px 20px;text-align:center;margin-bottom:28px;box-shadow:0 12px 32px rgba(139,92,246,.35);position:relative;overflow:hidden}
.admin-hero:before{content:"";position:absolute;top:-50%;right:-20%;width:180px;height:180px;background:rgba(255,255,255,.08);border-radius:50%}
.admin-hero-icon{font-size:38px;margin-bottom:10px;position:relative}
.admin-hero-title{font-size:20px;font-weight:800;color:#fff;letter-spacing:.5px;position:relative}
.admin-hero-sub{font-size:12px;color:rgba(255,255,255,.85);margin-top:4px;position:relative}
.admin-section-title{font-size:11px;font-weight:800;color:var(--muted);letter-spacing:1.5px;margin:24px 4px 12px}
.admin-list{background:var(--card);border:1px solid var(--border);border-radius:18px;overflow:hidden;box-shadow:0 4px 16px rgba(0,0,0,.06)}
.admin-row{display:flex;align-items:center;gap:14px;padding:16px;cursor:pointer;border-bottom:1px solid var(--border);transition:background .15s}
.admin-row:last-child{border-bottom:none}
.admin-row:active{background:var(--border)}
.admin-row-icon{width:46px;height:46px;border-radius:14px;display:flex;align-items:center;justify-content:center;font-size:22px;flex-shrink:0}
.icon-add{background:linear-gradient(135deg,#3b82f6,#2563eb);box-shadow:0 4px 12px rgba(59,130,246,.35)}
.icon-list{background:linear-gradient(135deg,#f59e0b,#d97706);box-shadow:0 4px 12px rgba(245,158,11,.35)}
.icon-orders{background:linear-gradient(135deg,#8b5cf6,#7c3aed);box-shadow:0 4px 12px rgba(139,92,246,.35)}
.icon-stats{background:linear-gradient(135deg,#10b981,#059669);box-shadow:0 4px 12px rgba(16,185,129,.35)}
.admin-row-text{flex:1}
.admin-row-title{font-size:15px;font-weight:700;margin-bottom:2px}
.admin-row-sub{font-size:12px;color:var(--muted)}
.admin-row-arrow{font-size:24px;color:var(--muted);font-weight:300}
.admin-hint{margin-top:26px;padding:16px 18px;background:linear-gradient(135deg,rgba(99,102,241,.12),rgba(139,92,246,.08));border:1px solid rgba(139,92,246,.25);border-radius:16px;font-size:13px;color:var(--muted);line-height:1.55}
.promo-form{background:var(--card);border:1px solid var(--border);border-radius:18px;padding:18px;margin-bottom:20px;box-shadow:0 4px 16px rgba(0,0,0,.06)}
.promo-field{margin-bottom:14px}
.promo-label{font-size:11px;font-weight:700;color:var(--muted);letter-spacing:1px;margin-bottom:8px;display:block}
.promo-input{width:100%;background:var(--bg);border:1px solid var(--border);color:var(--text);padding:13px 15px;border-radius:12px;font-size:15px;font-family:inherit;outline:none;transition:border-color .2s}
.promo-input:focus{border-color:#8b5cf6}
.promo-btn{width:100%;background:linear-gradient(135deg,#8b5cf6,#6366f1);color:#fff;border:none;padding:15px;border-radius:12px;font-size:15px;font-weight:700;cursor:pointer;box-shadow:0 4px 14px rgba(139,92,246,.4);transition:transform .15s}
.promo-btn:active{transform:scale(.98)}
.promo-item{display:flex;align-items:center;gap:12px;background:var(--card);border:1px solid var(--border);border-radius:14px;padding:14px 16px;margin-bottom:10px}
.promo-item-code{flex:1}
.promo-item-title{font-size:15px;font-weight:800;letter-spacing:1px;color:#a78bfa;margin-bottom:2px}
.promo-item-sub{font-size:12px;color:var(--muted)}
.promo-item-del{background:rgba(239,68,68,.15);border:none;color:#ef4444;width:36px;height:36px;border-radius:10px;font-size:16px;cursor:pointer}

.promo-input[type="tel"] { letter-spacing: 2px; font-size: 16px; }
