﻿.btn {
  --btn-bg: var(--color-card);
  --btn-ink: var(--color-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 var(--space-5);
  height: 44px;
  border-radius: var(--radius-btn);
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: box-shadow var(--dur-base) var(--ease-out),
    background-color var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out),
    color var(--dur-base) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: translateY(0) scale(0.99);
}

.btn:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 3px;
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
}

.btn-primary {
  background-color: var(--rose-600);
  background-image: linear-gradient(160deg, var(--rose-600), var(--rose-700) 70%);
  color: var(--color-on-primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 4px 14px rgba(150, 57, 78, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.btn-primary:hover {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 6px 20px rgba(150, 57, 78, 0.3);
}

.btn-secondary {
  background: var(--glass-bg-strong);
  color: var(--color-primary);
  border: 1px solid var(--rose-300);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.btn-secondary:hover {
  background: #FFFFFF;
  border-color: var(--rose-500);
}

.btn-gold {
  background-color: var(--gold-600);
  background-image: linear-gradient(155deg, #C08A2D, var(--gold-600));
  color: #FFFFFF;
  box-shadow: var(--glass-highlight), 0 6px 16px rgba(161, 98, 7, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.btn-outline {
  background: transparent;
  color: var(--color-ink);
  border: 1px solid var(--color-border-strong);
}

.btn-outline:hover {
  border-color: var(--rose-500);
  color: var(--color-primary);
  background: var(--blush-50);
}

.btn-ghost {
  background: transparent;
  color: var(--color-ink-soft);
}

.btn-ghost:hover {
  background: var(--blush-100);
  color: var(--color-primary);
}

.btn-danger {
  background: var(--color-danger);
  color: #FFFFFF;
}

.btn-success {
  background: var(--color-success);
  color: #FFFFFF;
}

.btn-sm {
  height: 34px;
  padding: 0 var(--space-4);
  font-size: var(--fs-xs);
}

.btn-lg {
  height: 52px;
  padding: 0 var(--space-8);
  font-size: var(--fs-sm);
}

.btn-block {
  width: 100%;
}

.icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-ink-soft);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.icon-btn:hover {
  background: var(--blush-100);
  color: var(--color-primary);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
}

/* One primary action (if any) plus a kebab trigger (ui.js's menu()) at the
   end of a table row - replaces stacking every possible action inline,
   which crowded/overlapped once a row had 3+ of them (Invoices, Bookings,
   Payments). */
.row-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ============================================================
   LIQUID GLASS - shared surface system
   One set of primitives over the --glass-* tokens (tokens.css)
   so nav bars, floating cards, sheets and admin chrome all read
   as one material instead of hand-rolled backdrop-filter values.
   Radius is intentionally left to the caller: the customer site's
   Dior direction keeps glass sharp-edged (see the "no bubbles"
   rule in customer.css), while admin surfaces round it - both
   read as "glass" through translucency + blur + edge highlight,
   not through corner radius.
   ============================================================ */
.glass,
.glass--card,
.glass--nav,
.glass--sheet {
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm), var(--glass-highlight), 0 0 0 1px var(--glass-edge);
}

/* Elevated content surface (product/service cards floating over imagery,
   dashboard tiles): stronger fill so text stays legible, deeper shadow. */
.glass--card {
  background: var(--glass-bg-strong);
  box-shadow: var(--shadow-md), var(--glass-highlight), 0 0 0 1px var(--glass-edge);
  transition: box-shadow var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}

.glass--card:hover {
  box-shadow: var(--shadow-lg), var(--glass-highlight), 0 0 0 1px var(--glass-edge);
  transform: translateY(-2px);
}

/* Chrome that sits above scrolling content (headers, sidebars, sticky
   bars): deepest tint so text stays readable over any content beneath. */
.glass--nav {
  background: var(--glass-bg-deep);
  border-color: var(--glass-border);
}

/* Overlays that sit above everything (dialogs, sheets, toasts): the
   strongest fill, since they must stay legible over arbitrary content. */
.glass--sheet {
  background: var(--glass-bg-strong);
  box-shadow: var(--shadow-lg), var(--glass-highlight), 0 0 0 1px var(--glass-edge);
}

@media (prefers-reduced-transparency: reduce) {
  .glass,
  .glass--card,
  .glass--nav,
  .glass--sheet {
    background: var(--color-card);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass,
  .glass--card,
  .glass--nav,
  .glass--sheet {
    background: var(--color-card);
  }
}

/* Ambient light the glass blurs against - without color behind it,
   translucency reads as flat, not "liquid". Fixed so it drifts subtly
   without adding scrollable height, and stays out of the paint order. */
.glass-ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.glass-ambient::before,
.glass-ambient::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  animation: glassAmbientDrift 22s var(--ease-in-out) infinite alternate;
}

.glass-ambient::before {
  width: 46vw;
  height: 46vw;
  top: -14vw;
  right: -10vw;
  background: radial-gradient(circle, var(--rose-300) 0%, transparent 70%);
}

.glass-ambient::after {
  width: 40vw;
  height: 40vw;
  bottom: -16vw;
  left: -8vw;
  background: radial-gradient(circle, var(--champagne-300) 0%, transparent 70%);
  animation-name: glassAmbientDrift2;
  animation-duration: 26s;
}

@keyframes glassAmbientDrift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-3vw, 2vw) scale(1.08); }
}

@keyframes glassAmbientDrift2 {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(3vw, -2vw) scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
  .glass-ambient::before,
  .glass-ambient::after {
    animation: none;
  }
}

.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-pad {
  padding: var(--space-6);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-neutral {
  background: var(--pearl-200);
  color: var(--plum-600);
}

.badge-success {
  background: var(--color-success-surface);
  color: var(--color-success);
}

.badge-warning {
  background: var(--color-warning-surface);
  color: var(--color-warning);
}

.badge-danger {
  background: var(--color-danger-surface);
  color: var(--color-danger);
}

.badge-info {
  background: var(--color-info-surface);
  color: var(--color-info);
}

.badge-gold {
  background: var(--champagne-200);
  color: var(--gold-600);
}

.badge-success-light {
  background: var(--color-success-surface);
  color: var(--color-success);
  opacity: 0.82;
}

.badge-warning-light {
  background: var(--color-warning-surface);
  color: var(--color-warning);
  opacity: 0.82;
}

.badge-gold-light {
  background: var(--champagne-200);
  color: var(--gold-600);
  opacity: 0.82;
}

/* Document activity timeline (spec 16) */
.divider { height: 1px; background: var(--admin-border, #e3e3dd); border: 0; margin: 6px 0; }

.timeline {
  list-style: none;
  margin: 8px 0 0;
  padding: 0 0 0 16px;
  border-left: 2px solid var(--admin-border, #e3e3dd);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.timeline li { position: relative; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -23px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-primary, #2f6b4f);
  box-shadow: 0 0 0 3px #fff;
}
.timeline .tl-when { font-size: var(--fs-xs); color: var(--muted); letter-spacing: 0.02em; }
.timeline .tl-text { font-size: var(--fs-sm); color: var(--color-ink); margin-top: 1px; }
.timeline .tl-empty { color: var(--muted); font-size: var(--fs-sm); }

.badge-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-ink);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 44px;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-card);
  font-size: var(--fs-sm);
  color: var(--color-ink);
  transition: border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}

.textarea {
  min-height: 96px;
  resize: vertical;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237D5F66' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--color-ring);
  box-shadow: 0 0 0 3px rgba(150, 57, 78, 0.12);
}

.input[aria-invalid="true"],
.select[aria-invalid="true"] {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(192, 52, 52, 0.1);
}

.hint {
  font-size: var(--fs-xs);
  color: var(--color-ink-faint);
}

.field-error {
  font-size: var(--fs-xs);
  color: var(--color-danger);
  font-weight: 500;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4) var(--space-5);
}

.form-section-title {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--champagne-200);
  margin-bottom: var(--space-2);
}

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-pill);
  background: var(--color-border-strong);
  transition: background-color var(--dur-base) var(--ease-out);
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-base) var(--ease-out);
}

.switch input:checked + .switch-track {
  background: var(--color-primary);
}

.switch input:checked + .switch-track::after {
  transform: translateX(18px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--fs-sm);
  cursor: pointer;
}

input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  margin-top: 2px;
  flex-shrink: 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  min-width: 640px;
}

.data-table th {
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-ink-soft);
  padding: var(--space-4);
  background: var(--pearl-50);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.data-table td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr {
  transition: background-color var(--dur-fast) var(--ease-out);
}

.data-table tbody tr:hover {
  background: var(--blush-50);
}

/* A row that opens a record on click (CRM contact rows, etc) instead of
   requiring a dedicated "View" button - the row IS the affordance. */
.data-table tbody tr.row-clickable {
  cursor: pointer;
}

.data-table td.num-cell,
.data-table th.num-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.data-table .row-total td {
  background: var(--blush-50);
  font-weight: 600;
}

.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-ink-soft);
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}

.tab:hover {
  color: var(--color-primary);
}

.tab[aria-selected="true"] {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-strong);
  background: var(--color-card);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--color-ink-soft);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}

.chip:hover {
  border-color: var(--rose-300);
  color: var(--color-primary);
}

.chip[aria-pressed="true"],
.chip.active {
  background: var(--rose-600);
  border-color: var(--rose-600);
  color: #FFFFFF;
}

.seg-control {
  display: inline-flex;
  max-width: 100%;
  overflow-x: auto;
  background: var(--pearl-100);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.seg-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--color-ink-soft);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}

.seg-btn:hover {
  color: var(--color-primary);
}

.seg-btn[aria-pressed="true"] {
  background: var(--color-card);
  color: var(--color-primary);
  box-shadow: var(--shadow-xs);
}

.search-box {
  position: relative;
  min-width: 220px;
}

.search-box .input {
  padding-left: 38px;
}

.search-box svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-ink-faint);
  pointer-events: none;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(58, 34, 41, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: var(--space-4);
  animation: fadeIn var(--dur-base) var(--ease-out);
}

.dialog {
  width: min(100%, 560px);
  max-height: calc(100vh - var(--space-10));
  overflow-y: auto;
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), var(--glass-highlight), 0 0 0 1px var(--glass-edge);
  animation: dialogIn var(--dur-base) var(--ease-out);
}

@media (prefers-reduced-transparency: reduce) {
  .dialog { background: var(--color-card); backdrop-filter: none; -webkit-backdrop-filter: none; }
}

.dialog-lg {
  width: min(100%, 860px);
}

.dialog-xl {
  width: min(100%, 1040px);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--glass-bg-strong);
  z-index: 2;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.dialog-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
}

.dialog-body {
  padding: var(--space-6);
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  position: sticky;
  bottom: 0;
  background: var(--glass-bg-strong);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  flex-wrap: wrap;
}

@media (prefers-reduced-transparency: reduce) {
  .dialog-header, .dialog-footer { background: var(--color-card); }
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-sheet);
  background: rgba(58, 34, 41, 0.4);
  animation: fadeIn var(--dur-base) var(--ease-out);
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-sheet);
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-bottom: 0;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  max-height: 86vh;
  overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: var(--shadow-lg), var(--glass-highlight);
  animation: sheetUp var(--dur-slow) var(--ease-out);
}

@media (prefers-reduced-transparency: reduce) {
  .sheet { background: var(--color-card); backdrop-filter: none; -webkit-backdrop-filter: none; }
}

.sheet-grabber {
  width: 44px;
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--color-border-strong);
  margin: var(--space-3) auto var(--space-2);
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-6);
}

.sheet-body {
  padding: var(--space-2) var(--space-6) var(--space-8);
}

.toast-region {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: min(380px, calc(100vw - var(--space-8)));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  background: var(--plum-900);
  color: #FDF4F4;
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
  animation: toastIn var(--dur-slow) var(--ease-out);
}

.toast.leaving {
  animation: toastOut var(--dur-base) var(--ease-out) forwards;
}

.toast.success { background: #1F4A37; }
.toast.error { background: #6E2020; }
.toast.gold { background: #4E3608; }

.toast svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-6);
  color: var(--color-ink-soft);
}

.empty-state svg {
  margin-inline: auto;
  margin-bottom: var(--space-4);
  color: var(--rose-300);
}

.empty-state h3 {
  font-family: var(--font-display);
  font-size: var(--fs-section-title);
  margin-bottom: var(--space-2);
  color: var(--color-ink);
}

.skeleton {
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--pearl-200) 25%, var(--blush-100) 50%, var(--pearl-200) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

.banner {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  align-items: flex-start;
}

.banner svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.banner-success {
  background: var(--color-success-surface);
  color: #1C523B;
  border: 1px solid #BFE0CF;
}

.banner-warning {
  background: var(--color-warning-surface);
  color: #6E4A00;
  border: 1px solid #EBD9A8;
}

.banner-error {
  background: var(--color-danger-surface);
  color: #7A2222;
  border: 1px solid #F0CACA;
}

.banner-info {
  background: var(--color-info-surface);
  color: var(--color-info);
  border: 1px solid var(--lavender-100);
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--rose-100);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--rose-800);
  overflow: hidden;
  flex-shrink: 0;
}

.avatar-sm {
  width: 30px;
  height: 30px;
  font-size: 0.6rem;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: var(--fs-sm);
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--color-card);
  border: 1px solid var(--champagne-200);
  box-shadow: var(--shadow-xs), var(--glass-highlight);
  overflow: hidden;
  flex-shrink: 0;
}

.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-top: var(--space-4);
  flex-wrap: wrap;
}

.progress-track {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--pearl-200);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--rose-500), var(--rose-600));
  transition: width var(--dur-slow) var(--ease-out);
}

/* ---- Ace's Assistant — premium glass chat ---- */

.assistant-fab {
  position: fixed;
  right: var(--space-5);
  bottom: var(--space-5);
  z-index: calc(var(--z-modal) - 12);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background:
    radial-gradient(130% 150% at 28% 0%, rgba(255, 255, 255, 0.45), transparent 46%),
    linear-gradient(150deg, var(--rose-500), var(--gold-600));
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 16px 34px -12px rgba(150, 57, 78, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}

.assistant-fab::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 0 6px rgba(196, 106, 118, 0.12);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out);
}

.assistant-fab:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 22px 40px -12px rgba(150, 57, 78, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.assistant-fab:focus-visible {
  outline: none;
}

.assistant-fab:focus-visible::after {
  opacity: 1;
}

/* ---- Persistent bottom tab bar (phones only) ----
   Surfaces the same reach desktop gets from the header - home, shop,
   book, wishlist, account - always one thumb-tap away instead of tucked
   behind the hamburger menu. "Book" stays the one raised, accent-filled
   action since it's the site's real conversion goal; the rest are plain
   tabs with an active-page state. Replaces the older single-pill CTA. */
.tab-bar { display: none; }
@media (max-width: 760px) {
  body.has-quick-bar { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .tab-bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-around;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    /* Nav-tier, like .site-header - must stay BELOW --z-sheet (200) so the
       cart drawer, dialogs and bottom sheets always cover it instead of
       the other way around. It was briefly set near --z-modal (300) and
       ended up sitting on top of the cart drawer, hiding its checkout
       button behind the tab bar on phones. */
    z-index: var(--z-nav);
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom, 0px));
    background: var(--color-card, #fff);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -10px 28px -18px rgba(26, 22, 19, 0.28);
  }
  .tab-bar__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex: 1;
    min-width: 0;
    padding: 4px 2px;
    color: var(--color-ink-faint);
    text-decoration: none;
    transition: color 0.18s var(--ease-out);
  }
  .tab-bar__item.is-active { color: var(--color-accent); }
  .tab-bar__ico { position: relative; display: flex; }
  .tab-bar__label { font-size: 0.62rem; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; }
  .tab-bar__item--cta { color: var(--color-ink); }
  .tab-bar__cta {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-top: -22px;
    border-radius: 50%;
    background: var(--color-accent);
    color: #fff;
    box-shadow: 0 12px 24px -10px rgba(180, 87, 31, 0.55);
    transition: transform 0.2s var(--ease-out);
  }
  .tab-bar__item--cta:active .tab-bar__cta { transform: scale(0.94); }
  .tab-bar .cart-count { top: -4px; right: -8px; }
  body.flow-open .tab-bar { display: none; }
}
@media (max-width: 760px) and (prefers-reduced-motion: reduce) {
  .tab-bar__item, .tab-bar__cta { transition: none; }
}

/* Keep the assistant below dialogs/sheets so confirmations stay usable. */
body.flow-open #aces-assistant-root {
  display: none;
}

.assistant-panel {
  position: fixed;
  right: var(--space-5);
  bottom: calc(var(--space-5) + 74px);
  z-index: calc(var(--z-modal) - 11);
  width: min(390px, calc(100vw - var(--space-8)));
  max-height: min(580px, calc(100vh - 150px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(180deg, var(--glass-bg-strong), var(--glass-bg));
  backdrop-filter: blur(24px) saturate(170%);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: 0 28px 64px -22px rgba(58, 34, 41, 0.34), var(--glass-highlight);
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}

.assistant-panel.open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.assistant-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--glass-edge);
  background: linear-gradient(180deg, var(--glass-bg-strong), transparent);
}

.assistant-head .grow { min-width: 0; }

.assistant-head b {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.01em;
  color: var(--color-ink);
  display: block;
}

.assistant-head .text-xs {
  font-family: var(--font-body);
  font-size: var(--fs-2xs, 0.72rem);
  letter-spacing: 0.04em;
  color: var(--color-ink-faint);
  text-transform: uppercase;
}

.assistant-avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
  background: linear-gradient(150deg, var(--rose-500), var(--gold-600));
  box-shadow: 0 6px 16px -6px rgba(150, 57, 78, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  position: relative;
}

.assistant-avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.assistant-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-height: 180px;
  scrollbar-width: thin;
}

.assistant-messages::-webkit-scrollbar { width: 6px; }
.assistant-messages::-webkit-scrollbar-thumb { background: rgba(196, 106, 118, 0.25); border-radius: 999px; }

.aa-msg {
  display: flex;
  animation: aaPop var(--dur-base) var(--ease-out) both;
}

.aa-msg.user {
  justify-content: flex-end;
}

.aa-bubble {
  max-width: 84%;
  padding: 11px 15px;
  border-radius: 18px;
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.aa-msg.bot .aa-bubble {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  color: var(--color-ink);
  border-bottom-left-radius: 6px;
  box-shadow: var(--shadow-xs);
}

.aa-msg.user .aa-bubble {
  background: linear-gradient(150deg, var(--rose-600), var(--rose-700));
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 10px 22px -12px rgba(150, 57, 78, 0.5);
}

.aa-typing {
  display: flex;
  align-items: center;
  min-width: 52px;
  min-height: 26px;
}

.aa-typing span {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--rose-500), var(--gold-600));
  animation: aaBlink 1s infinite;
}

.aa-typing span:nth-child(2) { animation-delay: 0.18s; }
.aa-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes aaBlink {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

@keyframes aaPop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.assistant-quick {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding: var(--space-1) var(--space-5) var(--space-3);
  scrollbar-width: none;
}

.assistant-quick::-webkit-scrollbar {
  display: none;
}

.assistant-input-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4) var(--space-4);
  border-top: 1px solid var(--glass-edge);
  background: var(--glass-bg);
}

.assistant-input-row .input {
  border-radius: 999px;
  background: var(--color-card);
  border-color: var(--color-border-strong);
  font-family: var(--font-body);
}

.assistant-input-row .input:focus {
  border-color: var(--color-ring);
  box-shadow: 0 0 0 3px rgba(150, 57, 78, 0.14);
}

.assistant-input-row .btn-primary {
  width: 44px;
  height: 44px;
  padding: 0;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--rose-500), var(--gold-600));
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 18px -8px rgba(150, 57, 78, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.assistant-input-row .btn-primary:hover {
  box-shadow: 0 12px 22px -8px rgba(150, 57, 78, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Rich assistant responses */

.aa-tool-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: var(--color-ink-faint);
  flex-shrink: 0;
}

.aa-tool-btn:hover {
  background: rgba(196, 106, 118, 0.16);
  color: var(--color-primary);
}

.aa-expand-btn {
  display: none;
}

@media (min-width: 769px) {
  .aa-expand-btn { display: grid; }
}

.assistant-panel.wide {
  width: min(500px, calc(100vw - var(--space-8)));
}

.aa-rows {
  margin: 8px 0 2px;
  padding: 0;
  list-style: none;
}

.aa-rows li {
  padding: 6px 10px;
  border-left: 2px solid var(--rose-300);
  background: var(--color-bg-alt);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: var(--fs-2xs, 0.75rem);
  line-height: 1.5;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

.aa-more {
  margin-top: 6px;
  font-size: var(--fs-2xs, 0.75rem);
  color: var(--color-ink-faint);
}

.aa-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.aa-actions .btn {
  padding: 7px 13px;
  font-size: var(--fs-2xs, 0.75rem);
  border-radius: 999px;
}

.aa-streaming::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 1em;
  vertical-align: text-bottom;
  margin-left: 2px;
  background: var(--rose-400, var(--rose-500));
  animation: aaBlink 1s infinite;
}

.notif-wrap {
  position: relative;
}

.notif-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(360px, calc(100vw - 32px));
  z-index: var(--z-nav);
  overflow: hidden;
  animation: dialogIn var(--dur-base) var(--ease-out);
}

@media (prefers-reduced-motion: reduce) {
  .aa-msg, .assistant-fab, .assistant-panel { animation: none !important; transition: opacity 0.12s linear !important; transform: none !important; }
  .aa-typing span { animation: none; opacity: 0.6; }
}

@media (max-width: 768px) {
  .assistant-panel {
    right: var(--space-2);
    left: var(--space-2);
    bottom: var(--space-2);
    width: auto;
    max-height: calc(100dvh - 96px);
    border-radius: 22px;
  }

  .assistant-panel.open .assistant-messages {
    min-height: 140px;
  }

  .assistant-fab {
    right: var(--space-4);
    /* Clears the bottom tab bar (76px + safe area) - the old 66px offset
       predates it and left the bubble sitting on the bar's top edge. */
    bottom: calc(var(--space-3) + 76px + env(safe-area-inset-bottom, 0px));
    width: 48px;
    height: 48px;
  }
}

@media (max-width: 768px) and (display-mode: standalone), (max-width: 768px) {
  @supports (height: 100dvh) {
    .assistant-panel {
      max-height: calc(100dvh - env(safe-area-inset-bottom, 0px) - 88px);
    }

    .assistant-input-row {
      padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
    }
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dialogIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(8px); }
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

.aa-media { display: block; width: 100%; max-height: 220px; object-fit: cover; border-radius: 12px; margin: 0 0 10px; background: rgba(127,127,127,.12); }

/* Pop-up windows scroll with the wheel, finger or keys, but do not draw the chunky scroll bar with its arrows */
.dialog, .dialog-body { scrollbar-width: none; -ms-overflow-style: none; }
.dialog::-webkit-scrollbar, .dialog-body::-webkit-scrollbar { display: none; width: 0; height: 0; }
