:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #637083;
  --border: #e1e5eb;
  --accent: #1a6b4f;
  --accent-hover: #145740;
  --accent-soft: #e5f2ec;
  --danger: #b3261e;
  --warn-bg: #fdf1e7;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.5; }
a { color: var(--accent); }
img { max-width: 100%; }
h1 { font-size: 1.7rem; line-height: 1.25; margin: 0.4em 0; }
h2 { font-size: 1.2rem; margin: 1.6em 0 0.6em; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.meta { color: var(--muted); font-size: 0.875rem; }

/* header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.header-row { display: flex; align-items: center; gap: 20px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
.logo { font-weight: 700; font-size: 1.25rem; text-decoration: none; color: var(--text); display: inline-flex; align-items: center; gap: 9px; }
.logo span { font-weight: 400; color: var(--muted); font-size: 0.9rem; }
.logo-mark { width: 34px; height: 34px; color: var(--accent); flex: none; }
.logo .logo-word { font-size: 1.35rem; letter-spacing: -0.02em; white-space: nowrap; color: var(--text); font-weight: 400; }
.logo-word b { font-weight: 800; }
.logo .logo-word span { font-size: 1.15rem; color: var(--muted); }
.main-nav { display: flex; gap: 16px; margin-left: auto; }
.main-nav a { text-decoration: none; color: var(--text); font-size: 0.95rem; }
.main-nav a:hover { color: var(--accent); }

.search-bar { display: flex; flex: 1; min-width: 220px; max-width: 560px; }
.search-bar input { flex: 1; min-width: 0; padding: 10px 14px; border: 1px solid var(--border); border-right: 0; border-radius: var(--radius) 0 0 var(--radius); font-size: 1rem; }
.search-bar button { border-radius: 0 var(--radius) var(--radius) 0; }
.search-bar.big { max-width: 640px; margin: 24px auto 0; }
.search-bar.big input { padding: 14px 18px; font-size: 1.1rem; }

/* knapper og felter */
button, .button {
  display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: var(--radius);
  padding: 10px 18px; font-size: 0.95rem; cursor: pointer; text-decoration: none; white-space: nowrap;
}
button:hover, .button:hover { background: var(--accent-hover); }
button.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
button.secondary:hover { background: var(--bg); }
button.danger { background: var(--surface); color: var(--danger); border: 1px solid var(--border); }
button.small { padding: 5px 10px; font-size: 0.8rem; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 0.875rem; color: var(--muted); margin-bottom: 14px; flex: 1; }
.field input, .field select, .field textarea {
  font: inherit; color: var(--text); padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); width: 100%;
}
.check { display: flex; gap: 8px; align-items: center; font-size: 0.9rem; margin-bottom: 14px; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { font-size: 0.875rem; color: var(--muted); margin-bottom: 4px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > .field { min-width: 200px; }

/* forside */
.hero { text-align: center; padding: 56px 0 24px; }
.hero h1 { font-size: 2.1rem; }
.hero p { color: var(--muted); max-width: 600px; margin: 0 auto; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; text-decoration: none; color: var(--text); }
.chip span { color: var(--muted); font-size: 0.8rem; }
.chip:hover { border-color: var(--accent); }

/* søgning */
.search-layout { display: grid; grid-template-columns: 240px 1fr; gap: 28px; padding: 24px 0; }
.filters { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; align-self: start; position: sticky; top: 80px; }
.price-range { display: flex; gap: 8px; }
.price-range input { width: 100%; min-width: 0; padding: 8px; border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.result-count { margin-top: 0; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--text); display: flex; flex-direction: column; transition: box-shadow 0.15s; }
.card:hover { box-shadow: 0 4px 14px rgba(20, 30, 50, 0.08); }
.card-img { aspect-ratio: 1; background: #fff; display: flex; align-items: center; justify-content: center; padding: 12px; }
.card-img img { max-height: 100%; object-fit: contain; }
.card-body { padding: 12px; border-top: 1px solid var(--border); flex: 1; }
.card-body h3 { font-size: 0.9rem; font-weight: 500; margin: 0 0 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.price { font-weight: 700; font-size: 1.05rem; margin: 0; }
.card .meta { margin: 4px 0 0; }
.stock.in { color: var(--accent); }
.stock.out { color: var(--muted); }
.pager { display: flex; gap: 16px; justify-content: center; align-items: center; margin: 28px 0; }
.empty { background: var(--surface); padding: 24px; border-radius: var(--radius); border: 1px solid var(--border); }

/* produkt */
.crumbs { margin: 20px 0 8px; font-size: 0.875rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.product { display: grid; grid-template-columns: minmax(0, 380px) 1fr; gap: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.product-img { display: flex; align-items: center; justify-content: center; }
.product-img img { max-height: 380px; object-fit: contain; }
.lead-price { font-size: 1.5rem; font-weight: 700; margin: 12px 0; }
.lead-price span { font-size: 1rem; font-weight: 400; color: var(--muted); }
.desc { color: var(--muted); }
.offers { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.offers th, .offers td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.offers th { font-size: 0.8rem; color: var(--muted); font-weight: 500; background: var(--bg); }
.offers tr:last-child td { border-bottom: 0; }

.merchant-list { list-style: none; padding: 0; columns: 2; }
.merchant-list li { padding: 6px 0; break-inside: avoid; }
.prose { max-width: 720px; padding: 24px 0 48px; }

/* footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); margin-top: 56px; padding: 28px 0; font-size: 0.875rem; color: var(--muted); }
.site-footer p { margin: 0 0 4px; }
.site-footer strong { color: var(--text); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; }

/* admin */
.admin main { padding-bottom: 48px; }
.admin-header { background: #1c2430; }
.admin-header .logo, .admin-header .main-nav a { color: #fff; }
.admin-header .logo span { color: #a8b3c2; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin: 20px 0; }
.panel h2 { margin-top: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 24px; }
.stats div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; color: var(--muted); font-size: 0.875rem; }
.stats span { display: block; font-size: 1.6rem; font-weight: 700; color: var(--text); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; background: var(--surface); }
.admin-table th, .admin-table td { padding: 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.admin-table th { color: var(--muted); font-weight: 500; }
.admin-table .src { word-break: break-all; max-width: 320px; }
.admin-table tr.inactive { opacity: 0.5; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions form { margin: 0; }
.bad { color: var(--danger); }
.flash { padding: 10px 14px; border-radius: 8px; margin-top: 16px; background: var(--accent-soft); }
.flash.error { background: var(--warn-bg); color: var(--danger); }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist .mark { display: inline-block; width: 22px; font-weight: 700; }
.checklist .ok .mark { color: var(--accent); }
.checklist .todo .mark { color: var(--muted); }
code { background: var(--bg); padding: 4px 8px; border-radius: 6px; word-break: break-all; }

@media (max-width: 800px) {
  .search-layout { grid-template-columns: 1fr; }
  .filters { position: static; }
  .product { grid-template-columns: 1fr; padding: 16px; }
  .footer-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .main-nav { margin-left: 0; }
  .merchant-list { columns: 1; }
  .offers thead { display: none; }
  .offers, .offers tbody, .offers tr, .offers td { display: block; width: 100%; }
  .offers tr { border-bottom: 1px solid var(--border); padding: 8px 0; }
  .offers td { border: 0; padding: 4px 14px; }
  .offers td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 0.8rem; }
  .admin-table { display: block; overflow-x: auto; }
}
