:root {
  color-scheme: light;
  --ink: #21160f;
  --brown: #3d210d;
  --accent: #a84a1c;
  --paper: #f4ecdf;
  --card: #fffaf2;
  --line: #d8c5af;
  --muted: #6e5848;
  font-family: Montserrat, system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 300px; }
h1,h2,.brand,.identity { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600; }
h1 { font-size: clamp(2rem, 4vw, 3.2rem); margin: 0; line-height: 1; }
h2 { font-size: 1.85rem; margin: 0 0 .7rem; line-height: 1.06; }
button, input, select, textarea { font: inherit; }
button, .actions a {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .65rem .9rem; min-height: 42px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--card); color: var(--brown); text-decoration: none; cursor: pointer; font-weight: 600;
}
button:hover, .actions a:hover { background: #ece1ce; }
button:disabled, a[aria-disabled="true"] { opacity: .55; cursor: default; }
.primary { background: var(--brown); color: #fffaf2; border-color: var(--brown); }
.primary:hover { background: #4d2204; }
.danger { color: #922f20; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
label { display: grid; align-content: start; gap: .4rem; font-size: .86rem; font-weight: 600; min-width: 0; }
input:not([type="checkbox"]), select, textarea {
  width: 100%; min-width: 0; padding: .62rem .7rem; border: 1px solid #b9a087; border-radius: 7px;
  background: #fffdfa; color: var(--ink); font-weight: 400;
}
input[type="file"] { padding: .45rem; }
textarea { resize: vertical; }
small { color: var(--muted); font-weight: 400; }
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: #21160f; }
.login-card {
  width: min(100%, 440px); display: grid; gap: 20px; padding: clamp(22px, 6vw, 42px);
  border-radius: 20px; border-top: 4px solid #a84a1c; background: var(--card);
}
.login-card h1 { font-size: 2.6rem; }
.brand { margin: 0; font-size: 1.35rem; color: var(--muted); }
#login-message, #status { min-height: 1.4em; margin: 0; font-size: .85rem; color: var(--muted); }
[data-error="true"] { color: #922f20 !important; }
.top {
  padding: 14px clamp(16px, 4vw, 48px); background: #21160f; color: #f4ecdf;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
}
.identity { display: flex; align-items: center; gap: 10px; font-size: 1.55rem; }
.top .primary { background: #ffc28a; color: #21160f; border-color: #ffc28a; }
.top .primary:hover { background: #ffd6ad; }
.actions, .form-actions { display: flex; flex-wrap: wrap; gap: 8px; }
main { max-width: 1340px; padding: 30px clamp(14px, 4vw, 42px); margin: auto; }
.page-heading { display: flex; align-items: baseline; flex-wrap: wrap; justify-content: space-between; gap: 14px; }
.version { font-size: .82rem; color: var(--muted); }
nav { display: flex; gap: 10px; padding: 22px 0 12px; }
nav [aria-pressed="true"] { background: var(--brown); color: #fffaf2; border-color: var(--brown); }
#status { margin-bottom: 8px; }
.editor { display: grid; grid-template-columns: minmax(250px, .8fr) minmax(0, 1.5fr); gap: 20px; align-items: start; }
.collection, .form-panel { background: var(--card); border: 1px solid var(--line); border-radius: 15px; padding: clamp(12px, 2vw, 24px); }
.list-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.list-top h2 { margin: 0; }
#items { list-style: none; margin: 14px 0 0; padding: 0; max-height: 66vh; overflow: auto; }
#items li + li { margin-top: 6px; }
.item {
  width: 100%; text-align: left; justify-content: flex-start; gap: 10px; padding: 7px;
  border-color: transparent; font-size: .88rem;
}
.item[aria-current="true"] { background: #ece1ce; border-color: #bda283; }
.item img { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; }
.item span { display: grid; gap: .25rem; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.full { grid-column: 1 / -1; }
.photo { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 14px; margin: 18px 0; }
.photo img { width: 104px; height: 104px; object-fit: cover; border-radius: 8px; }
.photo img[hidden] + label { grid-column: 1/-1; }
details { margin: 16px 0; padding: 12px 0; border-block: 1px solid var(--line); }
details label { margin-top: 12px; }
summary { cursor: pointer; font-weight: 600; font-size: .88rem; }
.check { display: flex; align-items: center; gap: 8px; margin: 18px 0; }
.check input { width: 17px; height: 17px; accent-color: var(--brown); }
@media (max-width: 680px) {
  .editor { grid-template-columns: 1fr; }
  #items { max-height: 228px; }
  .top { gap: 8px; }
  .actions { font-size: .78rem; }
}
