:root {
  --bg: #FEF6EE;
  --card: #F3F1F0;
  --ink: #212427;
  --muted: #6b6058;
  --accent: #820000;
  --accent-light: #a50000;
  --teal: #8CC0CE;
  --border: #e2d8d0;
  --white: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "DM Sans", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
}

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

h1 {
  font-family: "Prata", serif;
  font-weight: 400;
  font-size: 28px;
  margin: 0 0 8px;
  letter-spacing: 0.01em;
}

h2 {
  font-family: "DM Sans", sans-serif;
  font-weight: 500;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 16px;
  color: var(--muted);
}

a { color: inherit; text-decoration: none; }

/* ── Toolbar ─────────────────────────────── */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.toolbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ── Cards ───────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 24px;
  margin-bottom: 20px;
}

/* ── Rows ────────────────────────────────── */
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.row:last-child { border-bottom: none; }

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-form input { width: 80px; }

.purchase-row { align-items: flex-start; }

.purchase-actions {
  min-width: 280px;
  width: 340px;
}

.purchase-edit-form .field { margin-bottom: 8px; }

.purchase-edit { width: 100%; }

.purchase-edit summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 6px 0;
}

.purchase-edit[open] {
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 14px;
  background: var(--bg);
}

/* ── Buttons ─────────────────────────────── */
.btn {
  background: var(--accent);
  color: var(--white);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 9px 20px;
  font-family: "DM Sans", sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn:hover {
  background: var(--accent-light);
  border-color: var(--accent-light);
}

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

.btn.secondary:hover {
  background: var(--accent);
  color: var(--white);
}

.link {
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── Forms ───────────────────────────────── */
.field {
  display: block;
  margin-bottom: 16px;
}

.label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 14px;
  font-family: "DM Sans", sans-serif;
  background: var(--white);
  color: var(--ink);
  transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

textarea { resize: vertical; }

/* ── Type helpers ────────────────────────── */
.muted { color: var(--muted); font-size: 13px; }
.strong { font-weight: 500; }

/* ── Grid ────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ── Registry type badges ────────────────── */
.badge, .reg-type-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 2px 9px;
  vertical-align: middle;
  margin-left: 8px;
}

.badge-online, .reg-type-online {
  background: #e8f4f8;
  color: #3a7a8e;
}

.badge-instore, .reg-type-instore {
  background: #f5eaea;
  color: var(--accent);
}

/* ── Radio group ─────────────────────────── */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.radio-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

.radio-label input[type="radio"] {
  width: auto;
  accent-color: var(--accent);
}

/* ── Public widget ───────────────────────── */
/* ── Registry widget — theme-adaptive CSS variables ─────────────────────────
   All --reg-* vars default to the app's own brand palette but are overridden
   at runtime by widget/registry.js detectTheme() when embedded in a storefront.
   ─────────────────────────────────────────────────────────────────────────── */
.registry-root {
  --reg-font:         var(--site-font, "DM Sans", sans-serif);
  --reg-heading-font: var(--site-heading-font, "Prata", serif);
  --reg-accent:       var(--accent, #820000);
  --reg-accent-light: var(--accent-light, #a50000);
  --reg-ink:          var(--ink, #212427);
  --reg-muted:        var(--muted, #6b6058);
  --reg-border:       var(--border, #e2d8d0);
  --reg-white:        var(--white, #ffffff);
  --reg-card:         var(--card, #F3F1F0);
  --reg-btn-text:     #ffffff;
  --reg-radius:       4px;

  background: transparent;
  padding: 28px 24px;
  font-family: var(--reg-font);
  color: var(--reg-ink);
}

.reg-header {
  font-family: var(--reg-heading-font);
  font-weight: 400;
  font-size: 34px;
  letter-spacing: 0.01em;
  margin-bottom: 6px;
  color: var(--reg-ink);
}

.reg-sub {
  color: var(--reg-muted);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 28px;
}

.reg-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.reg-card {
  background: var(--reg-white);
  border: 1px solid var(--reg-border);
  border-radius: var(--reg-radius);
  padding: 20px;
  display: block;
  transition: box-shadow 0.15s;
}

.reg-card:hover {
  box-shadow: 0 4px 18px rgba(0,0,0,0.08);
}

.reg-name {
  font-family: var(--reg-heading-font);
  font-weight: 400;
  font-size: 17px;
  margin-bottom: 6px;
  color: var(--reg-ink);
}

.reg-meta {
  font-size: 11px;
  color: var(--reg-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.reg-actions { margin-top: 14px; }

.reg-items { display: grid; gap: 10px; }

.reg-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--reg-white);
  border: 1px solid var(--reg-border);
  border-radius: var(--reg-radius);
  padding: 14px 16px;
}

.reg-item-name {
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 3px;
}

.reg-item-meta {
  color: var(--reg-muted);
  font-size: 12px;
  letter-spacing: 0.03em;
}

/* Registry search */
.reg-search-wrap { margin-bottom: 24px; }

.reg-search {
  width: 100%;
  max-width: 420px;
  padding: 10px 18px;
  border: 1px solid var(--reg-border);
  border-radius: 999px;
  font-size: 14px;
  font-family: var(--reg-font);
  background: var(--reg-white);
  color: var(--reg-ink);
  transition: border-color 0.15s;
}

.reg-search:focus {
  outline: none;
  border-color: var(--reg-accent);
}

/* Widget buttons */
.reg-btn {
  background: var(--reg-accent);
  color: var(--reg-btn-text);
  border: none;
  border-radius: var(--reg-radius);
  padding: 8px 16px;
  font-family: var(--reg-font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.reg-btn:hover { opacity: 0.85; }

.reg-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.reg-back-btn {
  background: transparent;
  border: 1px solid var(--reg-border);
  color: var(--reg-ink);
  border-radius: var(--reg-radius);
  padding: 8px 16px;
  font-family: var(--reg-font);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  margin-bottom: 20px;
  transition: border-color 0.15s, color 0.15s;
}

.reg-back-btn:hover {
  border-color: var(--reg-accent);
  color: var(--reg-accent);
}

.reg-status {
  min-height: 20px;
  margin-bottom: 12px;
  font-size: 13px;
}

.reg-ok { color: #2a6e3f; }
.reg-error { color: var(--reg-accent); }

.reg-instore-note {
  font-size: 12px;
  color: var(--reg-muted);
  font-style: italic;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

/* Registry info card: square photo left + description right */
.reg-info-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  border: 1px solid var(--reg-border);
  border-radius: var(--reg-radius);
  padding: 16px;
  margin-bottom: 20px;
  background: var(--reg-white);
}

.reg-info-photo {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--reg-radius);
  flex-shrink: 0;
}

.reg-info-desc {
  flex: 1;
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--reg-muted);
}

/* Product item thumbnail */
.reg-item-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--reg-radius);
  flex-shrink: 0;
}

.reg-item { gap: 12px; }

@media (max-width: 520px) {
  .reg-info-card { flex-direction: column; }
  .reg-info-photo { width: 100%; height: 180px; }
}

/* ── Setup page ──────────────────────────── */
.setup-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.step-num {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}

.setup-list {
  padding-left: 20px;
  line-height: 1.9;
}

.setup-list li { margin-bottom: 4px; }

.setup-block { margin-top: 16px; }

.code-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 14px 16px;
  font-family: "Menlo", "Courier New", monospace;
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 8px 0 0;
  color: var(--ink);
}

.copy-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.copy-val { flex: 1; min-width: 0; }

.setup-steps p, .setup-steps ul, .setup-steps ol { margin: 8px 0; }

code {
  font-family: "Menlo", "Courier New", monospace;
  font-size: 12.5px;
  background: var(--card);
  border-radius: 2px;
  padding: 1px 5px;
  color: var(--accent);
}

/* ── Inline edit (name / date) ───────────── */
.edit-meta { margin-top: 6px; }

.edit-meta summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  list-style: none;
}

.edit-meta summary::-webkit-details-marker { display: none; }

.edit-meta-form {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.edit-meta-form .field { margin-bottom: 0; }

/* ── Photo upload ────────────────────────── */
.toolbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.registry-photo-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.registry-photo-preview {
  width: 100%;
  max-width: 260px;
  height: 160px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  margin-bottom: 12px;
  display: block;
}

.photo-file-label input[type="file"] {
  padding: 6px 8px;
  font-size: 13px;
}

.registry-photo-list {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.row-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Portal ──────────────────────────────── */
.portal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.portal-section { margin-bottom: 0; }

.portal-items-grid {
  display: grid;
  gap: 0;
}

.portal-items-header {
  display: grid;
  grid-template-columns: 1fr 80px 80px 100px;
  gap: 8px;
  padding: 8px 0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.portal-items-row {
  display: grid;
  grid-template-columns: 1fr 80px 80px 100px;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}

.portal-items-row:last-child { border-bottom: none; }

.portal-still-needed {
  font-weight: 500;
  color: var(--accent);
}

.portal-fulfilled {
  font-weight: 500;
  color: #2a6e3f;
}

/* ── Channel badges (admin purchases list) ───────────────────────────────── */
.channel-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 0.72em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 5px;
  vertical-align: middle;
}
.channel-online { background: #dbeafe; color: #1d4ed8; }
.channel-in_store, .channel-in\.store { background: #dcfce7; color: #15803d; }
.channel-off_registry, .channel-off\.registry { background: #fef9c3; color: #854d0e; }

/* ── Registry cart badge (Ecwid storefront cart/checkout) ─────────────────── */
.reg-cart-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 7px;
  background: #f0f4f0;
  border: 1px solid #c8d8c8;
  border-radius: 3px;
  font-size: 0.8em;
  color: #2a6e3f;
  font-weight: 500;
  white-space: nowrap;
}

/* ── Responsive ──────────────────────────── */
@media (max-width: 720px) {
  .toolbar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .grid { grid-template-columns: 1fr; }
  .row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .row-actions { width: 100%; flex-wrap: wrap; }
  .purchase-actions { width: 100%; min-width: 0; }
}
