:root {
  --bg: #faf6ee;
  --card: #fffdf7;
  --ink: #38281a;
  --ink-soft: #5b4c3b;
  --muted: #7a6a58;
  --muted-2: #8a7a5f;
  --gold: #9c7a45;
  --gold-line: #ddcfb8;
  --panel: #f3ead9;
  --panel-line: #e5d7bd;
  --brown: #8a6237;
  --brown-dark: #6d4c2a;
  --serif: Georgia, 'Times New Roman', 'Noto Serif', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); }
body { font-family: var(--sans); color: var(--ink-soft); }
a { color: var(--brown); text-decoration: none; }
a:hover { color: var(--brown-dark); text-decoration: underline; }
input, textarea, button { font-family: var(--sans); }
input:focus, textarea:focus { outline: 2px solid #c9a568; outline-offset: 1px; }
button { cursor: pointer; }

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

header.top {
  padding: 44px 24px 8px;
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px;
  max-width: 1180px; margin: 0 auto;
}
.eyebrow { font-size: 12px; letter-spacing: 3px; text-transform: uppercase; color: var(--gold); font-weight: 600; }
h1.title { font-family: var(--serif); font-weight: 500; font-size: 42px; margin: 6px 0 4px; color: var(--ink); }
.count-label { font-size: 15px; color: var(--muted); }

.top-right { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.admin-row { font-size: 13px; color: var(--muted-2); display: flex; gap: 10px; align-items: center; }
.badge-admin {
  background: var(--brown); color: var(--card); font-size: 11px; font-weight: 600;
  letter-spacing: .5px; padding: 3px 10px; border-radius: 999px;
}
.link-btn { border: none; background: transparent; color: var(--brown); font-size: 13px; cursor: pointer; padding: 2px; text-decoration: underline; }

.search-input {
  border: 1px solid var(--gold-line); background: var(--card); border-radius: 999px;
  padding: 12px 20px; font-size: 15px; width: min(320px, 100%); color: var(--ink-soft);
}

.tribute { margin: 24px auto 0; }
.tribute-card {
  background: var(--panel); border: 1px solid var(--panel-line); border-radius: 18px;
  padding: 28px 30px; display: flex; gap: 28px; align-items: center; flex-wrap: wrap;
}
.tribute-photo {
  width: 120px; height: 120px; border-radius: 50%; flex-shrink: 0; border: 3px solid #c9a568;
  object-fit: cover; background: #efe4cf;
}
.tribute-text h2 { font-family: var(--serif); font-weight: 500; font-size: 24px; margin: 0 0 8px; color: var(--ink); }
.tribute-text p { margin: 0; line-height: 1.65; font-size: 15.5px; color: var(--ink-soft); }

nav.collections {
  margin: 28px auto 0; padding: 0 24px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  max-width: 1180px; margin-left: auto; margin-right: auto;
}
.pill {
  border: 1px solid var(--gold-line); background: var(--card); color: var(--brown);
  border-radius: 999px; padding: 8px 16px; font-size: 13.5px; font-weight: 600;
}
.pill.on { border-color: var(--brown); background: var(--brown); color: var(--card); }
.pill:hover { border-color: #b08d52; }
.sep { width: 1px; height: 22px; background: var(--gold-line); margin: 0 4px; }
.grow { flex: 1; }
.tags-toggle {
  border: 1px solid var(--gold-line); background: var(--card); color: var(--brown);
  border-radius: 8px; padding: 8px 14px; font-size: 13.5px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px;
}
.tags-toggle.on { border-color: var(--brown); background: var(--brown); color: var(--card); }
.add-pair-btn {
  border: 1px dashed #b08d52; background: transparent; color: var(--brown);
  border-radius: 999px; padding: 8px 16px; font-size: 13.5px; font-weight: 600;
}
.add-pair-btn:hover { background: var(--panel); }

.tags-panel {
  max-width: 1180px; margin: 14px auto 0; padding: 0 24px;
}
.tags-panel-inner {
  background: var(--card); border: 1px solid #e8dcc6; border-radius: 14px; padding: 16px 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.tags-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tags-panel-title { font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.tag-chip {
  border: 1px solid #e0d3ba; background: var(--card); color: var(--brown);
  border-radius: 999px; padding: 6px 13px; font-size: 13px; font-weight: 500;
}
.tag-chip.on { border-color: var(--brown); background: var(--brown); color: var(--card); }
.tag-chip .n { opacity: .65; font-size: 11.5px; }

main.catalog { max-width: 1180px; margin: 20px auto 80px; padding: 0 24px; }
.empty-note { text-align: center; padding: 70px 20px; color: var(--muted-2); font-size: 16px; }
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px;
}
.card {
  background: var(--card); border: 1px solid #e8dcc6; border-radius: 14px; overflow: hidden;
  cursor: pointer; display: flex; flex-direction: column; animation: fadeUp .35s ease both;
}
.card:hover { border-color: #c9a568; box-shadow: 0 6px 18px rgba(120, 90, 40, .12); }
.card-photo { aspect-ratio: 1; background: #f1e8d6; position: relative; }
.card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-photo .placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted-2); text-align: center; padding: 16px;
  background: repeating-linear-gradient(45deg, #f1e8d6, #f1e8d6 10px, #eadfc8 10px, #eadfc8 20px);
}
.card-badge {
  position: absolute; top: 10px; left: 10px; color: var(--card); font-size: 11px; font-weight: 600;
  letter-spacing: .5px; padding: 4px 10px; border-radius: 999px;
}
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-title-row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.card-title { font-family: var(--serif); font-size: 17px; font-weight: 600; color: var(--ink); }
.card-price { font-size: 14px; font-weight: 600; color: var(--gold); white-space: nowrap; }
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.mini-tag { font-size: 11.5px; color: var(--brown); background: var(--panel); border-radius: 999px; padding: 3px 9px; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(56, 40, 26, .45); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--card); border-radius: 18px; max-width: 880px; width: 100%; max-height: 88vh;
  overflow: auto; display: flex; flex-wrap: wrap; box-shadow: 0 24px 60px rgba(56, 40, 26, .3);
}
.modal-photo { flex: 1 1 320px; min-width: 280px; background: #f1e8d6; position: relative; min-height: 300px; }
.modal-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.modal-photo .placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted-2);
  background: repeating-linear-gradient(45deg, #f1e8d6, #f1e8d6 10px, #eadfc8 10px, #eadfc8 20px);
}
.modal-body { flex: 1 1 380px; min-width: 300px; padding: 30px 32px; display: flex; flex-direction: column; gap: 14px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-title { font-family: var(--serif); font-weight: 500; font-size: 28px; margin: 0; color: var(--ink); }
.close-x { border: none; background: transparent; font-size: 22px; color: var(--muted-2); cursor: pointer; line-height: 1; padding: 4px; }
.status-line { font-size: 13px; font-weight: 600; color: var(--gold); letter-spacing: .5px; text-transform: uppercase; }
.desc { margin: 0; line-height: 1.65; font-size: 15.5px; color: var(--ink-soft); white-space: pre-wrap; }
.story-box { background: var(--panel); border: 1px solid var(--panel-line); border-radius: 12px; padding: 14px 16px; }
.story-label { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); font-weight: 600; margin-bottom: 5px; }
.story-text { font-family: var(--serif); font-style: italic; font-size: 15px; line-height: 1.6; color: var(--ink-soft); white-space: pre-wrap; }
.modal-footer { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; border-top: 1px solid #eee3cf; padding-top: 16px; margin-top: auto; }
.price-tag { font-family: var(--serif); font-size: 22px; color: var(--ink); }

.btn {
  border: none; background: var(--brown); color: var(--card); border-radius: 10px;
  padding: 10px 18px; font-size: 14px; font-weight: 600;
}
.btn:hover { background: var(--brown-dark); }
.btn.ghost { background: transparent; border: 1px solid var(--gold-line); color: var(--brown); }
.btn.ghost:hover { background: var(--panel); }
.btn[disabled] { opacity: .55; cursor: default; }

label.field { font-size: 12.5px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; gap: 5px; }
.field input, .field textarea {
  border: 1px solid var(--gold-line); background: #fff; border-radius: 9px; padding: 10px 12px;
  font-size: 15px; color: var(--ink-soft); resize: vertical;
}
.form-error { color: #a34a2a; font-size: 13.5px; }
.form-note { font-size: 13px; color: var(--muted-2); }

.tag-editor {
  border: 1px solid var(--gold-line); background: #fff; border-radius: 9px; padding: 8px 10px;
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
}
.tag-editor input { border: none; background: transparent; font-size: 14px; flex: 1; min-width: 110px; padding: 4px 2px; outline: none; }
.draft-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 500; color: var(--brown); background: var(--panel); border-radius: 999px; padding: 4px 6px 4px 11px; }
.draft-tag button { border: none; background: transparent; color: var(--brown); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 4px; }

.login-modal { max-width: 360px; width: 100%; }
.login-modal .modal-body { padding: 26px 28px; gap: 16px; }

.photo-upload-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.thumb-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb-strip img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--gold-line); }

.admin-page { max-width: 900px; margin: 0 auto; padding: 40px 24px 80px; }
.admin-page h1 { font-family: var(--serif); font-weight: 500; color: var(--ink); }
.inquiry-row {
  background: var(--card); border: 1px solid #e8dcc6; border-radius: 12px; padding: 16px 18px;
  display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px;
}
.inquiry-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.inquiry-item { font-family: var(--serif); font-weight: 600; color: var(--ink); }
.inquiry-meta { font-size: 12.5px; color: var(--muted-2); }
.inquiry-actions { display: flex; gap: 8px; margin-top: 6px; }
.status-pill { font-size: 11px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; }
.status-pill.new { background: #8a6237; color: #fffdf7; }
.status-pill.reviewed { background: #9c7a45; color: #fffdf7; }
.status-pill.archived { background: #ddcfb8; color: #5b4c3b; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 20px; border-radius: 999px; font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 100;
}
.hidden { display: none !important; }
