:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #182b25;
  background: #f3f5f2;
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: #176548; text-underline-offset: 0.18em; }
h1 { font-size: clamp(1.7rem, 5vw, 2.4rem); line-height: 1.2; }
h2 { font-size: 1.15rem; margin: 0; }
button, input, select { font: inherit; }
button, select, input:not([type="file"]) { min-height: 48px; border: 1px solid #8c9e94; border-radius: 8px; padding: 0.7rem 0.9rem; }
button { background: #fff; color: #184a36; font-weight: 650; cursor: pointer; }
button:hover:not(:disabled) { background: #e9f1eb; }
button.primary { background: #1b6447; color: #fff; border-color: #1b6447; }
button.primary:hover:not(:disabled) { background: #144b35; }
button:disabled, input:disabled, select:disabled { opacity: 0.55; cursor: wait; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #bd7500; outline-offset: 3px; }
input, select { background: #fff; color: #182b25; max-width: 100%; }
input[type="file"] { width: 100%; padding: 1rem; background: #eef4ef; border: 2px dashed #749482; border-radius: 10px; }
input::file-selector-button { font: inherit; font-weight: 650; padding: 0.8rem 1rem; margin-right: 0.75rem; border-radius: 8px; background: #fff; color: #184a36; border: 1px solid #8c9e94; cursor: pointer; }
progress { width: 100%; height: 22px; accent-color: #1b6447; }
.brand { font-weight: 800; letter-spacing: -0.03em; font-size: 1.4rem; text-decoration: none; }
.topbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; padding: 1rem max(1rem, calc((100vw - 1500px) / 2)); background: #fff; border-bottom: 1px solid #d5dfd7; }
.topbar nav { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; }
.login-shell { max-width: 480px; margin: 5vh auto; padding: 1.25rem; }
.upload-shell { max-width: 680px; margin: 2rem auto; padding: 0 1rem 3rem; }
.review-shell { max-width: 1500px; margin: 2rem auto; padding: 0 1rem 3rem; }
.panel { border: 1px solid #d5dfd7; border-radius: 14px; background: #fff; padding: 1.25rem; }
.form-stack { display: flex; flex-direction: column; gap: 0.75rem; }
.form-stack > label { font-weight: 650; }
.message { min-height: 1.5em; overflow-wrap: anywhere; }
.error, .failure-list { color: #a52323; }
.failure-list { padding-left: 1.25rem; overflow-wrap: anywhere; }
.review-toolbar { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.review-toolbar select { min-width: 220px; }
.items-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 600px), 1fr)); align-items: start; gap: 1.2rem; }
.item-card { min-width: 0; }
.item-heading { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.badge { display: inline-block; border-radius: 20px; padding: 0.25rem 0.65rem; font-size: 0.8rem; background: #eaf0ea; color: #294634; }
.excluded-badge { background: #fff0d6; color: #754900; margin: 0; }
.photos-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 1rem; }
.photo-card { display: flex; flex-direction: column; gap: 0.6rem; min-width: 0; padding: 0.65rem; border: 1px solid #d8e0da; border-radius: 10px; }
.photo-card.is-excluded { background: #f8f5ed; border-color: #d1b98a; }
.photo-link { display: block; background: #eff1ee; border-radius: 6px; overflow: hidden; }
.photo-link img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; display: block; }
.photo-time { color: #4e6257; font-size: 0.85rem; margin: 0; }
.photo-field { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.9rem; }
.photo-field select { width: 100%; }
[hidden] { display: none !important; }
.mode-banner { padding: 1rem; border: 2px solid #bd7500; background: #fff3d8; border-radius: 8px; }
#draft-state { overflow-wrap: anywhere; margin: 1rem 0; }
#draft-state pre { white-space: pre-wrap; overflow-wrap: anywhere; }
textarea { font: inherit; min-height: 90px; padding: 0.7rem; border: 1px solid #8c9e94; border-radius: 8px; width: 100%; }
#item-detail { margin: 1rem 0; overflow-wrap: anywhere; }
.open-item { display: block; width: 100%; margin: 0.75rem 0 1rem; }
#item-detail { scroll-margin-top: 1rem; min-width: 0; }
#item-detail input:not([type=checkbox]), #item-detail textarea { width: 100%; min-width: 0; }
.fact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 1rem; }
.fact-grid label { display: flex; flex-direction: column; }
.fact-grid input[type=checkbox] { min-height: 24px; align-self: start; }
.description-preview { white-space: pre-wrap; border: 1px solid #d5dfd7; padding: 1rem; }
#comp-list > div { padding: 0.75rem 0; border-bottom: 1px solid #d5dfd7; }
#comp-list button { margin: 0.25rem; }
@media (max-width: 500px) {
  #item-detail .review-toolbar button { width: 100%; }
  .topbar { align-items: flex-start; }
  .topbar nav { gap: 0.65rem; font-size: 0.9rem; }
  .topbar nav span { max-width: 130px; overflow-wrap: anywhere; }
  .panel { padding: 1rem; }
  .review-toolbar { align-items: stretch; }
  .review-toolbar label { width: 100%; }
  .review-toolbar select { min-width: 0; flex: 1; }
}

/* S2: retain the existing cards; collection controls stack on phones. */
.collection-rule { display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:12px; margin-block:12px; }
.release-control { margin-block:16px; }
.collection-card select,.collection-rule input,.collection-rule select { max-width:100%; }
