:root {
  /* Light theme (default) */
  --bg: #f4f5f7;
  --bg-grad: linear-gradient(180deg, #f8f9fb 0%, #eef0f4 100%);
  --surface: #ffffff;
  --surface-hover: #f4f5f7;
  --surface-solid: #ffffff;
  --glass: rgba(255, 255, 255, 0.85);
  --glass-border: #e5e7eb;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;

  --accent: #6d28d9;
  --accent-2: #ec4899;
  --accent-grad: linear-gradient(135deg, #6d28d9 0%, #ec4899 100%);
  --accent-soft: rgba(109, 40, 217, 0.08);

  --ok: #16a34a;
  --ok-soft: rgba(22, 163, 74, 0.1);
  --warn: #ea580c;
  --warn-soft: rgba(234, 88, 12, 0.1);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.08);

  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;

  --max: 440px;
  --blur: blur(20px);
  --shadow: 0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
  --shadow-lg: 0 8px 24px rgba(15,23,42,.12);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Dark theme override */
:root[data-theme=dark] {
  --bg: #0d0e12;
  --bg-grad: linear-gradient(180deg, #11131a 0%, #0d0e12 42%, #0a0b0e 100%);
  --surface: #15171d;
  --surface-hover: #1b1e26;
  --surface-solid: #15171d;
  --surface-2: #1c1f27;
  --glass: #15171d;
  --glass-border: rgba(255, 255, 255, 0.09);
  --text: #f5f5f7;
  --text-2: #a0a0b8;
  --text-3: #6b6b80;

  --accent: #8b6cff;
  --accent-2: #e66a9b;
  --accent-grad: linear-gradient(135deg, #8066ee 0%, #d95d91 100%);
  --accent-soft: rgba(139, 108, 255, 0.12);

  --ok: #00d97e;
  --ok-soft: rgba(0, 217, 126, 0.12);
  --warn: #ffb800;
  --warn-soft: rgba(255, 184, 0, 0.12);
  --danger: #ff4757;
  --danger-soft: rgba(255, 71, 87, 0.12);

  --shadow: 0 1px 3px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Override: glass surfaces solid white in light theme for readability */
:root:not([data-theme=dark]) .glass {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}
:root:not([data-theme=dark]) .filters-sidebar,
:root:not([data-theme=dark]) .topbar,
:root:not([data-theme=dark]) .subnav,
:root:not([data-theme=dark]) .card,
:root:not([data-theme=dark]) .diet-profile {
  box-shadow: var(--shadow);
}
:root:not([data-theme=dark]) .filter-input,
:root:not([data-theme=dark]) .filter-select,
:root:not([data-theme=dark]) .form-page textarea,
:root:not([data-theme=dark]) .form-page input[type=text] {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #0f172a;
}

/* ===== Adaptive layout ===== */
.content {
  padding: 16px 16px calc(80px + var(--safe-bottom));
  max-width: 1280px;
  margin: 0 auto;
}
.dom-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 720px) {
  .dom-layout { grid-template-columns: 260px minmax(0, 1fr); align-items: start; }
  .cards { grid-template-columns: 1fr; }
}
@media (min-width: 1000px) {
  .dom-layout { grid-template-columns: 300px minmax(0, 1fr); gap: 28px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1280px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1550px) {
  .content { max-width: 1440px; }
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.results-column { min-width: 0; }
.catalog-toolbar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
  min-height: 48px; padding: 0 4px 12px; border-bottom: 1px solid var(--glass-border);
}
.catalog-count { margin-right: auto; color: var(--text-3); font-size: 12px; letter-spacing: .2px; }
.catalog-count strong { color: var(--text); font-size: 15px; }
.catalog-save { border: 0 !important; background: transparent !important; color: var(--text-2) !important; }
.catalog-save:hover { color: var(--accent) !important; }
@media (max-width: 719px) {
  .catalog-toolbar { position: sticky; top: calc(54px + var(--safe-top)); z-index: 20; margin: 0 -10px 12px; padding: 8px 10px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(14px); }
  .catalog-save { display: none; }
}

/* ===== Filters sidebar ===== */
.filters-sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface-solid);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  box-shadow: none;
  overflow: hidden;
}
.filters-head { display: none; }
.filters-scroll { padding: 16px; min-height: 0; }
.filter-disclosure { border-bottom: 1px solid var(--glass-border); padding: 0 0 10px; margin-bottom: 10px; }
.filter-disclosure summary { cursor: pointer; list-style: none; color: var(--text); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; }
.filter-disclosure summary::-webkit-details-marker { display: none; }
.filter-disclosure summary::after { content: "+"; float: right; color: var(--text-3); font-size: 15px; line-height: 11px; }
.filter-disclosure[open] summary::after { content: "−"; }
.filter-disclosure .filter-chips { margin-top: 10px; }
.filters-closebtn, .filters-donebtn, .filters-toggle, .filters-backdrop { display: none; }
@media (min-width: 720px) {
  .filters-sidebar {
    position: sticky;
    top: calc(56px + var(--safe-top) + 14px);
    height: calc(100vh - 84px - var(--safe-top));
  }
  .filters-scroll { flex: 1; min-height: 0; padding-bottom: 22px; overflow-y: auto; scrollbar-width: none; }
  .filter-actions { flex-shrink: 0; box-shadow: 0 -8px 18px rgba(0,0,0,.14); }
  .filters-scroll::-webkit-scrollbar { width: 5px; }
  .filters-scroll::-webkit-scrollbar-track { background: transparent; }
  .filters-scroll::-webkit-scrollbar-thumb {
    background: rgba(139,108,255,.45);
    border-radius: 999px; border: 1px solid transparent; background-clip: padding-box;
  }
  .filters-scroll::-webkit-scrollbar-thumb:hover { background: rgba(139,108,255,.7); }
}
@media (max-width: 719px) {
  .dom-layout { gap: 12px; }
  .filters-backdrop { position: fixed; inset: 0; z-index: 200; background: rgba(5, 5, 12, .55); backdrop-filter: blur(3px); }
  body.filters-open .filters-backdrop { display: block; }
  .filters-sidebar {
    position: fixed; z-index: 201; top: 0; right: 0; bottom: 0;
    width: min(390px, calc(100vw - 20px)); height: auto; border-radius: 20px 0 0 20px;
    transform: translateX(105%); transition: transform .25s ease;
  }
  .filters-sidebar.open { transform: translateX(0); }
  .filters-head { display: block; position: absolute; inset: 0 0 auto; z-index: 2; padding: 18px 58px 16px 16px; background: var(--surface-solid); border-bottom: 1px solid var(--glass-border); }
  .filters-title { font-size: 15px; font-weight: 850; letter-spacing: -.2px; }
  .filters-scroll { flex: 1; height: auto; max-height: none; padding: 72px 16px 88px; }
  .filters-closebtn {
    display: grid; place-items: center; position: absolute; top: 12px; right: 12px; z-index: 2;
    width: 36px; height: 36px; border: 1px solid var(--glass-border); border-radius: 50%;
    background: var(--surface-solid); color: var(--text); font-size: 16px; cursor: pointer;
  }
  .filters-donebtn {
    display: flex; position: absolute; z-index: 2; left: 16px; right: 16px; bottom: calc(12px + var(--safe-bottom));
    width: calc(100% - 32px); min-height: 48px; border: 0; color: #fff;
    background: var(--accent); box-shadow: none;
  }
  .filter-actions { display: none; }
  .filters-toggle {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    width: 100%; min-height: 46px; margin-bottom: 2px; padding: 10px 16px;
    border: 1px solid var(--glass-border); border-radius: 10px;
    background: var(--surface-solid); color: var(--text);
    font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
  }
  body.filters-open { overflow: hidden; }
}
.filter-group {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--glass-border);
}
.filter-group:last-of-type { border-bottom: none; }
.filter-section-label {
  display: block;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-3);
  margin-bottom: 6px;
}
.filters-sidebar input, .filters-sidebar select { font-family: inherit; }
.filters-sidebar input:focus, .filters-sidebar select:focus { box-shadow: 0 0 0 3px var(--accent-soft); }
.filters-sidebar .filter-chips { gap: 5px; }
.filters-sidebar .chip { padding: 6px 10px; font-size: 12px; background: transparent; }
.filters-sidebar .chip.active { box-shadow: none; }
.filters-sidebar .filter-section-label { color: var(--text-3); }
.filter-select,
.filter-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .15s, background .15s;
  margin-bottom: 6px;
}
.filter-select:focus, .filter-input:focus { border-color: var(--accent); }
.filter-select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

.subtype-checks { display: flex; flex-direction: column; gap: 4px; }
.subtype-check {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--text); cursor: pointer;
  padding: 4px 0;
}
.subtype-check input { width: 20px; height: 20px; accent-color: var(--accent); }

.price-group, .area-group, .storey-group {
  display: flex; align-items: center; gap: 4px;
}
.price-group input, .area-group input, .storey-group input {
  flex: 1; min-width: 0; padding: 10px 8px; border-radius: 8px;
  border: 1px solid var(--glass-border); background: var(--bg);
  color: var(--text); font-size: 14px; outline: none;
}
.dash { color: var(--text-3); flex: 0 0 auto; }
.cur { color: var(--text-3); font-weight: 600; flex: 0 0 auto; }

.rooms-group { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ===== Offer tabs (rent / sale, page level) ===== */
.offer-tabs {
  display: flex; gap: 4px; margin-bottom: 12px;
  background: var(--surface-2); border: 1px solid var(--glass-border); border-radius: 10px; padding: 3px;
}
.offer-tab {
  flex: 1; padding: 8px 10px; border-radius: 999px;
  text-align: center; text-decoration: none;
  color: var(--text-2); font-size: 13px; font-weight: 700;
  transition: color .2s ease, background .2s ease, box-shadow .2s ease, transform .2s ease;
}
.offer-tab:hover { color: var(--text); background: var(--surface-hover); }
.offer-tab.active {
  background: var(--accent); color: #fff;
  box-shadow: none;
}

/* ===== Segment tabs ===== */
.segment-tabs {
  display: flex; gap: 4px; margin-bottom: 14px;
  background: var(--surface-2); border: 1px solid var(--glass-border); border-radius: 10px; padding: 3px;
}
.seg-tab {
  flex: 1; padding: 8px 6px; border: none; border-radius: 8px;
  background: transparent; color: var(--text-3); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.seg-tab:hover { color: var(--text); }
.seg-tab.active {
  background: var(--accent); color: #fff;
  box-shadow: none;
}

/* ===== Chip ===== */
.chip {
  padding: 7px 13px; border-radius: 999px; border: 1px solid var(--glass-border);
  background: var(--surface-solid, #fff); color: var(--text-2); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: color .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease; user-select: none;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active {
  background: var(--accent); color: #fff; border-color: transparent;
  box-shadow: none;
}

.seg-only { display: none; }
.seg-only.show { display: block; }

/* ===== Smart input ===== */
.smart-input { margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--glass-border); }
.smart-input summary {
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent);
  padding: 8px 12px; border-radius: var(--radius-xs);
  background: var(--accent-soft); border: 1px solid rgba(139,108,255,.2);
}
.smart-input summary:hover { background: rgba(139,108,255,.2); }
.smart-input-body { display: flex; gap: 6px; margin-top: 8px; }
.smart-input-body input { flex: 1; padding: 10px; font-size: 13px; }

/* ===== Filter actions ===== */
.filter-actions {
  position: relative; z-index: 3;
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: center;
  padding: 12px 16px 14px; border-top: 1px solid var(--glass-border);
  background: var(--surface-solid);
}
.filter-actions .btn { min-height: 40px; padding: 9px 12px; white-space: nowrap; }
.filter-actions .btn.primary { min-width: 0; box-shadow: none; }
.filter-search-arrow { font-size: 18px; line-height: .6; }

.result-count { font-size: 14px; color: var(--text-2); font-weight: 600; margin-bottom: 12px; }

/* Active filter bar */
.active-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 12px; padding: 8px 12px;
  background: var(--accent-soft);
  border: 1px solid rgba(139,108,255,.15);
  border-radius: var(--radius-sm);
}
.chips-wrap { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.active-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 8px 4px 12px;
  background: var(--surface-solid, #fff);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  font-size: 12px; font-weight: 600; color: var(--text);
}
.active-chip .chip-x {
  border: none; background: none; cursor: pointer;
  color: var(--text-3); font-size: 14px; padding: 0 2px;
  line-height: 1;
}
.active-chip .chip-x:hover { color: var(--danger); }
.sort-inline {
  padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: var(--surface-solid, #fff);
  color: var(--text); font-size: 13px; font-weight: 600;
  cursor: pointer; outline: none;
}

/* ===== Sub-navigation ===== */
.topbar {
  display: flex;
  align-items: center;
  height: calc(56px + var(--safe-top));
  padding: var(--safe-top) 20px 0;
  background: var(--surface-solid);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.brand {
  font-weight: 800;
  font-size: 22px;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
  letter-spacing: -0.8px;
}
.tabs {
  display: flex;
  gap: 2px;
  margin-left: auto;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 3px;
}
.tabs a {
  color: var(--text-3);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
}
.tabs a.active {
  color: #fff;
  background: var(--accent);
  box-shadow: none;
}

/* Language switcher */
.lang-switch {
  display: flex;
  gap: 2px;
  margin-left: 8px;
  background: rgba(0,0,0,0.3);
  border-radius: 9px;
  padding: 3px;
}
.lang-btn {
  padding: 5px 9px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 1px 8px rgba(124, 92, 252, 0.4);
}

.theme-btn {
  width: 36px; height: 36px;
  border: 1px solid var(--glass-border);
  background: rgba(0,0,0,.3);
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  margin-left: 8px;
  transition: all .15s;
}
:root:not([data-theme=dark]) .theme-btn {
  background: #ffffff;
  border-color: #e5e7eb;
  box-shadow: var(--shadow);
}
.theme-btn:hover { background: rgba(255,255,255,.1); }

/* ===== Toast ===== */
#toast-container {
  position: fixed;
  top: calc(56px + var(--safe-top) + 12px);
  left: 50%; transform: translateX(-50%);
  z-index: 1000;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--surface-solid, #fff);
  border: 1px solid var(--glass-border);
  color: var(--text);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  pointer-events: auto;
  min-width: 240px;
  max-width: 360px;
  text-align: center;
  animation: toast-in .25s ease;
}
.toast.ok { border-color: var(--ok); color: var(--ok); }
.toast.err { border-color: var(--danger); color: var(--danger); }
.toast.info { border-color: var(--accent); }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ===== Modal ===== */
#modal-root:empty { display: none; }
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fade-in .15s ease;
}
.modal {
  background: var(--surface-solid, #fff);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 360px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modal-in .2s ease;
}
.modal h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.modal p { color: var(--text-2); margin-bottom: 20px; line-height: 1.5; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: scale(.95); }
  to { opacity: 1; transform: scale(1); }
}

/* ===== Listing detail ===== */
.listing-detail { max-width: 600px; margin: 0 auto; }

/* Listing detail overlay: feed stays in the DOM, scroll is preserved. */
#detail-overlay { position: fixed; inset: 0; z-index: 900; background: var(--bg); display: none; }
#detail-overlay.open { display: block; }
#detail-overlay-body {
  height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 58px 12px 28px; max-width: 760px; margin: 0 auto;
}
@media (min-width: 1000px) {
  #detail-overlay-body { max-width: 960px; padding: 58px 24px 28px; }
}
@media (min-width: 1280px) {
  #detail-overlay-body { max-width: 1120px; }
}
#detail-close {
  position: fixed; top: 12px; right: 12px; z-index: 910;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--glass-border); background: var(--surface-solid, #fff);
  font-size: 16px; cursor: pointer; box-shadow: var(--shadow-lg);
}
#detail-catalog {
  position: fixed; top: 12px; left: 12px; z-index: 910;
  height: 40px; padding: 0 14px; border-radius: 20px;
  border: 1px solid var(--glass-border); background: var(--surface-solid, #fff);
  font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; box-shadow: var(--shadow-lg);
}
.detail-loading { text-align: center; padding: 40px 0; color: var(--text); opacity: .6; }
body.detail-overlay-open { overflow: hidden; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent); text-decoration: none; font-size: 14px; font-weight: 600;
  margin-bottom: 16px;
}
.back-link:hover { opacity: .8; }
.detail-card {
  background: var(--surface-solid, #fff);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.detail-cover { width: 100%; height: 320px; object-fit: cover; background: var(--surface-2, #f1f3f6); display: block; }

/* Photo gallery */
.detail-gallery { width: 100%; }
/* Fixed aspect ratio: the stage never resizes with the bitmap, so thumbs and
   text below cannot jump regardless of photo orientation. */
.gallery-stage { position: relative; width: 100%; aspect-ratio: 4 / 3; }
.gallery-stage .detail-cover { position: absolute; inset: 0; width: 100%; height: 100%; }
.gallery-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%;
  border: none; background: rgba(0,0,0,0.45); color: #fff;
  font-size: 24px; cursor: pointer; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  line-height: 1; padding: 0;
  transition: background .15s;
}
.gallery-nav:hover { background: rgba(0,0,0,0.7); }
.gallery-prev { left: 8px; }
.gallery-next { right: 8px; }
.gallery-counter {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(0,0,0,0.5); color: #fff;
  font-size: 12px; padding: 2px 8px; border-radius: 10px;
  pointer-events: none;
}
.gallery-thumbs {
  display: flex; gap: 6px; overflow-x: auto; padding: 8px 0;
  scrollbar-width: thin;
}
.gallery-thumb {
  width: 64px; height: 64px; border-radius: 8px; object-fit: cover;
  cursor: pointer; border: 2px solid transparent; flex-shrink: 0;
  transition: border-color .15s;
}
@media (min-width: 720px) {
  .gallery-thumb { width: 80px; height: 80px; }
}
.gallery-thumb:hover { border-color: var(--accent); }
.gallery-thumb.active { border-color: var(--accent); }
.detail-body { padding: 24px; }
.detail-price { font-size: 32px; font-weight: 800; letter-spacing: -1px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.detail-price-m2 { font-size: 14px; color: var(--text-3); font-weight: 500; }
.detail-title-line { color: var(--text-2); font-size: 15px; margin: 12px 0 20px; line-height: 1.5; }
.detail-section { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--glass-border); }
.detail-section:last-child { border-bottom: none; }
.detail-map-section { padding-bottom: 20px; }
.detail-map {
  display: block; width: 100%; height: 280px; border: 0;
  border-radius: var(--radius-sm); background: var(--surface-2, #f1f3f6);
}
.detail-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-3); margin-bottom: 10px;
}
.detail-amenities { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-amenities .amen {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
}
.detail-specs { width: 100%; border-collapse: collapse; }
.detail-specs th, .detail-specs td { text-align: left; padding: 8px 0; font-size: 14px; }
.detail-specs th { color: var(--text-3); font-weight: 500; width: 40%; vertical-align: top; }
.detail-specs td { color: var(--text); font-weight: 500; }
.detail-specs tr { border-bottom: 1px solid var(--glass-border); }
.detail-specs tr:last-child { border-bottom: none; }
.detail-publisher { font-size: 15px; color: var(--text); font-weight: 500; }
.detail-desc { color: var(--text); line-height: 1.65; white-space: pre-wrap; font-size: 15px; }
.detail-contact { width: 100%; margin-top: 16px; }
.detail-source { margin-top: 10px; }

/* Desktop: vertical stack — wide photo on top (fixed aspect), full-width
   text below. Nothing jumps: stage height is set by aspect-ratio only. */
@media (min-width: 720px) {
  .listing-detail { max-width: 800px; margin: 0 auto; }
  .gallery-stage { aspect-ratio: 16 / 10; }
  .detail-body { padding: 32px 40px; }
}
@media (min-width: 1000px) {
  .listing-detail { max-width: 1000px; }
  .gallery-stage { aspect-ratio: 2 / 1; }
  .detail-body { padding: 32px 48px; }
}

/* ===== Adaptive layout ===== */

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
}
.btn:active { transform: scale(0.96); }
.btn.primary {
  background: var(--accent);
  border: none;
  color: #fff;
  box-shadow: none;
}
.btn.primary:active { box-shadow: none; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn.small { padding: 9px 16px; font-size: 13px; border-radius: var(--radius-xs); }
.btn.danger {
  border-color: rgba(255, 71, 87, 0.3);
  color: var(--danger);
  background: var(--danger-soft);
}
.btn.big {
  padding: 18px 40px;
  font-size: 17px;
  border-radius: var(--radius);
  width: 100%;
}
.btn[disabled] { opacity: 0.35; pointer-events: none; }

/* ===== Admin dashboard ===== */
.admin {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px 0 48px;
}
.admin-header {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 26px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  background: linear-gradient(120deg, var(--surface-solid) 0%, var(--surface-solid) 68%, var(--accent-soft) 100%);
  box-shadow: var(--shadow);
}
.admin-header::after {
  position: absolute;
  top: -76px;
  right: -30px;
  width: 210px;
  height: 210px;
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  content: "";
  opacity: .65;
}
.admin-header > * { position: relative; z-index: 1; }
.admin-header h1 { margin: 0; font-size: clamp(28px, 4vw, 38px); line-height: 1; letter-spacing: -1.4px; }
.admin-subtitle, .admin-updated, .admin-panel p, .admin-status { margin: 7px 0 0; color: var(--text-2); font-size: 14px; }
.admin-subtitle { max-width: 580px; }
.admin-updated { color: var(--text-3); font-size: 12px; }
.admin-header .btn { min-height: 42px; border-color: var(--glass-border); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.admin-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px; border: 1px solid var(--glass-border); border-radius: 12px; background: var(--surface-hover); scrollbar-width: none; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tab { flex: 0 0 auto; min-height: 38px; padding: 8px 14px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 750; cursor: pointer; }
.admin-tab:hover { color: var(--text); }
.admin-tab.active { border-color: var(--glass-border); background: var(--surface-solid); color: var(--text); box-shadow: 0 1px 2px rgba(15, 23, 42, .12); }
.admin-section { min-width: 0; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.admin-kpi, .admin-panel {
  background: var(--surface-solid);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.admin-kpi {
  position: relative;
  min-height: 124px;
  padding: 18px;
  overflow: hidden;
}
.admin-kpi::before {
  position: absolute;
  top: 0;
  left: 18px;
  width: 32px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--accent);
  content: "";
}
.admin-kpi-value { display: block; margin-top: 13px; font-size: 28px; font-weight: 800; line-height: 1; letter-spacing: -1.2px; color: var(--text); }
.admin-kpi-label { display: block; margin-top: 10px; color: var(--text-2); font-size: 10px; font-weight: 800; letter-spacing: .75px; text-transform: uppercase; }
.admin-kpi-note { display: block; margin-top: 7px; color: var(--text-3); font-size: 12px; font-weight: 700; }
.admin-panels { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
.admin-panel { padding: 20px; min-width: 0; }
.categories-page { display: flex; flex-direction: column; gap: 22px; padding: 26px 0 56px; }
.categories-hero { padding: 8px 0 2px; }
.categories-eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.categories-hero h1 { margin: 0; font-size: clamp(30px, 4vw, 44px); letter-spacing: -1.5px; }
.categories-subtitle { margin: 10px 0 0; color: var(--text-2); font-size: 15px; }
.category-index { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: 34px; row-gap: 0; }
.category-index-item { display: grid; grid-template-columns: 72px minmax(0, 1fr) 10px; align-items: center; gap: 16px; min-width: 0; min-height: 124px; padding: 24px 0; border-bottom: 1px solid var(--glass-border); background: transparent; color: var(--text); text-decoration: none; transition: color .15s ease, transform .15s ease; }
.category-index-item:hover { color: var(--accent); transform: translateX(3px); }
.category-index-item:focus-visible { border-radius: 10px; outline: 3px solid var(--accent); outline-offset: 4px; }
.category-index-art { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 20px; background: var(--category-art-bg, var(--accent-soft)); color: var(--category-art-color, var(--accent)); overflow: hidden; transition: background-color .15s ease, color .15s ease; }
.category-index-art img { display: block; width: 68px; height: 68px; object-fit: contain; filter: var(--category-art-filter, none); }
[data-theme="dark"] .category-index-art { --category-art-bg: rgba(139, 108, 255, .18); --category-art-color: #c4b5fd; --category-art-filter: brightness(1.12) saturate(.9); }
[data-theme="dark"] .category-index-item:hover .category-index-art { --category-art-bg: rgba(139, 108, 255, .28); }
.category-index-label { min-width: 0; color: inherit; font-size: 16px; font-weight: 750; line-height: 1.25; }
[data-theme="dark"] .categories-subtitle { color: #b8b8ca; }
[data-theme="dark"] .category-index-item { border-bottom-color: rgba(255, 255, 255, .14); }
.category-index-arrow { width: 7px; height: 7px; border-top: 2px solid currentColor; border-right: 2px solid currentColor; transform: rotate(45deg); opacity: .38; }
@media (max-width: 1199px) { .category-index { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 28px; } }
@media (max-width: 899px) { .category-index { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; } }
@media (max-width: 719px) { .categories-page { gap: 16px; padding-top: 18px; } .category-index { grid-template-columns: 1fr; } .category-index-item { min-height: 96px; padding: 16px 0; } .category-index-art { width: 60px; height: 60px; border-radius: 17px; } .category-index-art img { width: 58px; height: 58px; } }
.admin-analytics-section { display: block; }
.admin-feature { display: flex; flex-wrap: wrap; flex-direction: column; gap: 8px; margin-top: 14px; padding: 12px; border: 1px solid var(--glass-border); border-radius: 12px; }
.admin-feature strong { font-size: 14px; }
.admin-feature select, .admin-feature input { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--glass-border); background: var(--bg-inset, transparent); color: var(--text-1); font-size: 13px; }
.admin-feature .btn { align-self: flex-start; }
.admin-analytics-panels { margin-top: 16px; }
.admin-analytics-panels > .admin-panel { min-width: 0; }
.admin-analytics-grid { margin-top: 14px; }
.admin-panel-head { padding-bottom: 16px; border-bottom: 1px solid var(--glass-border); }
.admin-panel-head h2 { margin: 0; font-size: 18px; line-height: 1.2; letter-spacing: -.35px; }
.admin-panel-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.admin-panel-actions .btn { width: 100%; min-height: 44px; }
.admin-details summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; color: var(--text); font-size: 14px; font-weight: 750; list-style: none; }
.admin-details summary::-webkit-details-marker { display: none; }
.admin-details summary::after { color: var(--text-3); content: "+"; font-size: 20px; font-weight: 400; line-height: 1; }
.admin-details[open] summary::after { content: "−"; }
.admin-panel.admin-details { padding: 18px 20px; }
.admin-report, .admin-list { display: grid; gap: 0; margin-top: 14px; }
.admin-report-row, .admin-list-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--glass-border);
  color: var(--text-2);
  font-size: 13px;
}
.admin-report-row:last-child, .admin-list-item:last-child { border-bottom: 0; }
.admin-report-row strong, .admin-list-item strong { color: var(--text); font-variant-numeric: tabular-nums; }
.admin-status { min-height: 20px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.admin-error { color: var(--danger); }
.admin-link { color: var(--text-2); font-size: 13px; font-weight: 700; text-decoration: none; }
.admin-link:hover, .admin-link.active { color: var(--accent); }
.admin-periods { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0 0; padding: 4px; width: fit-content; border: 1px solid var(--glass-border); border-radius: 10px; background: var(--surface-hover); }
.admin-period {
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 750;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}
.admin-period:hover { color: var(--text); }
.admin-period.active { background: var(--surface-solid); border-color: var(--glass-border); color: var(--text); box-shadow: 0 1px 2px rgba(15, 23, 42, .12); }
.admin-charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.admin-chart { padding: 15px; min-width: 0; border: 1px solid var(--glass-border); border-radius: 12px; background: var(--surface-hover); color: var(--accent); }
.admin-chart h3 { margin: 0 0 10px; font-size: 10px; font-weight: 800; color: var(--text-2); letter-spacing: .7px; text-transform: uppercase; }
.admin-chart-svg { width: 100%; height: 72px; display: block; }
.admin-sub-note { color: var(--text-3); font-size: 11px; font-weight: 600; }
.admin-delta-up { color: var(--ok, #16a34a); }
.admin-delta-down { color: var(--danger); }
:root[data-theme=dark] .admin-header { background: linear-gradient(120deg, var(--surface-solid) 0%, var(--surface-solid) 65%, rgba(124, 92, 252, .18) 100%); }
:root[data-theme=dark] .admin-period.active { box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
@media (max-width: 719px) {
  .admin { gap: 14px; padding-top: 12px; }
  .admin-header { align-items: flex-start; flex-direction: column; padding: 22px; }
  .admin-header .btn { width: 100%; }
  .admin-tabs { margin: 0 -2px; border-radius: 10px; }
  .admin-grid { grid-template-columns: minmax(0, 1fr); }
  .admin-charts { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 720px) {
  .admin-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .admin-panels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-analytics-section { grid-template-columns: minmax(0, 1fr); }
  .admin-analytics-panels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-panel-actions { flex-direction: row; }
  .admin-panel-actions .btn { width: auto; }
}
@media (min-width: 1000px) {
  .admin-kpi { min-height: 132px; }
  .admin-panel { padding: 24px; }
}

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: 64px 0 48px;
}
.hero h1 {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -2px;
  margin-bottom: 12px;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p {
  color: var(--text-2);
  margin-bottom: 36px;
  font-size: 17px;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}
.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== Search ===== */
.searchbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.searchbar input {
  flex: 1;
  padding: 15px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: all 0.2s ease;
}
.searchbar input::placeholder { color: var(--text-3); }
.searchbar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.feed-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

/* Search hint */
.search-hint {
  margin-bottom: 16px;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.search-hint p {
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 10px;
}
.hint-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.hint-tags span {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(124, 92, 252, 0.2);
}

/* Search status bar */
.search-status {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 16px;
  padding: 0 2px;
  animation: fadeIn 0.2s ease;
}

/* Search loading state */
.searchbar input.searching {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: searchPulse 1.2s ease-in-out infinite;
}
@keyframes searchPulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--accent-soft); }
  50% { box-shadow: 0 0 0 8px rgba(124, 92, 252, 0.05); }
}

/* ===== Sub-navigation ===== */
.subnav {
  display: flex;
  gap: 4px;
  padding: 8px 16px;
  max-width: 1280px;
  margin: 0 auto;
  border-bottom: 1px solid var(--glass-border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.subnav::-webkit-scrollbar { display: none; }
.subnav a {
  padding: 8px 12px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: 999px;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.subnav a:hover { color: var(--text); background: var(--surface-hover); }
.subnav a.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(139,108,255,.18);
}
.fav-count[hidden] { display: none; }
.fav-count {
  display: inline-block;
  min-width: 18px;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--accent, #4da3ff);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  vertical-align: 1px;
}

/* ===== Sub-navigation ===== */
.card .cover-placeholder {
  width: 100%; height: 236px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2, #f1f3f6);
  color: var(--text-3);
  font-size: 48px;
}
.card-top {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; row-gap: 4px;
}
.adv-badge {
  display: inline-block;
  margin: 6px 0 0;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  color: var(--text-2);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
}
.card .price { font-size: 24px; font-weight: 800; letter-spacing: -1px; color: var(--text); }
.card .price-m2 {
  font-size: 12px; color: var(--text-2); font-weight: 700;
  white-space: nowrap;
  background: var(--accent-soft);
  border: 1px solid rgba(139,108,255,.14);
  padding: 3px 8px;
  border-radius: 999px;
}
.card .price-m2-sale {
  font-size: 13px; color: var(--accent); font-weight: 800;
}
.card .loc {
  color: var(--text-2); font-size: 14px; margin: 8px 0 10px;
  line-height: 1.4; word-break: break-word;
}
.card .loc .sep { color: var(--text-3); margin: 0 6px; }
.card .desc { margin: 10px 0 12px; color: var(--text-2); font-size: 14px; line-height: 1.5; word-break: break-word; }
.card-distance { margin: 8px 0 10px; color: var(--text-2); font-size: 12px; line-height: 1.4; }
.card .tags {
  display: flex; flex-wrap: wrap; gap: 5px; margin: 12px 0 14px;
  padding: 8px 0; border-top: 1px solid var(--glass-border);
}
.card .tags span {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 4px 8px;
  background: var(--accent-soft); border: 1px solid rgba(139,108,255,.15);
  border-radius: 16px; font-size: 11px; font-weight: 600;
  color: var(--text-2); white-space: nowrap;
}
.card .tags .pet {
  background: var(--ok-soft); border-color: rgba(0,217,126,.2); color: var(--ok);
}
.card-dates {
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  padding-top: 10px; border-top: 1px solid var(--glass-border);
  color: var(--text-3); font-size: 11px; line-height: 1.4;
}

/* ===== Catalogue cards (dom feed): price over photo, clean meta ===== */
.cover-price {
  position: absolute; left: 12px; bottom: 12px; z-index: 2;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 8px;
  background: rgba(13,14,18,.86);
  border: 1px solid rgba(255,255,255,.13);
  box-shadow: none;
}
.cover-price .price { font-size: 19px; font-weight: 850; letter-spacing: -.4px; color: #fff; line-height: 1.15; }
.cover-price .price-m2 {
  font-size: 11px; color: rgba(255,255,255,.32); font-weight: 700;
  letter-spacing: .2px; text-transform: uppercase;
  background: transparent; border: 0; padding: 0; border-radius: 0;
}
.cover-price .price-m2-sale { color: #ffd166; }
.card-title {
  font-size: 16px; font-weight: 750; letter-spacing: -.2px; color: var(--text);
}
.card-sub { color: var(--text-3); font-weight: 600; }
.card-meta {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0;
  color: var(--text-2); font-size: 12px; font-weight: 600;
}
.card-meta .meta {
  display: inline-flex; align-items: center;
  padding: 0; border-radius: 0;
  background: transparent; border: 0;
  font-size: 12px; font-weight: 650; color: var(--text-2);
}
.card-meta .meta + .meta::before { content: "·"; margin-right: 6px; color: var(--text-3); }
.card-amenities {
  display: flex; flex-wrap: wrap; gap: 5px 8px; margin: 12px 0 14px;
  padding: 10px 0 0; border-top: 1px solid var(--glass-border);
}
.card-amenities + .card-foot { margin-top: 12px; }
.card-amenities span {
  display: inline-flex; align-items: center;
  padding: 0; border: 0; background: none;
  color: var(--text-3); font-size: 10px; font-weight: 700; line-height: 1.2;
}
.card-amenities span + span::before { content: "·"; margin-right: 8px; color: var(--text-3); }
.card-amenities span:hover { color: var(--accent); }
.card-foot {
  display: flex; flex-wrap: wrap; gap: 4px 14px;
  margin-top: auto;
  padding-top: 11px; border-top: 1px solid var(--glass-border);
  color: var(--text-3); font-size: 11px; line-height: 1.4;
}
@media (min-width: 1000px) {
  .card .cover-placeholder { height: 220px; }
}
.card-top, .loc, .desc, .tags, .card-dates, .adv-badge, .card-distance { /* legacy — kept for my/fav/archive pages */ }

.card .tags {
  display: flex; flex-wrap: wrap; gap: 5px; margin: 12px 0 14px;
  padding: 8px 0; border-top: 1px solid var(--glass-border);
}
.card .tags span {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 4px 8px;
  background: var(--accent-soft); border: 1px solid rgba(139,108,255,.15);
  border-radius: 16px; font-size: 11px; font-weight: 600;
  color: var(--text-2); white-space: nowrap;
}
.card .tags .pet {
  background: var(--ok-soft); border-color: rgba(0,217,126,.2); color: var(--ok);
}
.card-dates {
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  padding-top: 10px; border-top: 1px solid var(--glass-border);
  color: var(--text-3); font-size: 11px; line-height: 1.4;
}

.cards {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (max-width: 719px) {
  .cards { display: flex; flex-direction: column; gap: 14px; }
  section.dom > .cards,
  .dom > .cards { display: flex; flex-direction: column; }
  .card { border-radius: 16px; }
  .card .cover, .card .cover-placeholder { height: 205px; }
  .card-body { padding: 14px; }
  .cover-price { left: 8px; bottom: 8px; padding: 6px 10px; }
  .cover-price .price { font-size: 18px; }
  .card-title { font-size: 15px; }
  .card-meta { margin-top: 10px; }
  .card-meta .meta { padding: 4px 8px; font-size: 11px; }
  .card-amenities { margin: 10px 0 12px; padding-top: 9px; }
  .card-foot { font-size: 10px; }
}
/* Pages without sidebar (my listings) — full grid even on wide screens */
@media (min-width: 720px) {
  .dom > .cards:not(.results-column .cards) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1100px) {
  .dom > .cards:not(.results-column .cards) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.card {
  background: var(--surface-solid, #fff);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
  transition: border-color .16s ease, box-shadow .16s ease;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.card:hover { border-color: rgba(139,108,255,.42); box-shadow: 0 10px 26px rgba(15,23,42,.12); }
.card .btn-fav {
  position: absolute; top: 10px; right: 10px; z-index: 5;
  width: 36px; height: 36px; border-radius: 50%;
  border: none; background: rgba(0,0,0,.4); color: rgba(255,255,255,.7);
  font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all .15s; backdrop-filter: blur(4px);
}
.card .btn-fav:hover { background: rgba(0,0,0,.6); }
.card .btn-fav.active { color: #ff4757; }
.card { position: relative; }
.card-link {
  display: flex; flex-direction: column; height: 100%;
  color: inherit; text-decoration: none;
}
.card:active { transform: none; }
.card .cover {
  width: 100%;
  height: 210px;
  object-fit: cover;
  background: linear-gradient(135deg, #1a1a2e, #16161f);
}
@media (min-width: 1000px) { .card .cover { height: 220px; } .card-body { padding: 20px; } }
.price {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.8px;
}
.loc {
  color: var(--text-2);
  font-size: 14px;
  margin: 4px 0 12px;
}
.desc {
  margin: 12px 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}
.tags span {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
}
.tags .pet {
  background: var(--ok-soft);
  border-color: rgba(0, 217, 126, 0.3);
  color: var(--ok);
}
.tag-hidden { color: var(--warn); font-size: 13px; font-weight: 600; }
.owner-actions { margin-top: 14px; display: flex; gap: 8px; padding: 0 16px 14px; }
.empty {
  color: var(--text-3);
  text-align: center;
  padding: 60px 20px;
  font-size: 15px;
}

/* ===== Form ===== */
.form-page { max-width: var(--max); margin: 0 auto; }
.form-page h2 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 24px;
}
.form-page label {
  display: block;
  margin-bottom: 20px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-page textarea,
.form-page input[type=text] {
  width: 100%;
  margin-top: 8px;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: rgba(0,0,0,0.25);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}
.form-page textarea::placeholder,
.form-page input::placeholder { color: var(--text-3); }
.form-page textarea:focus,
.form-page input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.form-page input[type=file] { margin-top: 10px; font-size: 14px; color: var(--text-2); }

/* Form mode toggle (Form vs Wizard) */
.form-mode-toggle {
  display: flex; gap: 4px; padding: 4px;
  background: var(--surface-2, #f1f3f6); border-radius: 12px;
  margin-bottom: 20px;
}
:root[data-theme=dark] .form-mode-toggle { background: rgba(255,255,255,.05); }
.mode-btn {
  flex: 1; padding: 12px; border: none; background: transparent;
  border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer;
  color: var(--text-2); transition: all .15s;
}
.mode-btn:hover { color: var(--text); }
.mode-btn.active {
  background: var(--surface-solid, #fff);
  color: var(--text);
  box-shadow: var(--shadow);
}
:root[data-theme=dark] .mode-btn.active { background: var(--accent-soft); color: var(--accent); }

/* Form sections */
.form-section {
  background: var(--surface-solid, #fff);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.form-section h3 { font-size: 17px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.form-section .form-row { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.form-section .form-row > label { flex: 1; min-width: 140px; }
.form-section .check-label {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 8px;
  background: var(--surface-2, #f1f3f6); cursor: pointer;
  font-size: 13px; font-weight: 500;
}
:root[data-theme=dark] .form-section .check-label { background: rgba(255,255,255,.05); }
.form-section .check-label input { accent-color: var(--accent); }
.form-section .check-label:hover { background: var(--accent-soft); }
.form-section input[type="text"],
.form-section input[type="number"],
.form-section select {
  width: 100%; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--glass-border); background: var(--surface-2, #f1f3f6);
  color: var(--text); font-size: 14px; margin-top: 4px;
}
:root[data-theme=dark] .form-section input[type="text"],
:root[data-theme=dark] .form-section input[type="number"],
:root[data-theme=dark] .form-section select { background: rgba(255,255,255,.05); }
.form-section input:focus, .form-section select:focus { border-color: var(--accent); outline: none; }
.form-section textarea {
  width: 100%; padding: 12px; border-radius: 8px;
  border: 1px solid var(--glass-border); background: var(--surface-2, #f1f3f6);
  color: var(--text); font-size: 14px; margin-top: 4px; resize: vertical; min-height: 120px;
}

/* Amenities grid */
.amenities-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px;
}

/* AI assistant */
.ai-assistant {
  background: linear-gradient(135deg, var(--accent-soft), transparent);
  border: 1px solid rgba(139,108,255,.2);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.ai-toggle {
  width: 100%; text-align: left; padding: 8px 0;
  background: none; border: none; font-size: 15px; font-weight: 600;
  color: var(--accent); cursor: pointer; display: flex; align-items: center; gap: 8px;
}
.ai-body { margin-top: 12px; }
.ai-actions { display: flex; gap: 8px; margin-top: 8px; }
.ai-status {
  margin-top: 12px; padding: 12px; border-radius: 8px;
  background: var(--surface-2, #f1f3f6); font-size: 13px; line-height: 1.6;
  display: flex; flex-direction: column; gap: 6px;
}
:root[data-theme=dark] .ai-status { background: rgba(255,255,255,.05); }

/* Photo preview */
.photo-drop { position: relative; padding: 16px; border: 2px dashed var(--glass-border); border-radius: var(--radius-sm); text-align: center; }
.photo-drop:hover { border-color: var(--accent); }
.photo-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.photo-preview { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.photo-preview-item { position: relative; width: 80px; height: 80px; border-radius: 8px; overflow: hidden; }
.photo-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.photo-preview-item .photo-remove {
  position: absolute; top: 2px; right: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: rgba(0,0,0,.6); color: #fff;
  border: none; cursor: pointer; font-size: 11px; line-height: 1;
}

/* Form submit actions */
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Mic / Voice ===== */
.text-wrap { position: relative; }
.text-wrap textarea { padding-right: 60px; min-height: 130px; resize: vertical; }
.mic-btn {
  position: absolute;
  right: 12px;
  bottom: 12px;
  border: none;
  background: var(--accent-grad);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(124, 92, 252, 0.4);
}
.mic-btn:active { transform: scale(0.88); }
.mic-btn.recording {
  background: linear-gradient(135deg, #ff4757, #ff6b9d);
  animation: pulse-rec 1.2s ease-in-out infinite;
}
@keyframes pulse-rec {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.5); }
  50% { box-shadow: 0 0 0 12px rgba(255, 71, 87, 0); }
}
/* ===== Expiry / archive badges ===== */
.tag-expiring {
  background: rgba(245, 158, 11, 0.15); color: #d97706;
  padding: 2px 8px; border-radius: 8px; font-size: 12px; font-weight: 600;
}
.tag-expired {
  background: rgba(107, 114, 128, 0.15); color: #6b7280;
  padding: 2px 8px; border-radius: 8px; font-size: 12px; font-weight: 600;
}
.card.expiring .cover,
.card.expiring .cover-placeholder { filter: grayscale(0.3); opacity: 0.85; }
.card.archived .cover,
.card.archived .cover-placeholder { filter: grayscale(1); opacity: 0.6; }
.card.archived { border-color: var(--glass-border); }

/* ===== Result banner ===== */
.result {
  margin-top: 20px;
  padding: 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-align: center;
  font-size: 15px;
}
.result.ok {
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid rgba(0, 217, 126, 0.2);
}
.result.err {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(255, 71, 87, 0.2);
}

/* ===== Food ===== */
.food { max-width: var(--max); margin: 0 auto; }
.diet-profile {
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}
.diet-profile summary {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 0;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.diet-profile summary::-webkit-details-marker { display: none; }
.diet-profile summary::after { content: " ▾"; color: var(--text-3); }
.diet-profile[open] summary::after { content: " ▴"; }
.diet-profile[open] summary { margin-bottom: 16px; }
.diet-profile label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--glass-border);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 0;
}
.diet-profile label:last-of-type { border-bottom: none; }
.diet-profile input[type=checkbox] {
  width: 24px;
  height: 24px;
  accent-color: var(--accent);
  cursor: pointer;
  border-radius: 6px;
}
.diet-profile .btn { margin-top: 18px; width: 100%; }

.scanner-area {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  padding: 20px 0;
}

/* Scan mode selector */
.scan-modes {
  display: flex; gap: 0; width: 100%; max-width: 360px;
  border-radius: var(--radius-sm); overflow: hidden;
  border: 1px solid var(--glass-border);
}
.scan-mode {
  flex: 1; padding: 10px 16px; border: none; cursor: pointer;
  background: transparent; color: var(--text-2); font-size: 14px; font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.scan-mode:first-child { border-right: 1px solid var(--glass-border); }
.scan-mode.active { background: var(--accent-soft); color: var(--accent); }

.scan-hint {
  color: var(--text-2); font-size: 13px; text-align: center; margin: 0;
  min-height: 18px;
}

/* Camera viewfinder */
.camera-view {
  position: relative; width: 100%; max-width: 360px;
  aspect-ratio: 3 / 4; border-radius: var(--radius); overflow: hidden;
  background: #000; border: 1px solid var(--glass-border);
}
.camera-view video {
  width: 100%; height: 100%; object-fit: cover;
}
.camera-overlay {
  position: absolute; inset: 0; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
}
.camera-overlay::before {
  content: ""; width: 70%; height: 40%;
  border: 2px solid rgba(255,255,255,0.6); border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.3);
}
.camera-overlay.barcode-pulse::before {
  border-color: var(--ok);
  box-shadow: 0 0 0 9999px rgba(0,217,126,0.15);
}
.camera-controls {
  display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 360px;
}
.camera-controls .btn { width: 100%; text-align: center; }

.scanning {
  text-align: center;
  padding: 56px 0;
}
.scanning p {
  color: var(--text-2);
  margin-top: 20px;
  font-size: 16px;
  font-weight: 500;
}
.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--glass-border);
  border-top-color: var(--accent);
  border-right-color: var(--accent-2);
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Verdict ===== */
.verdict-screen {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}
.verdict-card {
  width: 100%;
  border-radius: var(--radius);
  padding: 32px 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: verdict-in 0.4s ease-out;
}
@keyframes verdict-in {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.verdict-card.colour-green {
  background: linear-gradient(135deg, var(--ok-soft), rgba(0, 217, 126, 0.04));
  border: 1px solid rgba(0, 217, 126, 0.25);
}
.verdict-card.colour-yellow {
  background: linear-gradient(135deg, var(--warn-soft), rgba(255, 184, 0, 0.04));
  border: 1px solid rgba(255, 184, 0, 0.25);
}
.verdict-card.colour-red {
  background: linear-gradient(135deg, var(--danger-soft), rgba(255, 71, 87, 0.04));
  border: 1px solid rgba(255, 71, 87, 0.25);
}
.verdict-card.colour-no_data {
  background: var(--surface);
  border: 1px solid var(--glass-border);
}
.verdict-card h2 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
}
.product-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}
.product-brand { color: var(--text-3); font-weight: 500; }
.verdict-card.colour-green h2 { color: var(--ok); }
.verdict-card.colour-yellow h2 { color: var(--warn); }
.verdict-card.colour-red h2 { color: var(--danger); }
.verdict-card.colour-no_data h2 { color: var(--text-2); }
.reasons {
  list-style: none;
  text-align: left;
}
.reasons li {
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 14px;
  color: var(--text);
}
.reasons li:last-child { border-bottom: none; }
.ingredient-list {
  margin-top: 18px;
  text-align: left;
}
.ingredient-list-title {
  color: var(--text-3);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 8px;
}
.ing-chip {
  display: inline-block;
  margin: 3px 4px 3px 0;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.3;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--text);
}
.ing-chip.add {
  cursor: pointer;
  color: var(--accent, #4da3ff);
  border-color: rgba(77, 163, 255, 0.35);
  background: rgba(77, 163, 255, 0.08);
}
.ing-chip.add:hover { background: rgba(77, 163, 255, 0.16); }
.additive-body { white-space: normal; color: var(--text); }
.trust {
  color: var(--text-3);
  font-size: 12px;
  margin-top: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.feedback-actions {
  display: flex;
  gap: 12px;
  width: 100%;
}
.feedback-actions .btn { flex: 1; }
.feedback-actions .btn.ok {
  border-color: rgba(0, 217, 126, 0.3);
  color: var(--ok);
  background: var(--ok-soft);
}

/* ===== HTMX ===== */
.htmx-indicator { opacity: 0; transition: opacity 0.2s; }
.htmx-request .htmx-indicator { opacity: 1; }

/* ===== Scrollbar (subtle) ===== */
::-webkit-scrollbar { width: 0; }

/* ===== Wizard (form mode toggle) ===== */
.wizard-bar { margin-bottom: 16px; }
.wizard-steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.wiz-step {
  padding: 6px 12px; border-radius: 16px; border: 1px solid var(--glass-border);
  background: transparent; color: var(--text-2); font-size: 13px; cursor: pointer;
}
.wiz-step.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.wiz-step.done { color: var(--ok); border-color: rgba(0, 217, 126, 0.3); }
.wizard-progress {
  height: 6px; border-radius: 3px; background: var(--glass-border); overflow: hidden;
}
.wizard-progress-fill {
  height: 100%; background: var(--accent-grad); width: 0; transition: width .25s ease;
}
.wizard-nav {
  display: flex; justify-content: space-between; gap: 12px; padding: 12px 0;
}

/* ===== AI status / confirm ===== */
.ai-line { font-size: 13px; padding: 8px 10px; border-radius: var(--radius-sm); background: rgba(127,127,127,.08); }
.ai-line.ok { color: var(--ok); }
.ai-line.warn { color: var(--danger); }
.ai-line.tip { color: var(--accent); }
.ai-confirm {
  margin-top: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 10px; border-radius: var(--radius-sm); border: 1px dashed var(--glass-border);
}
.ai-confirm-text { flex: 1 1 100%; font-size: 13px; color: var(--text-2); }

/* ===== Form hint / preview ===== */
.form-hint { flex: 1; align-self: center; font-size: 13px; color: var(--text-2); }
.form-actions { display: flex; gap: 12px; align-items: center; justify-content: flex-end; }
.preview-modal img.preview-photo {
  width: 100%; max-height: 240px; object-fit: cover; border-radius: var(--radius-sm); margin-bottom: 12px;
}
.preview-row { font-size: 14px; margin-bottom: 6px; }
.preview-text {
  margin-top: 10px; font-size: 13px; color: var(--text-2); white-space: pre-wrap;
  max-height: 160px; overflow: auto;
}

/* photo preview thumbs must stay clickable above the invisible file input */
.photo-preview { position: relative; z-index: 1; }

/* ===== Saved searches ===== */
.saved-search {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--glass-border);
}
.saved-search a { flex: 1; color: var(--text); text-decoration: none; font-size: 14px; }
.saved-search a:hover { color: var(--accent); }
.saved-search .btn { flex-shrink: 0; }

/* ===== Card stats (owner view) ===== */
.card-stats {
  display: flex; gap: 12px; padding: 0 16px 14px;
  font-size: 13px; color: var(--text-2);
}

/* ===== Cover wrap with fav button overlay ===== */
.cover-wrap { position: relative; }
.cover-wrap .btn-fav {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  background: rgba(0,0,0,0.35); border: none; border-radius: 50%;
  width: 32px; height: 32px; display: flex; align-items: center;
  justify-content: center; cursor: pointer;
  transition: background .2s;
}
.cover-wrap .btn-fav svg path,
.btn-fav svg path {
  fill: none;
  stroke: rgba(255,255,255,0.75);
  stroke-width: 2;
  transition: fill .2s, stroke .2s;
}
.cover-wrap .btn-fav.active svg path,
.btn-fav.active svg path {
  fill: #ff3b5c;
  stroke: #ff3b5c;
}
.cover-wrap .btn-fav:hover { background: rgba(0,0,0,0.5); }
.cover-wrap .btn-fav.active:hover { background: rgba(0,0,0,0.5); }

/* ===== Lightbox ===== */
.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.92); display: flex; align-items: center;
  justify-content: center; cursor: zoom-out;
  /* Reserve space for the close/rotate buttons (top) and thumbs (bottom)
     so the photo never sits under them; contain letterboxes inside. */
  padding: 60px 8px 72px; box-sizing: border-box;
}
/* The topbar uses backdrop-filter: blur(20px), which Chromium paints on its
   own composited layer ABOVE a lower-z fixed sibling — so it shone through
   the photo lightbox. Hide it while the lightbox is open (body.lb-open). */
body.lb-open .topbar { visibility: hidden; }
body.lb-open #detail-catalog,
body.lb-open #detail-close { display: none; }
/* Direct child only: .lb-thumbs > .lb-thumb imgs must keep their 48px size
   (the descendant selector made every thumb full-viewport, covering the photo). */
.lightbox > img {
  /* Fill the viewport box; object-fit scales the bitmap up/down with
     aspect preserved. max-* only ever shrinks, never enlarges — that's
     why small photos stayed tiny on wide screens. */
  width: 100%; height: 100%; object-fit: contain;
  border-radius: 4px;
}
.lb-rotate, .lb-close {
  position: fixed; top: 16px; width: 44px; height: 44px;
  border: none; border-radius: 50%; background: rgba(255,255,255,0.15);
  color: #fff; font-size: 22px; cursor: pointer; z-index: 1001;
  backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center;
}
.lb-rotate { right: 16px; }
.lb-close { left: 16px; }
.lb-rotate:active, .lb-close:active { background: rgba(255,255,255,0.3); }
.lb-thumbs {
  position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; z-index: 1001; max-width: 90vw; overflow-x: auto;
  padding: 4px; border-radius: 8px; background: rgba(0,0,0,0.4);
}
.lb-thumb {
  width: 48px; height: 48px; border-radius: 4px; object-fit: cover;
  opacity: .6; cursor: pointer; flex-shrink: 0;
}
.lb-thumb.active { opacity: 1; outline: 2px solid var(--accent); }

/* ===== Similar listings ===== */
.similar-section { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--glass-border); }
.similar-title { margin: 0 0 12px; font-size: 16px; font-weight: 600; color: var(--text-1); }
.similar-cards { display: grid; grid-template-columns: 1fr; gap: 12px; }
.card.small .cover, .card.small .cover-placeholder { height: 110px; }
@media (min-width: 720px) { .similar-cards { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .similar-cards { grid-template-columns: 1fr 1fr 1fr; } }

/* ===== Food scan preview + scan-line ===== */
.scan-photo-preview {
  position: relative; width: 100%; max-width: 360px; height: 200px;
  margin: 0 auto; border-radius: var(--radius-sm); overflow: hidden;
  background: var(--surface) center/cover no-repeat;
  border: 1px solid var(--glass-border);
}
.scan-line {
  position: absolute; left: 0; right: 0; height: 2px; background: var(--accent);
  top: 0; animation: scan 1.5s ease-in-out infinite;
}
@keyframes scan {
  0% { top: 0; opacity: 1; }
  50% { top: 100%; opacity: 0.3; }
  100% { top: 0; opacity: 1; }
}
.stage-message { margin-top: 14px; color: var(--text-2); font-size: 15px; font-weight: 500; }

/* ===== Food tabs + lists ===== */
.food-tabs {
  display: flex; gap: 8px; margin-bottom: 20px; border-bottom: 1px solid var(--glass-border);
  padding-bottom: 10px; flex-wrap: wrap;
}
.food-tabs .tab {
  padding: 8px 16px; border-radius: 18px; border: 1px solid var(--glass-border);
  background: transparent; color: var(--text-2); font-size: 14px; cursor: pointer;
}
.food-tabs .tab.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.food-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.food-list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--glass-border);
}
.food-item-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.food-item-dot.colour-green { background: var(--ok); }
.food-item-dot.colour-yellow { background: var(--warn); }
.food-item-dot.colour-red { background: var(--danger); }
.food-item-dot.colour-no_data { background: var(--text-3); }
.food-item-name { flex: 1; font-size: 14px; color: var(--text); }
.food-item-link { display: flex; align-items: center; gap: 10px; flex: 1; text-decoration: none; color: inherit; }
.food-item-time { font-size: 12px; color: var(--text-3); }

/* ===== Auth entry page ===== */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 60vh; text-align: center; }
.auth-loader { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.auth-hint { color: var(--text-2); font-size: 15px; padding: 0 20px; }


.category-navigation {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 13px;
  min-width: 0;
  padding: 3px 0 17px;
  border-bottom: 1px solid var(--glass-border);
}
.category-navigation .breadcrumbs,
.category-navigation #category-children {
  scrollbar-width: none;
}
.category-navigation .breadcrumbs::-webkit-scrollbar,
.category-navigation #category-children::-webkit-scrollbar { display: none; }
.category-navigation .breadcrumbs {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 20px;
  margin: 0;
  overflow-x: auto;
  white-space: nowrap;
  color: var(--text-3);
  font-size: 12px;
  letter-spacing: .01em;
}
.category-navigation .breadcrumbs a {
  flex: 0 0 auto;
  color: var(--text-2);
  font-weight: 650;
  text-decoration: none;
  transition: color .15s ease;
}
.category-navigation .breadcrumbs a:hover,
.category-navigation .breadcrumbs a:focus-visible { color: var(--accent); }
.category-navigation .breadcrumbs a:last-child {
  color: var(--text);
  font-weight: 750;
}
.category-navigation .breadcrumbs > span { color: var(--text-3); opacity: .7; }
.category-navigation #category-children {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px 24px;
  min-width: 0;
  width: 100%;
  overflow: visible;
  padding: 0 2px;
  border-bottom: 1px solid var(--glass-border);
}
.category-navigation #category-children .cat-root {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  min-height: 40px;
  padding: 7px 0 10px;
  white-space: normal;
  overflow-wrap: anywhere;
  color: var(--text-2);
  background: transparent;
  border: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  transition: color .15s ease;
}
.category-navigation #category-children .cat-root::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
  content: "";
  transform: scaleX(0);
  transform-origin: center;
  transition: transform .15s ease;
}
.category-navigation #category-children .cat-root:hover,
.category-navigation #category-children .cat-root:focus-visible,
.category-navigation #category-children .cat-root[aria-current="page"] {
  color: var(--accent);
}
.category-navigation #category-children .cat-root:hover::after,
.category-navigation #category-children .cat-root:focus-visible::after,
.category-navigation #category-children .cat-root[aria-current="page"]::after {
  transform: scaleX(1);
}
.category-navigation #category-children .cat-root:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}
@media (max-width: 719px) {
  .category-navigation { gap: 10px; padding-bottom: 13px; }
  .category-navigation #category-children { gap: 8px 20px; }
}
