:root {
  --navy: #16243f;
  --navy-soft: #315779;
  --sand: #f4f6f9;
  --paper: #ffffff;
  --line: #dde3ea;
  --ink: #1a2436;
  --muted: #5f6d7a;
  --teal: #315779;
  --teal-dark: #24415c;
  --brass: #c9a84c;
  --danger: #b3402f;
  --ok: #2e7d4f;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(22, 36, 63, .06), 0 6px 20px rgba(22, 36, 63, .06);
  --gold-ink: #8a6d1f;
  --sky: #a7d6ff;
  --serif: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--sand); color: var(--ink); font: 15px/1.5 var(--sans); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.005em; color: var(--navy); margin: 0; line-height: 1.2; }
h1, h2, h3, .stat b, .brand { font-variant-numeric: lining-nums; }
h1 { font-size: 36px; } h2 { font-size: 26px; } h3 { font-size: 21px; }
a { color: var(--teal-dark); }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stack > * + * { margin-top: 14px; }

/* ---- controls ---- */
button, input, select, textarea { font: inherit; color: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--paper); cursor: pointer; font-weight: 600; text-decoration: none; color: var(--ink); white-space: nowrap;
}
.btn:hover { border-color: #b9c4d0; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); }
.btn.dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--teal-dark); padding: 0 8px; }
.btn.danger { color: var(--danger); }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

label.field { display: block; font-size: 13px; font-weight: 600; color: var(--navy-soft); }
label.field > span.opt { font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=number], input[type=url], input[type=search], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 11px; margin-top: 4px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 16px;
}
textarea { min-height: 76px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
label.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
label.check input { width: 17px; height: 17px; accent-color: var(--teal); }

/* ---- top bar ---- */
.topbar { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar .inner { max-width: 1320px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font: 600 23px/1 var(--serif); letter-spacing: .01em; color: #fff; text-decoration: none; white-space: nowrap; }
.brand img { width: 42px; height: 42px; object-fit: contain; flex: none; }
.brand span { display: block; }
.brand small { display: block; font: 600 10px/1 var(--sans); letter-spacing: .18em; text-transform: uppercase; color: #c9a84c; margin-top: 3px; }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a, .topbar .linkbtn {
  color: #dbe4ee; text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: 14px;
  background: none; border: 0; cursor: pointer; white-space: nowrap;
}
.topbar nav a.active, .topbar nav a:hover, .topbar .linkbtn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.topbar .search { flex: 4 1 220px; max-width: 520px; }
.topbar .search input { margin: 0; border: 0; background: rgba(255, 255, 255, .12); color: #fff; }
.topbar .search input::placeholder { color: #b4c2d2; }
.topbar .search input:focus { background: #fff; color: var(--ink); }
.cartbtn { background: var(--brass); border: 0; color: var(--navy); border-radius: 8px; min-height: 40px; padding: 0 14px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.who { font-size: 13px; color: #b4c2d2; white-space: nowrap; }
a.who { text-decoration: none; padding: 8px 6px; border-radius: 8px; }
a.who:hover { color: #fff; text-decoration: underline; }

.page { max-width: 1320px; margin: 0 auto; padding: 22px 20px 60px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 18px; }

/* ---- storefront ---- */
.depts { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 18px; scrollbar-width: thin; }
.chip {
  flex: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper);
  cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap;
}
.chip:hover { border-color: var(--navy-soft); }
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.shop { display: grid; grid-template-columns: 230px 1fr; gap: 24px; align-items: start; }
.filters { position: sticky; top: 78px; max-height: calc(100vh - 100px); overflow-y: auto; }
.filters h4 { margin: 0 0 6px; font: 700 11px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.filters section + section { margin-top: 20px; }
.catlink { display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 6px 8px; border: 0; border-radius: 6px; background: none; text-align: left; cursor: pointer; font-size: 14px; }
.catlink:hover { background: #e9eef4; }
.catlink.active { background: #e4f1ff; color: var(--teal-dark); font-weight: 700; }
.catlink span:last-child { color: var(--muted); font-weight: 400; font-size: 12px; }
.resultbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.resultbar select { width: auto; margin: 0; font-size: 14px; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.product { display: flex; flex-direction: column; overflow: hidden; }
.product .img { aspect-ratio: 4 / 3; background: #e9eef4; display: grid; place-items: center; overflow: hidden; }
.product .img img { width: 100%; height: 100%; object-fit: cover; }
.product .img .ph { font: 600 46px var(--serif); color: #a9b6c4; }
.product .body { padding: 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product .title { font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.product .meta { font-size: 13px; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: #e9eef4; color: #4a5866; white-space: nowrap; }
.tag.local { background: #e0f0e6; color: #24633f; }
.tag.cold { background: #e1edf6; color: #2a5d85; }
.product .foot { margin-top: auto; padding-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.price { font-weight: 700; font-size: 17px; color: var(--navy); }
.price.poa { font-size: 13px; font-weight: 600; color: var(--gold-ink); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--teal); border-radius: 8px; overflow: hidden; }
.stepper button { width: 34px; height: 34px; border: 0; background: var(--teal); color: #fff; font-size: 18px; font-weight: 700; cursor: pointer; }
.stepper input { width: 44px; height: 34px; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; text-align: center; font-weight: 700; font-size: 15px; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 24px; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }

/* ---- drawer / modal ---- */
.overlay { position: fixed; inset: 0; background: rgba(22, 36, 63, .45); z-index: 40; display: flex; justify-content: flex-end; }
.overlay.center { justify-content: center; align-items: flex-start; padding: 5vh 14px; overflow-y: auto; }
.drawer { width: min(480px, 100%); height: 100%; background: var(--sand); display: flex; flex-direction: column; }
.drawer header, .modal header { padding: 16px 18px; background: var(--paper); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.drawer .scroll { flex: 1; overflow-y: auto; padding: 14px 18px; }
.drawer footer { padding: 14px 18px; background: var(--paper); border-top: 1px solid var(--line); }
.modal { width: min(680px, 100%); background: var(--paper); border-radius: var(--radius); overflow: hidden; }
.modal .content { padding: 18px; }
.modal footer { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.x { margin-left: auto; border: 0; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; }
.cartline { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.cartline .top { display: flex; gap: 10px; align-items: flex-start; }
.cartline .top > div:first-child { flex: 1; }
.cartline .controls { display: flex; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.cartline input[type=text] { min-height: 34px; font-size: 14px; margin-top: 8px; }
.totals { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.totals strong { font-size: 20px; color: var(--navy); }

/* ---- tables ---- */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font: 700 11px/1.2 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid #e9eef4; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f8fafc; }
td input[type=number], td input[type=text], td select { margin: 0; min-height: 34px; padding: 4px 8px; font-size: 14px; }
td input.num { width: 92px; text-align: right; }
.thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: #e9eef4; display: block; }
span.thumb { display: grid; place-items: center; font: 600 17px var(--serif); color: #a9b6c4; }

.status { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: #e9eef4; color: #4a5866; white-space: nowrap; }
.status.submitted, .status.pending { background: #fbeed3; color: #8a5a0a; }
.status.confirmed, .status.preparing { background: #e1edf6; color: #2a5d85; }
.status.out_for_delivery { background: #e6e3f5; color: #4b3f91; }
.status.delivered { background: #e0f0e6; color: #24633f; }
.status.cancelled, .status.unavailable { background: #f6e1dd; color: #933224; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { padding: 14px 16px; }
.stat b { display: block; font: 600 34px/1.1 var(--serif); color: var(--navy); }
.stat span { font-size: 13px; color: var(--muted); }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.notice { padding: 10px 14px; border-radius: 8px; background: #fbeed3; color: #6b4708; font-size: 14px; }
.notice.ok { background: #e0f0e6; color: #1f5636; }
.notice.err { background: #f6e1dd; color: #7d2a1e; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: 14px; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; }
.drop { border: 2px dashed #b9c4d0; border-radius: var(--radius); padding: 26px; text-align: center; background: #f8fafc; cursor: pointer; }
.drop.over { border-color: var(--teal); background: #e4f1ff; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(440px, calc(100% - 32px)); }
#toast div { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 8px; box-shadow: var(--shadow); font-weight: 600; font-size: 14px; }
#toast div.err { background: var(--danger); }

/* ---- sign in ---- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth .hero { background: linear-gradient(165deg, #101b31 0%, #16243f 45%, #315779 100%); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth .hero h1 { color: #fff; font-size: 54px; font-weight: 500; max-width: 12em; }
.auth .hero h1 em { display: block; font: 400 19px/1.4 var(--sans); color: var(--brass); margin-top: 10px; }
.auth .hero .mark { width: 150px; height: auto; display: block; margin-bottom: 26px; }
.auth .hero .rule { width: 64px; height: 1px; background: var(--brass); margin: 18px 0; }
.auth .hero p { color: #d5e3f2; font-size: 17px; max-width: 30em; }
.auth .panel { padding: 56px; display: flex; align-items: center; justify-content: center; }
.auth .panel > div { width: min(400px, 100%); }

@media (max-width: 860px) {
  .shop { grid-template-columns: 1fr; }
  .filters { position: static; max-height: none; }
  .filters section { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
  .filters section + section { margin-top: 10px; }
  .filters h4 { margin: 0; }
  .filters .cats { display: flex; gap: 6px; overflow-x: auto; width: 100%; }
  .topbar .spacer { display: none; }
  .cartbtn { margin-left: auto; }
  .filters .cats .catlink { flex: none; width: auto; border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 6px 12px; }
  .topbar .inner { flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  .topbar .search { order: 5; flex-basis: 100%; max-width: none; }
  .who { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
  .page { padding: 16px 14px 60px; }
  .products { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth .hero { gap: 20px; }
  .auth .panel { align-items: flex-start; }
  .auth .hero { padding: 32px 24px; } .auth .hero h1 { font-size: 38px; } .auth .hero .mark { width: 96px; margin-bottom: 16px; }
  .auth .panel { padding: 28px 20px; }
}
