:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --text: #1f1d1a;
  --muted: #6f6a62;
  --border: #e3ddd3;
  --accent: #b5651d;
  --accent-text: #ffffff;
  --danger: #b3261e;
  --success-bg: #e8f3e8;
  --success-text: #1e5b25;
  --error-bg: #fbeaea;
  --error-text: #8c1d18;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171614;
    --surface: #211f1c;
    --text: #efe9e0;
    --muted: #a39d93;
    --border: #36322d;
    --accent: #e0914a;
    --accent-text: #1a1206;
    --danger: #f2827a;
    --success-bg: #1d3320;
    --success-text: #a7d8ab;
    --error-bg: #3a1a18;
    --error-text: #f4b4ae;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
code { font: 0.85em ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }
h1 { font-size: 1.8rem; line-height: 1.2; margin: 0 0 0.75rem; }
h2 { font-size: 1.1rem; margin: 2rem 0 0.5rem; }
.muted { color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.75rem; color: var(--accent); margin: 0 0 0.5rem; font-weight: 600; }

body.public { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem;
  width: 100%;
  max-width: 560px;
}
.card.narrow { max-width: 380px; margin: 10vh auto 0; }
.center { text-align: center; }
.description { white-space: pre-wrap; overflow-wrap: anywhere; margin: 1rem 0; }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; margin: 1.5rem 0 0; font-size: 0.9rem; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.admin-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 0.75rem 16px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.brand span { color: var(--accent); font-weight: 500; }
main.wide { max-width: 960px; margin: 0 auto; padding: 1.5rem 16px 4rem; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar h1 { margin: 0; }

table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.nowrap { white-space: nowrap; }
.actions { white-space: nowrap; text-align: right; }
.actions a + a { margin-left: 0.75rem; }
@media (max-width: 640px) {
  table, thead, tbody, tr, td { display: block; }
  thead { display: none; }
  tr { border-bottom: 1px solid var(--border); padding: 0.5rem 0; }
  td { border: 0; padding: 0.2rem 0.8rem; }
  .actions { text-align: left; }
}

.stack { display: grid; gap: 1rem; }
label { display: grid; gap: 0.35rem; font-weight: 600; font-size: 0.9rem; }
label.checkbox { display: flex; align-items: flex-start; gap: 0.5rem; font-weight: 400; }
input:not([type=checkbox]), textarea {
  font: inherit; font-weight: 400; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.75rem; width: 100%;
}
textarea { resize: vertical; min-height: 10rem; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button, .button {
  font: inherit; font-weight: 600; cursor: pointer; display: inline-block; text-decoration: none;
  background: var(--accent); color: var(--accent-text); border: 0; border-radius: 8px; padding: 0.6rem 1.1rem;
}
button.link { background: none; color: var(--accent); padding: 0; font-weight: 500; }
button.danger { background: var(--danger); color: #fff; }
form.inline { display: flex; align-items: center; gap: 0.75rem; }
.danger-zone { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); display: grid; gap: 0.75rem; justify-items: start; }

.alert { padding: 0.75rem 1rem; border-radius: 8px; margin: 0 0 1rem; }
.alert p { margin: 0; }
.alert.success { background: var(--success-bg); color: var(--success-text); }
.alert.error { background: var(--error-bg); color: var(--error-text); }

/* ---------- Lamp photo ---------- */
.lamp-photo {
  position: relative; display: block; margin: -2rem -2rem 1.5rem;
  border-radius: 14px 14px 0 0; overflow: hidden; background: var(--border); cursor: zoom-in;
}
.lamp-photo img { display: block; width: 100%; height: auto; max-height: 70vh; object-fit: cover; }
.zoom-hint {
  position: absolute; right: 0.75rem; bottom: 0.75rem; width: 2.25rem; height: 2.25rem;
  display: grid; place-items: center; border-radius: 50%;
  background: rgb(0 0 0 / 0.55); color: #fff; font-size: 1.1rem; line-height: 1;
}
.lamp-photo:hover img { opacity: 0.94; }
.lamp-photo:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.lightbox {
  border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh;
  width: 100vw; height: 100vh; display: none; place-items: center; cursor: zoom-out;
}
.lightbox[open] { display: grid; }
.lightbox::backdrop { background: rgb(0 0 0 / 0.88); }
.lightbox img {
  max-width: calc(100vw - 32px); max-height: calc(100vh - 32px);
  width: auto; height: auto; object-fit: contain; border-radius: 6px;
}
.lightbox-close {
  position: fixed; top: 12px; right: 12px; width: 2.75rem; height: 2.75rem; padding: 0;
  border-radius: 50%; background: rgb(255 255 255 / 0.15); color: #fff; font-size: 1.6rem; line-height: 1;
}

.photo-field { border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem 1rem 1rem; display: grid; gap: 0.6rem; justify-items: start; margin: 0; }
.photo-field legend { font-weight: 600; font-size: 0.9rem; padding: 0 0.25rem; }
.photo-preview { display: block; max-width: 240px; max-height: 240px; border-radius: 8px; border: 1px solid var(--border); }
