/* ── Theme CSS variables (default: blue) ── */
:root {
  --clr-900:    #0f2554;
  --clr-700:    #1b4096;
  --clr-500:    #2e6db4;
  --clr-400:    #4a80c4;
  --clr-300:    #7a9cc4;
  --clr-200:    #a8d0f7;
  --clr-100:    #d6e8f7;
  --clr-50:     #e8f3fc;
  --clr-border: #d0e3f5;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--clr-50);
  color: #1a2540;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* The messages "app mode" panel needs a genuine ceiling (not just a floor)
   on body so its flex descendants compute bounded heights and scroll
   internally instead of growing the whole page to fit their content. */
body:has(.messages-page) {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

a { color: inherit; text-decoration: none; }

/* ── Auth pages ── */
.auth-page {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 2rem;
}
.auth-card {
  background: #fff;
  border: 1.5px solid var(--clr-border);
  border-radius: 16px;
  padding: 2rem 2.25rem 1.75rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 4px 20px rgba(27,64,150,0.10);
}
.auth-title { font-size: 1.5rem; font-weight: 800; color: var(--clr-900); margin-bottom: 0.25rem; }
.auth-sub   { color: var(--clr-300); font-size: 0.9rem; margin-bottom: 1.5rem; }
.auth-form  { display: flex; flex-direction: column; gap: 0.1rem; }
.auth-switch { text-align: center; font-size: 0.88rem; color: var(--clr-300); margin-top: 1.25rem; }
.auth-switch a { color: var(--clr-500); font-weight: 600; }
.auth-switch a:hover { text-decoration: underline; }
.btn-full { width: 100%; text-align: center; margin-top: 0.5rem; }
.optional { color: var(--clr-300); font-weight: 400; font-size: 0.82rem; }

/* Password show/hide */
.pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.pw-wrap input {
  flex: 1;
  padding-right: 2.5rem;
}
.pw-toggle {
  position: absolute;
  right: 0.6rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.pw-toggle:hover { opacity: 1; }

/* Password match feedback */
.pw-match-msg { font-size: 0.8rem; margin-top: 0.3rem; font-weight: 600; }
.pw-match-msg.match    { color: #1a7a45; }
.pw-match-msg.no-match { color: #c0392b; }

/* Wanted request box */
.wanted-box {
  background: var(--clr-50);
  border: 1.5px solid var(--clr-border);
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  margin: 0.75rem 0 1rem;
}
.wanted-box-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.wanted-heading { font-size: 0.92rem; font-weight: 800; color: var(--clr-900); }
.wanted-sub-text { font-size: 0.82rem; color: var(--clr-400); }
.inline-edit-input {
  flex: 1 1 220px;
  min-width: 0;
  font: inherit;
  font-size: 0.82rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  border: 1.5px solid var(--clr-500);
  background: #fff;
  color: #1a2540;
}
.inline-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  opacity: 0.6;
  padding: 0;
}
.inline-edit-btn:hover { opacity: 1; }
.wanted-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.wanted-form textarea {
  flex: 1 1 260px;
  min-width: 0;
  resize: vertical;
  font: inherit;
  padding: 0.4rem 0.65rem;
  border: 1.5px solid var(--clr-border);
  border-radius: 8px;
  background: #fff;
  color: #1a2540;
}
.wanted-form textarea:focus { outline: none; border-color: var(--clr-500); }
.wanted-submit { flex: 0 0 auto; margin-top: 0; padding: 0.4rem 0.9rem; }
.wanted-login-link {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--clr-500);
}
.wanted-login-link:hover { color: var(--clr-700); }

/* Remember me */
.remember-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--clr-900);
  margin: 0.6rem 0 0.25rem;
  cursor: pointer;
}
.remember-check input { accent-color: var(--clr-500); width: 1rem; height: 1rem; cursor: pointer; }

/* Forgot password */
.forgot-link {
  display: block;
  font-size: 0.82rem;
  color: var(--clr-400);
  margin-top: 0.35rem;
  transition: color 0.15s;
}
.forgot-link:hover { color: var(--clr-700); text-decoration: underline; }

.security-question-display {
  background: var(--clr-50);
  border: 1px solid var(--clr-border);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  color: var(--clr-900);
  font-weight: 500;
  margin-top: 0.25rem;
}

/* Avatar upload */
.avatar-upload-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.avatar-preview {
  width: 68px; height: 68px;
  border-radius: 50%;
  background: var(--clr-100);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  cursor: pointer;
  border: 2px dashed var(--clr-border);
  transition: border-color 0.15s;
}
.avatar-preview:hover { border-color: var(--clr-500); }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-placeholder { font-size: 1.6rem; color: var(--clr-300); }
.avatar-upload-label { font-size: 0.88rem; font-weight: 600; color: var(--clr-500); cursor: pointer; }
.avatar-upload-label:hover { text-decoration: underline; }
.file-input-hidden { display: none; }

/* Auth prompt on item page */
.auth-prompt-btns { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.5rem; }
.btn-outline {
  display: inline-block;
  background: #fff;
  color: var(--clr-700);
  border: 1.5px solid var(--clr-700);
  border-radius: 8px;
  padding: 0.6rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}
.btn-outline:hover { background: var(--clr-50); }

.notif-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.notif-btn-row .btn-outline { flex: 1 1 auto; text-align: center; }

/* Watchlist button (item detail) */
.btn-watch {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #fff;
  color: var(--clr-700);
  border: 1.5px solid var(--clr-700);
  border-radius: 8px;
  padding: 0.55rem 1.1rem;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-family: inherit;
}
.btn-watch:hover { background: var(--clr-50); }
.btn-watch.watching {
  background: #fef3e2;
  color: #7a4a00;
  border-color: #f5a623;
}
.btn-watch.watching:hover { background: #fde8c4; }

/* ── Header ── */
.site-header {
  background: linear-gradient(135deg, var(--clr-900) 0%, var(--clr-700) 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.5rem 1.5rem;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 0.4rem;
}

.site-logo {
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  display: inline-flex;
  align-items: baseline;
}
.logo-penny { /* styled by logo-style-* class */ }
.logo-deals { margin-left: 4px; }

/* ── Logo styles ── */
.logo-style-plain .logo-penny,
.logo-style-plain .logo-deals {
  color: #fff;
  -webkit-text-fill-color: #fff;
  text-shadow: none;
}
.logo-style-glow .logo-penny,
.logo-style-glow .logo-deals {
  color: #fff;
  -webkit-text-fill-color: #fff;
  text-shadow: 0 0 16px rgba(255,255,255,0.7), 0 0 36px rgba(255,255,255,0.35);
}
.logo-style-gradient .logo-penny {
  background: linear-gradient(90deg, var(--clr-100), #fff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}
.logo-style-gradient .logo-deals {
  color: #fff;
  -webkit-text-fill-color: #fff;
  text-shadow: 0 0 18px rgba(255,255,255,0.5);
}
.logo-style-gold .logo-penny,
.logo-style-gold .logo-deals {
  color: #ffd700;
  -webkit-text-fill-color: #ffd700;
  text-shadow: 0 0 14px rgba(255,215,0,0.6), 0 1px 3px rgba(0,0,0,0.3);
}
.logo-style-color .logo-penny,
.logo-style-color .logo-deals {
  color: var(--clr-200);
  -webkit-text-fill-color: var(--clr-200);
  text-shadow: 0 0 14px rgba(255,255,255,0.25);
}

.header-nav { display: flex; gap: 0.6rem 1.5rem; align-items: center; flex-wrap: wrap; }
.header-nav a {
  color: var(--clr-200);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.15s;
  position: relative;
}
.header-nav a:hover { color: #fff; }

.nav-profile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--clr-400);
  flex-shrink: 0;
}
.nav-avatar-initials {
  background: var(--clr-500);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
}
.nav-username { color: var(--clr-200); font-size: 0.9rem; font-weight: 600; }
.nav-logout   { color: var(--clr-300); font-size: 0.82rem; transition: color 0.15s; }
.nav-logout:hover { color: #fff; }
.nav-profile-link { display: flex; align-items: center; gap: 0.5rem; transition: opacity 0.15s; }
.nav-profile-link:hover { opacity: 0.85; }

.account-section-heading { font-size: 0.95rem; font-weight: 700; color: var(--clr-700); margin: 0.25rem 0 0.75rem; }

/* ── Account page: appearance customization ── */
.account-customize-label { font-size: 0.82rem; font-weight: 700; color: var(--clr-700); margin: 1rem 0 0.4rem; }
.account-customize-label:first-child { margin-top: 0; }
.account-swatch-row { display: flex; flex-wrap: wrap; gap: 0.55rem; align-items: center; }
.account-logo-opts { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* ── Account page: saved replies ── */
.saved-replies-group { margin-bottom: 1.25rem; }
.saved-replies-label { font-size: 0.82rem; font-weight: 700; color: var(--clr-700); margin-bottom: 0.5rem; }
.saved-reply-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.6rem; }
.saved-reply-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  background: var(--clr-50);
  border: 1px solid var(--clr-border);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
}
.saved-reply-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.saved-reply-label { font-size: 0.72rem; font-weight: 700; color: var(--clr-500); }
.saved-reply-value { font-size: 0.88rem; color: #1a2540; word-break: break-word; }
.saved-reply-add-form { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.saved-reply-add-form input {
  flex: 1 1 140px;
  border: 1.5px solid var(--clr-border);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  font-size: 0.88rem;
  font-family: inherit;
}
.saved-reply-add-form input:focus {
  outline: none;
  border-color: var(--clr-500);
  box-shadow: 0 0 0 3px rgba(46,109,180,0.15);
}
.saved-reply-add-form button { flex-shrink: 0; }
.nav-auth-link { color: var(--clr-200); font-weight: 500; font-size: 0.92rem; transition: color 0.15s; }
.nav-auth-link:hover { color: #fff; }
.btn-nav-signup {
  background: var(--clr-500);
  color: #fff;
  padding: 0.3rem 0.85rem;
  border-radius: 7px;
  font-size: 0.88rem;
  font-weight: 700;
  transition: background 0.15s;
}
.btn-nav-signup:hover { background: var(--clr-400); }

.badge {
  background: #f04e37;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  margin-left: 4px;
  vertical-align: middle;
}

/* ── Desktop notification re-enable banner ── */
.notif-reenable-banner {
  position: sticky;
  top: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: var(--clr-900);
  color: #fff;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  flex-wrap: wrap;
}
.notif-reenable-btn {
  background: #fff;
  color: var(--clr-900);
  border: none;
  border-radius: 6px;
  padding: 0.25rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}
.notif-reenable-btn:hover { background: var(--clr-100); }
.notif-reenable-dismiss {
  background: none;
  border: none;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.15rem 0.3rem;
}
.notif-reenable-dismiss:hover { color: #fff; }

/* ── Message toast notifications ── */
.msg-toast-wrap {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(340px, calc(100vw - 2rem));
}
.msg-toast {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: var(--clr-700);
  color: #fff;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  text-decoration: none;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.msg-toast-show { opacity: 1; transform: translateX(0); }
.msg-toast strong {
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-toast span {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.85);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.msg-toast-extra {
  font-size: 0.7rem !important;
  font-weight: 700;
  color: rgba(255,255,255,0.7) !important;
  -webkit-line-clamp: 1 !important;
}

/* ── Flash messages ── */
.flash-container { max-width: 1100px; margin: 1rem auto 0; padding: 0 1.5rem; }
.flash {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}
.flash-success { background: #d1f0e0; color: #1a5c35; border-left: 4px solid #2ecc71; }
.flash-error   { background: #fde8e8; color: #7b1f1f; border-left: 4px solid #e74c3c; }

/* ── Main ── */
.main-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  flex: 1;
  width: 100%;
}
.main-content:has(.messages-page) {
  padding-top: 1rem;
  padding-bottom: 1rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.main-content:has(.item-detail) { max-width: 1300px; }

/* ── Hero ── */
.page-hero {
  background: linear-gradient(135deg, var(--clr-700) 0%, var(--clr-500) 100%);
  color: #fff;
  border-radius: 14px;
  padding: 2rem 2.5rem;
  margin-bottom: 1.75rem;
}
.page-hero h1 { font-size: 1.9rem; font-weight: 800; margin-bottom: 0.4rem; }
.page-hero p  { font-size: 1rem; color: #cce0f7; }

/* ── Availability tabs ── */
.availability-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--clr-border);
}
.avail-tab {
  padding: 0.55rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--clr-300);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.avail-tab:hover { color: var(--clr-700); }
.avail-tab.active { color: var(--clr-700); border-bottom-color: var(--clr-700); }

/* ── Category bar ── */
.category-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.cat-pill {
  background: #fff;
  border: 1.5px solid var(--clr-border);
  color: var(--clr-700);
  padding: 0.35rem 0.9rem;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.cat-pill:hover  { background: var(--clr-100); }
.cat-pill.active { background: var(--clr-700); color: #fff; border-color: var(--clr-700); }

/* ── Item Grid ── */
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.25rem;
}

.item-card {
  position: relative;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(27,64,150,0.10);
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  border: 1.5px solid var(--clr-border);
}
.item-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(27,64,150,0.18);
}
.item-card.card-sold    { opacity: 0.65; }
.item-card.card-pending { opacity: 0.85; }

.item-card-link {
  display: flex;
  flex-direction: column;
  flex: 1;
  color: inherit;
  text-decoration: none;
}

.card-edit-btn {
  position: absolute;
  top: 10px; right: 10px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  z-index: 5;
  transition: background 0.15s, transform 0.15s;
}
.card-edit-btn:hover { background: rgba(0,0,0,0.8); transform: scale(1.08); }

.card-watch-form { position: absolute; top: 10px; right: 10px; z-index: 5; }
.card-watch-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
  font-family: inherit;
  padding: 0;
}
.card-watch-btn:hover  { background: rgba(0,0,0,0.8); transform: scale(1.08); }
.card-watch-btn.watched { background: #f5a623; color: #fff; }
.card-watch-btn.watched:hover { background: #e2941a; }

.item-img-wrap {
  position: relative;
  width: 100%;
  height: 190px;
  overflow: hidden;
  background: var(--clr-100);
}
.item-img-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.no-img {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--clr-300); font-size: 0.9rem;
}

.status-banner {
  position: absolute;
  top: 10px; left: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.banner-sold    { background: #c0392b; color: #fff; }
.banner-pending { background: #e67e22; color: #fff; }
.banner-new     { background: #27ae60; color: #fff; }

.item-info { padding: 1rem; flex: 1; display: flex; flex-direction: column; gap: 0.25rem; }
.item-category { font-size: 0.75rem; color: var(--clr-400); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.item-lot { color: #94a3b8; font-weight: 600; letter-spacing: 0.3px; white-space: nowrap; }
.item-title { font-size: 1.05rem; font-weight: 700; color: var(--clr-900); line-height: 1.3; }
.item-price { font-size: 1.2rem; font-weight: 800; color: var(--clr-700); }
.item-desc { font-size: 0.85rem; color: #4a5568; line-height: 1.45; flex: 1; }
.item-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 0.5rem; font-size: 0.8rem;
}
.pickup-tag { color: var(--clr-300); }
.msg-hint { color: var(--clr-500); font-weight: 600; }

/* ── Item Detail ── */
.item-detail { max-width: 1300px; }
.back-link {
  display: inline-block;
  color: var(--clr-500);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
  transition: color 0.15s;
}
.back-link:hover { color: var(--clr-700); }

.item-detail-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 1.75rem;
  align-items: start;
}
@media (max-width: 780px) {
  .item-detail-layout { grid-template-columns: 1fr; }
}

.item-detail-left { position: relative; display: flex; flex-direction: column; gap: 1rem; min-width: 0; }

.detail-img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  background: var(--clr-100);
}
.item-detail-info { display: flex; flex-direction: column; gap: 0.6rem; }
.detail-title { font-size: 1.6rem; font-weight: 800; color: var(--clr-900); line-height: 1.25; }
.detail-price { font-size: 2rem; font-weight: 900; color: var(--clr-700); }

.status-badge {
  display: inline-block;
  padding: 0.3rem 0.85rem;
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 700;
}
.status-badge.available { background: #d1f0e0; color: #1a5c35; }
.status-badge.pending   { background: #fef3e2; color: #7a4a00; }
.status-badge.sold      { background: #fde8e8; color: #7b1f1f; }

.detail-pickup { font-size: 0.88rem; color: var(--clr-400); font-weight: 500; }
.detail-desc h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--clr-300); margin-bottom: 0.35rem; }
.detail-desc p  { font-size: 0.95rem; color: #2d3748; line-height: 1.6; }

/* ── Item inline chat panel ── */
.item-chat-panel {
  background: #fff;
  border: 1.5px solid var(--clr-border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(27,64,150,0.09);
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 120px);
}
.item-chat-header {
  background: linear-gradient(135deg, var(--clr-700), var(--clr-500));
  color: #fff;
  padding: 0.85rem 1rem;
  font-weight: 700;
  font-size: 0.97rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.chat-status-note { font-size: 0.75rem; font-weight: 400; color: var(--clr-200); }
.item-chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 200px;
  max-height: 420px;
  scroll-behavior: smooth;
}
.chat-empty-hint {
  color: var(--clr-300);
  font-size: 0.88rem;
  text-align: center;
  margin: auto;
  padding: 1rem;
}

/* Request Address */
.address-request-row {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--clr-border);
  flex-shrink: 0;
}
.btn-request-address {
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
}
.address-request-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.address-request-form input[type="text"] {
  border: 1.5px solid var(--clr-border);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  font-size: 0.9rem;
  font-family: inherit;
}
.address-request-form input[type="text"]:focus {
  outline: none;
  border-color: var(--clr-500);
  box-shadow: 0 0 0 3px rgba(46,109,180,0.15);
}
.address-request-actions { display: flex; align-items: center; gap: 0.75rem; }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.85rem; }
.address-request-status {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--clr-border);
  background: var(--clr-50);
  color: var(--clr-700);
  font-size: 0.85rem;
  font-weight: 600;
  flex-shrink: 0;
}
.item-chat-form {
  border-top: 1px solid var(--clr-border);
  padding: 0.6rem 0.75rem;
  background: #fff;
  flex-shrink: 0;
}
.chat-guest-prompt {
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
}
.chat-guest-prompt p { color: #4a5568; font-size: 0.92rem; }

.form-group { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.85rem; }
.form-group label { font-size: 0.85rem; font-weight: 600; color: #2d4a7a; }
.form-group input,
.form-group textarea {
  border: 1.5px solid var(--clr-border);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  color: #1a2540;
  transition: border-color 0.15s, box-shadow 0.15s;
  resize: vertical;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--clr-500);
  box-shadow: 0 0 0 3px rgba(46,109,180,0.15);
}

.btn-primary {
  display: inline-block;
  background: linear-gradient(135deg, var(--clr-700), var(--clr-500));
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  font-family: inherit;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

/* ── Admin Page ── */
.admin-page { max-width: 800px; }
.admin-heading { font-size: 1.7rem; font-weight: 800; color: var(--clr-900); margin-bottom: 0.4rem; }
.msg-count { color: var(--clr-300); font-size: 0.9rem; margin-bottom: 1.25rem; }

.msg-list { display: flex; flex-direction: column; gap: 1rem; }

.msg-card {
  background: #fff;
  border: 1.5px solid var(--clr-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(27,64,150,0.07);
}
.msg-card.unread {
  border-color: var(--clr-500);
  box-shadow: 0 2px 12px rgba(27,64,150,0.15);
}

.msg-header {
  background: var(--clr-50);
  padding: 0.65rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--clr-border);
}
.msg-item-link { font-weight: 700; color: var(--clr-700); font-size: 0.95rem; }
.msg-item-link:hover { text-decoration: underline; }
.msg-item-price { color: var(--clr-400); font-size: 0.85rem; font-weight: 600; margin-left: 0.5rem; }
.msg-meta { font-size: 0.8rem; color: var(--clr-300); display: flex; align-items: center; gap: 0.5rem; }
.new-badge {
  background: var(--clr-700); color: #fff;
  font-size: 0.7rem; font-weight: 700;
  padding: 2px 7px; border-radius: 99px;
}

.msg-body { padding: 0.85rem 1rem; }
.msg-sender { display: flex; align-items: baseline; gap: 0.6rem; margin-bottom: 0.4rem; }
.msg-sender strong { font-size: 1rem; color: var(--clr-900); }
.msg-contact { font-size: 0.85rem; color: var(--clr-500); }
.msg-text { font-size: 0.95rem; color: #2d3748; line-height: 1.55; }

/* ── New Listing Form ── */
.listing-form { max-width: 580px; margin-top: 1rem; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 500px) { .form-row { grid-template-columns: 1fr; } }

.field-hint { font-size: 0.78rem; color: var(--clr-300); margin-top: 0.25rem; }
.req { color: #c0392b; }

.file-input {
  border: 1.5px dashed var(--clr-border);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  background: #fff;
  width: 100%;
  cursor: pointer;
}
.file-input:hover { border-color: var(--clr-500); }

select {
  border: 1.5px solid var(--clr-border);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  color: #1a2540;
  width: 100%;
  cursor: pointer;
}
select:focus {
  outline: none;
  border-color: var(--clr-500);
  box-shadow: 0 0 0 3px rgba(46,109,180,0.15);
}

.form-actions { display: flex; align-items: center; gap: 1rem; margin-top: 0.5rem; }

.btn-cancel {
  color: var(--clr-300);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.15s;
}
.btn-cancel:hover { color: var(--clr-700); }

/* ── Manage Listings ── */
.admin-heading-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.admin-heading-row .admin-heading { margin-bottom: 0; }
.admin-heading-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.listings-table { display: flex; flex-direction: column; gap: 0.75rem; }

.listing-row {
  background: #fff;
  border: 1.5px solid var(--clr-border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  box-shadow: 0 1px 4px rgba(27,64,150,0.07);
}
.listing-row.listing-sold { opacity: 0.6; }

.listing-img {
  width: 64px; height: 64px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--clr-100);
}
.listing-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.listing-info { flex: 1; min-width: 0; }
.listing-title { font-weight: 700; color: var(--clr-700); font-size: 1rem; }
.listing-title:hover { text-decoration: underline; }
.listing-meta { font-size: 0.83rem; color: var(--clr-300); margin-top: 0.2rem; }
.txt-avail { color: #1a7a45; font-weight: 600; }
.txt-sold  { color: #c0392b; font-weight: 600; }

.listing-actions { flex-shrink: 0; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }

.btn-status {
  border: none;
  border-radius: 7px;
  padding: 0.38rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.btn-status:hover { opacity: 0.85; }
.btn-avail   { background: #d1f0e0; color: #1a5c35; }
.btn-pending { background: #fef3e2; color: #7a4a00; }
.btn-sold    { background: #fde8e8; color: #7b1f1f; }

.status-dot {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.7rem;
  border-radius: 99px;
  white-space: nowrap;
}
.status-dot-available { background: #d1f0e0; color: #1a5c35; }
.status-dot-pending   { background: #fef3e2; color: #7a4a00; }
.status-dot-sold      { background: #fde8e8; color: #7b1f1f; }

.listing-row.status-sold    { opacity: 0.65; }
.listing-row.status-pending { opacity: 0.85; }

.btn-delete {
  background: #fff;
  color: #c0392b;
  border: 1.5px solid #e8b4b0;
  border-radius: 7px;
  padding: 0.4rem 0.9rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.btn-delete:hover { background: #c0392b; color: #fff; border-color: #c0392b; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 3rem; color: var(--clr-300); }
.empty-state p { margin-bottom: 1rem; }

/* ── Admin messages page ──
   Fill whatever height main-content actually has left, instead of
   guessing header/flash-banner pixel heights and subtracting from 100vh. */
.messages-page { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.messages-panel {
  display: grid;
  grid-template-columns: 300px 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: 14px;
  border: 1.5px solid var(--clr-border);
  box-shadow: 0 2px 12px rgba(27,64,150,0.10);
  background: #fff;
}

/* Shared panel header (blue bar) */
.panel-header {
  background: linear-gradient(135deg, var(--clr-700), var(--clr-500));
  color: #fff;
  padding: 0.85rem 1rem;
  font-weight: 700;
  font-size: 0.97rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.panel-header-badge {
  background: rgba(255,255,255,0.25);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
}

/* People list (left panel) */
.people-panel {
  border-right: 1.5px solid var(--clr-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.people-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.people-empty { padding: 1.5rem; color: var(--clr-300); font-size: 0.88rem; text-align: center; }

.person-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid #eef4fb;
  text-decoration: none;
  color: inherit;
  transition: background 0.12s;
  position: relative;
  cursor: pointer;
}
.person-row:hover   { background: var(--clr-50); }
.person-active      { background: var(--clr-50) !important; border-left: 3px solid var(--clr-700); }
.person-unread .person-name    { font-weight: 800; color: var(--clr-900); }
.person-unread .person-preview { color: #1a2540; font-weight: 600; }

.person-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--clr-700);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.person-avatar img { width: 100%; height: 100%; object-fit: cover; }
.person-avatar-sm  { width: 36px; height: 36px; font-size: 0.88rem; }

.person-info  { flex: 1; min-width: 0; }
.person-top   { display: flex; justify-content: space-between; align-items: baseline; }
.person-name  { font-size: 0.9rem; font-weight: 600; color: #1a2540; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-time  { font-size: 0.7rem; color: var(--clr-300); flex-shrink: 0; margin-left: 4px; }
.person-item  { font-size: 0.75rem; color: var(--clr-400); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.person-preview { font-size: 0.8rem; color: var(--clr-300); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.you-label    { color: var(--clr-400); font-style: normal; }

.item-row-thumb {
  width: 44px; height: 44px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--clr-100);
}
.item-row-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.item-convs-list { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; }

.back-to-people {
  color: var(--clr-200);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  margin-right: 0.75rem;
  transition: color 0.15s;
}
.back-to-people:hover { color: #fff; }

.conv-count-badge {
  background: var(--clr-700);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  flex-shrink: 0;
}

.open-chat-arrow {
  font-size: 0.9rem;
  color: var(--clr-300);
  flex-shrink: 0;
  margin-left: 4px;
}
.person-row:hover .open-chat-arrow { color: var(--clr-700); }

.unread-dot {
  width: 9px; height: 9px;
  background: #e53935;
  border-radius: 50%;
  flex-shrink: 0;
  margin-left: auto;
}

/* Thread panel (right) */
.thread-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.thread-panel-header { gap: 1rem; }
.thread-person { display: flex; align-items: center; gap: 0.7rem; flex: 1; min-width: 0; }
.thread-person-name { font-size: 0.97rem; font-weight: 700; }
.thread-person-item { font-size: 0.75rem; color: var(--clr-200); font-weight: 400; }
.thread-person-item:hover { text-decoration: underline; }
.thread-item-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }

.thread-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  scroll-behavior: smooth;
}

.thread-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--clr-300);
  gap: 0.75rem;
}
.thread-placeholder-icon { font-size: 2.5rem; }
.thread-placeholder p { font-size: 0.92rem; }

/* Chat bubbles (shared) */
.bubble-row   { display: flex; align-items: center; gap: 0.3rem; }
.bubble-left  { justify-content: flex-start; }
.bubble-right { justify-content: flex-end; }
.bubble-right .msg-delete-form { order: -1; }

.msg-delete-form { flex-shrink: 0; }
.msg-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.3;
  font-size: 0.8rem;
  padding: 0.2rem;
  line-height: 1;
  transition: opacity 0.15s;
}
.msg-delete-btn:hover { opacity: 0.9; }

.bubble {
  max-width: 70%;
  padding: 0.55rem 0.85rem;
  border-radius: 18px;
  font-size: 0.92rem;
  line-height: 1.45;
  word-break: break-word;
}
.bubble-buyer       { background: var(--clr-700); color: #fff; border-bottom-right-radius: 4px; }
.bubble-seller      { background: var(--clr-50); color: #1a2540; border: 1px solid var(--clr-border); border-bottom-left-radius: 4px; }
.bubble-buyer-admin { background: var(--clr-50); color: #1a2540; border: 1px solid var(--clr-border); border-bottom-left-radius: 4px; }
.bubble-seller-admin{ background: var(--clr-700); color: #fff; border-bottom-right-radius: 4px; }

.bubble-time {
  display: block;
  font-size: 0.67rem;
  opacity: 0.6;
  margin-top: 3px;
  text-align: right;
}

/* Quick-reply chips beside a request message bubble */
.bubble-quick-replies {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
}
.quick-reply-chip {
  background: var(--clr-50);
  color: var(--clr-700);
  border: 1px solid var(--clr-border);
  border-radius: 99px;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.12s;
}
.quick-reply-chip:hover { background: var(--clr-100); }

.quick-reply-menu-wrap { position: relative; }
.quick-reply-menu {
  display: none;
  flex-direction: column;
  gap: 1px;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #fff;
  border-radius: 8px;
  padding: 0.3rem;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  z-index: 60;
  min-width: 160px;
  max-height: 220px;
  overflow-y: auto;
}
.quick-reply-menu.open { display: flex; }
.quick-reply-menu button {
  background: none;
  border: none;
  text-align: left;
  padding: 0.4rem 0.55rem;
  font-size: 0.8rem;
  font-family: inherit;
  color: #1a2540;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  width: 100%;
}
.quick-reply-menu button:hover { background: var(--clr-50); }

.chat-input-form {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  border-top: 1px solid var(--clr-border);
  background: #fff;
  flex-shrink: 0;
}
.chat-input-form textarea {
  flex: 1;
  border: 1.5px solid var(--clr-border);
  border-radius: 20px;
  padding: 0.5rem 1rem;
  font-size: 0.92rem;
  font-family: inherit;
  resize: none;
  overflow: hidden;
  line-height: 1.4;
  min-height: 38px;
  max-height: 120px;
  background: var(--clr-50);
  transition: border-color 0.15s;
}
.chat-input-form textarea:focus {
  outline: none;
  border-color: var(--clr-500);
  background: #fff;
}
.btn-send {
  background: var(--clr-700);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 36px; height: 36px;
  font-size: 0.95rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.btn-send:hover { background: var(--clr-500); }

/* ── Footer ── */
.site-footer {
  background: var(--clr-900);
  color: var(--clr-300);
  text-align: center;
  padding: 1.25rem 1rem;
  font-size: 0.83rem;
  line-height: 1.5;
  margin-top: 2rem;
}
.site-footer p { max-width: 640px; margin: 0 auto 0.35rem; }
.site-footer p:last-child { margin-bottom: 0; }

/* ── Theme picker (admin header) ── */
.theme-picker-wrap { position: relative; }
.theme-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  line-height: 1;
  opacity: 0.75;
  transition: opacity 0.15s, background 0.15s;
}
.theme-toggle-btn:hover { opacity: 1; background: rgba(255,255,255,0.18); }
.theme-swatches {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: #fff;
  border-radius: 14px;
  padding: 0.7rem 0.85rem;
  box-shadow: 0 6px 24px rgba(0,0,0,0.22);
  gap: 0.45rem;
  z-index: 300;
  white-space: nowrap;
  align-items: center;
}
.theme-swatches.open { display: flex; }
.swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
  flex-shrink: 0;
  padding: 0;
}
.swatch:hover { transform: scale(1.18); }
.swatch-active { border-color: #fff; box-shadow: 0 0 0 2.5px #333; transform: scale(1.12); }

/* ── Logo style + size picker (admin) ── */
.logo-style-picker-wrap { position: relative; }
.logo-style-options {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: #fff;
  border-radius: 14px;
  padding: 0.5rem;
  box-shadow: 0 6px 24px rgba(0,0,0,0.22);
  z-index: 300;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 120px;
}
.logo-style-options.open { display: flex; }
.logo-picker-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #a0aec0;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 0.1rem 0.5rem 0.1rem;
}
.logo-picker-divider {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 0.25rem 0;
}
.logo-opt {
  background: none;
  border: 1.5px solid transparent;
  border-radius: 8px;
  padding: 0.32rem 0.75rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: #2d3748;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
  font-family: inherit;
  white-space: nowrap;
}
.logo-opt:hover { background: #f0f4ff; }
.logo-opt-active { border-color: var(--clr-500); color: var(--clr-700); background: var(--clr-50); }
.logo-size-btns {
  display: flex;
  gap: 0.25rem;
  padding: 0.1rem 0.25rem;
}
.logo-size-btn {
  flex: 1;
  background: none;
  border: 1.5px solid #e2e8f0;
  border-radius: 7px;
  padding: 0.3rem 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: #4a5568;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s;
  text-align: center;
}
.logo-size-btn:hover { background: #f0f4ff; border-color: var(--clr-300); }
.logo-size-btn-active { border-color: var(--clr-500); color: var(--clr-700); background: var(--clr-50); }

/* ── Logo sizes ── */
.logo-size-sm { font-size: 1.15rem; }
.logo-size-md { font-size: 1.75rem; }
.logo-size-lg { font-size: 2.3rem; }
.logo-size-xl { font-size: 3rem; }

/* ── Image gallery ── */
.gallery { display: flex; flex-direction: column; gap: 0.6rem; min-width: 0; }
.gallery-main { width: 100%; border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); display: block; object-fit: contain; }
.gallery-thumbs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.gallery-thumb {
  width: 72px; height: 72px;
  border-radius: 8px;
  object-fit: cover;
  cursor: pointer;
  border: 2.5px solid transparent;
  transition: border-color 0.15s, opacity 0.15s;
  opacity: 0.7;
}
.gallery-thumb:hover  { opacity: 1; }
.thumb-active { border-color: var(--clr-700); opacity: 1; }

/* ── Videos on item detail ── */
.detail-videos { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 0.5rem; }
.detail-video {
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  background: #000;
  max-height: 400px;
}

/* ── Edit listing media management ── */
.media-thumb-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.3rem;
}
.media-thumb-item {
  position: relative;
  width: 88px; height: 88px;
  flex-shrink: 0;
}
.media-thumb-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 8px;
  border: 1.5px solid var(--clr-border);
}
.media-cover-badge {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  background: #b8860b;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

.media-menu-wrap { position: absolute; top: -6px; right: -6px; }
.media-menu-btn {
  background: #fff;
  color: #333;
  border: none;
  border-radius: 50%;
  width: 24px; height: 24px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  transition: background 0.12s;
}
.media-menu-btn:hover { background: #f0f0f0; }

.media-menu {
  display: none;
  flex-direction: column;
  gap: 1px;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #fff;
  border-radius: 10px;
  padding: 0.35rem;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  z-index: 50;
  min-width: 150px;
}
.media-menu.open { display: flex; }
.media-menu form { display: contents; }
.media-menu button {
  background: none;
  border: none;
  text-align: left;
  padding: 0.45rem 0.6rem;
  font-size: 0.82rem;
  font-family: inherit;
  color: #1a2540;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  width: 100%;
}
.media-menu button:hover { background: var(--clr-50); }
.media-menu-danger { color: #c0392b !important; }
.media-menu-danger:hover { background: #fde8e8 !important; }

.media-video-list { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 0.3rem; }
.media-video-item { display: flex; flex-direction: column; gap: 0.3rem; }
.edit-video-preview {
  width: 100%;
  max-height: 240px;
  border-radius: 8px;
  background: #000;
  border: 1.5px solid var(--clr-border);
}

/* ── Edit button on listings row ── */
.btn-edit {
  display: inline-block;
  background: var(--clr-50);
  color: var(--clr-700);
  border: 1.5px solid var(--clr-border);
  border-radius: 7px;
  padding: 0.38rem 0.8rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-edit:hover { background: var(--clr-700); color: #fff; border-color: var(--clr-700); }

/* ── Gallery arrows ── */
.gallery-main-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
}
.gallery-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.45);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px; height: 40px;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  z-index: 10;
  padding: 0;
}
.gallery-arrow:hover { background: rgba(0,0,0,0.7); }
.gallery-arrow-left  { left: 10px; }
.gallery-arrow-right { right: 10px; }

/* ── Search bar ── */
.search-form { margin-bottom: 0.6rem; }
.search-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.search-input {
  flex: 1;
  border: 1.5px solid var(--clr-border);
  border-radius: 10px;
  padding: 0.6rem 1rem;
  font-size: 0.97rem;
  font-family: inherit;
  background: #fff;
  color: #1a2540;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus {
  outline: none;
  border-color: var(--clr-500);
  box-shadow: 0 0 0 3px rgba(46,109,180,0.13);
}
.search-btn {
  background: var(--clr-700);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.6rem 1rem;
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
  line-height: 1;
}
.search-btn:hover { background: var(--clr-500); }
.search-back-btn {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--clr-500);
  margin-bottom: 0.85rem;
  transition: color 0.15s;
}
.search-back-btn:hover { color: var(--clr-700); text-decoration: underline; }
.search-result-label {
  font-size: 0.88rem;
  color: var(--clr-300);
  margin-bottom: 0.75rem;
}
.search-result-label strong { color: #1a2540; }

/* ══════════════════════════════════════════════
   MOBILE / APP LAYOUT
   ══════════════════════════════════════════════ */

:root {
  --bottom-nav-h: 62px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── Bottom navigation bar ── */
.bottom-nav {
  display: none;
}

/* ── Tablet tweaks (600–900px) ── */
@media (max-width: 900px) {
  .item-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
  .messages-panel {
    grid-template-columns: 260px 1fr;
  }
}

/* ── Mobile (≤ 680px) — full app mode ── */
@media (max-width: 680px) {

  /* Show bottom nav */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--clr-900);
    border-top: 1px solid rgba(255,255,255,0.12);
    z-index: 500;
    padding-bottom: var(--safe-bottom);
  }

  /* Pad content above bottom nav */
  .main-content {
    padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 1rem);
  }
  .main-content:has(.messages-page) {
    padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom));
  }
  .main-content:has(.messages-page) + .site-footer {
    display: none;
  }

  /* Keep footer text clear of the fixed bottom nav */
  .site-footer {
    padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 1rem);
  }

  /* Shrink header — hide nav links (moved to bottom nav) */
  .header-nav > a,
  .theme-picker-wrap,
  .logo-style-picker-wrap {
    display: none;
  }
  /* Cap large logo sizes so they don't crowd the compact mobile header */
  .logo-size-lg, .logo-size-xl { font-size: 1.75rem; }
  .header-nav .nav-profile {
    display: flex;
  }
  .nav-username { display: none; }
  .nav-logout { font-size: 0.78rem; }
  /* Show login/signup buttons for guests */
  .header-nav .nav-auth-link,
  .header-nav .btn-nav-signup {
    display: inline-block;
  }

  /* Item grid — 2 columns */
  .item-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
  }
  .item-img-wrap   { height: 130px; }
  .item-info       { padding: 0.65rem 0.7rem; gap: 0.15rem; }
  .item-title      { font-size: 0.88rem; }
  .item-price      { font-size: 1rem; }
  .item-desc       { display: none; }
  .item-footer     { display: none; }
  .item-category   { font-size: 0.68rem; }

  /* Hero */
  .page-hero { padding: 1.25rem 1.25rem; margin-bottom: 1rem; }
  .page-hero h1 { font-size: 1.4rem; padding-right: 4rem; }
  .page-hero p  { font-size: 0.88rem; }

  /* Item detail — stack vertically */
  .item-detail-layout { grid-template-columns: 1fr; }
  .item-chat-panel { position: static; max-height: none; }
  .item-chat-thread { max-height: 320px; }
  .detail-img { max-height: 32vh; }
  .gallery-thumbs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .gallery-thumb {
    width: 56px; height: 56px;
    flex-shrink: 0;
  }
  .detail-title { font-size: 1.25rem; }

  /* Messages — single-panel app mode */
  .messages-panel {
    grid-template-columns: 1fr;
    border-radius: 8px;
  }
  .messages-panel:not(.has-active-conv) .thread-panel { display: none; }
  .messages-panel.has-active-conv .people-panel       { display: none; }
  .messages-panel.has-active-conv .thread-panel       {
    display: flex;
    height: 100%;
  }

  /* Auth pages */
  .auth-card { border-radius: 12px; padding: 1.5rem 1.25rem; }

  /* Admin listings */
  .listing-row { flex-wrap: wrap; gap: 0.6rem; }
  .listing-actions { width: 100%; justify-content: flex-start; }
  .admin-heading-actions { width: 100%; }
  .admin-heading-actions a { flex: 1 1 auto; text-align: center; }

  /* Search bar */
  .search-input { font-size: 0.93rem; }

  /* Main padding */
  .main-content { padding: 1rem 1rem calc(var(--bottom-nav-h) + var(--safe-bottom) + 1rem); }
}

/* ── Very small phones (≤ 380px) ── */
@media (max-width: 380px) {
  .item-grid { grid-template-columns: 1fr; }
  .header-inner { padding: 0 0.75rem; }
  .item-img-wrap { height: 160px; }
  .item-info { padding: 0.75rem; }
  .item-desc { display: block; }
  .item-footer { display: flex; }
}

/* ── Bottom nav item styles ── */
.bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.2rem;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  gap: 0.18rem;
  position: relative;
  transition: color 0.15s;
  min-height: var(--bottom-nav-h);
}
.bnav-item:hover { color: rgba(255,255,255,0.85); }
.bnav-active     { color: #fff !important; }
.bnav-active .bnav-icon { color: var(--clr-200); }

.bnav-icon  { font-size: 1.25rem; line-height: 1; display: block; }
.bnav-label { font-size: 0.6rem; font-weight: 600; letter-spacing: 0.3px; text-transform: uppercase; }

.bnav-badge {
  position: absolute;
  top: 7px;
  right: calc(50% - 18px);
  background: #e53935;
  color: #fff;
  font-size: 0.58rem;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 99px;
  min-width: 15px;
  text-align: center;
  pointer-events: none;
}

.bnav-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255,255,255,0.35);
  display: block;
}
.bnav-initials {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--clr-500);
  color: #fff;
  font-weight: 800;
  font-size: 0.78rem;
  display: flex; align-items: center; justify-content: center;
}

/* Mobile back button in thread header */
.desktop-only { display: inline; }
@media (max-width: 680px) { .desktop-only { display: none; } }

.mobile-back-btn {
  display: none;
  color: var(--clr-200);
  font-size: 1.8rem;
  line-height: 1;
  font-weight: 300;
  margin-right: 0.25rem;
  padding: 0 0.25rem;
  transition: color 0.15s;
}
.mobile-back-btn:hover { color: #fff; }
@media (max-width: 680px) {
  .mobile-back-btn { display: block; }
}

/* ── Invoices ── */
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 500px) { .form-row-3 { grid-template-columns: 1fr; } }

.invoice-items-table {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.invoice-item-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.invoice-item-title-input,
.invoice-item-price-input {
  border: 1.5px solid var(--clr-border);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  color: #1a2540;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.invoice-item-title-input:focus,
.invoice-item-price-input:focus {
  outline: none;
  border-color: var(--clr-500);
  box-shadow: 0 0 0 3px rgba(46,109,180,0.15);
}
.invoice-item-title-input { flex: 1; min-width: 0; }
.invoice-item-price-input { width: 110px; flex-shrink: 0; }
.invoice-item-row .btn-delete { flex-shrink: 0; }

.btn-confirm-invoice { background: #1a5c2e; }
.btn-confirm-invoice:hover { background: #144a24; }
