:root {
  --primary: #24453a;
  --primary-dark: #1a332b;
  --accent: #d9672b;
  --bg: #faf7f2;
  --surface: #ffffff;
  --text: #1d1d1b;
  --text-muted: #5f5b55;
  --border: #ddd6ca;
  --danger: #b3261e;
  --danger-bg: #fbeceb;
  --ok-bg: #e9f3ee;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { font-size: 18px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

a { color: var(--primary); }

h1, h2 { line-height: 1.2; margin: 0 0 0.5rem; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.logo { display: flex; align-items: baseline; gap: 3px; text-decoration: none; }
.logo-main { font-size: 1.6rem; font-weight: 700; color: var(--primary); letter-spacing: -0.3px; }
.logo-accent { font-size: 1.1rem; font-weight: 600; color: var(--accent); font-style: italic; letter-spacing: -0.2px; }
.logo-star { fill: var(--accent); width: 18px; height: 18px; transform: translateY(-4px); margin-left: 1px; }

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.lead { font-size: 1.1rem; color: var(--text-muted); margin: 0 0 1.5rem; }
.muted { color: var(--text-muted); }

/* Forms */
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 600; margin-bottom: 0.3rem; }
.field .hint { display: block; font-weight: 400; color: var(--text-muted); font-size: 0.9rem; }

input[type="text"], input[type="email"], input[type="tel"], input[type="date"], textarea {
  width: 100%;
  font: inherit;
  padding: 0.7rem 0.8rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
input:focus, textarea:focus { outline: none; border-color: var(--primary); }
textarea { min-height: 6rem; resize: vertical; }

.code-input {
  font-size: 1.8rem !important;
  letter-spacing: 0.4em;
  text-align: center;
  max-width: 14rem;
}

.row { display: flex; gap: 0.8rem; }
.row > .field { flex: 1; min-width: 0; }

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 1.4rem;
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: var(--primary-dark); }
.button:disabled { opacity: 0.65; cursor: default; }
.button.full { width: 100%; }
.button.secondary { background: var(--surface); color: var(--primary); border: 2px solid var(--primary); }

.link-button {
  background: none;
  border: none;
  padding: 0.4rem;
  font: inherit;
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
}

.actions { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center; margin-top: 1.5rem; }

/* Messages */
.alert { padding: 0.8rem 1rem; border-radius: var(--radius); margin-bottom: 1.2rem; }
.alert.error { background: var(--danger-bg); color: var(--danger); }
.alert.ok { background: var(--ok-bg); color: var(--primary); }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
}

.sale-list { list-style: none; padding: 0; margin: 1.5rem 0; display: grid; gap: 0.8rem; }
.sale-list a { display: block; text-decoration: none; color: inherit; }
.sale-list a:hover .card { border-color: var(--primary); }
.sale-title { font-weight: 700; font-size: 1.1rem; color: var(--primary); }

.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: #f1ece3;
  color: var(--text-muted);
}

.web-address { font-weight: 600; word-break: break-all; }

/* Item form */
.photo-picker { display: block; position: relative; }
.photo-picker input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.photo-picker:focus-within .button { outline: 3px solid var(--accent); outline-offset: 2px; }
.photo-status { margin-top: 0.4rem; }
.photo-previews { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }
.photo-previews img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

.price-input { display: flex; align-items: center; gap: 0.4rem; max-width: 12rem; }
.price-input span { font-weight: 700; font-size: 1.2rem; }

.saved-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem; }
.saved-banner .button { min-height: 44px; }

.photo-grid { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-bottom: 1.2rem; }
.photo-tile { display: flex; flex-direction: column; align-items: center; }
.photo-tile img { width: 110px; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

.danger-zone { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.link-button.danger { color: var(--danger); }

/* Sale page items */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 1.5rem 0 0.8rem; }
.section-head h2 { margin: 0; }

.item-list { list-style: none; padding: 0; margin: 1rem 0 2rem; display: grid; gap: 0.8rem; }
.item-row { padding: 0.8rem; scroll-margin-top: 1rem; }
.item-main { display: flex; gap: 0.9rem; align-items: center; text-decoration: none; color: inherit; }
.item-main > span { display: flex; flex-direction: column; min-width: 0; }
.item-thumb { width: 72px; height: 72px; flex: none; object-fit: cover; border-radius: 8px; background: #f1ece3; }
.item-title { font-weight: 700; overflow-wrap: anywhere; }
.item-price { font-size: 1.1rem; }
.edit-link { color: var(--primary); text-decoration: underline; font-size: 0.9rem; }
.status-sold .item-title, .status-sold .item-price { color: var(--text-muted); text-decoration: line-through; }

.status-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; margin-top: 0.8rem; }
.status-button {
  min-height: 46px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}
.status-button.available.current { background: var(--primary); border-color: var(--primary); color: #fff; }
.status-button.hold.current { background: #f6c453; border-color: #e2ad35; color: #3d2c00; }
.status-button.sold.current { background: var(--danger); border-color: var(--danger); color: #fff; }

.sale-details { margin-top: 2rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.sale-details summary { font-weight: 600; color: var(--primary); cursor: pointer; padding: 0.5rem 0; font-size: 1.05rem; }
.sale-details[open] summary { margin-bottom: 1rem; }

@media (max-width: 480px) {
  .row { flex-direction: column; gap: 0; }
}
