/* ==========================================================================
   orgnummer.no — designsystem
   Ultraminimalistisk: lys nøytral bakgrunn, hvite flater uten rammer, piller,
   nesten monokromt. Geist til tekst, Geist Mono til tall og etiketter.
   ========================================================================== */

@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-var-ext.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+1E00-1EFF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Geist Mono";
  src: url("fonts/GeistMono-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Geist Mono";
  src: url("fonts/GeistMono-var-ext.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+1E00-1EFF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #f4f4f2;
  --surface: #ffffff;
  --surface-2: #f4f4f2;
  --surface-3: #e9e9e6;
  --text: #171717;
  --text-2: #666666;
  --text-3: #6f6f6f;
  --border: rgba(0, 0, 0, 0.05);
  --border-strong: rgba(0, 0, 0, 0.1);

  --accent: #d92d20;
  --accent-soft: rgba(217, 45, 32, 0.08);

  --danger: #b42318;
  --danger-soft: rgba(180, 35, 24, 0.08);
  --warn: #935f00;
  --warn-soft: rgba(147, 95, 0, 0.09);
  --ok: #157f3d;
  --ok-soft: rgba(21, 127, 61, 0.09);

  --inverse-bg: #171717;
  --inverse-text: #fafafa;

  --ring: rgba(0, 0, 0, 0.1);
  --halo-a: rgba(96, 118, 205, 0.055);
  --halo-b: rgba(148, 120, 210, 0.04);
  --shadow-overlay: 0 4px 12px rgba(0, 0, 0, 0.04), 0 24px 60px rgba(0, 0, 0, 0.1);

  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --chevron: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236f6f6f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0e0e0e;
  --surface: #191919;
  --surface-2: #0e0e0e;
  --surface-3: #262626;
  --text: #ededed;
  --text-2: #a3a3a3;
  --text-3: #9a9a9a;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);

  --accent: #f4645a;
  --accent-soft: rgba(244, 100, 90, 0.12);

  --danger: #f88b81;
  --danger-soft: rgba(248, 139, 129, 0.12);
  --warn: #e3b341;
  --warn-soft: rgba(227, 179, 65, 0.11);
  --ok: #6ccb8b;
  --ok-soft: rgba(108, 203, 139, 0.12);

  --inverse-bg: #fafafa;
  --inverse-text: #171717;

  --ring: rgba(255, 255, 255, 0.16);
  --halo-a: rgba(88, 112, 220, 0.1);
  --halo-b: rgba(132, 106, 222, 0.07);
  --shadow-overlay: 0 4px 12px rgba(0, 0, 0, 0.4), 0 24px 60px rgba(0, 0, 0, 0.55);

  --chevron: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9a9a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");

  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e0e;
    --surface: #191919;
    --surface-2: #0e0e0e;
    --surface-3: #262626;
    --text: #ededed;
    --text-2: #a3a3a3;
    --text-3: #9a9a9a;
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.14);

    --accent: #f4645a;
    --accent-soft: rgba(244, 100, 90, 0.12);

    --danger: #f88b81;
    --danger-soft: rgba(248, 139, 129, 0.12);
    --warn: #e3b341;
    --warn-soft: rgba(227, 179, 65, 0.11);
    --ok: #6ccb8b;
    --ok-soft: rgba(108, 203, 139, 0.12);

    --inverse-bg: #fafafa;
    --inverse-text: #171717;

    --ring: rgba(255, 255, 255, 0.16);
    --halo-a: rgba(88, 112, 220, 0.1);
    --halo-b: rgba(132, 106, 222, 0.07);
    --shadow-overlay: 0 4px 12px rgba(0, 0, 0, 0.4), 0 24px 60px rgba(0, 0, 0, 0.55);

    --chevron: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9a9a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");

    color-scheme: dark;
  }
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

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

[hidden] { display: none !important; }

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection { background: var(--surface-3); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header { background: transparent; }

.header-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-tld { color: var(--text-3); font-weight: 500; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   Knapper
   -------------------------------------------------------------------------- */

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  background: var(--surface);
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.icon-btn:hover { background: var(--surface-3); }
.icon-btn:active { transform: scale(0.94); }

.icon-btn.open { background: var(--inverse-bg); color: var(--inverse-text); }

.text-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  padding: 7px 12px;
  border-radius: 999px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.text-btn:hover { background: var(--surface); color: var(--text); }

.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease,
              transform 0.15s ease;
}

.pill-btn:active { transform: scale(0.97); }

.pill-btn.primary { background: var(--inverse-bg); color: var(--inverse-text); }
.pill-btn.primary:hover { opacity: 0.85; }
.pill-btn.primary.copied { background: var(--ok); color: #fff; opacity: 1; }

.pill-btn.ghost {
  border: 1px solid var(--border-strong);
  color: var(--text);
  background: var(--surface);
}

.pill-btn.ghost:hover { background: var(--surface-2); }

.pill-btn.ghost.faved {
  color: var(--accent);
  border-color: transparent;
  background: var(--accent-soft);
}

/* --------------------------------------------------------------------------
   Innstillinger
   -------------------------------------------------------------------------- */

.settings-wrap { position: relative; }

.menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 296px;
  max-height: min(560px, calc(100dvh - 90px));
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-overlay);
  padding: 20px;
  z-index: 60;
  transform-origin: top right;
  animation: menu-in 0.16s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes menu-in {
  from { opacity: 0; transform: scale(0.96) translateY(-4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.menu-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: 10px;
}

.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.menu-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

.menu-select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background-color: var(--surface-2);
  background-image: var(--chevron);
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 15px;
  border: none;
  border-radius: 12px;
  padding: 11px 44px 11px 14px;
  cursor: pointer;
}

.menu-select.num { font-family: var(--font-mono); font-size: 13px; }

.opt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 8px;
  border: none;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13.5px;
  font-weight: 500;
  text-align: center;
  color: var(--text-2);
  transition: background-color 0.13s ease, color 0.13s ease, transform 0.13s ease;
}

.opt-btn .icon { width: 14px; height: 14px; }

.opt-btn:hover { background: var(--surface-3); color: var(--text); }
.opt-btn:active { transform: scale(0.97); }

.opt-btn.active {
  background: var(--inverse-bg);
  color: var(--inverse-text);
  font-weight: 600;
}

.menu-divider {
  height: 1px;
  background: var(--border);
  margin: 18px -20px;
}

.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 14px;
  line-height: 1.35;
  cursor: pointer;
  user-select: none;
}

.switch {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 40px;
  height: 23px;
  border-radius: 999px;
  background: var(--surface-3);
  position: relative;
  cursor: pointer;
  transition: background-color 0.18s ease;
  margin: 0;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2.5px;
  left: 2.5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  transition: transform 0.18s ease;
}

.switch:checked { background: var(--inverse-bg); }
.switch:checked::after { transform: translateX(17px); background: var(--inverse-text); }

.menu-info {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.7;
  color: var(--text-3);
}

.menu-info a { color: var(--text-2); text-decoration: none; }
.menu-info a:hover { text-decoration: underline; }

.menu-year { margin-top: 6px; }

/* --------------------------------------------------------------------------
   Hero + søk
   -------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 20px;
  flex: 1;
}

.hero {
  text-align: center;
  padding: clamp(48px, 15vh, 150px) 0 8px;
}

.search-wrap {
  position: relative;
  margin: 0 auto;
  text-align: left;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 58px;
  padding: 0 12px 0 22px;
  background: var(--surface);
  border-radius: 999px;
  transition: box-shadow 0.15s ease, background-color 0.25s ease;
}

.search-box:focus-within { box-shadow: 0 0 0 2px var(--ring); }

/* Gemini-aktig gradient bak feltet – puster rolig når feltet er ufokusert */

.search-wrap::before {
  content: "";
  position: absolute;
  inset: -90px -50px;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(46% 58% at 32% 50%, var(--halo-a), transparent 72%),
    radial-gradient(46% 58% at 68% 50%, var(--halo-b), transparent 72%);
  filter: blur(32px);
  opacity: 0.65;
}

@media (prefers-reduced-motion: no-preference) {
  .search-wrap:not(:focus-within)::before {
    animation: halo 8s ease-in-out infinite alternate;
  }
}

@keyframes halo {
  from { opacity: 0.35; transform: scale(0.97); }
  to { opacity: 0.75; transform: scale(1.03); }
}

/* Skrivemaskin-placeholder */

.ph-anim {
  position: absolute;
  left: 54px;
  right: 56px;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  font-size: 16.5px;
  color: var(--text-3);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
}

.ph-anim::after {
  content: "";
  width: 1.5px;
  height: 1.2em;
  margin-left: 2px;
  background: var(--text-3);
  flex-shrink: 0;
  animation: caret-blink 1.1s steps(2, start) infinite;
}

.ph-anim.typing::after { animation: none; opacity: 1; }

.search-box:focus-within .ph-anim::after { display: none; }

#searchInput:not(:placeholder-shown) ~ .ph-anim { display: none; }

@keyframes caret-blink {
  to { opacity: 0; }
}

.search-icon { color: var(--text-3); width: 20px; height: 20px; }

#searchInput {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  padding: 0; /* nuller UA-padding så teksten treffer overlayets posisjon */
  margin: 0;
  font: inherit;
  font-size: 16.5px;
  color: var(--text);
  outline: none;
  height: 100%;
}

#searchInput::placeholder { color: var(--text-3); }
#searchInput::-webkit-search-cancel-button { display: none; }

.clear-btn { width: 36px; height: 36px; background: transparent; color: var(--text-3); }
.clear-btn:hover { background: var(--surface-2); color: var(--text); }
.clear-btn .icon { width: 17px; height: 17px; }

.spinner {
  width: 17px;
  height: 17px;
  border: 2px solid var(--surface-3);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.search-box.loading .spinner { opacity: 1; }

@keyframes spin { to { transform: rotate(360deg); } }

/* Autocomplete + palett */

.ac-list {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 8px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-overlay);
  z-index: 40;
  max-height: min(440px, 55vh);
  overflow-y: auto;
  animation: ac-in 0.14s ease;
}

@keyframes ac-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.ac-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 14px;
  border-radius: 12px;
  cursor: pointer;
}

.ac-item[aria-selected="true"] { background: var(--surface-2); }

.ac-kbd {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--text-3);
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--surface-2);
  pointer-events: none;
}

.ac-item[aria-selected="true"] .ac-kbd { background: var(--surface-3); }

@media (hover: hover) and (pointer: fine) {
  .ac-item { padding-right: 58px; }
}

.ac-name {
  font-weight: 550;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ac-meta {
  font-size: 12.5px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 7px;
}

.ac-meta .orgnr { color: var(--text); font-size: 12.5px; }

.tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 2px 8px;
  flex-shrink: 0;
}

.ac-item[aria-selected="true"] .tag { background: var(--surface-3); }

.ac-note {
  padding: 13px 16px;
  font-size: 14px;
  color: var(--text-2);
  text-align: center;
}

.ac-note.error { color: var(--danger); }

.ac-note-head {
  padding: 12px 14px 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
}

/* --------------------------------------------------------------------------
   Lister: favoritter + nylige
   -------------------------------------------------------------------------- */

.list-section { margin-top: 44px; }
.list-section:last-of-type { margin-bottom: 64px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 10px;
}

.section-head h2 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 7px;
}

.section-icon { width: 13px; height: 13px; }

.heart-filled { fill: var(--accent); stroke: var(--accent); }

.rows {
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border-radius: 20px;
  transition: background-color 0.25s ease;
}

.row {
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: 14px;
  transition: background-color 0.15s ease;
}

.row:hover { background: var(--surface-2); }

.row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  padding: 12px 8px 12px 15px;
  border-radius: 14px;
}

.row-name {
  font-weight: 550;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-meta {
  font-size: 12.5px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 7px;
}

.row-meta .orgnr { color: var(--text); font-size: 12.5px; }

.row-actions {
  display: flex;
  align-items: center;
  padding-right: 7px;
}

.row-actions .icon-btn {
  width: 36px;
  height: 36px;
  background: transparent;
  color: var(--text-3);
}

.row-actions .icon-btn:hover { background: var(--surface-3); color: var(--text); }
.row-actions .icon-btn .icon { width: 18px; height: 18px; }

.icon-btn.heart-btn.active { color: var(--accent); }
.icon-btn.heart-btn.active .icon { fill: var(--accent); }

.icon-btn.heart-btn.pop .icon { animation: heart-pop 0.35s ease; }

@keyframes heart-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.icon-btn.copied { color: var(--ok) !important; }

/* --------------------------------------------------------------------------
   Detaljvisning (dialog)
   -------------------------------------------------------------------------- */

.detail:focus, .detail:focus-visible { outline: none; }

.detail {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
  width: min(560px, calc(100vw - 32px));
  max-height: min(84dvh, 720px);
  box-shadow: var(--shadow-overlay);
  overscroll-behavior: contain;
  overflow: hidden;
}

.detail-inner {
  overflow-y: auto;
  max-height: inherit;
  padding: 28px;
}

.detail::backdrop {
  background: rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.detail[open] { animation: dialog-in 0.2s cubic-bezier(0.2, 0.9, 0.3, 1); }

@keyframes dialog-in {
  from { opacity: 0; transform: scale(0.98) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.detail.closing { animation: dialog-out 0.16s ease forwards; }
.detail.closing::backdrop { animation: backdrop-out 0.16s ease forwards; }

@keyframes dialog-out {
  to { opacity: 0; transform: scale(0.98) translateY(6px); }
}

@keyframes backdrop-out {
  to { opacity: 0; }
}

.detail-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  padding-right: 44px;
}

.badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge.neutral { background: var(--surface-2); color: var(--text-2); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }

.detail-name {
  margin: 0;
  font-size: clamp(1.3rem, 4.5vw, 1.6rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
  overflow-wrap: anywhere;
  padding-right: 44px;
}

.detail-favicon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: #fff;
  object-fit: contain;
  margin-right: 10px;
  vertical-align: -3px;
  display: inline-block;
}

.detail-sub {
  margin: 6px 0 0;
  color: var(--text-2);
  font-size: 14px;
}

.orgnr-card {
  margin-top: 22px;
  padding: 18px 20px;
  background: var(--surface-2);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.orgnr-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: 4px;
}

.orgnr-value {
  font-size: clamp(1.3rem, 5.5vw, 1.6rem);
  font-weight: 600;
  line-height: 1.1;
}

.orgnr-actions { display: flex; gap: 8px; }

.heart-action { width: 44px; padding: 0; }
.heart-action .icon { width: 20px; height: 20px; }
.heart-action.faved .icon { fill: var(--accent); }

.facts {
  margin-top: 26px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 24px;
}

.fact-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: 4px;
}

.fact-value { font-size: 14.5px; line-height: 1.5; overflow-wrap: anywhere; }

.fact-value .link-btn {
  color: var(--text);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
  cursor: pointer;
  transition: text-decoration-color 0.15s ease;
}

.fact-value .link-btn:hover { text-decoration-color: var(--text); }

.fact.wide { grid-column: 1 / -1; }

.sub-links { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.sub-links .link-btn { text-align: left; }
.sub-links .show-all { color: var(--text-3); }

.detail-links {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
}

.detail-links a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
  padding: 4px 0;
  transition: text-decoration-color 0.15s ease;
}

.detail-links a:hover { text-decoration-color: var(--text); }
.detail-links .icon { width: 14px; height: 14px; }

.detail-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--surface-2);
  color: var(--text-2);
}

.detail-close:hover { background: var(--surface-3); color: var(--text); }

/* Skeleton */

.skeleton {
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.detail-error {
  text-align: center;
  padding: 28px 0 8px;
  color: var(--text-2);
}

.detail-error .pill-btn { margin-top: 18px; }

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.toast {
  position: fixed;
  inset: auto; /* nuller popover-UA-styling (inset: 0) */
  margin: 0;
  border: 0;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translate(-50%, 16px);
  background: var(--inverse-bg);
  color: var(--inverse-text);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: var(--shadow-overlay);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 100;
  max-width: calc(100vw - 40px);
  display: flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
}

.toast .toast-text { overflow: hidden; text-overflow: ellipsis; }

.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }

.toast-action {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: inherit;
  opacity: 0.7;
  text-decoration: underline;
  text-underline-offset: 3px;
  flex-shrink: 0;
  transition: opacity 0.15s ease;
}

.toast-action:hover { opacity: 1; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  text-align: center;
  padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--text-3);
}

.site-footer p { margin: 0; }
.site-footer a { color: var(--text-2); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   Print: åpen detaljvisning skrives ut som et rent dokument
   -------------------------------------------------------------------------- */

@media print {
  .header-actions, .site-footer, .toast, .ac-list, .spinner {
    display: none !important;
  }

  body { background: #fff !important; color: #000 !important; }

  body:has(.detail[open]) .hero,
  body:has(.detail[open]) .list-section { display: none !important; }

  .detail {
    position: static !important;
    width: 100% !important;
    max-width: none !important;
    max-height: none !important;
    box-shadow: none !important;
    border: none !important;
    animation: none !important;
    overflow: visible !important;
  }

  .detail::backdrop { display: none !important; }

  .detail-inner {
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
  }

  .detail-close, .orgnr-actions { display: none !important; }
}

/* --------------------------------------------------------------------------
   Mobil
   -------------------------------------------------------------------------- */

@media (max-width: 600px) {
  .hero { padding-top: 32px; }

  .search-box { height: 54px; padding-left: 20px; }

  .ph-anim { left: 52px; }

  .detail {
    width: 100vw;
    max-width: none;
    margin: auto 0 0;
    max-height: 92dvh;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
  }

  .detail[open] { animation: sheet-in 0.26s cubic-bezier(0.2, 0.9, 0.3, 1); }

  @keyframes sheet-in {
    from { opacity: 0.5; transform: translateY(48px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .detail.closing { animation: sheet-out 0.16s ease forwards; }

  @keyframes sheet-out {
    to { opacity: 0; transform: translateY(40px); }
  }

  .detail-inner { padding: 24px 20px calc(28px + env(safe-area-inset-bottom)); }

  .facts { grid-template-columns: 1fr; gap: 16px; }

  .orgnr-card { padding: 16px; }

  .row-main { padding-left: 13px; }

  .menu { width: min(296px, calc(100vw - 32px)); }
}
