/* =========================================================
   Acres & Oak Kitchen — Pickup Acceptance Form
   Styling targets the look of the source PDF
   ========================================================= */

:root {
  --ink:        #1f2a36;
  --ink-soft:   #4a5a6c;
  --muted:      #8a96a4;
  --paper:      #ffffff;
  --tint:       #f3eee5;            /* warm tan for table stripes */
  --tint-soft:  #faf6ee;
  --accent:     #2c4a5e;            /* deep teal/navy from header bars */
  --accent-2:   #43617a;
  --line:       #d8d2c4;
  --line-soft:  #e9e4d8;
  --bg:         #ece7dc;            /* desk surface */
  --good:       #2f7a3d;
  --bad:        #9c3737;
  --warn:       #c2581c;
  --shadow:     0 8px 28px rgba(31, 42, 54, 0.18);
  --serif:      "Cormorant Garamond", "Georgia", serif;
  --sans:       "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ---------- TOP BAR ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.topbar-left { display: flex; flex-direction: column; line-height: 1.15; }
.brand { font-weight: 700; letter-spacing: 1.5px; font-size: 13px; }
.brand-sub { font-family: var(--serif); font-size: 16px; font-style: italic; opacity: 0.9; }
.topbar-right { display: flex; gap: 8px; }

/* ---------- BUTTONS ---------- */
.btn {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .05s ease, background .15s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: #fff;
  color: var(--accent);
}
.btn-primary:hover { background: #f6f1e6; }
.btn-secondary {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.4);
  color: #fff;
}
.btn-secondary:hover { background: rgba(255,255,255,0.25); }
.btn-ghost {
  background: transparent;
  color: #fff;
  border-color: rgba(255,255,255,0.35);
}
.btn-ghost:hover { background: rgba(255,255,255,0.12); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- MODE BANNER ---------- */
.mode-banner {
  padding: 10px 24px;
  background: #fff7e6;
  border-bottom: 1px solid #f0d99a;
  color: #6b4f12;
  font-weight: 500;
  text-align: center;
}
.mode-banner.success { background: #e8f5ec; border-bottom-color: #b4d8bf; color: #2f6a3d; }
.mode-banner.aok     { background: #eef2f6; border-bottom-color: #c8d3df; color: var(--accent); }

/* ---------- PAGES WRAP ---------- */
.pages-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  padding: 32px;
  max-width: 1900px;
  margin: 0 auto;
  align-items: start;
}
@media (max-width: 1280px) {
  .pages-wrap { grid-template-columns: 1fr; max-width: 920px; }
}

.page {
  background: var(--paper);
  border-radius: 4px;
  box-shadow: var(--shadow);
  padding: 28px 36px 20px;
  aspect-ratio: 8.5 / 11;        /* mirror letter proportions */
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- PAGE HEADER + TITLE ---------- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
  margin-bottom: 14px;
}
.page-brand   { color: var(--accent); font-weight: 700; letter-spacing: 1.5px; }
.page-brand-r { font-family: var(--serif); color: var(--ink-soft); font-style: italic; }

.kicker {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 1.5px;
  font-size: 11px;
  margin: 0;
}
.page-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 26px;
  margin: 2px 0 2px;
  color: var(--ink);
  line-height: 1.1;
}
.page-tagline {
  font-style: italic;
  color: var(--ink-soft);
  margin: 0 0 8px;
  font-size: 12px;
}

/* ---------- SECTION HEADERS ---------- */
.section-head {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--accent);
  text-transform: uppercase;
  margin: 12px 0 2px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--line);
}
.section-head-serif {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}
.section-note {
  font-style: italic;
  color: var(--ink-soft);
  margin: 4px 0 8px;
  font-size: 11.5px;
  line-height: 1.4;
}
.section-note-italic { font-style: italic; }

/* ---------- INPUT GRIDS ---------- */
.grid { display: grid; gap: 8px 14px; margin-bottom: 8px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.field { display: flex; flex-direction: column; }
.field-label {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 1.2px;
  font-size: 10px;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.input {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 6px 4px;
  outline: none;
  border-radius: 0;
  transition: border-color .15s ease, background .15s ease;
}
.input:focus { border-bottom-color: var(--accent); background: var(--tint-soft); }
.input:disabled { background: transparent; color: var(--muted); }
select.input { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%234a5a6c' fill='none' stroke-width='1.4' stroke-linecap='round'/></svg>"); background-repeat: no-repeat; background-position: right 4px center; padding-right: 18px; }

/* ---------- LINE TABLES ---------- */
.line-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  margin-bottom: 8px;
}
.line-table thead th {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 9.5px;
  letter-spacing: 1px;
  padding: 5px 6px;
  text-align: left;
  text-transform: uppercase;
}
.line-table { table-layout: fixed; }
.line-table thead th.col-num    { width: 38px;  text-align: center; }
.line-table thead th.col-yn     { width: 68px;  text-align: center; font-size: 8.5px !important; letter-spacing: 0.4px; }
.line-table thead th.col-mark   { width: 48px;  text-align: center; }
.line-table thead th.col-item   { width: auto; }
.line-table thead th.col-reason { width: 58px;  text-align: center; }
.line-table thead th.col-due    { width: 110px; }
.line-table thead th.col-notes  { width: auto; }
.line-table tbody td:first-child { width: 28px; text-align: center; }
.line-table tbody td { word-wrap: break-word; overflow: hidden; }
.cell-reason { text-align: center; }
.cell-yn { text-align: center; }
.yn-select {
  width: 38px;
  padding: 2px 2px;
  font-weight: 700;
  font-size: 11px;
  text-align: center;
  text-align-last: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  font-family: var(--sans);
}
.yn-select option { font-weight: 700; }
.yn-select.yn-y { color: var(--good); border-color: var(--good); }
.yn-select.yn-n { color: var(--bad);  border-color: var(--bad); }

.line-table tbody td {
  border-bottom: 1px solid var(--line-soft);
  padding: 2px 4px;
  vertical-align: middle;
  height: 22px;
}
.reason-select { width: 50px; padding: 2px 4px; font-weight: 700; color: var(--bad); text-align: center; text-align-last: center; background: transparent; border: 1px solid var(--line); border-radius: 3px; font-family: var(--sans); font-size: 11px; }
.reason-select:disabled { color: var(--muted); font-weight: normal; border-color: var(--line-soft); }
.line-table tbody tr:nth-child(odd) td { background: var(--tint-soft); }

.row-num { text-align: center; color: var(--ink-soft); font-weight: 600; }

/* in-table inputs lose their underline */
.line-table .input { border-bottom: none; padding: 4px 2px; font-size: 12px; width: 100%; min-width: 0; box-sizing: border-box; }
.line-table .input:focus { background: #fff8e2; }
.line-table input[type=number] { text-align: center; padding: 4px 0; width: 100%; }
.line-table input[type=number]::-webkit-inner-spin-button,
.line-table input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.line-table input[type=number] { -moz-appearance: textfield; appearance: textfield; }

.cell-mark { text-align: center; }
.cell-mark input[type=checkbox] { transform: scale(1.25); cursor: pointer; }

/* The item-picker button looks like a pseudo-input */
.item-picker {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  color: var(--muted);
  font-family: var(--sans);
  min-height: 26px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-picker > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-picker:hover { border-color: var(--accent-2); color: var(--ink); }
.item-picker.has-value { color: var(--ink); border-style: solid; border-color: var(--line); }
.item-picker .pill {
  display: inline-block;
  font-size: 9.5px;
  letter-spacing: 0.5px;
  background: var(--tint);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 6px;
  font-weight: 600;
  text-transform: uppercase;
}

/* Reason-code dropdown — color-coded */
.reason-select {
  font-weight: 600;
  font-size: 12px;
  border-radius: 4px;
  border: 1px solid var(--line);
  padding: 3px 6px;
  background: #fff;
  color: var(--bad);
}
.reason-select:disabled { color: var(--muted); background: #fbfaf6; cursor: not-allowed; }
.reason-select option { color: var(--ink); font-weight: 500; }

/* ---------- REASON CODE LEGEND TABLE (page 2) ---------- */
.reason-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
  font-size: 11.5px;
}
.reason-table .rcell {
  border: 1px solid var(--line-soft);
  padding: 4px 10px;
  width: 50%;
  background: #fff;
}
.rcode {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 3px;
  margin-right: 10px;
  min-width: 28px;
  text-align: center;
}

/* ---------- CHECKLIST ---------- */
.checklist {
  list-style: none;
  padding: 0;
  margin: 4px 0 6px;
  font-size: 11.5px;
}
.checklist li { padding: 1px 0; }
.checklist label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.checklist input[type=checkbox] { transform: scale(1.2); margin-top: 2px; }

/* ---------- LEGAL BLOCK ---------- */
.legal-block {
  background: #fbf8f1;
  border-left: 3px solid var(--warn);
  padding: 6px 10px;
  margin: 4px 0 8px;
  font-size: 10.5px;
  line-height: 1.4;
}
.legal-block p { margin: 0; }
.legal-final { color: var(--bad); font-weight: 600; }

/* ---------- SIGNATURES ---------- */
.sig-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr 0.7fr;
  gap: 14px;
  padding: 4px 0;
  border-top: 1px solid var(--line);
  margin-top: 2px;
}
.sig-row:first-of-type { border-top: 1px solid var(--accent); }
.sig-line { display: flex; flex-direction: column; }
.sig-label {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 1.2px;
  font-size: 10px;
  margin-bottom: 4px;
  text-transform: uppercase;
}
.sig-box {
  height: 38px;
  border-bottom: 1px solid var(--ink-soft);
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tint-soft);
  border-radius: 3px 3px 0 0;
  transition: background .15s ease;
}
.sig-box:hover { background: #fff8e2; }
.sig-box.locked { cursor: not-allowed; background: transparent; opacity: 0.6; }
.sig-placeholder { color: var(--muted); font-size: 12px; font-style: italic; }
.sig-img { max-width: 100%; max-height: 100%; }

/* ---------- PAGE FOOTER ---------- */
.page-footer {
  margin-top: auto;
  padding-top: 16px;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.5px;
  border-top: 1px solid var(--line-soft);
}

/* ---------- MODAL ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(31, 42, 54, 0.55);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.35);
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
}
.modal-card-tall { max-width: 520px; max-height: 80vh; }
.modal-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-head h3 { margin: 0; font-family: var(--serif); font-size: 20px; color: var(--accent); }
.modal-close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--ink-soft);
  cursor: pointer;
  line-height: 1;
}
.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
}
.modal-body #sig-canvas {
  width: 100%;
  height: 200px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fffdf6;
  touch-action: none;
}
.modal-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 0;
  font-style: italic;
}
.modal-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.modal-foot .btn-ghost { color: var(--ink); border-color: var(--line); }
.modal-foot .btn-ghost:hover { background: var(--tint-soft); }
.modal-foot .btn-primary { background: var(--accent); color: #fff; }
.modal-foot .btn-primary:hover { background: var(--accent-2); }

/* ---------- ITEM SEARCH RESULTS ---------- */
#item-search { width: 100%; border: 1px solid var(--line); padding: 10px 12px; border-radius: 4px; font-size: 14px; }
#item-search:focus { border-color: var(--accent); background: #fff; }
.item-results {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  max-height: 50vh;
  overflow-y: auto;
  border-top: 1px solid var(--line-soft);
}
.item-results li {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.item-results li:hover, .item-results li.active { background: var(--tint-soft); }
.item-results .item-name { font-weight: 600; color: var(--ink); }
.item-results .item-meta { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
.item-results .item-price { color: var(--accent); font-weight: 600; font-size: 13px; }
.item-results .item-cat-pill {
  display: inline-block;
  font-size: 9.5px;
  letter-spacing: 0.5px;
  background: var(--tint);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 6px;
  font-weight: 600;
  text-transform: uppercase;
}
.item-results .seasonal-tag {
  display: inline-block;
  font-size: 9px;
  background: #fce8d4;
  color: var(--warn);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---------- TOAST ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 12px 22px;
  border-radius: 6px;
  font-size: 13px;
  z-index: 300;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.toast.error   { background: var(--bad); }
.toast.success { background: var(--good); }

/* ---------- READONLY/AOK MODE STYLING ---------- */
body.mode-aok .input:not([data-aok-active]) { pointer-events: none; }
body.mode-aok .item-picker:not([data-aok-active]) { pointer-events: none; opacity: 0.85; }
body.mode-aok .cell-mark input { pointer-events: none; }
body.mode-aok .checklist input { pointer-events: none; }
body.mode-aok .sig-box[data-sig-target="franchisee"] { pointer-events: none; }
body.mode-aok .sig-box[data-sig-target="aok"].locked { cursor: pointer; opacity: 1; background: var(--tint-soft); }
body.mode-done .input { pointer-events: none; }
body.mode-done #btn-submit { display: none; }
body.mode-done .sig-box { pointer-events: none; cursor: default; }
