:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1a1d21;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --accent: #10b981;
  --shadow: 0 4px 16px rgba(0,0,0,.08);
}
[data-theme="dark"] {
  --bg: #0f1216;
  --surface: #1a1f26;
  --text: #e8eaed;
  --muted: #9aa4b2;
  --border: #2a313a;
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --accent: #34d399;
  --shadow: 0 4px 20px rgba(0,0,0,.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background .25s, color .25s;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.2rem; }
.logo { font-size: 1.4rem; }
.actions { display: flex; gap: 10px; }
.icon-btn {
  position: relative;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text); border-radius: 10px;
  padding: 8px 12px; cursor: pointer; font-size: 1rem;
  transition: background .2s, transform .1s;
}
.icon-btn:hover { background: var(--border); }
.icon-btn:active { transform: scale(.95); }
.badge {
  position: absolute; top: -6px; right: -6px;
  background: var(--accent); color: #fff;
  font-size: .7rem; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* Container / grid */
.container { max-width: 1000px; margin: 0 auto; padding: 24px 20px 60px; }
.page-title { font-size: 1.5rem; margin-bottom: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .15s;
}
.card:hover { transform: translateY(-3px); }
.card .thumb { font-size: 3rem; text-align: center; padding: 28px 0; background: var(--bg); }
.card-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-name { font-weight: 600; }
.card-desc { font-size: .85rem; color: var(--muted); flex: 1; }
.card-price { font-weight: 700; color: var(--primary); font-size: 1.05rem; }
.btn-add {
  background: var(--primary); color: #fff; border: none;
  border-radius: 10px; padding: 10px; cursor: pointer; font-weight: 600;
  transition: background .2s;
}
.btn-add:hover { background: var(--primary-hover); }

/* Drawer */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 30; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%;
  width: min(400px, 90vw); background: var(--surface);
  border-left: 1px solid var(--border); z-index: 40;
  transform: translateX(100%); transition: transform .28s ease;
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px; border-bottom: 1px solid var(--border);
}
.cart-items { flex: 1; overflow-y: auto; padding: 12px 18px; }
.cart-line {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.cart-line .ci-emoji { font-size: 1.6rem; }
.cart-line .ci-info { flex: 1; }
.cart-line .ci-name { font-weight: 600; font-size: .95rem; }
.cart-line .ci-price { color: var(--muted); font-size: .85rem; }
.qty { display: flex; align-items: center; gap: 6px; }
.qty button {
  width: 26px; height: 26px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg);
  color: var(--text); cursor: pointer; font-weight: 700;
}
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.drawer-foot { padding: 18px; border-top: 1px solid var(--border); }
.total-row { display: flex; justify-content: space-between; margin-bottom: 14px; font-size: 1.1rem; }
.btn-primary {
  width: 100%; background: var(--accent); color: #fff; border: none;
  border-radius: 10px; padding: 13px; font-weight: 700; cursor: pointer;
  font-size: 1rem; transition: opacity .2s;
}
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary:not(:disabled):hover { opacity: .9; }
.hint { font-size: .78rem; color: var(--muted); margin-top: 10px; text-align: center; }

/* Modal */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.5);
}
.modal-card {
  background: var(--surface); border-radius: 16px; padding: 32px 28px;
  width: min(360px, 90vw); text-align: center; box-shadow: var(--shadow);
}
.status-icon { font-size: 3rem; margin-bottom: 12px; }
.modal-card h3 { margin-bottom: 8px; }
.modal-card p { color: var(--muted); margin-bottom: 20px; font-size: .9rem; }

.hidden { display: none !important; }
