:root {
  --wine: #6b1f3a;
  --wine-dark: #4a1528;
  --gold: #c89b3c;
  --bg: #f7f4f2;
  --card: #ffffff;
  --ink: #2a2226;
  --muted: #8a7f84;
  --line: #e7e0dd;
  --green: #2e8b57;
  --red: #c0392b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--link); text-decoration: none; }

/* Nav */
.navbar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--wine); color: #fff; padding: .6rem 1rem;
  position: sticky; top: 0; z-index: 50;
}
.brand { color: #fff; font-weight: 700; font-size: 1.15rem; display: inline-flex;
  align-items: center; gap: .5rem; }
.brand-logo { height: 30px; width: auto; vertical-align: middle; border-radius: 5px;
  background: #fff; padding: 3px 6px; }  /* white chip so transparent/dark logos read on the wine nav */
.nav-links { display: flex; align-items: center; gap: .25rem; margin-left: auto; flex-wrap: wrap; }
.nav-links a { color: #f3e6ea; padding: .4rem .7rem; border-radius: 8px; font-size: .95rem; }
.nav-links a:hover, .nav-links a.active { background: rgba(255,255,255,.18); color: #fff; }
.nav-user { color: var(--gold); font-weight: 600; margin-left: .5rem; }
.nav-links a.logout { color: #f3c6cf; }
.nav-toggle { display: none; background: none; border: none; color: #fff; font-size: 1.5rem; margin-left: auto; cursor: pointer; }
.user-menu { position: relative; margin-left: .5rem; }
.user-trigger { background: none; border: none; cursor: pointer; font: inherit;
  color: var(--gold); font-weight: 600; padding: .4rem .7rem; border-radius: 8px; }
.user-trigger:hover, .user-trigger.active { background: rgba(255,255,255,.18); }
.user-trigger .caret { font-size: .8em; opacity: .8; }
.user-dropdown { position: absolute; right: 0; top: 100%; min-width: 190px; margin-top: .3rem;
  background: var(--wine-dark); border: 1px solid rgba(255,255,255,.15); border-radius: 10px;
  padding: .35rem; display: none; flex-direction: column; z-index: 60;
  box-shadow: 0 14px 30px -12px rgba(0,0,0,.5); }
.user-dropdown.open { display: flex; }
.user-dropdown a { color: #f3e6ea; padding: .5rem .7rem; border-radius: 8px; font-size: .95rem; }
.user-dropdown a:hover, .user-dropdown a.active { background: rgba(255,255,255,.18); color: #fff; }
.user-dropdown a.sa { color: var(--gold); }
.user-dropdown a.logout { color: #f3c6cf; }
.menu-divider { height: 1px; background: rgba(255,255,255,.15); margin: .3rem 0; }
.loc-switch { margin-left: .5rem; }
.loc-switch select { background: var(--wine-dark); color: #fff; border: 1px solid rgba(255,255,255,.25);
  border-radius: 8px; padding: .35rem .5rem; font-size: .9rem; }
.loc-label { color: #f3e6ea; margin-left: .5rem; font-size: .9rem; }

/* Layout */
.container { max-width: 1100px; margin: 0 auto; padding: 1.25rem; }
.full { max-width: 1400px; margin: 0 auto; padding: 1rem; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.25rem 0 .6rem; }

/* Cards & grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem; }
.grid { display: grid; gap: 1rem; }
.row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.spread { justify-content: space-between; }
.muted { color: var(--muted); }
.right { text-align: right; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  background: var(--link); color: #fff; border: none; border-radius: 10px;
  padding: .6rem 1rem; font-size: 1rem; cursor: pointer; font-weight: 600; }
.btn:hover { background: var(--link-dark); }
.btn-lg { padding: .9rem 1.4rem; font-size: 1.1rem; width: 100%; }
.btn-ghost { background: #fff; color: var(--wine); border: 1px solid var(--line); }
.btn-ghost:hover { background: #faf6f7; }
.btn-gold { background: var(--gold); color: #3a2c10; }
.btn-danger { background: var(--red); }
.btn-sm { padding: .35rem .6rem; font-size: .85rem; border-radius: 8px; }

/* Forms */
label { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin: .6rem 0 .2rem; }
input, select, textarea { width: 100%; padding: .6rem .7rem; border: 1px solid var(--line);
  border-radius: 10px; font-size: 1rem; font-family: inherit; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
textarea { min-height: 80px; }
.field-inline { display: flex; gap: .5rem; align-items: flex-end; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }

/* Product images & color dot */
.product-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: #faf6f7; }
.product-thumb.placeholder { font-size: 1.1rem; }
.product-photo { width: 120px; height: 120px; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--line); }
.color-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%;
  margin-right: .4rem; vertical-align: middle; }
.note-preview { display: inline-block; max-width: 340px; color: var(--muted);
  font-size: .8rem; font-style: italic; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; vertical-align: bottom; cursor: help; }

/* Inventory group section headers */
.group-header td { background: var(--wine); color: #fff; font-weight: 700;
  font-size: .95rem; letter-spacing: .02em; padding: .5rem .7rem;
  border-radius: 6px; }
.group-header td .muted { color: #f3d9e1; font-weight: 500; }

/* Clickable table rows */
tr.clickable-row { cursor: pointer; }
tr.clickable-row:hover td { background: #faf6f7; }

/* Sortable headers & pager */
.sort-link { color: var(--muted); display: inline-flex; align-items: center; gap: .2rem; }
.sort-link:hover { color: var(--wine); }
.sort-link.active { color: var(--wine); }
.sort-arrow { font-size: .7rem; }
.pager { display: flex; align-items: center; justify-content: center; gap: 1rem;
  margin-top: 1rem; }

/* CSS bar chart for reports */
.barchart { margin-bottom: 1rem; display: flex; flex-direction: column; gap: .35rem; }
.bar-row { display: grid; grid-template-columns: 180px 1fr 90px; align-items: center; gap: .6rem; }
.bar-label { font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { background: var(--bg); border-radius: 6px; height: 18px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--wine); border-radius: 6px; min-width: 2px; }
.bar-val { text-align: right; font-size: .85rem; font-weight: 600; }
@media (max-width: 640px) { .bar-row { grid-template-columns: 110px 1fr 70px; } }

/* Badges */
.badge { display: inline-block; padding: .15rem .5rem; border-radius: 999px; font-size: .75rem;
  font-weight: 600; background: #efe9e6; color: var(--muted); }
.badge.green { background: #e3f3ea; color: var(--green); }
.badge.red { background: #fbe6e3; color: var(--red); }
.badge.gold { background: #f7eed6; color: #8a6d1f; }

/* Flash */
.flash-container { position: fixed; top: 70px; right: 1rem; z-index: 100; display: flex; flex-direction: column; gap: .5rem; max-width: 340px; }
.flash { background: #fff; border-left: 4px solid var(--muted); padding: .7rem 1rem; border-radius: 8px;
  box-shadow: var(--shadow); display: flex; justify-content: space-between; gap: 1rem; }
.flash button { background: none; border: none; font-size: 1.1rem; cursor: pointer; color: var(--muted); }
.flash-success { border-left-color: var(--green); }
.flash-error { border-left-color: var(--red); }

/* ---- Register (POS) two-pane layout ---- */
.pos { display: grid; grid-template-columns: 1fr 380px; gap: 1rem; align-items: start; }
/* Register group tabs */
.reg-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .9rem;
  border-bottom: 1px solid var(--line); padding-bottom: .6rem; }
.reg-tab { background: #fff; border: 1px solid var(--line); color: var(--ink);
  padding: .5rem .9rem; border-radius: 999px; cursor: pointer; font-size: .95rem;
  font-weight: 600; }
.reg-tab:hover { border-color: var(--gold); }
.reg-tab.active { background: var(--wine); color: #fff; border-color: var(--wine); }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.product-tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .8rem; text-align: left; cursor: pointer; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: .3rem; min-height: 96px; }
.product-tile:hover { border-color: var(--gold); }
.product-tile .name { font-weight: 600; font-size: .95rem; }
.product-tile .price { color: var(--wine); font-weight: 700; }
.product-tile .meta { font-size: .75rem; color: var(--muted); }
.product-tile.oos { opacity: .55; }

/* Product color picker (edit form) */
.color-picker { display: flex; flex-wrap: wrap; gap: .5rem; }
.color-picker .swatch { position: relative; width: 34px; height: 34px; border-radius: 8px;
  cursor: pointer; border: 2px solid var(--line); display: inline-flex;
  align-items: center; justify-content: center; margin: 0; }
.color-picker .swatch.none { background: #fff;
  background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%),
    linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%);
  background-size: 12px 12px; background-position: 0 0, 6px 6px; }
.color-picker .swatch input { position: absolute; opacity: 0; width: 0; height: 0; }
.color-picker .swatch .tick { color: #fff; font-weight: 800; opacity: 0;
  text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.color-picker .swatch.none .tick { color: var(--ink); text-shadow: none; }
.color-picker .swatch:has(input:checked) { border-color: var(--ink); transform: scale(1.08); }
.color-picker .swatch:has(input:checked) .tick { opacity: 1; }
.cart { position: sticky; top: 80px; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: .3rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.cart-line .line-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .5rem; }
.cart-line .line-remove { background: var(--wine); color: #fff; border: none;
  width: 22px; height: 22px; border-radius: 50%; font-size: 1rem; line-height: 1;
  cursor: pointer; font-weight: 700; flex: 0 0 auto; align-self: center; padding: 0; }
.cart-line .line-remove:hover { background: var(--wine-dark); }
.cart-line .qty { display: flex; gap: .3rem; align-items: center; }
.cart-line input[type=number] { width: 56px; padding: .3rem; }
/* Tip preset buttons */
.tip-presets { display: flex; flex-wrap: wrap; gap: .35rem; }
.tip-btn { flex: 1 1 auto; min-width: 52px; background: #fff; border: 1px solid var(--line);
  color: var(--ink); padding: .5rem .4rem; border-radius: 10px; cursor: pointer;
  font-weight: 600; font-size: .95rem; }
.tip-btn:hover { border-color: var(--gold); }
.tip-btn.active { background: var(--wine); color: #fff; border-color: var(--wine); }

.totals div { display: flex; justify-content: space-between; padding: .2rem 0; }
.totals .grand { font-size: 1.3rem; font-weight: 800; border-top: 2px solid var(--ink); margin-top: .4rem; padding-top: .5rem; }

/* Login PIN pad */
.login-wrap { max-width: 420px; margin: 8vh auto; position: relative; z-index: 1;
  background: rgba(255,255,255,.86); backdrop-filter: blur(3px); }
.login-logo { max-height: 90px; max-width: 240px; width: auto; object-fit: contain; }
/* Page background layer: a fixed, full-page image behind all content, shown on
   the winery-selected pages. "watermark" = faint, centered, contained; "cover" =
   full-bleed photo with a page-color scrim for legibility. Sits above the body
   canvas (z-index 0); main content is lifted above it (z-index 1). The navbar
   (z-index 50) and flash-container (z-index 100) already sit above it. */
.page-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-repeat: no-repeat; background-position: center; }
.page-bg-watermark { background-size: min(92vw, 900px); }
.page-bg-cover { background-size: cover; }
.page-bg-scrim { position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: var(--bg); }
main { position: relative; z-index: 1; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-top: 1rem; }
.pinpad button { padding: 1.1rem; font-size: 1.4rem; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; }
.pinpad button:active { background: var(--bg); }
.pin-display { font-size: 2rem; letter-spacing: .5rem; text-align: center; min-height: 2.4rem; }

/* Calendar */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid .head { text-align: center; font-size: .75rem; color: var(--muted); font-weight: 700; padding: .3rem; }
.cal-cell { background: var(--card); border: 1px solid var(--line); border-radius: 8px; min-height: 84px;
  padding: .4rem; font-size: .8rem; display: block; color: var(--ink); cursor: pointer; }
.cal-cell:hover { border-color: var(--gold); background: #fffdf7; }
.cal-cell.dim { opacity: .4; }
.cal-cell.today { border-color: var(--gold); border-width: 2px; }
.cal-cell .dnum { font-weight: 700; }
.cal-cell .count { display: inline-block; margin-top: .3rem; }
.schedule-item { border-left: 4px solid var(--wine); padding: .6rem .8rem; margin-bottom: .6rem;
  background: var(--card); border-radius: 8px; box-shadow: var(--shadow); }
.schedule-item.tour { border-left-color: var(--gold); }
.time-col { font-weight: 700; color: var(--wine); }

/* Employee schedule weekly grid */
.sched-grid { min-width: 820px; }
.sched-grid th, .sched-grid td { border: 1px solid var(--line); vertical-align: top;
  padding: .4rem; text-align: left; }
.sched-grid th { text-align: center; }
.sched-grid th.today, .sched-grid td.today { background: #fbf6e9; }
.sched-grid td.emp { font-weight: 600; white-space: nowrap; background: #faf6f7; }
.shift-chip { display: block; background: var(--wine); color: #fff; border-radius: 6px;
  padding: .25rem .4rem; font-size: .8rem; margin-bottom: .3rem; line-height: 1.3; }
.shift-chip:hover { background: var(--wine-dark); color: #fff; }
.shift-chip .role { display: block; font-size: .7rem; opacity: .85; }
.shift-add { display: inline-block; color: var(--muted); border: 1px dashed var(--line);
  border-radius: 6px; padding: 0 .5rem; font-weight: 700; }
.shift-add:hover { color: var(--wine); border-color: var(--gold); }

/* Tasting sheet builder */
.sheet-builder { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .5rem; max-height: 70vh; overflow-y: auto; }
.palette-card { display: flex; flex-direction: column; gap: .15rem; text-align: left;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .55rem .6rem;
  cursor: pointer; font-size: .85rem; }
.palette-card:hover { border-color: var(--gold); }
.palette-card .pc-name { font-weight: 600; }
.palette-card .pc-thumb { width: 100%; height: 70px; object-fit: contain; }
.palette-card .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.board { min-height: 200px; border: 2px dashed var(--line); border-radius: 12px;
  padding: .6rem; display: flex; flex-direction: column; gap: .5rem; background: var(--card); }
.board-card { display: flex; align-items: center; gap: .6rem; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; padding: .5rem .7rem; cursor: grab; }
.board-card.dragging { opacity: .4; }
.board-card .num { background: var(--wine); color: #fff; width: 26px; height: 26px;
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; flex: 0 0 auto; }
.board-card .bc-name { flex: 1; font-weight: 600; }
.board-card .bc-actions { display: flex; gap: .2rem; }
.board-card .bc-actions button { border: 1px solid var(--line); background: #fff;
  border-radius: 6px; width: 28px; height: 28px; cursor: pointer; }
.board-empty { text-align: center; padding: 1.5rem; }
@media (max-width: 760px) { .sheet-builder { grid-template-columns: 1fr; } }

/* Printable tasting sheet */
.tasting-print { max-width: 1000px; margin: 0 auto; }
.ts-header { text-align: center; margin-bottom: 1.2rem; }
.ts-header h1 { margin: .3rem 0; }
.ts-logo { max-height: 64px; }
.ts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.ts-card { border: 1px solid var(--line); border-radius: 12px; padding: 1rem; position: relative;
  border-top: 4px solid var(--wine); }
.ts-num { position: absolute; top: -16px; left: 50%; transform: translateX(-50%);
  background: var(--wine); color: #fff; width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.1rem; }
.ts-photo { display: block; width: 100%; height: 150px; object-fit: contain;
  margin-top: .8rem; }
.ts-photo.placeholder { display: flex; align-items: center; justify-content: center;
  font-size: 3rem; background: #faf6f7; border-radius: 8px; }
.ts-name { font-weight: 700; font-size: 1.05rem; margin-top: .5rem; }
.ts-meta { color: var(--muted); font-size: .85rem; margin: .2rem 0 .5rem; }
.ts-notes { font-size: .9rem; line-height: 1.4; }

/* Receipt */
.receipt { max-width: 420px; margin: 0 auto; }
.receipt .line { display: flex; justify-content: space-between; padding: .2rem 0; }

@media (max-width: 880px) {
  .pos { grid-template-columns: 1fr; }
  .cart { position: static; }
  .nav-toggle { display: block; }
  .nav-links { display: none; width: 100%; flex-direction: column; align-items: stretch; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: .6rem; }
  .nav-user { margin: .3rem 0; }
  .user-menu { width: 100%; margin-left: 0; }
  .user-trigger { width: 100%; text-align: left; }
  .user-trigger .caret { display: none; }
  .user-dropdown { position: static; display: flex; min-width: 0; margin: 0; padding: 0 0 0 .5rem;
    background: transparent; border: none; box-shadow: none; }
}
@media print {
  .navbar, .flash-container, .no-print { display: none !important; }

  /* Schedule grid: print in landscape, legible regardless of background
     printing (chips become dark-on-white so white text never disappears). */
  @page { size: landscape; margin: 1cm; }
  .card { box-shadow: none; border-color: #999; }
  .sched-grid { min-width: 0; font-size: 10px; width: 100%; }
  .sched-grid th, .sched-grid td { border-color: #999; }
  .sched-grid th.today, .sched-grid td.today, .sched-grid td.emp { background: #fff !important; }
  .shift-add { display: none !important; }
  .shift-chip { background: #fff !important; color: #000 !important;
    border: 1px solid #666; }
  .shift-chip .role { opacity: 1; }

  /* Tasting sheet: keep number badges legible without background printing. */
  .ts-card { break-inside: avoid; border-color: #666; }
  .ts-num { background: #fff !important; color: #000 !important; border: 2px solid #000; }
  .ts-card { border-top-color: #000; }
}

/* ---- Public booking hero (customer-facing branded header) ---- */
.public-hero {
  position: relative; overflow: hidden; text-align: center;
  /* Dark scrim over the brand color so white text stays legible even when the
     imported primary is very light (e.g. a white-dominant site). */
  background: linear-gradient(rgba(0,0,0,.30), rgba(0,0,0,.46)), var(--wine);
  color: #fff;
  padding: 2.2rem 1rem; border-radius: 14px; margin-bottom: 1.5rem;
}
.public-hero-inner { position: relative; z-index: 1; }
.public-hero-logo {
  max-height: 64px; max-width: 220px; object-fit: contain;
  background: #fff; padding: 6px 10px; border-radius: 10px; margin-bottom: .6rem;
}
.public-hero-name { margin: 0; color: #fff; font-size: clamp(1.6rem, 4vw, 2.4rem); }
.public-hero-tagline { margin: .35rem 0 0; opacity: .9; }
