*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:  #111111;
  --green2: #333333;
  --light:  #f5f5f5;
  --border: #ddd;
  --text:   #212121;
  --muted:  #757575;
  --error:  #c62828;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,.12);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

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

/* ── Header ── */
.top-nav { background: var(--green); color: #fff; padding: 14px 16px; font-size: 1.1rem; font-weight: 600; position: sticky; top: 0; z-index: 100; }
.app-title { font-size: 1.1rem; font-weight: 600; margin: 0; }

/* ── Layout ── */
.screen { display: flex; flex-direction: column; min-height: calc(100vh - 52px); }
.screen.hidden { display: none; }
.form-layout { display: flex; flex: 1; height: calc(100vh - 52px); }

/* ── Menu panel ── */
.menu-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.category-tabs { display: flex; gap: 8px; padding: 12px; overflow-x: auto; background: #fff; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.category-tabs::-webkit-scrollbar { display: none; }
.cat-btn { flex-shrink: 0; padding: 8px 16px; border: 2px solid var(--border); border-radius: 20px; background: #fff; font-size: .9rem; cursor: pointer; transition: all .15s; }
.cat-btn.active, .cat-btn:focus-visible { border-color: var(--green); color: var(--green); font-weight: 600; outline: 2px solid var(--green); outline-offset: 2px; }
.items-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; padding: 12px; }
.items-list { display: contents; }

/* ── Item card ── */
.item-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; cursor: pointer; border: 2px solid transparent; transition: border-color .15s; }
.item-card:focus-visible, .item-card:hover { border-color: var(--green); outline: none; }
.item-photo { width: 100%; aspect-ratio: 1; object-fit: cover; background: #e0e0e0; display: block; }
.item-photo-placeholder { width: 100%; aspect-ratio: 1; background: linear-gradient(135deg, #e0e0e0, #bdbdbd); display: none; align-items: center; justify-content: center; color: var(--muted); font-size: .75rem; text-align: center; padding: 8px; }
.item-info { padding: 10px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.item-name { font-size: .9rem; font-weight: 600; line-height: 1.3; }
.item-price { font-size: .9rem; color: var(--green); font-weight: 700; }
.item-price-unknown { font-size: .8rem; color: var(--muted); font-style: italic; }
.item-add { margin: 0 10px 10px; padding: 7px; border: none; border-radius: 6px; background: var(--green); color: #fff; font-size: .85rem; font-weight: 600; cursor: pointer; transition: background .15s; }
.item-add:hover, .item-add:focus-visible { background: var(--green2); outline: 2px solid var(--green); outline-offset: 2px; }
.item-add.in-cart { background: #333333; }

/* ── Cart panel ── */
.cart-panel { width: 340px; background: #fff; border-left: 1px solid var(--border); display: flex; flex-direction: column; overflow-y: auto; }
.drawer-handle { display: none; }
.customer-fields { padding: 12px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--border); }
.field-row { display: flex; gap: 8px; }
.field-row input { flex: 1; min-width: 0; }
input, textarea { padding: 9px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: .9rem; width: 100%; }
input:focus, textarea:focus { outline: 2px solid var(--green); border-color: var(--green); }
input[aria-required="true"] { border-left: 3px solid var(--green); }
.hidden { display: none !important; }
.datetime-row { display: flex; gap: 10px; }
.datetime-field { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.datetime-field label { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.datetime-field input[type="date"],
.datetime-field select { width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: .95rem; box-sizing: border-box; background: #fff; appearance: auto; }
.datetime-field input:focus-visible,
.datetime-field select:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.field-error { display: block; font-size: .8rem; color: #c62828; margin-top: 4px; }
.fulfillment-toggle { display: flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.fulfill-btn { flex: 1; padding: 9px; border: none; background: #fff; font-size: .9rem; cursor: pointer; transition: background .15s; }
.fulfill-btn.active { background: var(--green); color: #fff; font-weight: 600; }
.fulfill-btn:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
.cart-items { flex: 1; padding: 12px; overflow-y: auto; }
.cart-empty { color: var(--muted); font-size: .9rem; text-align: center; padding: 24px 0; }
.cart-line { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.cart-line-name { flex: 1; }
.cart-line-mods { font-size: .8rem; color: var(--muted); }
.cart-qty { display: flex; align-items: center; gap: 6px; }
.cart-qty-btn { width: 26px; height: 26px; border: 1px solid var(--border); border-radius: 50%; background: #fff; cursor: pointer; font-size: 1rem; display: flex; align-items: center; justify-content: center; }
.cart-qty-btn:focus-visible { outline: 2px solid var(--green); }
textarea { resize: vertical; min-height: 60px; margin: 8px 12px 0; width: calc(100% - 24px); }
.submit-btn { margin: 12px; padding: 14px; border: none; border-radius: var(--radius); background: var(--green); color: #fff; font-size: 1rem; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; transition: background .15s; }
.submit-btn:hover, .submit-btn:focus-visible { background: var(--green2); outline: 2px solid var(--green); outline-offset: 2px; }
.submit-btn:disabled { opacity: .6; cursor: not-allowed; }
.submit-error { margin: 0 12px 12px; padding: 10px 12px; background: #ffebee; border: 1px solid var(--error); border-radius: 6px; color: var(--error); font-size: .9rem; }

/* ── Spinner ── */
.spinner { width: 20px; height: 20px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Customization sheet ── */
.cust-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 200; }
.cust-sheet { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(480px,100%); max-height: 80vh; background: #fff; border-radius: 16px 16px 0 0; z-index: 201; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 -4px 24px rgba(0,0,0,.2); }
.cust-header { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 1.1rem; }
#cust-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; padding: 4px 8px; }
#cust-close:focus-visible { outline: 2px solid var(--green); border-radius: 4px; }
.cust-groups { overflow-y: auto; padding: 12px 16px; flex: 1; }
fieldset.cust-group { border: none; margin: 0 0 16px; padding: 0; min-width: 0; }
.cust-group-label { display: block; font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.cust-option { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.cust-option label { font-size: .95rem; cursor: pointer; }
.cust-option input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--green); cursor: pointer; }
.cust-footer { padding: 14px 16px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.cust-qty { display: flex; align-items: center; gap: 10px; }
.qty-btn { width: 36px; height: 36px; border: 2px solid var(--green); border-radius: 50%; background: #fff; color: var(--green); font-size: 1.2rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.qty-btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.qty-num { font-size: 1.1rem; font-weight: 700; min-width: 24px; text-align: center; }
.cust-add { flex: 1; padding: 12px; border: none; border-radius: var(--radius); background: var(--green); color: #fff; font-size: 1rem; font-weight: 700; cursor: pointer; }
.cust-add:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ── Mobile cart FAB ── */
.cart-fab { position: fixed; bottom: 20px; right: 20px; padding: 14px 20px; border: none; border-radius: 30px; background: var(--green); color: #fff; font-weight: 700; font-size: 1rem; box-shadow: 0 4px 16px rgba(0,0,0,.25); cursor: pointer; z-index: 100; }
.cart-fab:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.cart-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 149; }

/* ── Confirmation ── */
.confirm-card { max-width: 440px; margin: 60px auto; padding: 40px 32px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); text-align: center; }
.confirm-icon { font-size: 3rem; color: var(--green); margin-bottom: 16px; }
.confirm-title { font-size: 1.6rem; font-weight: 700; margin-bottom: 12px; }
.confirm-body { font-size: 1rem; line-height: 1.5; margin-bottom: 12px; }
.confirm-note { font-size: .9rem; color: var(--muted); margin-bottom: 24px; }
.confirm-note a { color: var(--green); }

/* ── Mobile ── */
@media (max-width: 768px) {
  .form-layout { flex-direction: column; height: auto; }
  .menu-panel { min-height: 60vh; }
  .cart-panel { position: fixed; bottom: 0; left: 0; right: 0; width: 100%; max-height: 80vh; border-radius: 16px 16px 0 0; border-left: none; border-top: 1px solid var(--border); z-index: 150; transform: translateY(100%); transition: transform .3s ease; box-shadow: 0 -4px 24px rgba(0,0,0,.15); overflow-y: auto; }
  .cart-panel.open { transform: translateY(0); }
  .drawer-handle { display: flex; justify-content: center; padding: 10px; }
  #drawer-close-btn { background: none; border: none; color: var(--muted); font-size: .9rem; cursor: pointer; }
  #drawer-close-btn:focus-visible { outline: 2px solid var(--green); border-radius: 4px; }
}
