/* Craft Fair Vendor OS — Phase 1. Warm craft-fair palette, mobile-first. */
:root {
  --bg: #f7f3ea;
  --surface: #fffdf8;
  --line: #e2d9c8;
  --ink: #2b3a2f;
  --muted: #6f7a6e;
  --green: #2f5d46;
  --green-soft: #e4efe8;
  --rust: #b7583b;
  --gold: #c9922c;
  --gold-soft: #fbf0d5;
  --blue: #3e6b7e;
  --blue-soft: #e0edf2;
  --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px; line-height: 1.5;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 18px; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; min-height: 62px; gap: 12px; }
.brand { font-weight: 800; font-size: 18px; color: var(--ink); text-decoration: none; }
.topnav { display: flex; align-items: center; gap: 10px; }
.who { color: var(--muted); font-size: 14px; }
.inline { display: inline; margin: 0; }
main.wrap { padding-top: 26px; padding-bottom: 60px; min-height: 70vh; }
.footer { color: var(--muted); font-size: 13px; padding-bottom: 30px; }

h1 { font-size: 30px; margin: 0 0 6px; letter-spacing: -0.01em; }
h2 { font-size: 21px; margin: 26px 0 12px; }
.sub { color: var(--muted); margin-top: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }

.btn {
  display: inline-block; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); border-radius: 10px; padding: 10px 16px; font-weight: 600;
  text-decoration: none; cursor: pointer; font-size: 15px;
}
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-danger { background: var(--rust); border-color: var(--rust); color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 10px; font-size: 14px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat .value { font-size: 30px; font-weight: 800; margin-top: 6px; }

table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.table-wrap { overflow-x: auto; }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.pill-pending { background: var(--gold-soft); color: #8a6414; }
.pill-approved { background: var(--blue-soft); color: var(--blue); }
.pill-rejected { background: #f7e3dc; color: var(--rust); }
.pill-waitlisted { background: #e9e4f8; color: #5b4b9e; }
.pill-paid { background: var(--green-soft); color: var(--green); }
.pill-unpaid { background: #eee; color: var(--muted); }

form.stack label { display: block; margin: 14px 0 4px; font-weight: 600; }
form.stack input[type=text], form.stack input[type=email], form.stack input[type=password],
form.stack input[type=date], form.stack input[type=number], form.stack select, form.stack textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 16px; background: #fff; color: var(--ink);
}
form.stack textarea { min-height: 90px; resize: vertical; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.mt { margin-top: 16px; }

.flashes { padding-top: 14px; }
.flash { border-radius: 10px; padding: 11px 14px; margin-bottom: 10px; font-weight: 600; }
.flash-ok { background: var(--green-soft); color: var(--green); }
.flash-warn { background: var(--gold-soft); color: #8a6414; }
.flash-demo { background: #fff7e0; border: 2px dashed var(--gold); color: #8a6414; }

/* POS (Phase 2) */
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.pos-item {
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 16px 12px; cursor: pointer; text-align: center; min-height: 110px;
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
}
.pos-item:active { transform: scale(.97); border-color: var(--green); }
.pos-item:disabled { opacity: .45; cursor: default; }
.pos-name { font-weight: 700; font-size: 15px; }
.pos-price { font-size: 18px; color: var(--green); font-weight: 800; }
.pos-stock { font-size: 12px; color: var(--muted); }
.pos-cart h2 { font-size: 19px; }
.pos-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pos-qty { display: flex; align-items: center; gap: 10px; }
.pos-qty button {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); font-size: 20px; font-weight: 700; cursor: pointer;
}
.pos-total { text-align: right; font-size: 20px; margin-top: 14px; }

/* virtual market (Phase 3) */
.mkt-item { display: flex; flex-direction: column; }
.mkt-photo { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; margin-bottom: 10px; }
.mkt-name { font-weight: 700; margin-bottom: 2px; }
.mkt-foot { display: flex; justify-content: space-between; align-items: baseline; margin-top: 8px; }

/* booth map */
.boothmap { display: grid; gap: 8px; margin-top: 8px; }
.booth {
  border: 2px solid var(--line); border-radius: 10px; background: var(--surface);
  min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; padding: 6px 4px; text-align: center;
}
.booth small { font-weight: 600; font-size: 11px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.booth-open { border-style: dashed; color: var(--muted); }
.booth-assigned { background: var(--blue-soft); border-color: var(--blue); }
.booth-paid { background: var(--green-soft); border-color: var(--green); }
.booth-held { background: var(--gold-soft); border-color: var(--gold); }
.pill-open { background: #eee; color: var(--muted); }
.pill-assigned { background: var(--blue-soft); color: var(--blue); }
.pill-held { background: var(--gold-soft); color: #8a6414; }

/* venue map + concert-style booth dots */
.venue-map { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.venue-map img { display: block; width: 100%; height: auto; -webkit-user-drag: none; user-select: none; -webkit-user-select: none; }
.map-dot {
  position: absolute; transform: translate(-50%, -50%);
  min-width: 44px; height: 44px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; border: 2px solid; font-weight: 800; font-size: 14px;
  cursor: pointer; background: var(--surface);
}
button.map-dot { font-family: inherit; }
.map-dot-open { background: var(--green); border-color: var(--green); color: #fff; }
.map-dot-open:hover { filter: brightness(1.1); }
.map-dot-taken { background: #cfcfcf; border-color: #a9a9a9; color: #666; cursor: default; }
.map-dot-mine { background: var(--gold); border-color: var(--gold); color: #fff; cursor: default; }
.map-dot-assigned { background: var(--blue); border-color: var(--blue); color: #fff; cursor: default; }
.map-dot-paid { background: var(--green); border-color: var(--green); color: #fff; cursor: default; }
.map-dot-held { background: var(--gold-soft); border-color: var(--gold); color: #8a6414; cursor: default; }
/* Resizable booth rectangles (organizer editor + vendor picker) */
.map-booth {
  position: absolute; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 2px solid; font-weight: 800;
  user-select: none; -webkit-user-select: none;
  touch-action: none; min-width: 12px; min-height: 12px; overflow: visible;
  padding: 2px; text-align: center; line-height: 1.1;
  container-type: size;
}
/* NOTE: no background here — the map-dot-* status classes own the
   background/text colors. Setting one here would override them
   (equal specificity, later in file) and hide labels. */
/* Booth label scales with booth size so tiny booths stay legible */
.map-booth .blbl {
  font-size: 13px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 100%; pointer-events: none;
}
@supports (font-size: 1cqw) {
  .map-booth .blbl { font-size: clamp(6px, 32cqw, 15px); }
}
button.map-booth { font-family: inherit; cursor: pointer; }
button.map-booth:disabled { cursor: default; }
div.map-booth { cursor: grab; }
div.map-booth.dragging { cursor: grabbing; opacity: .88; z-index: 5; box-shadow: 0 6px 16px rgba(0,0,0,.35); }
.map-booth .resize-handle {
  position: absolute; right: -8px; bottom: -8px; width: 16px; height: 16px;
  background: #fff; border: 2px solid var(--blue); border-radius: 50%;
  cursor: nwse-resize; touch-action: none;
}
.map-booth .resize-handle::after {
  content: ""; position: absolute; inset: 4px;
  border-right: 2px solid var(--blue); border-bottom: 2px solid var(--blue);
  border-bottom-right-radius: 3px;
}
.map-saved-toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: #1e7e34; color: #fff; font-weight: 700; padding: 10px 22px;
  border-radius: 999px; box-shadow: 0 4px 14px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 99;
}
.map-saved-toast.show { opacity: 1; }
.venue-map-editor { cursor: crosshair; }
.venue-map-editor img { user-select: none; -webkit-user-select: none; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 14px; margin: 10px 0; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; margin-right: 6px; vertical-align: -2px; }

/* Zoomable venue maps: the inner .map-zoom grows with --z, the wrap scrolls to pan */
.map-zoom-wrap { position: relative; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); max-height: 72vh; background: #f4f5f7; cursor: grab; touch-action: pan-x pan-y; user-select: none; -webkit-user-select: none; }
.map-zoom-wrap.panning { cursor: grabbing; }
.map-zoom { width: calc(100% * var(--z, 1)); }
.map-zoom .venue-map { border: 0; border-radius: 0; }
/* Toolbar lives in .map-zoom-ui ABOVE the scrollable wrap (hoisted by
   initMapZoom) so it never scrolls away while panning a zoomed map. */
.map-zoom-ui { margin: 0; }
.map-zoom-bar { display: flex; gap: 2px; align-items: center; width: fit-content; margin: 0 0 6px auto; background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 999px; padding: 3px 5px; box-shadow: 0 2px 8px rgba(0,0,0,.14); }
.map-zoom-bar button { border: 0; background: transparent; width: 30px; height: 30px; border-radius: 50%; font-size: 17px; font-weight: 800; cursor: pointer; line-height: 1; color: var(--ink); }
.map-zoom-bar button:hover { background: var(--blue-soft); }
.map-zoom-bar span { min-width: 46px; text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); }
/* Booth detail popover (tap a booth on any map view) */
.booth-pop { position: fixed; z-index: 200; min-width: 180px; max-width: 260px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(30,25,15,.22); padding: 10px 12px; font-size: 13px; line-height: 1.45; color: var(--ink); }
.booth-pop-title { font-weight: 800; font-size: 15px; margin-bottom: 4px; padding-right: 20px; }
.booth-pop-status { font-weight: 700; font-size: 11px; background: var(--blue-soft); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.booth-pop-row { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.booth-pop-row span { color: var(--muted); }
.booth-pop-row strong { font-weight: 600; text-align: right; }
.booth-pop-x { position: absolute; top: 2px; right: 6px; border: 0; background: none; font-size: 18px; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px; }
.booth-pop-action { width: 100%; margin-top: 8px; }
/* Vendor name appears inside booths once zoomed in enough to read it */
.map-booth .bvend { display: none; font-size: clamp(5px, 20cqw, 11px); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; pointer-events: none; opacity: .95; }
.map-zoom.zoomed .map-booth .bvend { display: block; }
.map-zoom.zoomed .map-booth { flex-direction: column; }

.banner-demo {
  background: #fff7e0; border: 2px dashed var(--gold); border-radius: var(--radius);
  padding: 16px; margin-bottom: 18px; font-weight: 600;
}
.hero { text-align: center; padding: 60px 10px 40px; }
.hero h1 { font-size: clamp(32px, 6vw, 54px); }
.hero p { color: var(--muted); font-size: 18px; max-width: 640px; margin: 12px auto 26px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 34px; text-align: left; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.step strong { display: block; margin-bottom: 6px; }
@media (max-width: 560px) {
  h1 { font-size: 24px; }
  .topbar-inner { min-height: 56px; }
  .who { display: none; }
}
