* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #2a2620;
  background: #faf8ec;
  line-height: 1.5;
}
.wrap { max-width: 1100px; margin: 0 auto; padding: 1rem; }
header { background: #fcfaef; border-bottom: 1px solid #e3dac6; }
header .wrap { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
header h1 { margin: 0; font-size: 1.4rem; }
header h1 a { color: #2a3d52; text-decoration: none; }
header .adminnav a { margin-left: 1rem; font-size: .9rem; }

main.wrap { padding-top: 1.5rem; padding-bottom: 3rem; min-height: 70vh; }

footer { border-top: 1px solid #e3dac6; background: #fcfaef; font-size: .9rem; }
footer .wrap { display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
footer .footer-right { margin-left: auto; }
footer .inlineform { display: inline; }
footer a, header a { color: #2c5f8d; }

.flash { padding: .6rem .9rem; border-radius: 4px; margin-bottom: 1rem; }
.flash-success { background: #eaf2e3; border: 1px solid #bcd4ac; color: #2c5f3a; }
.flash-error   { background: #f7e8e0; border: 1px solid #e6c3b1; color: #8b2d23; }
.empty { color: #8a8174; font-style: italic; }

/* Index grid */
.sitedesc { margin: 0 0 1.2rem 0; color: #4a4238; }
.sitedesc p { margin: 0 0 .7rem 0; }
.sitedesc p:last-child { margin-bottom: 0; }
.sortbar { margin: 0 0 1rem 0; font-size: .9rem; color: #6b6258; }
.sortbar select { font-size: .9rem; padding: .2rem .4rem; border: 1px solid #cdc4b3; border-radius: 3px; background: #fff; color: #2a2620; }
.cat-heading { margin: 1.2rem 0 .6rem 0; font-size: 1.15rem; color: #2c5f8d; border-bottom: 1px solid #d8cfbc; padding-bottom: .25rem; font-weight: 600; }
.card .category { margin: .4rem 0 0 0; font-size: .75rem; color: #8a8174; text-transform: uppercase; letter-spacing: .04em; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.card-link { display: block; color: inherit; text-decoration: none; }
.card-link:hover .card { border-color: #2c5f8d; box-shadow: 0 4px 12px rgba(44, 95, 141, .15); }
.card-link:hover .see-details { text-decoration: underline; }
.card { background: #fff; border: 1px solid #e3dac6; border-radius: 6px; padding: .8rem; position: relative; transition: border-color .12s, box-shadow .12s; height: 100%; display: flex; flex-direction: column; box-shadow: 0 1px 2px rgba(60, 45, 20, .04); }
.card.sold { opacity: .85; }
.card h2 { font-size: 1.05rem; margin: .4rem 0 .2rem 0; color: #2a3d52; }
.card .price { margin: 0; color: #2c5f3a; font-weight: 600; }
.card .bidline { margin: .2rem 0 .4rem 0; color: #6b6258; font-size: .9rem; }
.card .desc-snip { margin: 0 0 .5rem 0; font-size: .85rem; color: #5a5246; flex-grow: 1; white-space: pre-wrap; }
.card .see-details { margin: 0; font-size: .85rem; color: #2c5f8d; font-weight: 600; }
.card .thumb { display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 4px; background: #f0e8d8; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #b8aa92; font-size: .9rem; }
.ribbon { position: absolute; top: .6rem; right: .6rem; background: #b9572a; color: #fff; padding: .2rem .5rem; font-size: .75rem; border-radius: 3px; letter-spacing: .04em; text-transform: uppercase; z-index: 1; }

/* Detail page */
.detail .category { margin: 0 0 .2rem 0; font-size: .8rem; color: #8a8174; text-transform: uppercase; letter-spacing: .04em; }
.detail h2 { color: #2a3d52; }
.detail .badge { display: inline-block; padding: .1rem .5rem; border-radius: 3px; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; vertical-align: middle; margin-left: .5rem; }
.detail .badge.sold { background: #b9572a; color: #fff; }
.detail .badge.deleted { background: #7a7368; color: #fff; }
.detail .price { font-size: 1.1rem; color: #2c5f3a; font-weight: 600; }
.detail .bidline { font-size: 1.05rem; color: #4a4238; }
.detail .description { white-space: pre-wrap; margin: 1rem 0 1.5rem 0; }

.gallery { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0; }
.gallery-item { display: block; width: 110px; height: 110px; overflow: hidden; border-radius: 4px; background: #f0e8d8; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Forms */
form.stacked label, .bidform form label { display: block; margin: .6rem 0; }
form.stacked input[type="text"],
form.stacked input[type="email"],
form.stacked input[type="number"],
form.stacked textarea,
.bidform input[type="email"],
.bidform input[type="number"] {
  display: block;
  width: 100%;
  padding: .5rem .6rem;
  border: 1px solid #cdc4b3;
  border-radius: 4px;
  font-size: 1rem;
  max-width: 420px;
  background: #fff;
  color: #2a2620;
}
form.stacked input:focus,
form.stacked textarea:focus,
.bidform input:focus { outline: none; border-color: #2c5f8d; box-shadow: 0 0 0 2px rgba(44, 95, 141, .15); }
form.stacked textarea { max-width: 640px; min-height: 120px; font-family: inherit; }
.askform form.stacked textarea { max-width: none; }
.bidform { background: #fff; border: 1px solid #e3dac6; border-radius: 6px; padding: 1rem; margin-top: 1rem; max-width: 480px; box-shadow: 0 1px 2px rgba(60, 45, 20, .04); }
.bidform h3 { margin-top: 0; color: #2a3d52; }
.bidform label.cb { display: flex; align-items: center; gap: .4rem; margin: .6rem 0; }
.bidform .note { color: #6b6258; font-size: .9rem; }
.bidform .bidas { color: #4a4238; margin: .2rem 0 .6rem 0; }
.bidform .bidas .inlineform { margin-left: .4rem; }
.adminbids { margin-top: 1.5rem; background: #fff; border: 1px solid #e3dac6; border-radius: 6px; padding: 1rem; box-shadow: 0 1px 2px rgba(60, 45, 20, .04); }
.adminbids h3 { margin-top: 0; color: #2a3d52; }
.adminbids tr.winner { background: #eaf2e3; }
.adminbids .note { color: #8a8174; font-size: .85rem; margin-top: .6rem; }
button, .btn {
  display: inline-block;
  background: #2c5f8d;
  color: #fff;
  border: 0;
  padding: .5rem 1rem;
  font-size: 1rem;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
}
button:hover, .btn:hover { background: #234c70; }
.btn.primary { background: #3a8a5a; }
.btn.primary:hover { background: #2f7048; }
.btn.danger, button.danger { background: #b03a2e; }
.btn.danger:hover, button.danger:hover { background: #8b2d23; }
.linkbtn { background: none; color: #2c5f8d; padding: 0; font-size: inherit; cursor: pointer; }
.linkbtn:hover { background: none; text-decoration: underline; }
.linkbtn.danger { color: #fff; background: #b03a2e; padding: .15rem .45rem; border-radius: 3px; text-decoration: none; }
.linkbtn.danger:hover { background: #8b2d23; color: #fff; text-decoration: none; }
.inlineform { display: inline; }
.adminactions { margin-top: 1.5rem; display: flex; gap: .5rem; align-items: center; }

.admintable { width: 100%; border-collapse: collapse; background: #fff; border-radius: 6px; overflow: hidden; box-shadow: 0 1px 2px rgba(60, 45, 20, .04); }
.admintable th, .admintable td { padding: .5rem; border-bottom: 1px solid #ede5d2; text-align: left; font-size: .9rem; }
.admintable th { background: #fcfaef; color: #4a4238; font-weight: 600; }
.admintable .price-cell { cursor: pointer; }
.admintable .price-cell:hover .price-view { text-decoration: underline dotted; color: #2c5f8d; }
.admintable .price-cell.editing { cursor: text; }
.admintable .price-input { width: 5.5rem; padding: .15rem .3rem; font-size: .9rem; border: 1px solid #2c5f8d; border-radius: 3px; }
.admintable .col-select { width: 1.6rem; padding-right: 0; }
.admintable tbody tr.row-selected { background: #e8eef5; }

/* Admin header with select-mode toggle */
.admin-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.admin-header h2 { margin: 0; color: #2a3d52; }
.select-toggle { background: #fff; color: #2c5f8d; border: 1px solid #cfd8e6; padding: .35rem .7rem; font-size: .9rem; display: inline-flex; align-items: center; gap: .4rem; }
.select-toggle:hover { background: #e8eef5; }
.select-toggle.active { background: #2c5f8d; color: #fff; border-color: #2c5f8d; }
.select-toggle-icon { font-size: 1.05rem; line-height: 1; }

/* Bulk actions bar */
[hidden] { display: none !important; }
.bulk-actions { background: #e8eef5; border: 1px solid #cfd8e6; border-radius: 4px; padding: .5rem .75rem; margin: 0 0 .8rem 0; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; font-size: .9rem; }
.bulk-actions .bulk-select-all { display: inline-flex; align-items: center; gap: .35rem; }
.bulk-actions .bulk-count { color: #4a4238; }
.bulk-actions .bulk-sep { color: #a8b3c2; }
.bulk-actions .bulk-drop { display: inline-flex; align-items: center; gap: .35rem; }
.bulk-actions .bulk-drop input[type="text"] { padding: .15rem .3rem; font-size: .9rem; border: 1px solid #cfd8e6; border-radius: 3px; width: 3.5rem; background: #fff; }
.bulk-actions .bulk-drop .btn { padding: .25rem .6rem; font-size: .85rem; }
.bulk-actions button[disabled], .bulk-actions .btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Confirmation overlay */
.confirm-overlay { position: fixed; inset: 0; background: rgba(40, 30, 15, .55); display: flex; align-items: center; justify-content: center; z-index: 1500; padding: 1rem; }
.confirm-dialog { background: #fff; border-radius: 6px; padding: 1.2rem 1.4rem; max-width: 440px; width: 100%; box-shadow: 0 8px 32px rgba(40, 30, 15, .3); }
.confirm-title { margin: 0 0 .6rem 0; font-size: 1.1rem; color: #2a3d52; }
.confirm-body { margin: 0 0 1rem 0; color: #4a4238; }
.confirm-actions { display: flex; justify-content: flex-end; gap: .5rem; }
.confirm-actions .btn { padding: .4rem .9rem; font-size: .95rem; }
.confirm-actions .btn.danger { background: #b03a2e; }
.confirm-actions .btn.danger:hover { background: #8b2d23; }

.existing-images { border: 1px solid #d8cfbc; padding: .5rem; border-radius: 4px; background: #fcfaef; }
.existing-images .thumblabel { display: inline-flex; flex-direction: column; align-items: center; margin: .4rem; gap: .2rem; font-size: .8rem; }
.existing-images img { width: 100px; height: 100px; object-fit: cover; border-radius: 4px; }

.image-dropzone-wrap { margin: .6rem 0; }
.image-dropzone-wrap .dz-label { display: block; margin-bottom: .3rem; }
.image-dropzone {
  border: 2px dashed #cdc4b3;
  border-radius: 6px;
  padding: 1.2rem;
  text-align: center;
  background: #fcfaef;
  transition: background .12s, border-color .12s;
}
.image-dropzone.drag-over { border-color: #2c5f8d; background: #eaf1f8; }
.image-dropzone .dz-hint { margin: 0 0 .2rem 0; color: #6b6258; }
.image-dropzone .dz-or { margin: 0 0 .5rem 0; color: #8a8174; font-size: .85rem; }
.image-dropzone .dz-pick { margin: 0; }
.image-dropzone .dz-preview {
  list-style: none;
  margin: 1rem 0 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  justify-content: center;
}
.image-dropzone .dz-item { position: relative; width: 100px; font-size: .75rem; color: #5a5246; }
.image-dropzone .dz-thumb {
  display: flex;
  width: 100px;
  height: 100px;
  background: #f0e8d8;
  border-radius: 4px;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  color: #8a8174;
  font-weight: 600;
  letter-spacing: .05em;
}
.image-dropzone .dz-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-dropzone .dz-name {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
  margin-top: .2rem;
  text-align: center;
}
.image-dropzone .dz-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  padding: 0;
  line-height: 18px;
  border-radius: 50%;
  background: #b03a2e;
  color: #fff;
  font-size: 1rem;
  border: 2px solid #fff;
  cursor: pointer;
}
.image-dropzone .dz-remove:hover { background: #8b2d23; }

.subform label { display: block; margin: .25rem 0; }
.subform button { margin-top: .5rem; }

.bidgroup { background: #fff; border: 1px solid #e3dac6; border-radius: 6px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 1px 2px rgba(60, 45, 20, .04); }
.bidgroup .status { font-size: .8rem; padding: .1rem .5rem; border-radius: 3px; margin-left: .5rem; vertical-align: middle; }
.status-winning { background: #eaf2e3; color: #2c5f3a; }
.status-outbid { background: #fbeed5; color: #7a5400; }
.status-sold-to-you { background: #eaf2e3; color: #2c5f3a; }
.status-sold-to-other { background: #ece5d2; color: #5a4f3f; }
.bidlog { margin: .4rem 0 0 1.2rem; padding: 0; font-size: .9rem; color: #6b6258; }

/* Lightbox */
.lb-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.88); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.lb-overlay img { max-width: 92vw; max-height: 88vh; display: block; cursor: pointer; }
.lb-close, .lb-prev, .lb-next { position: absolute; color: #fff; background: rgba(0,0,0,.3); border: 0; font-size: 1.6rem; padding: .5rem 1rem; cursor: pointer; user-select: none; }
.lb-close { top: 1rem; right: 1rem; }
.lb-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: 1rem; top: 50%; transform: translateY(-50%); }
.lb-prev:hover, .lb-next:hover, .lb-close:hover { background: rgba(0,0,0,.6); }
