:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --ink: #211d18;
  --ink-dim: #6b6255;
  --border: #e6e0d4;
  /* Sampled directly from the Divine Energy logo's mid-tone gold. */
  --accent: #be9655;
  --accent-hover: #9c7b46;
  --error: #a4342a;
  --success: #3c6e47;
  --font-display: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: -apple-system, "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17150f;
    --surface: #211d18;
    --ink: #f2ede2;
    --ink-dim: #b3a891;
    --border: #38322a;
    --accent: #d9b46f;
    --accent-hover: #e8c789;
  }
}

* { box-sizing: border-box; }

/* Global safety net: an element's own [hidden] attribute must always win over any component
   class's unconditional display:X rule (e.g. .btn's display:inline-block, .form-row-2's
   display:grid) - without this, author rules always beat the user-agent stylesheet's own
   [hidden]{display:none} default regardless of specificity or source order, so a hidden button
   or panel can silently stay visible. Found this exact bug three times (a receipt modal, an
   image lightbox, and latent in .btn/.form-row-2) before adding one rule to rule it out entirely. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

img { max-width: 100%; display: block; }

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px;
  max-width: 1180px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}

.brand-logo {
  height: 52px;
  width: 52px;
  object-fit: contain;
  /* The logo's linework is dark gold, drawn for a white background - in dark mode it needs a
     touch more separation from the near-black header, hence the subtle glow below. */
}

@media (prefers-color-scheme: dark) {
  .brand-logo {
    filter: drop-shadow(0 0 1px rgba(217, 180, 111, 0.35));
  }
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.03em;
  line-height: 1.1;
}

.brand-tagline {
  display: block;
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-top: 2px;
}

/* The brand block (logo+name+tagline) and nav links don't wrap by default, so on a phone-width
   screen they overflow the viewport instead of shrinking - the page then renders wider than the
   screen, which is what actually produces the "everything's tiny, I have to zoom in" feeling on
   a phone, not a real zoom level. Wrapping to two rows guarantees no horizontal overflow
   regardless of exact nav content. */
@media (max-width: 640px) {
  .site-header-inner {
    flex-wrap: wrap;
    row-gap: 10px;
    padding: 16px 20px;
  }
  .header-nav {
    gap: 16px;
    flex-wrap: wrap;
  }
  .brand-tagline {
    display: none;
  }
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.header-nav a {
  text-decoration: none;
  font-size: 14px;
  letter-spacing: 0.03em;
  color: var(--ink);
}

.lang-toggle {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.lang-btn {
  background: none;
  border: none;
  padding: 5px 10px;
  font-size: 12px;
  letter-spacing: 0.03em;
  cursor: pointer;
  color: var(--ink-dim);
}

.lang-btn.active {
  color: #fff;
  background: var(--accent);
}

.cart-link {
  position: relative;
}

.cart-count {
  position: absolute;
  top: -9px;
  right: -14px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 999px;
  min-width: 16px;
  text-align: center;
}

/* ---------- Hero ---------- */

.hero {
  padding: 72px 24px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 400;
  margin: 0 0 12px 0;
  letter-spacing: 0.02em;
}

.hero p {
  color: var(--ink-dim);
  font-size: 15px;
  max-width: 480px;
  margin: 0 auto;
}

/* ---------- Shop layout ---------- */

.shop-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 40px;
  padding: 48px 24px;
  max-width: 1180px;
  margin: 0 auto;
}

@media (max-width: 780px) {
  .shop-layout { grid-template-columns: 1fr; }
}

.filters h3 {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 0 0 14px 0;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 14px;
  cursor: pointer;
}

.shop-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--ink-dim);
}

.shop-toolbar select {
  font-family: var(--font-body);
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
}

/* ---------- Product grid ---------- */

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px 24px;
}

@media (max-width: 780px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .product-grid { grid-template-columns: 1fr; }
}

.product-card {
  text-decoration: none;
  color: inherit;
  display: block;
}

.product-card-image {
  aspect-ratio: 1 / 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.product-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card-tag {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}

.product-card-name {
  font-size: 15px;
  margin-bottom: 4px;
}

.product-card-price {
  font-size: 14px;
  color: var(--ink-dim);
}

.empty-state {
  color: var(--ink-dim);
  font-size: 14px;
  padding: 40px 0;
}

/* ---------- Product detail ---------- */

.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  padding: 48px 24px;
  max-width: 1180px;
  margin: 0 auto;
}

@media (max-width: 780px) {
  .product-detail { grid-template-columns: 1fr; gap: 28px; }
}

.product-gallery-main {
  aspect-ratio: 1 / 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.product-gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-gallery-thumbs {
  display: flex;
  gap: 8px;
}

.product-gallery-thumbs img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  cursor: pointer;
}

.product-info h1 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 400;
  margin: 4px 0 14px 0;
}

.product-info-price {
  font-size: 22px;
  margin-bottom: 20px;
}

.product-info-desc {
  color: var(--ink-dim);
  line-height: 1.7;
  white-space: pre-wrap;
  margin-bottom: 28px;
}

.qty-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.qty-input {
  width: 64px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  text-align: center;
  background: var(--surface);
  color: var(--ink);
}

.stock-note {
  font-size: 13px;
  color: var(--ink-dim);
  margin-top: 10px;
}

/* ---------- Buttons & forms ---------- */

.btn {
  display: inline-block;
  border: none;
  border-radius: 4px;
  padding: 14px 28px;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

.btn-primary {
  background: var(--ink);
  color: var(--bg);
}

.btn-primary:hover { background: var(--accent); }

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
}

.btn-sm { padding: 8px 16px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
  margin-bottom: 6px;
}

.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  font-family: var(--font-body);
  background: var(--surface);
  color: var(--ink);
}

.field textarea { resize: vertical; }

.status-msg {
  font-size: 13px;
  margin-top: 8px;
  min-height: 16px;
}

.status-msg.error { color: var(--error); }
.status-msg.success { color: var(--success); }

.vacation-banner {
  background: var(--accent);
  color: var(--ink);
  text-align: center;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500;
}

.hint-text {
  font-size: 13px;
  color: var(--ink-dim);
  line-height: 1.5;
  margin: 0 0 12px;
}

.row-actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.bulk-queue {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.bulk-item-thumb {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

.bulk-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.photo-compare {
  display: flex;
  gap: 16px;
  margin: 8px 0;
}

.photo-compare > div {
  flex: 1;
  text-align: center;
}

.photo-compare img {
  width: 100%;
  max-width: 260px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.row-status {
  font-size: 12px;
  margin-left: 8px;
  color: var(--ink-dim);
}

.row-status.success { color: var(--success); }
.row-status.error { color: var(--error); }

/* ---------- Cart ---------- */

.cart-page {
  max-width: 820px;
  margin: 0 auto;
  padding: 48px 24px;
}

.cart-page h1 {
  font-family: var(--font-display);
  font-weight: 400;
  margin-bottom: 28px;
}

.card-subtitle {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 18px;
  margin: 28px 0 12px 0;
}

.cart-row {
  display: grid;
  grid-template-columns: 72px 1fr auto auto auto;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.cart-row img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.cart-row-name { font-size: 14px; }
.cart-row-price { font-size: 13px; color: var(--ink-dim); }

.cart-row-qty {
  width: 56px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-align: center;
  background: var(--surface);
  color: var(--ink);
}

/* Same problem as the header: 5 fixed/auto columns (image, name, qty, total, remove) plus 4x
   16px gaps don't leave enough room for the name on a phone screen. Collapse to a 2-column grid
   (image | everything else), with qty/total/remove each dropping to their own row under the
   name instead of being squeezed into the original single row. */
@media (max-width: 560px) {
  .cart-row {
    grid-template-columns: 56px 1fr;
    row-gap: 6px;
  }
  .cart-row img { width: 56px; height: 56px; }
  .cart-row-qty,
  .cart-row-total,
  .cart-remove {
    grid-column: 2 / -1;
    justify-self: start;
  }
}

.cart-remove {
  background: none;
  border: none;
  color: var(--ink-dim);
  cursor: pointer;
  font-size: 13px;
  text-decoration: underline;
}

.cart-totals-line {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  padding: 4px 0;
  font-size: 14px;
  color: var(--ink-dim);
}

.cart-totals {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  padding: 24px 0;
  font-size: 18px;
}

/* ---------- Shop tour ---------- */

.shop-tour-section {
  border-top: 1px solid var(--border);
  padding: 56px 24px;
  max-width: 1180px;
  margin: 0 auto;
  text-align: center;
}

.shop-tour-section h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
  margin: 0 0 8px 0;
}

.shop-tour-intro {
  color: var(--ink-dim);
  font-size: 14px;
  margin: 0 0 32px 0;
}

.shop-tour-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  text-align: left;
}

@media (max-width: 780px) {
  .shop-tour-grid { grid-template-columns: 1fr; }
}

.shop-tour-card h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 17px;
  margin: 0 0 10px 0;
}

.shop-tour-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
}

.shop-tour-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.shop-tour-map-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 13px;
  color: var(--accent-hover);
  text-decoration: none;
}

.shop-tour-map-link:hover { text-decoration: underline; }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  color: var(--ink-dim);
  font-size: 13px;
}

/* ---------- Admin ---------- */

.admin-page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 24px;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.admin-tab-btn {
  background: none;
  border: none;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  color: var(--ink-dim);
  border-bottom: 2px solid transparent;
}

/* Six tabs in one row don't fit a phone screen either - scroll horizontally (the standard
   mobile tab-bar pattern) rather than wrap, since wrapping would push page content down by an
   unpredictable amount depending on how many tabs exist. */
@media (max-width: 700px) {
  .admin-page {
    padding: 24px 16px;
  }
  .admin-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }
  .admin-tab-btn {
    flex: 0 0 auto;
    padding: 10px 12px;
    font-size: 13px;
    white-space: nowrap;
  }
}

.admin-tab-btn.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.admin-panel[hidden] { display: none; }

.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 20px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

/* Products/Stock/Orders/variation tables have too many columns to fit a phone screen - scroll
   the table itself horizontally rather than let its cells get crushed unreadably narrow. */
@media (max-width: 700px) {
  .admin-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
}

.admin-table th, .admin-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}

.admin-table img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
}

/* Same 36x36 square as .admin-table img above, but with an explicit max-width - on the narrow-
   viewport table layout (@media rule below, display:block + white-space:nowrap on the table
   itself), the table cell no longer reliably sizes to its column, so the global `img { max-width:
   100% }` reset can clamp this thumbnail's width down to whatever that cell's shrunk content box
   happens to be while height stays fixed at 36px - producing a tall, narrow sliver instead of a
   square. Pinning max-width to the same 36px defeats that regardless of the cell's actual width. */
.stock-thumb {
  width: 36px;
  height: 36px;
  max-width: 36px;
  object-fit: cover;
  border-radius: 4px;
}

.admin-thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.admin-thumbs img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* Any product-photo thumbnail across Manager (product form, tables, before/after compare) opens
   full-size on click - cursor signals it's clickable, actual click handling is delegated in JS. */
.admin-thumbs img,
.admin-table img,
.photo-compare img,
.bulk-item-thumb {
  cursor: zoom-in;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 40px;
  cursor: zoom-out;
}

/* display:flex only applies when NOT hidden - setting it unconditionally on .image-lightbox
   would override the [hidden] attribute (same CSS specificity, author rule wins over the
   user-agent default), showing the dark overlay permanently regardless of the hidden state. */
.image-lightbox:not([hidden]) {
  display: flex;
}

.image-lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  cursor: default;
}

.image-lightbox-close {
  position: absolute;
  top: 16px;
  right: 24px;
  background: none;
  border: none;
  color: #fff;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 10px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

/* Used throughout checkout, account, and the Manager's product forms - two/three side-by-side
   inputs get cramped on a phone screen, so stack them instead. */
@media (max-width: 560px) {
  .form-row-2,
  .form-row-3 {
    grid-template-columns: 1fr;
  }
}

.tag {
  display: inline-block;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--border);
  color: var(--ink-dim);
}

.tag.paid, .tag.active { background: #dcebe0; color: var(--success); }
.tag.fulfilled { background: #dbe4f0; color: #2f5289; }
.tag.cancelled, .tag.failed { background: #f2dcd9; color: var(--error); }
.tag.draft, .tag.pending { background: var(--border); color: var(--ink-dim); }

/* ---------- Account ---------- */

.account-page {
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 24px;
}

.account-page h1 {
  font-family: var(--font-display);
  font-weight: 400;
  margin-bottom: 24px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.auth-tab-btn {
  background: none;
  border: none;
  padding: 8px 4px;
  font-size: 14px;
  cursor: pointer;
  color: var(--ink-dim);
  border-bottom: 2px solid transparent;
}

.auth-tab-btn.active { color: var(--ink); border-bottom-color: var(--accent); }

.auth-form[hidden] { display: none; }

.address-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
  margin-bottom: 12px;
  position: relative;
}

.address-card-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.address-card-actions button {
  background: none;
  border: none;
  color: var(--ink-dim);
  text-decoration: underline;
  font-size: 12px;
  cursor: pointer;
}

.header-nav a.subtle { color: var(--ink-dim); }

/* ---------- Manager access notice ---------- */

.access-denied {
  max-width: 480px;
  margin: 80px auto;
  text-align: center;
  padding: 0 24px;
}

.access-denied h1 {
  font-family: var(--font-display);
  font-weight: 400;
}

.account-section {
  margin-top: 36px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin: 14px 0;
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.owner-setup {
  margin-top: 40px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.owner-setup summary {
  cursor: pointer;
  color: var(--ink-dim);
  font-size: 13px;
}

.owner-setup[open] summary {
  margin-bottom: 14px;
}

.field-stack-gap {
  margin-top: 8px;
}

.listing-batch-list {
  list-style: none;
  margin: 0 0 12px 0;
  padding: 0;
  font-size: 13px;
}

.listing-batch-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.export-product-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.listing-mapping-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px 16px;
  margin: 14px 0;
}

.delivery-channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  margin: 14px 0;
  font-size: 13px;
}

.delivery-channel-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.variation-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.variation-option-btn {
  padding: 8px 14px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.variation-option-btn:hover:not(:disabled) {
  border-color: var(--accent);
}

.variation-option-btn.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.variation-option-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  text-decoration: line-through;
}

/* ---------- Messages ---------- */

.contact-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px;
}

.contact-page h1 {
  font-family: var(--font-display);
  font-weight: 400;
  margin-bottom: 8px;
}

.thread-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  background: var(--surface);
}

.thread-list-item:hover { border-color: var(--accent); }
.thread-list-item.unread { border-color: var(--accent); }

.thread-list-subject { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.thread-list-meta { font-size: 12px; color: var(--ink-dim); margin-top: 4px; }

.thread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  display: inline-block;
}

.admin-tab-btn .thread-dot { margin-left: 6px; }

.msg-bubble-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 480px;
  overflow-y: auto;
  padding: 4px 2px;
  margin: 16px 0;
}

.msg-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.msg-bubble-customer {
  align-self: flex-end;
  background: var(--ink);
  color: var(--bg);
  border-bottom-right-radius: 2px;
}

.msg-bubble-employee {
  align-self: flex-start;
  background: var(--border);
  color: var(--ink);
  border-bottom-left-radius: 2px;
}

.msg-bubble-meta {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 4px;
  display: block;
}

.thread-back-btn {
  background: none;
  border: none;
  color: var(--ink-dim);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  margin-bottom: 14px;
  text-decoration: underline;
}

/* ---------- POS ---------- */

/* The POS tab wants more room than a product form does, so it opts out of .admin-page's
   1000px cap - without this, an 80/20 split leaves the cart column too narrow to use even on
   a large iPad. :has() support is broad enough now (Safari 15.4+, Chrome 105+) to rely on it. */
@media (min-width: 901px) {
  .admin-page:has(#pos-panel:not([hidden])) {
    max-width: 1400px;
  }
}

.pos-layout {
  display: grid;
  grid-template-columns: 4fr 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .pos-layout { grid-template-columns: 1fr; }
}

.pos-cart-card { position: sticky; top: 16px; }

/* .form-row-2's normal breakpoint only responds to viewport width, but at a 20% column this
   card is narrow regardless of viewport - Discount/Payment Method need to stack unconditionally
   here rather than only on a narrow phone screen. */
.pos-cart-card .form-row-2 {
  grid-template-columns: 1fr;
}

.pos-cart-card .row-actions {
  flex-direction: column;
}

.pos-cart-card .row-actions .btn {
  width: 100%;
}

@media (max-width: 900px) {
  .pos-cart-card { position: static; }
}

.pos-shelf-crumb {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.pos-shelf-crumb .thread-back-btn { margin-bottom: 0; }

.pos-shelf-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.pos-shelf-tile {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  text-align: left;
}

.pos-shelf-tile:hover { border-color: var(--accent); }

.pos-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.pos-product-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.pos-product-tile:hover:not(:disabled) { border-color: var(--accent); }

.pos-product-tile:disabled,
.pos-product-tile.out-of-stock {
  opacity: 0.45;
  cursor: not-allowed;
}

.pos-product-tile img,
.pos-product-tile-noimg {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg);
}

.pos-product-tile-name {
  font-size: 13px;
  font-weight: 600;
}

.pos-product-tile-meta {
  font-size: 12px;
  color: var(--ink-dim);
}

.pos-cart-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  max-height: 320px;
  overflow-y: auto;
}

.pos-cart-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.pos-cart-row-qty {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Touch target, not click target - the 4px/10px .btn-sm default is fine with a mouse but too
   small to reliably tap with a thumb on an iPad. */
.pos-cart-row-qty button {
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 16px;
}

.pos-cart-row-total { font-weight: 600; white-space: nowrap; }

.pos-totals {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-bottom: 16px;
}

.pos-totals-line {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-dim);
  padding: 3px 0;
}

.pos-total-line {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 8px;
}

#pos-receipt-content h2 {
  font-family: var(--font-display);
  font-weight: 400;
  margin: 0 0 4px 0;
}

.pos-receipt-items {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
  margin: 12px 0;
}

.pos-receipt-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 3px 0;
}

.pos-receipt-total {
  font-size: 15px;
  font-weight: 600;
}

@media print {
  @page {
    size: 80mm auto;
    margin: 0;
  }
  body * { visibility: hidden; }
  #pos-receipt-content, #pos-receipt-content * { visibility: visible; }
  #pos-receipt-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 72mm;
    margin: 0;
    padding: 3mm;
    font-family: "Courier New", monospace;
    font-size: 11px;
    color: #000;
  }
  #pos-receipt-content h2 {
    font-family: "Courier New", monospace;
    font-size: 15px;
    text-align: center;
  }
  #pos-receipt-content .hint-text { color: #000; font-size: 10px; }
  #pos-receipt-content .hint-text:first-of-type { text-align: center; margin-bottom: 6px; }
  .pos-receipt-items { border-top: 1px dashed #000; border-bottom: 1px dashed #000; }
  .pos-receipt-row { font-size: 11px; }
  .pos-receipt-total { font-size: 13px; }
  .no-print { display: none !important; }
}

.pos-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

/* Kiosk mode: hide everything except the POS tab itself so a cashier can't wander off
   mid-transaction. The POS tab's own content stays visible since it's outside this selector. */
body.pos-locked .site-header,
body.pos-locked .admin-tabs {
  display: none;
}

body.pos-locked .admin-page {
  padding: 16px;
}

body.pos-locked #manager-content > .admin-panel:not(#pos-panel) {
  display: none;
}

/* ---------- Dashboard ---------- */

.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.dashboard-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dashboard-card-label {
  font-size: 11px;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dashboard-card-value {
  font-size: 22px;
  font-weight: 600;
  font-family: var(--font-display);
}

.dashboard-split {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.dashboard-split-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
}
