:root {
  --bg: #090706;
  --bg-body: #12100e;
  --bg-card: #15110f;
  --bg-sidebar: #100d0b;
  --text: #e7dfd2;
  --text-muted: #a79c8d;
  --accent: #d0a24f;
  --accent-hover: #e2b96f;
  --link: #c5ab78;
  --link-hover: #e3c588;
  --border: #2a211a;
  --border-light: #1d1713;
  --danger: #c44;
  --success: #4a4;
  --radius: 4px;
  --shadow: 0 12px 30px rgba(0,0,0,0.45);
  --font: Georgia, 'Times New Roman', serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --sidebar-w: 300px;
  --header-h: 200px;
  --header-h-scrolled: 50px;
  --header-current-h: var(--header-h);
  --header-progress: 0;
}

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

body {
  font-family: var(--font);
  background:
    radial-gradient(circle at top right, rgba(112, 72, 20, 0.16), transparent 32%),
    radial-gradient(circle at top left, rgba(63, 30, 17, 0.2), transparent 26%),
    linear-gradient(180deg, #110d0b 0%, var(--bg) 18%, #070605 100%);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }

/* ---- Header with wine images ---- */
#header {
  height: var(--header-current-h);
  background-color: #0a0807;
  background-size: cover;
  background-position: right top;
  background-repeat: no-repeat;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  display: flex;
  align-items: stretch;
  padding: 0;
  border-bottom: 1px solid rgba(208, 162, 79, 0.16);
  box-shadow: 0 16px 32px rgba(0,0,0,0.35);
  overflow: hidden;
}
#header.scrolled {
  height: var(--header-h-scrolled);
}
#header::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 6, 5, 0.35), rgba(8, 6, 5, 0.88)),
    radial-gradient(circle at 80% 15%, rgba(130, 84, 27, 0.18), transparent 22%),
    radial-gradient(circle at 18% 22%, rgba(198, 147, 64, 0.09), transparent 18%);
  pointer-events: none;
}
.header-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: center;
  gap: 1rem;
  padding:
    calc(1.8rem - 1.4rem * var(--header-progress))
    2rem
    calc(1rem - 0.6rem * var(--header-progress));
  transform: translateY(calc(14px * (1 - var(--header-progress))));
}
#header.scrolled .header-inner {
  align-items: center;
  padding: 0.4rem 1.5rem;
}
.header-left {
  display: flex;
  align-items: center;
  min-height: 1px;
}
.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
#header h1 {
  font-size: calc(2.2rem - 1rem * var(--header-progress));
  color: #fff;
  text-shadow: 0 2px 10px rgba(0,0,0,0.72);
  font-weight: normal;
  margin: 0;
  line-height: 1.1;
}
#header.scrolled h1 { font-size: 1.2rem; }
#header h1 a { color: #fff; }
#header h1 a:hover { color: var(--accent); }

/* Hamburger + sidebar close -- hidden on desktop */
.hamburger-btn, .sidebar-close {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  padding: 0.3rem;
  margin-right: 0.8rem;
  line-height: 1;
}

.hbg1  { background-image: url(/images/header1.jpg); }
.hbg2  { background-image: url(/images/header2.jpg); }
.hbg3  { background-image: url(/images/header3.jpg); }
.hbg4  { background-image: url(/images/header4.jpg); }
.hbg5  { background-image: url(/images/header5.jpg); }
.hbg6  { background-image: url(/images/header6.jpg); }
.hbg7  { background-image: url(/images/header7.jpg); }
.hbg8  { background-image: url(/images/header8.jpg); }
.hbg9  { background-image: url(/images/header9.jpg); }
.hbg10 { background-image: url(/images/header10.jpg); }
.hbg11 { background-image: url(/images/header11.jpg); }
.hbg12 { background-image: url(/images/header12.jpg); }
.hbg13 { background-image: url(/images/header13.jpg); }
.hbg14 { background-image: url(/images/header14.jpg); }
.hbg15 { background-image: url(/images/header15.jpg); }

/* ---- Wrapper: sidebar + main ---- */
#wrapper {
  display: flex;
  min-height: 100vh;
  padding-top: var(--header-current-h);
  background: var(--bg);
}

/* ---- Sidebar ---- */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 1rem 0;
  font-size: 0.85rem;
  overflow-y: auto;
  position: sticky;
  top: var(--header-current-h);
  height: calc(100vh - var(--header-current-h));
}
.scrolled ~ #wrapper #sidebar,
#sidebar.header-scrolled {
  top: var(--header-h-scrolled);
  height: calc(100vh - var(--header-h-scrolled));
}

.sb-section {
  padding: 0.6rem 1.2rem;
  border-bottom: 1px solid var(--border-light);
}
.sb-section:last-child { border-bottom: none; }

.sb-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  font-family: var(--font-sans);
}

.sb-section a {
  display: block;
  padding: 0.2rem 0;
  color: var(--text);
  transition: color 0.15s;
}
.sb-section a:hover { color: var(--accent); }
.sb-section a.active { color: var(--accent); font-weight: bold; }

.sb-store-select {
  width: 100%;
  max-width: 100%;
  padding: 0.35rem 0.5rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  font-size: 0.9rem;
}

/* Sidebar butikssök */
.sb-store-filter {
  position: relative;
}
.sb-store-selected {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.sb-store-search {
  width: 100%;
  box-sizing: border-box;
  padding: 0.35rem 0.5rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  font-size: 0.9rem;
}
.sb-store-filter .store-dropdown {
  left: 0;
  right: 0;
  min-width: 100%;
  max-height: 14rem;
}
.store-dropdown .store-option .store-option-addr {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.store-dropdown .store-option.sb-store-option-focus {
  background: rgba(255,255,255,0.1);
  color: var(--accent);
}
.store-dropdown .store-option.sb-store-option-focus .store-option-addr {
  color: var(--text-muted);
}

/* Sidebar search */
.sb-search {
  display: flex;
  gap: 4px;
}
.sb-search input {
  flex: 1;
  padding: 0.35rem 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font);
}
.sb-search input:focus { outline: none; border-color: var(--accent); }
.sb-search button {
  padding: 0.35rem 0.6rem;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: var(--font-sans);
}

/* Sidebar mini release table */
.sb-releases { width: 100%; font-size: 0.8rem; border-collapse: collapse; }
.sb-releases td, .sb-releases th {
  padding: 0.15rem 0.3rem;
  text-align: right;
  border-bottom: 1px solid var(--border-light);
}
.sb-releases th { color: var(--text-muted); font-weight: normal; text-align: left; }
.sb-releases td:first-child, .sb-releases th:first-child { text-align: left; }

/* ---- Main content ---- */
#app {
  flex: 1;
  padding: 1.5rem 2rem;
  min-width: 0;
}

h1 { font-size: 1.6rem; margin-bottom: 1rem; font-weight: normal; }
h2 { font-size: 1.3rem; margin-bottom: 0.8rem; font-weight: normal; }
h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }

/* ---- Tabs ---- */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.2rem;
  border-bottom: 2px solid var(--border);
}
.tabs a {
  padding: 0.5rem 1rem;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}
.tabs a.active, .tabs a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---- Release country groups ---- */
.release-country-group { margin-bottom: 1.5rem; }
.release-country-header {
  font-size: 1rem;
  margin: 0 0 0.3rem;
  padding: 0.3rem 0.5rem;
  background: var(--bg-card);
  color: var(--text);
  border-left: 3px solid var(--accent);
  border-radius: 2px;
}

/* ---- Product table ---- */
.product-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.product-table th {
  text-align: left;
  padding: 0.4rem 0.5rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  border-bottom: 2px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font-sans);
  user-select: none;
}
.product-table th:hover { color: var(--accent); }
.product-table th.sorted { color: var(--accent); }
.product-table th.sorted::after { content: ' ▾'; }
.product-table th.sorted-asc::after { content: ' ▴'; }
.product-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}
.product-table tr:hover { background: rgba(255,255,255,0.03); }
.product-table .col-year { width: 4em; text-align: center; }
.product-table .col-price { text-align: right; white-space: nowrap; }
.product-table .col-score { text-align: center; width: 3em; color: var(--text-muted); }
.product-table .col-score.has-score { color: var(--accent); font-weight: bold; }
.product-table .col-actions { text-align: center; width: 3em; }

.product-name-main { font-weight: bold; }
.product-name-thin { color: var(--text-muted); font-style: italic; }
.product-meta-line {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.product-meta-line a { color: var(--text-muted); }
.product-meta-line a:hover { color: var(--link); }

.terminated { text-decoration: line-through; opacity: 0.5; }

/* Utgått-badge i produkttabell */
.badge-dead {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--error, #c0392b);
  color: #fff;
  padding: 0.1em 0.4em;
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 0.4em;
  text-decoration: none;
}

/* Sortimentsbadgar */
.badge-assort {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.1em 0.35em;
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 0.3em;
  cursor: default;
}
.badge-assort-fast { background: #27ae60; color: #fff; }
.badge-assort-temp { background: #e67e22; color: #fff; }
.badge-assort-order { background: #7f8c8d; color: #fff; }
.badge-assort-local { background: #8e44ad; color: #fff; }
.badge-assort-season { background: #2980b9; color: #fff; }
.badge-assort-web { background: #16a085; color: #fff; }

/* Utgått-badge i detaljvy */
.badge-dead-detail {
  background: var(--error, #c0392b);
  color: #fff;
  font-weight: 700;
}

/* Utgått-banner i detaljvy */
.msg-dead {
  background: color-mix(in srgb, var(--error, #c0392b) 12%, transparent);
  border: 1px solid var(--error, #c0392b);
  color: var(--error, #c0392b);
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.detail-dead { opacity: 0.85; }

/* Systembolaget-länk i tabellrad */
.sb-link {
  font-weight: 600;
  color: var(--accent) !important;
  white-space: nowrap;
}
.sb-link:hover { text-decoration: underline; }

/* Systembolaget-knapp i detaljvy */
.btn-sb {
  display: inline-block;
  padding: 0.45rem 1rem;
  background: #4a7c3f;
  color: #fff !important;
  border: none;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-sb:hover { background: #3d6a34; }

/* External search links */
.external-links {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}
.btn-outline {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: transparent;
  font-size: 0.8rem;
  text-decoration: none;
  transition: all 0.15s;
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---- Sort controls ---- */
.sort-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
  font-size: 0.85rem;
  flex-wrap: wrap;
}
.sort-bar label { color: var(--text-muted); font-family: var(--font-sans); }
.sort-bar select {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.3rem 0.5rem;
  font-size: 0.82rem;
  font-family: var(--font);
}

/* Filter checkboxes */
.filter-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.8rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: var(--font-sans);
}
.filter-bar label { cursor: pointer; display: flex; align-items: center; gap: 0.3rem; }
.filter-bar input[type="checkbox"] { accent-color: var(--accent); }

/* ---- Detail page ---- */
.detail {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.detail-header {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
}
.detail-image {
  width: 120px;
  min-width: 120px;
  height: 180px;
  object-fit: contain;
  background: #fff;
  border-radius: var(--radius);
}
.detail-image-placeholder {
  width: 120px;
  min-width: 120px;
  height: 180px;
  background: var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.detail-title h2 { margin-bottom: 0.2rem; }
.detail-subtitle { color: var(--text-muted); font-style: italic; margin-bottom: 0.5rem; }
.detail-badges { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.badge {
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-family: var(--font-sans);
  background: var(--border);
  color: var(--text-muted);
}
.badge-organic { background: #2a4a2a; color: #8c8; }
.badge-kosher { background: #2a2a4a; color: #88c; }

.detail-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 1.2rem;
  margin: 1rem 0;
  font-size: 0.9rem;
}
.detail-grid dt { color: var(--text-muted); }
.detail-grid dd { font-weight: 500; }

/* Taste clock */
.taste-clock {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin: 0.8rem 0;
}
.taste-bar-item { text-align: center; font-size: 0.75rem; color: var(--text-muted); }
.taste-bar-item .bar-label { margin-bottom: 0.2rem; }
.taste-bar {
  width: 3rem;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.taste-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
}
.taste-bar-value { margin-top: 0.15rem; color: var(--text); }

/* Grapes */
.grape-list { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.grape-tag {
  font-size: 0.75rem;
  background: var(--border);
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  color: var(--text-muted);
}

/* ---- Ratings ---- */
.ratings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.5rem;
  margin: 0.8rem 0;
}
.rating-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  text-align: center;
}
.rating-label { font-size: 0.7rem; color: var(--text-muted); font-family: var(--font-sans); }
.rating-value { font-size: 1.2rem; font-weight: bold; color: var(--accent); }
.rating-value.empty { color: var(--text-muted); font-size: 0.85rem; font-weight: normal; }

/* ---- Notes ---- */
.notes-list { margin: 0.5rem 0; }
.note-item {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.85rem;
}
.note-date { color: var(--text-muted); font-size: 0.75rem; }
.note-text { margin-top: 0.2rem; }

/* ---- Diff view ---- */
.diff-section { margin-bottom: 1.5rem; }
.diff-section h3 { color: var(--text-muted); border-bottom: 1px solid var(--border); padding-bottom: 0.3rem; }
.diff-new h3 { color: var(--success); }
.diff-deleted h3 { color: var(--danger); }
.diff-updated h3 { color: var(--accent); }

/* ---- Buttons ---- */
.btn {
  padding: 0.4rem 0.8rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg); border: 1px solid var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--text-muted); }
.btn-sm { padding: 0.2rem 0.5rem; font-size: 0.75rem; }
.btn-icon { padding: 0.3rem; font-size: 0.8rem; background: none; border: none; color: var(--text-muted); cursor: pointer; }
.btn-icon:hover { color: var(--accent); }

/* ---- Action links in tables ---- */
.action-link {
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
}
.action-link:hover { color: var(--accent); }

/* ---- Forms ---- */
.form-card {
  max-width: 400px;
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.form-group { margin-bottom: 0.8rem; }
.form-group label {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: var(--font-sans);
}
.form-group input, .form-group textarea {
  width: 100%;
  padding: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--font);
}
.form-group input:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* ---- Search bar (main content) ---- */
.search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}
.search-bar input {
  flex: 1;
  padding: 0.5rem 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font);
}
.search-bar input:focus { outline: none; border-color: var(--accent); }

/* ---- Pagination ---- */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.3rem;
  margin-top: 1.2rem;
}
.pagination a, .pagination span {
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-family: var(--font-sans);
}
.pagination a { background: var(--bg-card); border: 1px solid var(--border); color: var(--text); }
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .current { background: var(--accent); color: #000; font-weight: bold; }

/* ---- Tables (generic) ---- */
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.data-table th {
  text-align: left;
  padding: 0.4rem 0.5rem;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-family: var(--font-sans);
}
table.data-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--border-light);
}

/* ---- News banner ---- */
.news-banner {
  position: relative;
  background: linear-gradient(135deg, #1a2a1a 0%, #1a3a2a 100%);
  border: 1px solid #2a5a3a;
  border-radius: var(--radius);
  padding: 1rem 2.5rem 1rem 1rem;
  margin-bottom: 1.2rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #c8e6c9;
}
.news-banner strong {
  display: block;
  font-size: 1rem;
  color: var(--accent);
  margin-bottom: 0.4rem;
}
.news-banner ul {
  margin: 0.3rem 0 0.5rem 1.2rem;
  padding: 0;
}
.news-banner li { margin-bottom: 0.2rem; }
.news-banner p { margin: 0; color: #9ab; }
.news-banner a { color: var(--accent); text-decoration: underline; }
.news-banner a:hover { color: var(--accent-hover); }
.news-close {
  position: absolute;
  top: 0.5rem;
  right: 0.6rem;
  background: none;
  border: none;
  color: #9ab;
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem;
}
.news-close:hover { color: #fff; }

/* ---- Messages ---- */
.msg { padding: 0.6rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.85rem; }
.msg-error { background: #3a1a1a; color: #f88; border: 1px solid #522; }
.msg-success { background: #1a3a1a; color: #8f8; border: 1px solid #252; }
.msg-info { background: #1a2a3a; color: #8cf; border: 1px solid #235; }

/* ---- Quick filter ---- */
.quick-filter-wrap {
  margin-bottom: 0.6rem;
}
.quick-filter-input {
  width: 100%;
  max-width: 320px;
  padding: 0.4rem 0.6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font);
}
.quick-filter-input:focus {
  outline: none;
  border-color: var(--accent);
}
.quick-filter-input::placeholder {
  color: var(--muted);
}

/* ---- Filter bar ---- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
  padding: 0.5rem 0.7rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.82rem;
}
.filter-bar label { color: var(--text-muted); white-space: nowrap; }
.filter-bar select, .filter-input {
  background: var(--bg-body);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
}
.filter-input { width: 10rem; }
.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  margin-left: 0.5rem;
}
.filter-checkbox input[type="checkbox"] { accent-color: var(--accent); }

.site-title a {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: inherit;
}
.site-logo {
  flex-shrink: 0;
  width: calc(28px - 4px * var(--header-progress));
  height: calc(28px - 4px * var(--header-progress));
  object-fit: contain;
  filter: drop-shadow(0 1px 10px rgba(0, 0, 0, 0.45));
}
.header-auth {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.header-auth-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(208, 162, 79, 0.24);
  background: rgba(15, 11, 9, 0.72);
  color: #f0e6d6;
  font-size: 0.82rem;
  font-family: var(--font-sans);
  letter-spacing: 0.01em;
  backdrop-filter: blur(6px);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.header-auth-link:hover {
  color: #fff3de;
  border-color: rgba(226, 185, 111, 0.55);
  background: rgba(31, 22, 16, 0.88);
}
.header-auth-primary {
  background: linear-gradient(180deg, rgba(214, 166, 84, 0.18), rgba(87, 53, 18, 0.22));
  border-color: rgba(208, 162, 79, 0.42);
}
.filter-price-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  color: var(--text-muted);
}
.filter-price-wrap label { margin: 0; }
.filter-price-input {
  width: 4.5rem;
  min-width: 0;
  background: var(--bg-body);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.25rem 0.35rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
}
.filter-price-sep { opacity: 0.7; }
.btn-small {
  padding: 0.2rem 0.45rem;
  font-size: 0.78rem;
}

/* Land (country) multi-select */
.filter-country-wrap {
  position: relative;
  display: inline-block;
}
.filter-country-btn {
  background: var(--bg-body);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
}
.filter-country-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.filter-country-dropdown {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 0.2rem;
  min-width: 12rem;
  max-height: 18rem;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 50;
  padding: 0.4rem;
}
.filter-country-dropdown.open {
  display: block;
}
.filter-country-option {
  display: block;
  padding: 0.25rem 0.4rem;
  cursor: pointer;
  border-radius: 3px;
}
.filter-country-option:hover {
  background: rgba(255,255,255,0.06);
}
.filter-country-option input[type="checkbox"] { accent-color: var(--accent); margin-right: 0.4rem; }
.filter-country-empty { color: var(--text-muted); font-size: 0.85rem; }

.store-filter.filter-bar-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.store-search-wrap { position: relative; display: inline-block; }
.store-search.filter-input { width: 9rem; min-width: 7rem; max-width: 14rem; }
.store-dropdown {
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 100;
  min-width: 100%;
  max-height: 16rem;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 0.15rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.store-dropdown .store-option {
  display: block;
  padding: 0.35rem 0.6rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px solid var(--border);
}
.store-dropdown .store-option:last-child { border-bottom: none; }
.store-dropdown .store-option:hover {
  background: rgba(255,255,255,0.06);
  color: var(--accent);
}

/* ---- Sortable table headers ---- */
.product-table thead th a {
  color: var(--text-muted);
  text-decoration: none;
}
.product-table thead th a:hover {
  color: var(--accent);
}
.product-table thead th.sorted a {
  color: var(--accent);
  font-weight: 600;
}

/* ---- Editable scores ---- */
.editable-score {
  cursor: pointer;
  transition: background 0.15s;
}
.editable-score:hover {
  background: rgba(255,255,255,0.08);
  color: var(--accent);
}

/* ---- Sidebar count badges ---- */
.sb-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.7;
}
.sb-diff-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sb-diff-list li { margin: 0; }
.sb-diff-list li.sb-active > a {
  color: var(--accent);
  font-weight: bold;
}

/* ---- Loading ---- */
.loading { text-align: center; padding: 2rem; color: var(--text-muted); }

/* ---- Responsive ---- */
@media (max-width: 800px) {
  :root {
    --header-h: 56px;
    --header-h-scrolled: 56px;
  }
  #header {
    height: 56px;
    align-items: stretch;
  }
  #header.scrolled { height: 56px; }
  .header-inner {
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
  }
  #header h1 { font-size: 1.2rem; }
  #header.scrolled h1 { font-size: 1.2rem; }
  .hamburger-btn { display: block; }
  .sidebar-close { display: block; }
  .header-auth {
    gap: 0.3rem;
  }
  .header-auth-link {
    min-height: 30px;
    padding: 0.22rem 0.5rem;
    font-size: 0.74rem;
  }
  .site-logo {
    width: 22px;
    height: 22px;
  }

  /* Sidebar: hidden by default, shown as overlay */
  #wrapper { flex-direction: column; }
  #sidebar {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    min-width: 100%;
    height: calc(100vh - 56px);
    z-index: 200;
    background: var(--bg-sidebar);
    border-right: none;
    overflow-y: auto;
    padding: 0.5rem 0;
    flex-direction: column;
  }
  #sidebar.header-scrolled {
    top: 56px;
    height: calc(100vh - 56px);
  }
  body.sidebar-open #sidebar {
    display: block;
  }
  .sb-section { padding: 0.5rem 1rem; border-bottom: 1px solid var(--border-light); }
  .sb-section a { padding: 0.4rem 0; min-height: 44px; display: flex; align-items: center; }

  /* Sidebar close button */
  .sidebar-close {
    position: absolute;
    top: 0.5rem;
    right: 0.8rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.3rem;
    z-index: 201;
  }
  .sidebar-close:hover { color: var(--accent); }

  /* Main content */
  #app { padding: 0.8rem; }
  h1 { font-size: 1.3rem; }

  /* Product table: hide score columns */
  .product-table .col-score { display: none; }
  .product-table .col-year { width: 3em; font-size: 0.75rem; }
  .product-table th { font-size: 0.7rem; padding: 0.3rem 0.25rem; }
  .product-table td { padding: 0.4rem 0.25rem; font-size: 0.8rem; }
  .product-name-main { font-size: 0.85rem; }
  .product-meta-line { font-size: 0.72rem; }

  /* Filter bar */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
    padding: 0.4rem;
  }
  .filter-bar label { min-height: 44px; display: flex; align-items: center; }
  .filter-bar select, .filter-input { min-height: 44px; font-size: 0.9rem; width: 100%; }
  .filter-country-btn { min-height: 44px; width: 100%; text-align: left; }
  .filter-country-dropdown {
    position: fixed;
    left: 0.5rem;
    right: 0.5rem;
    top: auto;
    bottom: 1rem;
    max-height: 60vh;
    width: auto;
    min-width: auto;
  }
  .filter-country-option { min-height: 44px; display: flex; align-items: center; }
  .filter-checkbox { min-height: 44px; }

  /* Tabs */
  .tabs { gap: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tabs a { padding: 0.5rem 0.6rem; font-size: 0.82rem; white-space: nowrap; min-height: 44px; display: flex; align-items: center; }

  /* Detail page */
  .detail { padding: 0.8rem; }
  .detail-header { flex-direction: column; align-items: center; gap: 0.8rem; }
  .detail-image, .detail-image-placeholder { width: 100%; max-width: 200px; height: auto; min-height: 160px; min-width: auto; }
  .detail-grid { gap: 0.2rem 0.8rem; font-size: 0.85rem; }
  .ratings-grid { grid-template-columns: repeat(3, 1fr); }
  .external-links { gap: 0.3rem; }
  .btn-outline { min-height: 44px; display: inline-flex; align-items: center; }
  .btn-sb { min-height: 44px; display: inline-flex; align-items: center; }

  /* Pagination */
  .pagination { flex-wrap: wrap; }
  .pagination a, .pagination span { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }

  /* Search bar */
  .search-bar { flex-direction: column; }
  .search-bar input { min-height: 44px; }
  .sb-search input { min-height: 44px; }
  .sb-search button { min-height: 44px; }
}
