:root {
  color-scheme: light;
  --bg: #f5f1ea;
  --bg-soft: #ebe5dc;
  --surface: #fffdf9;
  --surface-soft: #f7f2eb;
  --surface-strong: #ffffff;
  --text: #201e1b;
  --ink: #201e1b;
  --muted: #655f57;
  --border: #d8d0c5;
  --primary: #a33f00;
  --primary-strong: #843300;
  --on-primary: #ffffff;
  --accent: #16603f;
  --accent-soft: #e5f2ea;
  --danger: #b42318;
  --warning: #9a6700;
  --success: #137333;
  --shadow-sm: 0 8px 24px rgba(45, 35, 24, 0.08);
  --shadow-lg: 0 24px 70px rgba(45, 35, 24, 0.14);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --content: 1180px;
  --font-display: "Outfit", "Segoe UI", sans-serif;
  --font-body: "Manrope", "Segoe UI", sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d110f;
  --bg-soft: #151a17;
  --surface: #181e1b;
  --surface-soft: #202723;
  --surface-strong: #262e2a;
  --text: #f5f3ed;
  --ink: #f5f3ed;
  --muted: #b9c2bb;
  --border: #39433d;
  --primary: #f17832;
  --primary-strong: #ff9252;
  --on-primary: #17100b;
  --accent: #64dda9;
  --accent-soft: #17382a;
  --danger: #ff8c83;
  --warning: #ffd166;
  --success: #79e6a7;
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--primary) 10%, transparent), transparent 36rem),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll {
  overflow: hidden;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 72%, white);
  outline-offset: 3px;
}

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

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3,
strong {
  font-family: var(--font-display);
}

.container {
  width: min(var(--content), calc(100% - 2rem));
  margin-inline: auto;
}

.topbar {
  position: sticky;
  z-index: 40;
  top: 0;
  padding-top: env(safe-area-inset-top, 0);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px);
}

body[data-public-store] .topbar-signup,
body[data-public-store] .topnav,
body[data-public-store] .topnav-compact,
body[data-public-store] #admin-link {
  display: none;
}

body[data-public-store] .topbar-actions {
  gap: 0.5rem;
}

body[data-public-store] .brand-copy small {
  display: none;
}

body[data-public-store] .brand-copy strong {
  font-size: 0.95rem;
}

.topbar-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 14px;
  background: transparent;
  color: var(--on-primary);
  font: 800 0.86rem/1 var(--font-display);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-wordmark {
  display: none;
  height: 2.75rem;
  width: auto;
  max-width: min(220px, 52vw);
  object-fit: contain;
}

html[data-theme="dark"] .brand-wordmark-dark {
  display: block;
}

html:not([data-theme="dark"]) .brand-wordmark-light {
  display: block;
}

.brand-copy {
  display: grid;
}

.brand-copy strong {
  line-height: 1.1;
}

.brand-copy small {
  color: var(--muted);
  font-size: 0.74rem;
}

.topnav,
.topbar-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.topnav-compact {
  display: none;
  align-items: center;
  gap: 0.35rem;
}

.topnav-compact a {
  padding: 0.55rem 0.7rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.topnav-compact a:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.topnav a {
  padding: 0.65rem 0.8rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.topnav a:hover,
.topnav a.is-active {
  background: var(--surface-soft);
  color: var(--text);
}

.topbar-signup {
  white-space: nowrap;
}

.theme-switch {
  display: flex;
  gap: 0.2rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.theme-option {
  min-height: 44px;
  min-width: 44px;
  padding: 0.35rem 0.65rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 800;
}

.theme-option.is-active {
  background: var(--primary);
  color: var(--on-primary);
}

.button,
.tiny-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.7rem 1rem;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.button:hover,
.tiny-button:hover {
  transform: translateY(-1px);
}

.button:disabled,
.tiny-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.button-primary {
  background: var(--primary);
  color: var(--on-primary);
}

.button-primary:hover {
  background: var(--primary-strong);
}

.button-secondary,
.tiny-button {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.button-danger {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
  color: var(--danger);
}

.button-block {
  width: 100%;
}

.card,
.card-soft {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card {
  border-radius: var(--radius-lg);
}

.card-soft {
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  box-shadow: none;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.muted,
.field-note {
  color: var(--muted);
}

.field-note {
  margin: 0;
  font-size: 0.82rem;
}

.field {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}

.field > span,
.field > label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 11px;
  outline: none;
  background: var(--surface-strong);
  color: var(--text);
  padding: 0.78rem 0.85rem;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

textarea {
  resize: vertical;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.form-grid .span-2 {
  grid-column: 1 / -1;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  min-height: 44px;
  cursor: pointer;
}

.checkbox-row input {
  width: 1.25rem;
  height: 1.25rem;
  min-width: 1.25rem;
  min-height: 1.25rem;
  margin-top: 0.35rem;
  flex-shrink: 0;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 30px;
  width: fit-content;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.status-chip-success {
  border-color: color-mix(in srgb, var(--success) 35%, var(--border));
  background: color-mix(in srgb, var(--success) 10%, var(--surface));
  color: var(--success);
}

.status-chip-danger {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
  color: var(--danger);
}

.empty-state {
  padding: var(--space-6);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--muted);
  text-align: center;
}

.toast-region {
  position: fixed;
  z-index: 200;
  right: max(1rem, env(safe-area-inset-right, 0));
  bottom: max(1rem, env(safe-area-inset-bottom, 0));
  display: grid;
  gap: 0.65rem;
  width: min(360px, calc(100% - 2rem));
}

.toast {
  display: grid;
  gap: 0.15rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-lg);
}

.toast span {
  color: var(--muted);
  font-size: 0.84rem;
}

.site-footer {
  margin-top: var(--space-7);
  border-top: 1px solid var(--border);
  padding: var(--space-6) 0;
  color: var(--muted);
}

.site-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

@media (max-width: 760px) {
  .container {
    width: min(100% - 1rem, var(--content));
  }

  .topbar-inner {
    min-height: 62px;
  }

  .brand-copy small,
  .topnav {
    display: none;
  }

  .topnav-compact {
    display: flex;
  }

  .theme-option {
    min-height: 44px;
    min-width: 44px;
    padding-inline: 0.5rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .span-2 {
    grid-column: auto;
  }

  .site-footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .topnav-compact,
  .topbar-signup {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* Shared accessible business dialogs */
.cp-form-dialog {
  width: min(680px, calc(100% - 1.5rem));
  max-width: 100%;
  max-height: min(88dvh, 760px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.cp-form-dialog::backdrop { background: rgba(0, 0, 0, .65); }
.cp-form-dialog .product-dialog-content { display: grid; gap: var(--space-4); padding: var(--space-5); }
.cp-form-dialog h2 { margin: .25rem 0 0; }
.cp-form-dialog [data-dialog-error]:empty { display: none; }
@media (max-width: 600px) {
  .cp-form-dialog { width: calc(100% - .75rem); max-height: calc(100dvh - .75rem); border-radius: 22px; }
  .cp-form-dialog .product-dialog-content { padding: var(--space-4); }
}
