: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; }

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;
}

.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);
}

.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); }

/* ---------- 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);
}

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

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

/* ---------- 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;
}

.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;
}

.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;
}

.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);
}

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

.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;
}
