/* Cafe Du Vent — mobile-first, no external fonts or CDNs */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --brown: #6b4226;
  --brown-dark: #4e2e18;
  --cream: #faf6ef;
  --card: #ffffff;
  --ink: #2b2118;
  --muted: #8a7a6a;
  --line: #eadfd2;
  --accent: #c2703d;
  --green: #2e7d4f;
  --red: #c0392b;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(60, 35, 10, .10);
}
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.45;
}
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 16px; }

/* ---------- header ---------- */
.topbar {
  background: linear-gradient(135deg, var(--brown-dark), var(--brown));
  color: #fff;
  padding: 16px 16px 12px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 22px; letter-spacing: .5px; }
.topbar .sub { font-size: 13px; opacity: .9; margin-top: 2px; }
.topbar .sub a { color: #ffe1b8; text-decoration: none; }
.top-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.cart-btn {
  position: relative; flex: none;
  background: #fff; color: var(--brown-dark);
  border: none; border-radius: 999px; padding: 10px 16px;
  font-size: 15px; font-weight: 700;
}
.cart-btn .badge {
  position: absolute; top: -7px; right: -5px;
  background: var(--red); color: #fff; border-radius: 999px;
  min-width: 22px; height: 22px; line-height: 22px; text-align: center;
  font-size: 12px; padding: 0 5px;
}

/* ---------- search + chips ---------- */
.toolbar { padding: 12px 12px 0; max-width: 760px; margin: 0 auto; }
.search {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 999px; background: #fff; outline: none;
}
.search:focus { border-color: var(--accent); }
.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 12px 2px 4px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: #fff;
  border-radius: 999px; padding: 8px 14px; font-size: 14px; color: var(--ink);
}
.chip.active { background: var(--brown); color: #fff; border-color: var(--brown); }

/* ---------- menu grid (2 columns) ---------- */
.menu { max-width: 760px; margin: 0 auto; padding: 8px 12px 120px; }
.cat-title { font-size: 18px; margin: 18px 2px 10px; color: var(--brown-dark); }
.cat-desc { font-size: 13px; color: var(--muted); margin: -6px 2px 10px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid #f0e7da;
  text-align: left; padding: 0; width: 100%;
}
.card img { width: 100%; height: 132px; object-fit: cover; background: #eee; }
.card .body { padding: 10px 11px 12px; }
.card .name { font-size: 14.5px; font-weight: 700; line-height: 1.3; min-height: 38px; }
.card .desc { font-size: 12px; color: var(--muted); margin-top: 3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .price { color: var(--accent); font-weight: 800; font-size: 15px; margin-top: 7px; }
.card.unavailable { opacity: .55; }
.card.unavailable .price { color: var(--muted); text-decoration: line-through; }
.soldout {
  display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 700;
  color: var(--red); border: 1px solid var(--red); border-radius: 999px; padding: 2px 8px;
}
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

/* ---------- bottom sheets / overlays ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(30, 18, 8, .55);
  z-index: 40; display: none;
}
.overlay.open { display: block; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  background: #fff; border-radius: 20px 20px 0 0;
  max-height: 92vh; overflow-y: auto; padding: 0 16px 24px;
  transform: translateY(100%); transition: transform .25s ease;
  max-width: 760px; margin: 0 auto;
}
.sheet.open { transform: translateY(0); }
.sheet .grab { width: 44px; height: 5px; border-radius: 999px; background: #ddd; margin: 10px auto 4px; }
.sheet img.hero { width: 100%; height: 220px; object-fit: cover; border-radius: 12px; margin-top: 8px; }
.sheet h2 { font-size: 20px; margin-top: 12px; }
.sheet .price-big { color: var(--accent); font-weight: 800; font-size: 18px; margin-top: 4px; }
.sheet .desc { color: var(--muted); font-size: 14px; margin-top: 6px; }
.opt-label { font-size: 13px; font-weight: 700; color: var(--muted); margin: 16px 0 6px; text-transform: uppercase; letter-spacing: .4px; }
.opt-row { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 8px 13px; font-size: 14px;
}
.opt.active { background: var(--brown); color: #fff; border-color: var(--brown); }
.note-input, .text-input, .num-input, .select-input {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; outline: none;
}
.note-input:focus, .text-input:focus, .num-input:focus, .select-input:focus { border-color: var(--accent); }
.qty-row { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.qty-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; font-size: 20px; font-weight: 700; line-height: 1;
}
.qty-num { font-size: 18px; font-weight: 800; min-width: 28px; text-align: center; }
.btn-primary {
  width: 100%; background: var(--brown); color: #fff; border: none;
  border-radius: 12px; padding: 14px; font-size: 16px; font-weight: 800; margin-top: 18px;
}
.btn-primary:disabled { opacity: .5; }
.btn-ghost {
  width: 100%; background: #fff; color: var(--brown-dark);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  font-size: 15px; font-weight: 700; margin-top: 10px;
}
.btn-danger { background: #fff; color: var(--red); border: 1px solid #f0c4bd; border-radius: 10px; padding: 8px 12px; font-size: 14px; font-weight: 700; }
.btn-small { background: var(--brown); color: #fff; border: none; border-radius: 10px; padding: 8px 14px; font-size: 14px; font-weight: 700; }

/* ---------- cart ---------- */
.cart-line { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-line img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; flex: none; }
.cart-line .info { flex: 1; min-width: 0; }
.cart-line .name { font-weight: 700; font-size: 15px; }
.cart-line .opts { font-size: 13px; color: var(--muted); margin-top: 2px; }
.cart-line .row2 { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.cart-line .line-total { font-weight: 800; color: var(--accent); }
.qty-mini { display: flex; align-items: center; gap: 10px; }
.qty-mini button { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: #fff; font-size: 16px; }
.cart-total { display: flex; justify-content: space-between; font-size: 18px; font-weight: 800; padding: 14px 0 4px; }
.field-label { font-size: 13px; font-weight: 700; color: var(--muted); margin: 12px 0 5px; }
.order-code {
  font-size: 30px; font-weight: 800; letter-spacing: 2px; text-align: center;
  color: var(--brown-dark); background: var(--cream);
  border: 2px dashed var(--accent); border-radius: 12px; padding: 16px 8px; margin: 16px 0 8px;
}
.order-note { text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- admin ---------- */
.admin-wrap { max-width: 860px; margin: 0 auto; padding: 16px 14px 60px; }
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.admin-head h1 { font-size: 20px; }
.tabs { display: flex; gap: 8px; margin: 16px 0; }
.tab {
  flex: 1; padding: 11px 6px; border: 1px solid var(--line); background: #fff;
  border-radius: 12px; font-size: 15px; font-weight: 700;
}
.tab.active { background: var(--brown); color: #fff; border-color: var(--brown); }
.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 10px; text-align: center; }
.stat-card .v { font-size: 19px; font-weight: 800; color: var(--accent); }
.stat-card .l { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.panel { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 14px; }
.panel h3 { font-size: 16px; margin-bottom: 10px; }
.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 150px; padding-top: 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar { width: 100%; max-width: 26px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar-col .d { font-size: 10px; color: var(--muted); margin-top: 4px; white-space: nowrap; }
.bar-col .rv { font-size: 9.5px; color: var(--muted); }
.order-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: #fff; }
.order-card .head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.order-card .code { font-weight: 800; }
.order-card .time { font-size: 12.5px; color: var(--muted); }
.order-card .meta { font-size: 13.5px; color: var(--muted); margin-top: 4px; }
.order-card ul { margin: 8px 0 8px 18px; font-size: 14px; }
.order-card .total { font-weight: 800; color: var(--accent); }
.status-pill { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 9px; }
.st-new { background: #fdf0d5; color: #8a5a00; }
.st-preparing { background: #dbeafe; color: #1d4ed8; }
.st-served { background: #dcfce7; color: #166534; }
.st-paid { background: #e0e7ff; color: #3730a3; }
.st-cancelled { background: #fee2e2; color: #991b1b; }
.menu-edit-row { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.menu-edit-row img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; flex: none; }
.menu-edit-row .fields { flex: 1; min-width: 0; display: grid; gap: 6px; }
.menu-edit-row .row2 { display: flex; gap: 6px; }
.menu-edit-row .row2 .num-input { flex: 1; }
.toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.login-box { max-width: 420px; margin: 60px auto 0; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px 20px; }
.login-box h1 { font-size: 20px; margin-bottom: 6px; }
.login-box p { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.err { color: var(--red); font-size: 14px; margin-top: 10px; }
.top-list { list-style: none; }
.top-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.top-list li:last-child { border-bottom: none; }
.save-bar { position: sticky; bottom: 0; background: var(--cream); padding: 12px 0 4px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 8px; }
