:root {
  /* Yandex product palette */
  --brand: #ffcc00;
  --brand-dark: #f5c400;
  --brand-text: #000000;
  --bg: #f5f4f2;
  --surface: #ffffff;
  --text: #21201f;
  --muted: #6e6e6e;
  --border: #e5e3df;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo-link {
  display: flex;
  align-items: center;
}

.logo {
  height: 36px;
  width: auto;
}

.nav {
  display: flex;
  gap: 0.5rem;
  flex: 1;
}

.nav-btn {
  border: none;
  background: transparent;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}

.nav-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.nav-btn.active {
  background: var(--brand);
  color: var(--brand-text);
  font-weight: 600;
}

.user-badge {
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

.view.hidden {
  display: none;
}

h1 {
  margin: 0 0 0.25rem;
  font-size: 1.75rem;
}

.subtitle {
  color: var(--muted);
  margin: 0 0 1.5rem;
}

.loading {
  color: var(--muted);
  padding: 2rem;
  text-align: center;
}

.restaurants {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.card,
.restaurant-card,
.menu-card,
.order-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.restaurant-card {
  padding: 1.25rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.restaurant-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(255, 204, 0, 0.35);
}

.restaurant-card h3 {
  margin: 0 0 0.5rem;
}

.restaurant-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.menu-panel {
  margin-top: 1rem;
}

.menu-panel.hidden,
.cart.hidden,
.hidden {
  display: none !important;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.menu-card {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.menu-card .price {
  font-weight: 700;
  color: var(--brand);
}

.cart {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  width: min(320px, calc(100vw - 2rem));
  padding: 1.25rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border);
  z-index: 20;
}

.cart ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  max-height: 200px;
  overflow-y: auto;
}

.cart li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.cart-total {
  margin: 0 0 1rem;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s, opacity 0.15s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brand);
  color: var(--brand-text);
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-dark);
}

.btn-secondary {
  background: var(--text);
  color: #fff;
  width: 100%;
}

.btn-ghost {
  background: transparent;
  color: #c49000;
  padding-left: 0;
  font-weight: 600;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
}

.form input {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
}

#view-account .card {
  max-width: 400px;
  padding: 1.5rem;
}

#view-account hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

.orders-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.order-card {
  padding: 1.25rem;
}

.order-card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.status {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: #e8f5e9;
  color: #2e7d32;
}

.status.failed,
.status.payment_failed {
  background: #ffebee;
  color: #c62828;
}

.status.pending {
  background: #fff8e1;
  color: #f57f17;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 100;
  max-width: 90vw;
}

.toast.error {
  background: #21201f;
  color: #ffcc00;
}

@media (max-width: 640px) {
  .header {
    flex-wrap: wrap;
  }

  .nav {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .cart {
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
  }
}
