:root {
  --accent: #ffab91;
  --accent-dark: #f28b6d;
  --accent-text: #ffffff;
  --green: #2a9d5c;
  --pink: #ff6b6b;
  --bg: #f5f5f7;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #8e8e93;
  --border: #e8e8ed;
  --danger: #e05252;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-hover: 0 6px 20px rgba(0,0,0,0.10);
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.main { flex: 1; padding: 20px 16px 48px; min-height: 60vh; }

h1 { font-size: 1.7rem; font-weight: 800; margin-bottom: 16px; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 12px; }
.section-title { margin: 28px 0 14px; font-weight: 800; }
.muted { color: var(--muted); font-size: 0.88rem; }
.empty { padding: 32px 0; color: var(--muted); text-align: center; }
.back-link { display: inline-block; margin-bottom: 16px; font-weight: 600; color: var(--text); }

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

/* ---------- Header ---------- */
.header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.header-inner { display: flex; align-items: center; gap: 16px; height: 64px; }
.logo { font-size: 1.4rem; font-weight: 800; color: var(--text); display: flex; align-items: center; gap: 8px; letter-spacing: -0.03em; }
.logo-icon { font-size: 1.6rem; }

.burger {
  display: none; margin-left: auto;
  background: var(--bg); border: none; border-radius: 10px;
  font-size: 1.3rem; padding: 8px 12px; cursor: pointer; color: var(--text);
}

.nav { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.nav a {
  padding: 9px 14px; border-radius: 12px; color: var(--text);
  font-size: 0.95rem; font-weight: 500; white-space: nowrap;
  transition: background 0.15s;
}
.nav a:hover { background: var(--bg); }
.nav-courier { color: #7c5cbf !important; font-weight: 700; }
.nav-admin { color: var(--danger) !important; font-weight: 700; }
.nav-cart { position: relative; font-weight: 600; }
.badge {
  background: var(--accent); color: var(--accent-text); border-radius: 12px;
  font-size: 0.75rem; font-weight: 700; padding: 1px 8px; margin-left: 2px;
}
.nav-logout { color: var(--muted); }
.nav-user { font-weight: 600; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; background: var(--accent); color: var(--accent-text);
  border: none; border-radius: 14px; padding: 11px 20px;
  font-size: 0.95rem; font-weight: 700; cursor: pointer; text-align: center;
  transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: var(--accent-dark); }
.btn:active { transform: scale(0.98); }
.btn-small { padding: 7px 14px; font-size: 0.85rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-outline {
  background: var(--card); color: var(--text); border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--accent); background: #fdf0ea; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c74545; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #238049; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(120deg, #ffd9c2 0%, #ffb59e 55%, #ff9e7d 100%);
  color: #fff; border-radius: 24px;
  padding: 40px 28px; margin-bottom: 24px; text-align: center;
  box-shadow: var(--shadow);
}
.hero h1 { color: #fff; margin-bottom: 10px; font-size: 1.8rem; }
.hero p { opacity: 0.85; font-size: 1.02rem; }

/* ---------- Category chips ---------- */
.chips {
  display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px;
  margin-bottom: 20px; scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 9px 18px; border-radius: 30px;
  background: var(--card); border: 1.5px solid var(--border);
  font-size: 0.9rem; font-weight: 600; color: var(--text); white-space: nowrap;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent-dark); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

/* ---------- Filters ---------- */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px;
}
.filters input[type="search"], .filters select {
  flex: 1; min-width: 180px; padding: 12px 16px;
  border: 1.5px solid var(--border); border-radius: 14px;
  font-size: 1rem; background: var(--card); font-family: inherit;
}
.filters .btn { flex: 0 0 auto; }

input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
input[type="number"], input[type="url"], input[type="search"], select, textarea {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border);
  border-radius: 12px; font-size: 1rem; background: #fff; font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,171,145,0.3);
}
label { display: block; margin-bottom: 12px; font-weight: 600; font-size: 0.9rem; }
label small { font-weight: 400; color: var(--muted); }
label.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; }
label.checkbox input { width: auto; accent-color: var(--accent); }
input[type="checkbox"] { accent-color: var(--accent); }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.form-row label { margin-bottom: 0; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; }
.inline-form select { width: auto; padding: 6px 10px; font-size: 0.85rem; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.card h2 { margin-bottom: 14px; }

.auth-card {
  max-width: 440px; margin: 40px auto; background: var(--card);
  border: 1px solid var(--border); border-radius: 24px; padding: 32px;
  box-shadow: var(--shadow);
}
.auth-card h1 { text-align: center; font-size: 1.8rem; }
.auth-card form { margin-top: 16px; }

/* ---------- Dish grid (Yandex Eats style) ---------- */
.dish-grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.dish-card {
  background: var(--card); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: var(--shadow); transition: transform 0.15s, box-shadow 0.15s;
}
.dish-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }

.dish-photo {
  display: block; aspect-ratio: 4/3; position: relative;
  background: linear-gradient(135deg, #ffd9c2, #ffc4a8);
  overflow: hidden;
}
.dish-photo img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; transition: transform 0.3s; }
.dish-card:hover .dish-photo img { transform: scale(1.05); }
.dish-photo.no-img { background: linear-gradient(135deg, #ffd9c2, #ffc4a8); }
.dish-initial {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 3.2rem; font-weight: 800; color: rgba(0,0,0,0.15);
  pointer-events: none;
}
.dish-photo.has-photo .dish-initial { display: none; }
.dish-photo.large { max-width: 460px; width: 100%; border-radius: var(--radius); }
.dish-photo.large .dish-initial { font-size: 5rem; }

.dish-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.dish-body h3 { font-size: 1.05rem; font-weight: 700; }
.dish-body h3 a { color: var(--text); }
.dish-body h3 a:hover { color: var(--accent-dark); }
.dish-desc { color: var(--muted); font-size: 0.85rem; flex: 1; line-height: 1.4; }
.dish-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }

.tag-chip {
  display: inline-block; background: #fdf0ea; color: #c96f4a;
  font-size: 0.72rem; padding: 4px 10px; border-radius: 20px; font-weight: 600;
  width: fit-content;
}
.price { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; }
.price-big { font-size: 1.6rem; }
.rating { color: #f5a623; font-size: 0.85rem; font-weight: 600; }
.rating small { color: var(--muted); font-weight: 400; }
.add-form { display: flex; }
.add-form .btn { border-radius: 12px; padding: 8px 14px; }

/* ---------- Dish detail ---------- */
.dish-detail {
  display: grid; gap: 28px; margin-bottom: 32px;
  grid-template-columns: 1fr;
}
.dish-info h1 { margin: 8px 0 12px; font-size: 1.8rem; }
.dish-info p { color: var(--muted); }
.dish-actions { display: flex; align-items: center; gap: 18px; margin-top: 22px; flex-wrap: wrap; }
.dish-actions .btn { padding: 13px 28px; font-size: 1rem; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.table th { background: var(--bg); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafafa; }
.col-qty { width: 110px; }
.col-price { width: 110px; text-align: right; white-space: nowrap; font-weight: 600; }
.thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 10px; }

.table-wrap { overflow-x: auto; }
@media (max-width: 700px) {
  .table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* ---------- Status badges ---------- */
.status {
  display: inline-block; padding: 4px 12px; border-radius: 20px;
  font-size: 0.78rem; font-weight: 700; white-space: nowrap;
}
.status-pending { background: #fff3d6; color: #8a6d00; }
.status-preparing { background: #e3f0ff; color: #1a5fb4; }
.status-ready { background: #d9f5e3; color: #1a7a3c; }
.status-accepted { background: #e0f2f1; color: #00695c; }
.status-delivering { background: #ede9fe; color: #5b21b6; }
.status-delivered { background: #d9f5e3; color: #1a7a3c; }
.status-cancelled { background: #fdecea; color: #b3261e; }

/* ---------- Alerts ---------- */
.alert { padding: 13px 18px; border-radius: 14px; margin-bottom: 16px; font-size: 0.93rem; font-weight: 500; }
.alert-success { background: #d9f5e3; color: #1a7a3c; }
.alert-error { background: #fdecea; color: #b3261e; }

/* ---------- Cart ---------- */
.qty-form { display: flex; gap: 6px; align-items: center; }
.qty-form input { width: 64px; padding: 8px; text-align: center; }
.cart-summary { max-width: 440px; margin-left: auto; }
.summary-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 0.98rem; }
.summary-row.total { font-weight: 800; font-size: 1.15rem; border-top: 2px solid var(--border); margin-top: 10px; padding-top: 12px; }
.cart-summary .btn { margin-top: 14px; }

/* ---------- Checkout / forms ---------- */
.checkout-form { display: grid; gap: 18px; grid-template-columns: 1fr; max-width: 680px; }
@media (min-width: 800px) {
  .checkout-form { grid-template-columns: 1fr 1.3fr; align-items: start; }
}
.dish-form { display: grid; gap: 4px; }
.card-form { display: grid; gap: 4px; max-width: 560px; }
#map { max-width: 100%; overflow: hidden; border-radius: 14px; }

/* ---------- Profile ---------- */
.profile-grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 800px) { .profile-grid { grid-template-columns: 1fr 1fr; } }

/* ---------- Reviews ---------- */
.review { background: var(--card); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.review-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.review p { margin-top: 6px; }
.admin-reply { margin-top: 12px; padding: 12px 14px; background: #fdf6e3; border-radius: 12px; font-size: 0.9rem; }
.review-admin .card-form { margin-top: 12px; }

/* ---------- Order ---------- */
.order-grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 800px) { .order-grid { grid-template-columns: 1.4fr 1fr; align-items: start; } }
.order-card { margin-bottom: 16px; }
.order-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 10px; }
.order-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.order-actions select, .order-actions input { width: auto; padding: 7px 12px; font-size: 0.88rem; }
.order-admin .order-actions { margin-top: 12px; }
.order-map { border-radius: 12px; overflow: hidden; }

/* ---------- Admin ---------- */
.admin-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.stats-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); margin-bottom: 26px; }
.stat { text-align: center; padding: 22px 12px; }
.stat-num { display: block; font-size: 1.6rem; font-weight: 800; color: var(--accent-dark); letter-spacing: -0.02em; }
.stat span:last-child { font-size: 0.82rem; color: var(--muted); font-weight: 600; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); background: var(--card); margin-top: auto; }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 26px 16px; font-size: 0.88rem; color: var(--muted); }
.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--muted); font-weight: 500; }
.footer-links a:hover { color: var(--text); }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .burger { display: block; }
  .nav {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    background: var(--card); border-bottom: 1px solid var(--border);
    flex-direction: column; align-items: stretch; padding: 12px 16px 18px; gap: 4px;
    box-shadow: var(--shadow-hover);
  }
  .nav.open { display: flex; }
  .nav a { padding: 13px 10px; border-radius: 10px; font-size: 1rem; }
  .dish-detail { grid-template-columns: 1fr; }
  .dish-photo.large { max-width: 100%; }
  .dish-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
  .hero { padding: 30px 18px; }
  .hero h1 { font-size: 1.5rem; }
  h1 { font-size: 1.45rem; }
  .cart-table td, .cart-table th { padding: 9px 6px; font-size: 0.88rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 761px) and (max-width: 1024px) {
  .dish-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
  .dish-detail { grid-template-columns: 1fr 1.2fr; }
}
@media (min-width: 1025px) {
  .dish-detail { grid-template-columns: 440px 1fr; }
}
