/* ==========================================================================
   Corporate ordering — The BroBasket
   Black and white like the brand, with one warm accent (the colour of the
   good stuff in the basket). The spreadsheet is the hero: it should feel
   like a tool that respects a busy office manager, not a storefront.
   ========================================================================== */

:root {
  --ink: #111110;
  --ink-2: #4a4a46;
  --ink-3: #85857f;
  --paper: #fafaf7;
  --card: #ffffff;
  --rule: #e4e3dc;
  --rule-2: #c9c8bf;
  --amber: #b8741f;
  --amber-2: #f6ecdc;
  --ok: #2f6b3f;
  --ok-bg: #e7efe7;
  --bad: #a1291f;
  --bad-bg: #f8e7e4;
  --warn: #8a5a00;
  --warn-bg: #fbf1dc;
  --display: 'Archivo', 'Arial Narrow', system-ui, sans-serif;
  --body: 'Instrument Sans', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --pad: clamp(1rem, 4vw, 2.5rem);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.55 var(--body); }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
[hidden] { display: none !important; }

/* --- Bar + hero --------------------------------------------------------- */

.bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem var(--pad); background: #fff; color: var(--ink);
  border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.brand__logo { width: 44px; height: 44px; display: block; }
.brand__name { font: 700 1rem var(--display); letter-spacing: 0.02em; text-transform: uppercase; }
.brand__sub { font-size: 0.8rem; color: var(--ink-2); border-left: 1px solid var(--rule-2); padding-left: 0.6rem; }
.bar__help { font-size: 0.85rem; color: var(--ink-2); }

.hero { background: var(--ink); color: #fff; padding: 2.5rem var(--pad) 3rem; }
.hero__inner { max-width: 1180px; margin: 0 auto; }
.hero h1 {
  font: 800 clamp(2.1rem, 5.5vw, 3.6rem)/1.02 var(--display);
  font-stretch: 80%; letter-spacing: -0.01em; text-transform: uppercase; margin: 0 0 0.9rem; max-width: 18ch;
}
.hero__lede { max-width: 56ch; color: #d6d6cf; font-size: 1.05rem; margin: 0 0 1.75rem; }
.facts { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.75rem; }
.facts li { border: 1px solid #3a3a37; padding: 0.7rem 1rem; min-width: 11rem; }
.facts b { display: block; font: 700 1rem var(--display); color: #f0c98f; letter-spacing: 0.01em; }
.facts span { font-size: 0.82rem; color: #b9b9b2; }

/* --- Steps ----------------------------------------------------------------- */

.page { max-width: 1180px; margin: 0 auto; padding: 2rem var(--pad) 4rem; }
.step { background: var(--card); border: 1px solid var(--rule); padding: 1.5rem clamp(1rem, 3vw, 2rem) 1.75rem; margin-bottom: 1.25rem; }
.step__head { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1.25rem; }
.step__num {
  flex: none; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--ink); color: #fff;
  display: grid; place-items: center; font: 700 1rem var(--display);
}
.step h2 { font: 700 1.35rem/1.2 var(--display); margin: 0.15rem 0 0.2rem; }
.step__head p { margin: 0; }
.step--done { border-color: var(--ink); }
.step--done h2 { margin-top: 0; }

/* --- Controls --------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; text-decoration: none;
  font: 600 0.88rem var(--body); padding: 0.6rem 1rem; border: 1px solid var(--rule-2);
  background: var(--card); color: var(--ink); transition: border-color .12s, background .12s;
}
.btn:hover { border-color: var(--ink); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn--primary { background: var(--amber); border-color: var(--amber); color: #fff; }
.btn--primary:hover:not(:disabled) { background: #9c6118; border-color: #9c6118; }
.btn--big { font-size: 1rem; padding: 0.85rem 1.4rem; }

.toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.9rem; }
.toolbar__spacer { flex: 1; }
.inline { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--ink-2); }
select, input, textarea {
  font: inherit; font-size: 0.9rem; color: var(--ink); background: #fff;
  border: 1px solid var(--rule-2); padding: 0.5rem 0.6rem; border-radius: 0;
}
select { max-width: 22rem; }
.apply-all { display: inline-flex; align-items: center; gap: 0.5rem; flex-wrap: nowrap; }
.apply-all select { width: 15rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--amber); outline-offset: -1px; border-color: var(--amber); }

.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field > span { font-weight: 600; font-size: 0.85rem; }
.field em { font-style: normal; font-weight: 400; color: var(--ink-3); }
.field small { font-size: 0.78rem; }
.chip { font: 500 0.72rem var(--mono); padding: 0.1rem 0.35rem; border: 1px solid var(--rule-2); background: var(--paper); cursor: pointer; }
.preview { color: var(--amber); }
.preview:empty { display: none; }

.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem 1.5rem; margin-top: 1.5rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem 1.25rem; }

.actions { display: flex; justify-content: flex-end; margin-top: 1.4rem; gap: 0.6rem; flex-wrap: wrap; }
.actions--left { justify-content: flex-start; }
.fine { font-size: 0.8rem; color: var(--ink-2); margin: 1rem 0 0; max-width: 70ch; }
.error { color: var(--bad); font-weight: 500; }

/* --- The sheet ------------------------------------------------------------------ */

.sheet { border: 1px solid var(--rule-2); overflow: auto; max-height: 34rem; background: #fff; }
.sheet__table { border-collapse: collapse; width: 100%; font-size: 0.84rem; }
.sheet__table th {
  position: sticky; top: 0; z-index: 1; background: var(--paper); text-align: left; white-space: nowrap;
  font: 600 0.72rem var(--body); letter-spacing: 0.02em; color: var(--ink-2);
  padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--rule-2);
}
.sheet__table td { border-bottom: 1px solid var(--rule); padding: 0; vertical-align: top; }
.sheet__table--read td { padding: 0.55rem 0.6rem; }
.sheet__table .num { text-align: right; }
.sheet__table input, .sheet__table select {
  width: 100%; min-width: 7rem; border: 0; padding: 0.55rem 0.5rem; background: transparent; font-size: 0.84rem;
}
.sheet__table select { min-width: 15rem; }
.sheet__table td.c-gift { background: #fffdf8; }
.c-n { width: 2.4rem; }
td.c-n { font: 0.72rem var(--mono); color: var(--ink-3); padding: 0.6rem 0.5rem !important; }
.c-st input { min-width: 3.5rem; } .c-zip input { min-width: 5rem; } .c-qty input { min-width: 3.5rem; }
.c-x button { border: 0; background: none; color: var(--ink-3); font-size: 1.1rem; cursor: pointer; padding: 0.45rem 0.6rem; }
.c-x button:hover { color: var(--bad); }
td.bad { background: var(--bad-bg); box-shadow: inset 2px 0 0 var(--bad); }
td.warn { background: var(--warn-bg); }
tr.row-err td.c-n { color: var(--bad); font-weight: 600; }
.sheet__empty { padding: 1.5rem; color: var(--ink-3); margin: 0; }
.count { font-size: 0.82rem; color: var(--ink-2); margin: 0.5rem 0 0; }

.issues { list-style: none; margin: 1.25rem 0 0; padding: 0; border: 1px solid var(--bad); background: var(--bad-bg); }
.issues li { padding: 0.5rem 0.9rem; border-bottom: 1px solid #edcfca; font-size: 0.86rem; }
.issues li:last-child { border-bottom: 0; }
.issues li.warn { background: var(--warn-bg); }
.issues b { font-family: var(--mono); font-size: 0.75rem; margin-right: 0.4rem; }

/* --- Price --------------------------------------------------------------------------- */

.progress { position: relative; height: 2.2rem; border: 1px solid var(--rule-2); background: #fff; overflow: hidden; }
.progress__bar { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--amber-2); border-right: 2px solid var(--amber); transition: width .25s; }
.progress span { position: relative; line-height: 2.2rem; padding: 0 0.8rem; font-size: 0.82rem; }

.summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0; margin-top: 1rem;
  border: 1px solid var(--rule-2);
}
.summary div { padding: 0.8rem 1rem; border-right: 1px solid var(--rule); }
.summary div:last-child { border-right: 0; background: var(--ink); color: #fff; }
.summary b { display: block; font: 500 1.3rem var(--mono); letter-spacing: -0.02em; }
.summary span { font-size: 0.75rem; color: var(--ink-3); }
.summary div:last-child span { color: #c9c9c2; }
.nudge { margin: 0.9rem 0 0; padding: 0.7rem 0.9rem; background: var(--amber-2); border-left: 3px solid var(--amber); font-size: 0.88rem; }

.foot { text-align: center; font-size: 0.8rem; color: var(--ink-3); padding: 2rem var(--pad) 3rem; }

@media (max-width: 760px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .brand__sub { display: none; }
  .toolbar__spacer { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* --- Gift matching -------------------------------------------------------------- */
.match { border: 1px solid var(--amber); background: #fffaf2; padding: 1rem 1.1rem; margin: 0 0 1rem; }
.match__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.match h3 { font: 700 1.05rem var(--display); margin: 0 0 0.2rem; }
.match__head p { margin: 0 0 0.75rem; font-size: 0.85rem; }
.match__list { list-style: none; margin: 0; padding: 0; }
.match__list li { display: grid; grid-template-columns: 5.5rem minmax(10rem, 1fr) 1.2rem minmax(14rem, 1.6fr) auto;
  gap: 0.6rem; align-items: center; padding: 0.5rem 0; border-top: 1px solid #f0e2c8; }
.match__typed { font-weight: 600; font-size: 0.9rem; }
.match__typed small { display: block; font-weight: 400; color: var(--ink-3); font-size: 0.75rem; }
.match__arrow { color: var(--ink-3); }
.match__pick { display: block; }
.match__pick input { width: 100%; }
.match__pick small { display: block; margin-top: 0.15rem; font-size: 0.75rem; }
.tag { font: 600 0.68rem var(--body); text-transform: uppercase; letter-spacing: 0.05em; padding: 0.2rem 0.45rem; text-align: center; }
.tag--ok { background: var(--ok-bg); color: var(--ok); }
.tag--warn { background: var(--warn-bg); color: var(--warn); }
.tag--bad { background: var(--bad-bg); color: var(--bad); }
@media (max-width: 760px) {
  .match__list li { grid-template-columns: 1fr; }
  .match__arrow { display: none; }
}

/* --- Wider sheet: pinned names, message + date columns --------------------------- */
.sheet__table td.c-n, .sheet__table th.c-n { position: sticky; left: 0; z-index: 2; background: #fff; width: 2.6rem; min-width: 2.6rem; }
.sheet__table .c-first { position: sticky; left: 2.6rem; z-index: 2; background: #fff; }
.sheet__table .c-last  { position: sticky; left: calc(2.6rem + 8rem); z-index: 2; background: #fff; box-shadow: 1px 0 0 var(--rule-2); }
.sheet__table th.c-n, .sheet__table th.c-first, .sheet__table th.c-last { background: var(--paper); z-index: 3; }
.sheet__table .c-first input, .sheet__table .c-last input { min-width: 8rem; width: 8rem; }
.sheet__table tr.row-err td.c-first, .sheet__table tr.row-err td.c-last { background: #fff; }
.sheet__table .c-msg input { min-width: 18rem; }
.sheet__table .c-msg input::placeholder { color: #a8a7a0; font-style: italic; }
.sheet__table .c-date input { min-width: 9.5rem; }
.sheet__table .c-addr input { min-width: 11rem; }
.sheet__table .c-email input { min-width: 12rem; }
.sheet__table--read td.msg { max-width: 22rem; font-style: italic; color: var(--ink-2); }
.sheet__table--read td { font-size: 0.82rem; }

.field--code { max-width: 26rem; margin-top: 1.5rem; }
.field--code input { text-transform: uppercase; }
#codeNote.good { color: var(--ok); font-weight: 600; }
#codeNote.bad { color: var(--bad); }

.btn--quiet { border-color: transparent; color: var(--ink-2); }
.btn--quiet:hover { border-color: var(--rule-2); color: var(--ink); }

/* --- Gift search ------------------------------------------------------------------ */
.gift-menu {
  position: fixed; z-index: 50; max-height: 17rem; overflow-y: auto;
  background: #fff; border: 1px solid var(--ink); box-shadow: 0 8px 24px rgba(17,17,16,.16);
  font-size: 0.85rem;
}
.gift-menu[hidden] { display: none; }
.gift-menu li {
  display: flex; justify-content: space-between; gap: 1rem; align-items: baseline;
  padding: 0.45rem 0.65rem; cursor: pointer; border-bottom: 1px solid var(--rule);
}
.gift-menu li:last-child { border-bottom: 0; }
.gift-menu li[aria-selected='true'], .gift-menu li:hover { background: var(--amber-2); }
.gift-menu li.empty { cursor: default; color: var(--ink-3); justify-content: flex-start; }
.gift-menu ul { list-style: none; margin: 0; padding: 0; }
.gift-menu .price { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-2); white-space: nowrap; }
.gift-menu .sold { color: var(--ink-3); }
.sheet__table input.gift-pick { min-width: 15rem; }
input.gift-pick { background-image: none; }
td.c-gift input.gift-pick:placeholder-shown { color: var(--ink-3); }
.apply-all input.gift-pick { width: 15rem; }

.gift-menu .kind { display: block; font-size: 0.72rem; color: var(--ink-3); }

/* --- Choose gifts ------------------------------------------------------------------- */

.entry { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; }
.entry__card {
  text-align: left; cursor: pointer; padding: 1.1rem 1.25rem; background: var(--card);
  border: 1px solid var(--rule-2); font: inherit; color: inherit;
}
.entry__card:hover { border-color: var(--ink); }
.entry__card b { display: block; font: 700 1.05rem var(--display); margin-bottom: 0.15rem; }
.entry__card span { font-size: 0.85rem; color: var(--ink-2); }

.browse__bar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 1rem; }
.browse__bar input[type=search] { flex: 1 1 16rem; min-width: 12rem; }
.browse__count { font-size: 0.8rem; color: var(--ink-3); margin-left: auto; }
.chips { display: inline-flex; gap: 0.35rem; flex-wrap: wrap; }
.chip-btn {
  font: 600 0.8rem var(--body); padding: 0.45rem 0.7rem; border: 1px solid var(--rule-2);
  background: var(--card); cursor: pointer;
}
.chip-btn[aria-pressed='true'] { background: var(--ink); color: #fff; border-color: var(--ink); }

.grid-gifts {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 1rem; max-height: 40rem; overflow-y: auto; padding: 0.25rem;
}
.gift-card { border: 1px solid var(--rule); background: var(--card); display: flex; flex-direction: column; }
.gift-card[data-chosen='true'] { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber); }
.gift-card__img { aspect-ratio: 1; background: var(--paper) center/cover no-repeat; }
.gift-card__body { padding: 0.6rem 0.7rem 0.7rem; display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.gift-card__title { font-size: 0.82rem; line-height: 1.3; font-weight: 500; }
.gift-card__meta { font-size: 0.72rem; color: var(--ink-3); }
.gift-card__foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 0.5rem; }
.gift-card__price { font-family: var(--mono); font-size: 0.85rem; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--rule-2); }
.stepper button { border: 0; background: none; cursor: pointer; width: 1.7rem; height: 1.7rem; font-size: 1rem; line-height: 1; color: var(--ink); }
.stepper button:hover { background: var(--amber-2); }
.stepper span { min-width: 1.6rem; text-align: center; font-family: var(--mono); font-size: 0.8rem; }
.gift-card .add { font-size: 0.78rem; padding: 0.35rem 0.6rem; }
.sold-out { font-size: 0.72rem; color: var(--bad); }

.tray {
  position: sticky; bottom: 0; z-index: 20; display: flex; gap: 1rem; align-items: center;
  justify-content: space-between; flex-wrap: wrap;
  background: var(--ink); color: #fff; padding: 0.85rem clamp(1rem, 3vw, 2rem); margin: 0 0 1.25rem;
}
.tray__what b { font: 700 1rem var(--display); margin-right: 0.6rem; }
.tray__what span { color: #c9c9c2; font-size: 0.85rem; }
.tray__act { display: flex; gap: 0.5rem; }
.tray .btn { background: transparent; color: #fff; border-color: #55554f; }
.tray .btn:hover { border-color: #fff; }
.tray .btn--primary { background: var(--amber); border-color: var(--amber); }

/* --- Header nav --------------------------------------------------------------------- */
.nav { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.nav__link {
  font: 500 0.85rem var(--body); color: var(--ink); background: none; border: 0;
  padding: 0.45rem 0.7rem; cursor: pointer; text-decoration: none; border-bottom: 2px solid transparent;
}
.nav__link:hover { border-bottom-color: var(--amber); }
.nav__link--quiet { color: var(--ink-2); }
@media (max-width: 720px) {
  .bar { flex-wrap: wrap; gap: 0.35rem; }
  .nav { width: 100%; justify-content: flex-start; border-top: 1px solid var(--rule); padding-top: 0.35rem; }
  .nav__link { padding: 0.4rem 0.5rem; font-size: 0.8rem; }
}

/* --- Contact ------------------------------------------------------------------------ */
.contact__row { display: flex; align-items: center; gap: 0.6rem; margin: 0.75rem 0 0; }
.contact__value { font: 600 1rem var(--body); color: var(--ink); text-decoration: none; border-bottom: 2px solid var(--amber); }
.contact__value:hover { color: var(--amber); }
.linky { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
/* the modal styles live with the staff console; repeat the essentials here */
dialog.modal { border: 1px solid var(--ink); background: var(--card); color: var(--ink);
  padding: 1.75rem; width: min(28rem, calc(100vw - 2rem)); }
dialog.modal::backdrop { background: rgba(17,17,16,.55); }
dialog.modal h2 { font: 700 1.2rem var(--display); margin: 0.2rem 0 0.4rem; }
.modal__actions { display: flex; justify-content: flex-end; margin-top: 1.25rem; }
.eyebrow { font: 600 0.7rem var(--body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin: 0; }
