:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f0efea;
  --ink: #17201c;
  --ink-soft: #5c6660;
  --line: #e2e0d8;
  --accent: #146b4a;
  --accent-soft: #e6f1ea;
  --accent-ink: #0d4a33;
  --warn: #9a3d16;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(23, 32, 28, .06), 0 8px 24px rgba(23, 32, 28, .05);
  --max: 900px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12150f;
    --surface: #1b1f19;
    --surface-2: #232821;
    --ink: #edefe9;
    --ink-soft: #a3aca4;
    --line: #2d332c;
    --accent: #5fc79a;
    --accent-soft: #1d2f26;
    --accent-ink: #9fe3c2;
    --warn: #e79a6b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Topp ---------- */
.site-head {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-head .wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  letter-spacing: -.01em;
  text-decoration: none;
  font-size: 17px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  flex: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-mark { color: #10231a; }
}

.head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 560;
  text-decoration: none;
  cursor: pointer;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
}

.btn:active { transform: scale(.98); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-primary { color: #10231a; }
}

.btn-ghost { background: transparent; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 14px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ---------- Hero och sök ---------- */
.hero { padding: 26px 0 8px; }
.hero h1 {
  margin: 0 0 6px;
  font-size: clamp(24px, 6vw, 34px);
  letter-spacing: -.02em;
  line-height: 1.15;
}
.hero p { margin: 0; color: var(--ink-soft); }

.searchbar {
  position: sticky;
  top: 60px;
  z-index: 15;
  background: var(--bg);
  padding: 14px 0 8px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  box-shadow: var(--shadow);
}

.search-field input {
  border: 0;
  background: transparent;
  outline: none;
  width: 100%;
  min-height: 50px;
  font-size: 16px;
}

.search-field svg { flex: none; opacity: .5; }

.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 16px 6px;
  margin: 0 -16px;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.chip .count { opacity: .55; margin-left: 6px; font-variant-numeric: tabular-nums; }

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 10px;
}
.muted { color: var(--ink-soft); font-size: 14px; }

select.plain {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
}

/* ---------- Kort ---------- */
.cards { display: grid; gap: 12px; padding-bottom: 32px; }

@media (min-width: 680px) {
  .cards { grid-template-columns: 1fr 1fr; }
}

.card {
  display: flex;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .1s ease, border-color .15s ease;
}
.card:active { transform: scale(.995); }

.logo {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  flex: none;
  object-fit: contain;
  background: var(--surface-2);
  padding: 4px;
}

.logo-fallback {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 20px;
}

.card-body { min-width: 0; flex: 1; }
.card h3 {
  margin: 0 0 2px;
  font-size: 16.5px;
  letter-spacing: -.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card .meta {
  color: var(--ink-soft);
  font-size: 13.5px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.dot { opacity: .4; }
.card p {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tag {
  display: inline-block;
  background: var(--surface-2);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.badge-featured {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}

/* ---------- Företagssida ---------- */
.detail { padding: 8px 0 40px; }

.detail-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin: 10px 0 18px;
}
.detail-head .logo, .detail-head .logo-fallback { width: 72px; height: 72px; border-radius: 16px; font-size: 26px; }
.detail-head h1 { margin: 0 0 4px; font-size: 24px; letter-spacing: -.02em; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.panel h2 {
  margin: 0 0 10px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-soft);
}
.panel p { margin: 0 0 10px; white-space: pre-wrap; }
.panel p:last-child { margin-bottom: 0; }

.contact-list { display: grid; gap: 2px; }
.contact-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.contact-row:last-child { border-bottom: 0; }
.contact-row .label { color: var(--ink-soft); font-size: 13px; }
.contact-row .value { font-weight: 550; word-break: break-word; }
.contact-icon {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: var(--surface-2); font-size: 16px;
}

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.actions .btn { min-height: 48px; }
@media (max-width: 420px) { .actions { grid-template-columns: 1fr; } }

.social-links { display: flex; flex-wrap: wrap; gap: 8px; }
.social-links a {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; text-decoration: none; font-size: 14px;
}

/* ---------- Formulär ---------- */
.form { padding: 8px 0 60px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 560; margin-bottom: 6px; font-size: 14.5px; }
.field .hint { color: var(--ink-soft); font-size: 13px; margin-top: 4px; }

.field input, .field select, .field textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 48px;
  outline: none;
}
.field textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.grid-2 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

fieldset { border: 0; padding: 0; margin: 0 0 6px; }
legend {
  font-size: 13px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-soft); padding: 0; margin-bottom: 10px;
}

.hp { position: absolute; left: -9999px; opacity: 0; }

.notice {
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 14.5px;
}
.notice-ok { background: var(--accent-soft); color: var(--accent-ink); }
.notice-err { background: #fdeee6; color: var(--warn); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .notice-err { background: #35211a; }
}

.logo-picker { display: flex; align-items: center; gap: 12px; }
.logo-preview {
  width: 60px; height: 60px; border-radius: 12px;
  background: var(--surface-2); object-fit: contain; padding: 4px;
}

.empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--ink-soft);
}

.skeleton {
  height: 88px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 37%, var(--surface) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

.site-foot {
  border-top: 1px solid var(--line);
  padding: 22px 0 34px;
  color: var(--ink-soft);
  font-size: 13.5px;
  text-align: center;
}
.site-foot a { color: var(--ink-soft); }

.back {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-soft); text-decoration: none;
  font-size: 14px; padding: 12px 0; min-height: 44px;
}

dialog {
  border: 0; border-radius: 16px; padding: 18px;
  background: var(--surface); color: var(--ink);
  max-width: 420px; width: calc(100% - 32px);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0,0,0,.45); }
