/* Register pizza screen on the old Harbortouch grid layout (owner 2026-10-09:
   "the pizza builder on pos i like the old one better, this new is very
   difficult to find anything" / "it needs to be clean, fast").

   Layout, colours and behaviour copy the approved mock
   (staff/pos-pizza-grid-mock.html) — bigger: every tile is a real <button>,
   at least 64px tall, tile text 17px at 1280px wide, the chosen size, style
   and pizza obvious at a glance. The overlay is appended to <html> (not
   <body>) so the till's display-size zoom (pos.css data-pos-scale) never
   shrinks the fixed grid off the screen. No hover-only states: a till is a
   touch screen. */

#pos-pizza-grid {
  --ppg-bg: #0f1418; --ppg-panel: #1b2229; --ppg-tile: #5d6670; --ppg-tile-text: #ffffff;
  --ppg-green: #1f9d4b; --ppg-green-dk: #157a39; --ppg-red: #c62828; --ppg-orange: #e07b00;
  --ppg-blue: #2e5fa3; --ppg-teal: #0e8a85; --ppg-white: #f3f4f6; --ppg-gold: #b58a00;
  --ppg-black: #111; --ppg-pane: #f6f7f8; --ppg-pane-text: #1b2229; --ppg-line: #2b353e;
  --ppg-tile-font: 17px; --ppg-tile-min: 64px;

  position: fixed; inset: 0; z-index: 950;
  display: none; box-sizing: border-box;
  grid-template-columns: 250px minmax(0, 1fr) 160px;
  grid-template-rows: 50px minmax(0, 1fr) 100px;
  gap: 6px; padding: 6px;
  background: var(--ppg-bg); color: #fff;
  font: 700 16px/1.2 "Helvetica Neue", Arial, sans-serif;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#pos-pizza-grid.open { display: grid; }
#pos-pizza-grid *, #pos-pizza-grid *::before, #pos-pizza-grid *::after { box-sizing: border-box; }
#pos-pizza-grid button { font: inherit; color: inherit; cursor: pointer; -webkit-appearance: none; appearance: none; }

/* ── header ─────────────────────────────────────────────────────────────── */
#pos-pizza-grid .ppg-head {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 12px;
  background: var(--ppg-green); color: #fff; padding: 0 12px; border-radius: 6px; font-size: 18px;
}
#pos-pizza-grid .ppg-head .ppg-title { flex: 1; text-align: center; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#pos-pizza-grid .ppg-head .ppg-pill { background: rgba(0,0,0,.28); padding: 8px 12px; border-radius: 999px; font-size: 15px; white-space: nowrap; }
#pos-pizza-grid .ppg-head .ppg-pill.ppg-total { font-size: 20px; }
#pos-pizza-grid .ppg-head .ppg-classic {
  border: 0; background: rgba(0,0,0,.18); color: #e8f5ec; font-size: 13px; font-weight: 600;
  padding: 8px 10px; border-radius: 999px; min-height: 36px; text-decoration: underline;
}
#pos-pizza-grid .ppg-head .ppg-close {
  border: 0; background: rgba(0,0,0,.28); color: #fff; font-size: 24px; line-height: 1;
  width: 44px; min-height: 40px; border-radius: 6px;
}

/* ── left panes: WHOLE / 1st HALF / 2nd HALF ────────────────────────────── */
#pos-pizza-grid .ppg-panes { display: grid; grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 6px; min-height: 0; }
#pos-pizza-grid .ppg-pane {
  display: flex; flex-direction: column; border: 4px solid var(--ppg-line); border-radius: 6px; overflow: hidden;
  background: var(--ppg-pane); color: var(--ppg-pane-text); padding: 0; text-align: left; min-height: 0; width: 100%;
}
#pos-pizza-grid .ppg-pane h3 {
  margin: 0; padding: 9px 8px; text-align: center; background: var(--ppg-tile); color: #fff;
  font-size: 17px; letter-spacing: .08em; flex: 0 0 auto;
}
#pos-pizza-grid .ppg-pane.active { border-color: var(--ppg-green); }
#pos-pizza-grid .ppg-pane.active h3 { background: var(--ppg-green); }
#pos-pizza-grid .ppg-pane ul { list-style: none; margin: 0; padding: 8px 10px; font-size: 16px; display: grid; gap: 5px; align-content: start; overflow: hidden; flex: 1 1 auto; min-height: 0; }
#pos-pizza-grid .ppg-pane li { display: flex; justify-content: space-between; gap: 6px; line-height: 1.15; }
#pos-pizza-grid .ppg-pane li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pos-pizza-grid .ppg-pane li small { font-size: 13px; font-weight: 600; color: #66717f; white-space: nowrap; }
#pos-pizza-grid .ppg-pane li.no { color: #b00020; }
#pos-pizza-grid .ppg-pane li.extra { color: #8a5a00; }
#pos-pizza-grid .ppg-pane li.included { color: #1b2229; font-weight: 700; }
#pos-pizza-grid .ppg-pane li[data-inc],
#pos-pizza-grid .ppg-pane li[data-choice] {
  cursor: pointer; padding: 3px 6px; border-radius: 4px; background: rgba(27,34,41,.07);
}
#pos-pizza-grid .ppg-pane li.no[data-inc] {
  background: rgba(198,40,40,.14); text-decoration: line-through;
}
#pos-pizza-grid .ppg-pane li.kept { color: #4a5561; font-style: italic; font-weight: 600; }
#pos-pizza-grid .ppg-pane li.more { color: #66717f; font-size: 13px; }
#pos-pizza-grid .ppg-pane .ppg-hint { margin-top: auto; padding: 6px 10px; font-size: 12px; color: #66717f; font-weight: 600; flex: 0 0 auto; }
#pos-pizza-grid .ppg-pane .ppg-pizza-name { padding: 8px 10px 0; font-size: 16px; color: var(--ppg-green-dk); flex: 0 0 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── centre: size row, style row, page strip, the fixed tile grid ───────── */
#pos-pizza-grid .ppg-centre { display: grid; grid-template-rows: 80px 80px 34px minmax(0, 1fr); gap: 6px; min-width: 0; min-height: 0; }
#pos-pizza-grid .ppg-centre.has-specialties { grid-template-rows: 80px 80px auto 34px minmax(0, 1fr); }
#pos-pizza-grid .ppg-specialties { display: flex; align-items: center; gap: 6px; background: var(--ppg-panel); padding: 4px 6px; border-radius: 5px; overflow-x: auto; min-height: 0; }
#pos-pizza-grid .ppg-specialties[hidden] { display: none; }
#pos-pizza-grid .ppg-specialties-title { font-size: 13px; letter-spacing: .08em; color: var(--ppg-orange); padding: 0 6px; white-space: nowrap; flex: 0 0 auto; }
#pos-pizza-grid .ppg-specialties-list { display: flex; gap: 5px; flex: 1 1 auto; overflow-x: auto; }
#pos-pizza-grid .ppg-specialties-list .ppg-tile { flex: 0 0 auto; min-width: 118px; padding: 6px 8px; }
#pos-pizza-grid .ppg-specialties-list .ppg-tile.veg { background: var(--ppg-green); }
#pos-pizza-grid .ppg-specialties-list .ppg-tile.meat { background: var(--ppg-red); }
#pos-pizza-grid .ppg-specialties-list .ppg-tile.cheese { background: var(--ppg-white); color: #1b2229; }
#pos-pizza-grid .ppg-specialties-list .ppg-tile.prem { background: var(--ppg-gold); }
#pos-pizza-grid .ppg-specialties-list .ppg-tile.on { outline: 6px solid #ffd54a; outline-offset: -6px; }
#pos-pizza-grid .ppg-specialties-list .ppg-tile .ppg-badge { font-size: 12px; font-weight: 700; background: rgba(0,0,0,.4); color: #fff; padding: 2px 8px; border-radius: 999px; }
#pos-pizza-grid .ppg-specialties-list .ppg-tile.cheese .ppg-badge { background: rgba(0,0,0,.65); }
#pos-pizza-grid .ppg-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; min-height: 0; }
#pos-pizza-grid .ppg-row.ppg-styles { grid-template-columns: repeat(7, minmax(0, 1fr)); }
#pos-pizza-grid .ppg-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 0; border-radius: 5px; background: var(--ppg-tile); color: var(--ppg-tile-text);
  font-size: var(--ppg-tile-font); font-weight: 700; text-align: center; padding: 6px 4px;
  min-width: 0; min-height: var(--ppg-tile-min); line-height: 1.12; overflow: hidden; word-break: break-word;
}
#pos-pizza-grid .ppg-tile small { font-size: 13px; font-weight: 600; opacity: .92; }
#pos-pizza-grid .ppg-tile:active { transform: scale(.97); }
#pos-pizza-grid .ppg-tile.empty { background: #39424b; cursor: default; }
#pos-pizza-grid .ppg-tile.empty:active { transform: none; }
#pos-pizza-grid .ppg-tile.dim { opacity: .35; }
#pos-pizza-grid .ppg-tile.on { outline: 5px solid #fff; outline-offset: -5px; }
#pos-pizza-grid .ppg-row.ppg-sizes .ppg-tile.on { background: var(--ppg-green); }
#pos-pizza-grid .ppg-row.ppg-styles .ppg-tile.on { background: var(--ppg-red); }
#pos-pizza-grid .ppg-strip {
  display: flex; align-items: center; justify-content: center; gap: 14px; background: var(--ppg-green);
  border-radius: 5px; letter-spacing: .1em; font-size: 16px; padding: 0 10px; white-space: nowrap; overflow: hidden;
}
#pos-pizza-grid .ppg-strip .ppg-strip-side { background: rgba(0,0,0,.25); padding: 3px 10px; border-radius: 999px; letter-spacing: .04em; font-size: 14px; }
#pos-pizza-grid .ppg-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: repeat(6, minmax(0, 1fr)); gap: 5px; min-height: 0; }
#pos-pizza-grid .ppg-grid .ppg-tile.veg { background: var(--ppg-green); }
#pos-pizza-grid .ppg-grid .ppg-tile.meat { background: var(--ppg-red); }
#pos-pizza-grid .ppg-grid .ppg-tile.cheese { background: var(--ppg-white); color: #1b2229; }
#pos-pizza-grid .ppg-grid .ppg-tile.prem { background: var(--ppg-gold); }
#pos-pizza-grid .ppg-grid .ppg-tile.sauce { background: var(--ppg-blue); }
#pos-pizza-grid .ppg-grid .ppg-tile.dark { background: var(--ppg-black); }
#pos-pizza-grid .ppg-grid .ppg-tile.teal { background: var(--ppg-teal); }
#pos-pizza-grid .ppg-grid .ppg-tile.on { outline: 6px solid #ffd54a; outline-offset: -6px; }
#pos-pizza-grid .ppg-grid .ppg-tile .ppg-badge {
  font-size: 12px; font-weight: 700; background: rgba(0,0,0,.4); color: #fff; padding: 2px 8px; border-radius: 999px;
}
#pos-pizza-grid .ppg-grid .ppg-tile.cheese .ppg-badge { background: rgba(0,0,0,.65); }
#pos-pizza-grid .ppg-grid.ppg-mods .ppg-tile.on { background: var(--ppg-orange); outline-color: #fff; }

/* ── right rail: the pages ──────────────────────────────────────────────── */
#pos-pizza-grid .ppg-rail { display: grid; grid-template-rows: repeat(6, minmax(0, 1fr)); gap: 6px; min-height: 0; }
#pos-pizza-grid .ppg-rail .ppg-tile { font-size: 16px; letter-spacing: .04em; }
#pos-pizza-grid .ppg-rail .ppg-tile.on { background: var(--ppg-orange); outline: 0; }

/* ── bottom bar ─────────────────────────────────────────────────────────── */
#pos-pizza-grid .ppg-bottom { grid-column: 1 / -1; display: grid; grid-template-rows: minmax(0, 1fr) 30px; gap: 4px; min-height: 0; }
#pos-pizza-grid .ppg-bottom .ppg-row { grid-template-columns: repeat(8, minmax(0, 1fr)); }
#pos-pizza-grid .ppg-bottom .ppg-tile { font-size: 18px; }
#pos-pizza-grid .ppg-bottom .ppg-tile.done { background: var(--ppg-green-dk); }
#pos-pizza-grid .ppg-bottom .ppg-tile.danger { background: #7a2b2b; }
#pos-pizza-grid .ppg-bottom .ppg-tile.on { background: var(--ppg-orange); outline: 0; }
#pos-pizza-grid .ppg-status {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 12px;
  background: var(--ppg-green); border-radius: 5px; font-size: 15px; white-space: nowrap; overflow: hidden;
}
#pos-pizza-grid .ppg-status span { overflow: hidden; text-overflow: ellipsis; }
#pos-pizza-grid .ppg-status input {
  flex: 1; min-width: 0; border: 0; border-radius: 4px; padding: 4px 8px; font: 600 15px/1.2 inherit;
  font-family: inherit; color: #1b2229; background: #fff;
}

/* The store iPad (1024×768) and anything narrower than the till. */
@media (max-width: 1100px) {
  #pos-pizza-grid { grid-template-columns: 205px minmax(0, 1fr) 132px; grid-template-rows: 46px minmax(0, 1fr) 92px; --ppg-tile-font: 15px; }
  #pos-pizza-grid .ppg-centre { grid-template-rows: 70px 70px 30px minmax(0, 1fr); }
  #pos-pizza-grid .ppg-centre.has-specialties { grid-template-rows: 70px 70px auto 30px minmax(0, 1fr); }
  #pos-pizza-grid .ppg-head { font-size: 16px; }
  #pos-pizza-grid .ppg-head .ppg-pill { font-size: 13px; padding: 6px 10px; }
  #pos-pizza-grid .ppg-head .ppg-pill.ppg-total { font-size: 18px; }
  #pos-pizza-grid .ppg-pane h3 { font-size: 15px; padding: 7px 6px; }
  #pos-pizza-grid .ppg-pane ul { font-size: 14px; padding: 6px 8px; gap: 4px; }
  #pos-pizza-grid .ppg-pane .ppg-pizza-name { font-size: 14px; }
  #pos-pizza-grid .ppg-tile small { font-size: 12px; }
  #pos-pizza-grid .ppg-row.ppg-styles .ppg-tile { font-size: 13px; letter-spacing: -.01em; padding: 6px 2px; }
  #pos-pizza-grid .ppg-rail .ppg-tile { font-size: 14px; }
  #pos-pizza-grid .ppg-bottom .ppg-tile { font-size: 16px; }
  #pos-pizza-grid .ppg-strip { font-size: 14px; }
  #pos-pizza-grid .ppg-status { font-size: 13px; }
}
