:root {
  --green: #0d7a4f;
  --green-dark: #095c3c;
  --bg: #f7f8f6;
  --card: #ffffff;
  --border: #e4e7e2;
  --text: #1a1f1c;
  --muted: #6b756f;
  --radius: 14px;
}

* { box-sizing: border-box; }

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  font-weight: 800;
  font-size: 20px;
  color: var(--green-dark);
}
.logo span { color: var(--muted); font-weight: 500; }

nav { display: flex; gap: 24px; }
nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}
nav a.active, nav a:hover { color: var(--green-dark); border-bottom-color: var(--green); }

.cart-badge {
  font-weight: 700;
  background: var(--green);
  color: white;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 14px;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 32px;
  padding: 32px;
  max-width: 1200px;
  margin: 0 auto;
  align-items: start;
}

h1 { font-size: 24px; margin-bottom: 4px; }
.subtitle { color: var(--muted); margin-top: 0; margin-bottom: 24px; font-size: 14px; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-emoji { font-size: 40px; }
.product-store {
  font-size: 11px;
  font-weight: 700;
  color: var(--green-dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.product-name { font-weight: 600; font-size: 14px; min-height: 38px; }
.product-price { font-weight: 800; font-size: 16px; }
.product-stock { font-size: 12px; color: var(--muted); }

.add-btn {
  margin-top: auto;
  background: var(--green);
  color: white;
  border: none;
  padding: 10px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
}
.add-btn:hover { background: var(--green-dark); }
.add-btn:disabled { background: #ccc; cursor: not-allowed; }

.cart-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: sticky;
  top: 90px;
}
.cart-section h2 { margin-top: 0; font-size: 16px; }

.cart-items { display: flex; flex-direction: column; gap: 10px; min-height: 40px; margin-bottom: 12px; }
.cart-empty { color: var(--muted); font-size: 13px; }

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.cart-item-name { font-weight: 600; }
.cart-item-store { color: var(--muted); font-size: 11px; }
.remove-btn { background: none; border: none; color: #c0392b; cursor: pointer; font-size: 16px; }

.cart-total {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  padding: 12px 0;
  border-top: 2px solid var(--border);
}

.checkout-btn {
  width: 100%;
  background: var(--green-dark);
  color: white;
  border: none;
  padding: 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.checkout-btn:disabled { background: #ccc; cursor: not-allowed; }

.hint { font-size: 11px; color: var(--muted); margin-top: 10px; line-height: 1.5; }

.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal.hidden { display: none; }
.modal-content {
  background: white;
  border-radius: var(--radius);
  padding: 28px;
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}

.suborder-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-top: 12px;
}
.suborder-title { font-weight: 700; font-size: 14px; color: var(--green-dark); }
.suborder-row { display: flex; justify-content: space-between; font-size: 13px; margin-top: 6px; color: var(--muted); }
.suborder-row strong { color: var(--text); }

.close-modal-btn {
  margin-top: 20px;
  width: 100%;
  padding: 12px;
  background: var(--text);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

/* Store panel & admin */
.panel-container { max-width: 900px; margin: 32px auto; padding: 0 32px; }
.store-select { padding: 10px; border-radius: 8px; border: 1px solid var(--border); font-size: 14px; margin-bottom: 20px; }

table { width: 100%; border-collapse: collapse; background: white; border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 12px 14px; font-size: 13px; border-bottom: 1px solid var(--border); }
th { background: #f0f2f0; font-weight: 700; color: var(--muted); text-transform: uppercase; font-size: 11px; }

.status-badge {
  padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700;
  background: #e6f4ec; color: var(--green-dark);
}

.summary-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; margin-bottom: 28px; }
.summary-card { background: white; border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.summary-card .label { font-size: 12px; color: var(--muted); font-weight: 600; }
.summary-card .value { font-size: 22px; font-weight: 800; margin-top: 4px; color: var(--green-dark); }
