:root {
  --deep-green: #173617;
  --heading-green: #315B26;
  --gold: #D6A62B;
  --ink: #15210F;
  --surface: #ffffff;
  --surface-alt: #F4F6F4;
  --border: #D8DDD8;
  --text: #333333;
  --text-muted: #6b6b6b;
  --danger: #B3261E;
  --done: #2f6b3a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--surface-alt);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------- Header ---------- */

.app-header {
  background: var(--deep-green);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  min-height: 64px;
  gap: 12px;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-title { font-size: 15px; font-weight: 800; letter-spacing: 1px; line-height: 1.1; }
.brand-subtitle { font-size: 11px; color: #E8F0E2; font-weight: 500; line-height: 1.1; }

.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.header-user { font-size: 12px; color: #C9D8C1; display: flex; align-items: center; gap: 4px; }
.btn-icon { background: transparent; border: none; color: white; font-size: 13px; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.btn-icon:hover { background: rgba(255,255,255,0.12); }

/* ---------- Main / Footer ---------- */

.app-main { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 16px; padding-bottom: 90px; }
.app-footer { background: var(--surface); border-top: 1px solid var(--border); text-align: center; font-size: 11px; color: var(--text-muted); padding: 8px 12px; }

/* ---------- Buttons ---------- */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; border-radius: 8px; padding: 12px 18px; font-size: 14px; font-weight: 700; cursor: pointer; width: 100%; }
.btn-primary { background: var(--gold); color: var(--ink); }
.btn-primary:hover { filter: brightness(0.95); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--heading-green); border: 1.5px solid var(--heading-green); }
.btn-outline-danger { background: transparent; color: var(--danger); border: 1.5px solid var(--danger); }

/* ---------- Cards / forms ---------- */

.card { background: var(--surface); border-radius: 12px; padding: 24px 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); margin-top: 16px; }
.card h1, .card h2 { font-size: 18px; margin: 0 0 4px 0; color: var(--heading-green); }
.card p.hint { font-size: 12px; color: var(--text-muted); margin: 0 0 20px 0; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; padding: 11px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 15px; font-family: inherit; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--heading-green); }

.error-box { background: #fdeceb; border: 1px solid var(--danger); color: var(--danger); border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; }
.info-box { background: #fff6e0; border-left: 4px solid var(--gold); border-radius: 6px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; }
.success-box { background: #eaf5ec; border-left: 4px solid var(--done); border-radius: 6px; padding: 14px; font-size: 13px; }

/* ---------- Product search / list ---------- */

.search-row { margin-bottom: 12px; }
.search-row input { width: 100%; padding: 11px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 15px; }

.product-list { display: grid; gap: 8px; }

.product-item { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.product-item .product-body { flex: 1; min-width: 0; }
.product-item .product-name { font-size: 13px; font-weight: 700; }
.product-item .product-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.product-item .product-price { font-size: 12px; color: var(--heading-green); font-weight: 700; margin-top: 2px; }

.qty-control { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.qty-control button { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--heading-green); background: var(--surface); color: var(--heading-green); font-size: 16px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.qty-control button:disabled { opacity: 0.4; cursor: not-allowed; }
.qty-control .qty-value { min-width: 28px; text-align: center; font-size: 13px; font-weight: 700; }

/* ---------- Cart / order summary ---------- */

.cart-bar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--deep-green); color: white; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; box-shadow: 0 -2px 8px rgba(0,0,0,0.15); }
.cart-bar .cart-summary { font-size: 13px; }
.cart-bar .cart-summary b { font-size: 15px; }
.cart-bar .btn { width: auto; padding: 10px 18px; }

.order-line { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.order-line:last-child { border-bottom: none; }
.order-line .order-line-name { font-weight: 700; }
.order-line .order-line-meta { color: var(--text-muted); font-size: 11px; }

.address-option { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1.5px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 8px; cursor: pointer; }
.address-option.is-selected { border-color: var(--gold); background: #fffaf0; }
.address-option input { margin: 0; }
.address-option .address-label { font-size: 13px; }

/* ---------- Empty / loading states ---------- */

.state-box { text-align: center; padding: 40px 16px; color: var(--text-muted); }
.state-box .spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--gold); border-radius: 50%; margin: 0 auto 12px auto; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.link-btn { background: none; border: none; color: var(--heading-green); text-decoration: underline; cursor: pointer; font-size: 13px; padding: 4px; }

.tab-row { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tab-row button { flex: 1; background: none; border: none; padding: 10px; font-size: 13px; font-weight: 700; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tab-row button.is-active { color: var(--heading-green); border-bottom-color: var(--gold); }
