/* ================================================================
   Nora Signal — Gjenbrukbare komponenter: knapper, Spør Nora, toggle, modal, toast, pills, slider
   Utledet fra samples/sample2.html · Profilhåndbok v1.0
   ================================================================ */

/* Knapper */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 6px;
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .15s; border: none; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .45; cursor: default; }
.btn-primary:disabled:hover { background: var(--accent); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-secondary:disabled { opacity: .45; color: var(--text-tertiary); cursor: default; }
.btn-secondary:disabled:hover { background: var(--surface); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg); }

/* Underfaner (Firmasøk/Lagrede søk, Overvåkning, produktsider) */
.subtabs {
  display: inline-flex; gap: 3px; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 9px; padding: 3px; margin-bottom: 16px;
}
.subtab {
  border: none; background: transparent; font-family: inherit;
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  padding: 7px 14px; border-radius: 6px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; transition: all .15s;
}
.subtab:hover { color: var(--text); }
.subtab.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.subtab .nav-count { background: var(--bg); }
.subtab.active .nav-count { background: var(--surface); }

/* Klikkbart personnavn — åpner personprofilen */
.p-link { cursor: pointer; }
.p-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* Spør Nora */
.nora-ask {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  margin-bottom: 16px; transition: background .3s;
}
.nora-ask-row { display: flex; align-items: center; gap: 12px; }
.nora-spark {
  width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
  background: var(--accent-light); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.nora-spark svg { width: 18px; height: 18px; }
.nora-ask input {
  flex: 1; border: none; background: transparent;
  font-family: inherit; font-size: 14px; color: var(--text);
}
.nora-ask input:focus { outline: none; }
.nora-ask input::placeholder { color: var(--text-tertiary); }
.nora-response {
  display: none; margin-top: 12px; padding: 12px 14px;
  background: var(--accent-light); border-radius: 8px;
  font-size: 13px; color: var(--text); line-height: 1.6;
}
.nora-response.show { display: block; }
.nora-response strong { color: var(--accent); }

/* Avkryssing i tabell */
.rowcheck { display: flex; }
.rowcheck input { display: none; }

/* Infoboks (compliance) */
.infobox {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--blue-light); border-radius: 8px;
  padding: 12px 14px; font-size: 12.5px; color: var(--text-secondary);
  line-height: 1.6; margin-bottom: 16px;
}
.infobox svg { width: 16px; height: 16px; color: var(--blue); flex-shrink: 0; margin-top: 2px; }
.infobox strong { color: var(--text); font-weight: 600; }

/* Toggle */
.toggle-wrap { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-secondary); cursor: pointer; }
.toggle { position: relative; width: 34px; height: 20px; flex-shrink: 0; }
.toggle input { display: none; }
.toggle-track {
  position: absolute; inset: 0; border-radius: 10px;
  background: var(--border); transition: background .15s;
}
.toggle-knob {
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.15);
  transition: transform .15s;
}
.toggle input:checked ~ .toggle-track { background: var(--accent); }
.toggle input:checked ~ .toggle-knob { transform: translateX(14px); }

/* Personer-fane */
.person-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.pill {
  padding: 6px 13px; border-radius: 16px; font-size: 12.5px; font-weight: 500;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-secondary); cursor: pointer; transition: all .15s;
}
.pill:hover { border-color: var(--accent); color: var(--accent); }
.pill.active { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 16px);
  z-index: 200; background: var(--sb-bg); color: #fff;
  font-size: 13px; font-weight: 500;
  padding: 11px 18px; border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  opacity: 0; pointer-events: none; transition: all .2s ease;
  display: flex; align-items: center; gap: 9px; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast svg { width: 15px; height: 15px; color: #7CBB7D; flex-shrink: 0; }

.content-footer {
  margin-top: 24px; font-size: 11.5px; color: var(--text-tertiary);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.flink { cursor: pointer; }
.flink:hover { color: var(--accent); text-decoration: underline; }

/* ============ Range-slider ============ */
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 2px; background: var(--border); outline: none; margin: 6px 0 2px; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 15px; height: 15px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 2px solid var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
input[type="range"]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 2px solid var(--surface); }

/* ============ Modal ============ */
#modalOverlay { z-index: 125; }
.modal {
  position: fixed; z-index: 130; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 380px; max-width: 92vw; background: var(--surface);
  border-radius: 16px; padding: 24px; box-shadow: 0 24px 48px rgba(0,0,0,0.15);
  display: none;
}
.modal.open { display: block; animation: modalIn .2s ease; }
@keyframes modalIn {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 12px)) scale(.97); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.modal-text { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.btn-danger { background: var(--red) !important; color: #fff !important; }
.btn-danger:hover { opacity: .88; }

/* ---- CSV-eksport: feltvelgeren (#ekspModal, eksport.js) ---- */
.eksp-modal { width: 720px; }
.eksp-hurtig {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-secondary); margin-top: 10px;
}
.eksp-dot { color: var(--text-tertiary); }
.eksp-valgt { margin-left: auto; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.eksp-grupper {
  display: flex; gap: 26px; align-items: flex-start;
  max-height: 55vh; overflow-y: auto;
  margin-top: 10px; padding: 2px 6px 2px 2px;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.eksp-kol { flex: 1; min-width: 0; }
.eksp-gruppe { padding: 8px 0 6px; }
.eksp-gr-hode {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--text-tertiary); margin-bottom: 2px;
}
.eksp-gr-hode .flink { font-weight: 500; text-transform: none; letter-spacing: 0; font-size: 11px; }
.eksp-felt { padding: 4px 0; font-size: 12.5px; }
@media (max-width: 640px) {
  .eksp-grupper { flex-direction: column; max-height: 48vh; }
}

/* ---- Pene nedtrekk (NoraSelect, nselect.js) — erstatter native <select> ---- */
.nsel { position: relative; display: inline-flex; vertical-align: middle; max-width: 100%; }
.nsel > select {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; pointer-events: none; margin: 0; padding: 0; border: 0;
}
.nsel-btn {
  flex: 1; min-width: 0; display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 10px 7px 11px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 13px; color: var(--text); text-align: left;
  white-space: nowrap; transition: border-color .15s, box-shadow .15s;
}
.nsel-btn:hover { border-color: var(--accent); }
.nsel-btn:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.nsel-lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nsel-btn > svg { width: 14px; height: 14px; flex: none; color: var(--text-tertiary); transition: transform .15s; }
.nsel.open .nsel-btn { border-color: var(--accent); }
.nsel.open .nsel-btn > svg { transform: rotate(180deg); }
.nsel-panel {
  position: absolute; left: 0; top: calc(100% + 4px); z-index: 130;
  min-width: 100%; max-height: 300px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  animation: nselInn .12s ease;
}
@keyframes nselInn { from { opacity: 0; transform: translateY(-4px); } }
.nsel-panel.opp { top: auto; bottom: calc(100% + 4px); }
.nsel-panel.opp { animation-name: nselInnOpp; }
@keyframes nselInnOpp { from { opacity: 0; transform: translateY(4px); } }
.nsel-panel.hoyre { left: auto; right: 0; }
.nsel-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 6px; cursor: pointer;
  font-size: 13px; color: var(--text); white-space: nowrap;
}
.nsel-opt:hover, .nsel-opt.aktiv { background: var(--bg); }
.nsel-opt.valgt { color: var(--accent); font-weight: 500; }
.nsel-opt.deaktivert { opacity: .45; pointer-events: none; }
.nsel-check { margin-left: auto; font-size: 11px; color: var(--accent); opacity: 0; }
.nsel-opt.valgt .nsel-check { opacity: 1; }

/* Kontekstuelle størrelser — speiler de gamle select-stilene på stedet */
.sort-wrap .nsel-btn, .paging-size .nsel-btn, .dash-filter .nsel-btn, .aksje-aar .nsel-btn {
  padding: 5px 8px; font-size: 12.5px; border-radius: 6px;
}
.dash-filter .nsel { max-width: 150px; }
.dash-filter .nsel-btn { border-radius: 8px; }
.aksje-aar .nsel-btn { background: var(--bg); border-radius: 8px; font-weight: 600; font-size: 12px; }
.byra-filt .nsel-btn { padding: 6px 8px; font-size: 12px; }
/* Årsvelgerens gamle dekor-pil er overflødig — knappen har egen chevron */
.aksje-aar-chev { display: none; }

/* Selskaps-favicon (favIkonHtml i ui.js): legges oppå bokstav-ikonet i
   .fk-avatar/.detail-mark; feilet lasting fjerner bildet → bokstaven vises. */
.fav-ikon {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border-radius: inherit; object-fit: contain;
  padding: 6px; box-sizing: border-box; background: #fff;
}

/* ---- AI-hjelpen «Spør Nora» (#aiModal, knapper, Mitt selskap — aihjelp.js) ---- */
.ai-hjelp-btn {
  width: 100%; justify-content: center; margin-bottom: 10px;
  background: var(--surface); border: 1px solid var(--accent);
  color: var(--accent); font-weight: 600;
}
.ai-hjelp-btn:hover { background: var(--accent); color: #fff; }
.ai-hjelp-btn svg { width: 15px; height: 15px; }
.ai-hjelp-knapp { width: auto; margin-bottom: 0; }   /* i .page-actions (Nora BI) */
.ai-modal { width: min(680px, 94vw); max-height: 86vh; overflow: auto; }

/* ---- Oppdragsradar: annonse-modalen (#oppdragModal, products/oppdrag.js) ---- */
.oppdrag-modal { width: min(680px, 94vw); }
.oppd-modal-kropp { max-height: 60vh; overflow-y: auto; margin-top: 4px; padding-right: 4px; }
.oppd-modal-kropp .muted { color: var(--text-tertiary); font-weight: 400; }
.oppd-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 10px; }
.oppd-chip {
  font-size: 11.5px; padding: 3px 10px; border-radius: 12px;
  background: var(--accent-light); color: var(--text-secondary);
  border: 1px solid var(--border);
}
.oppd-seksjon {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-tertiary); margin: 14px 0 6px;
  border-top: 1px solid var(--border); padding-top: 10px;
}
.oppd-kontakt { font-size: 13px; padding: 4px 0; }
.oppd-kontakt-info { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; }
.oppd-kontakt-info a { color: var(--accent); }
.oppd-firma { font-size: 13px; line-height: 1.5; }
.oppd-tekst { white-space: pre-wrap; font-size: 13px; line-height: 1.65; color: var(--text-secondary); }
.oppd-flere { font-size: 13px; padding: 5px 0; cursor: pointer; border-bottom: 1px solid var(--border); }
.oppd-flere:hover { color: var(--accent); }
.oppd-tilbake { font-size: 12.5px; color: var(--accent); cursor: pointer; margin-bottom: 8px; }
.oppd-tilbake:hover { text-decoration: underline; }
.ai-intro { font-size: 13px; color: var(--text); line-height: 1.55; margin-bottom: 12px; }
.ai-sett-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ai-analyse-rad { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.ai-status { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }
.ai-feil { color: var(--red, #C0392B); }
.ai-spinn {
  display: inline-block; width: 12px; height: 12px; vertical-align: -2px;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: aiSpinn .8s linear infinite; margin-right: 4px;
}
@keyframes aiSpinn { to { transform: rotate(360deg); } }
.ai-tekst { resize: vertical; font-size: 13px; line-height: 1.5; }
.ai-onske { width: 100%; resize: vertical; }
.ai-forslag-head { font-weight: 600; font-size: 13px; margin-top: 16px; }
.ai-forslag-head span { font-weight: 400; color: var(--text-tertiary); font-size: 12px; }
.ai-forslag {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; margin-top: 10px; background: var(--surface);
}
.ai-forslag-topp { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.ai-forslag-navn { font-weight: 600; font-size: 13.5px; }
.ai-forslag-tekst { font-size: 12.5px; color: var(--text-secondary); margin-top: 4px; line-height: 1.5; }
.ai-kjor { flex-shrink: 0; }
@media (max-width: 640px) {
  .ai-sett-grid { grid-template-columns: 1fr; }
  .ai-forslag-topp { flex-direction: column; }
  .ai-hjelp-knapp { width: 100%; }
}

/* ============ Abonnement + kvote (Innstillinger) ============ */
.kvote-rad { margin-bottom: 12px; }
.kvote-topp {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12.5px; color: var(--text-secondary); margin-bottom: 5px;
}
.kvote-topp span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.kvote-bar {
  height: 8px; border-radius: 99px; overflow: hidden;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.kvote-fyll {
  height: 100%; border-radius: 99px; background: var(--accent);
  transition: width .3s ease;
}
.kvote-fyll.kvote-full { background: #c0392b; }

/* Team-kortet: invitasjonsskjema + ventende invitasjoner */
.team-invite-form { display: flex; gap: 8px; margin-top: 12px; }
.team-invite-form .input { flex: 1; min-width: 0; }
.team-inv-handlinger { display: flex; gap: 12px; align-items: center; font-size: 12.5px; }
.team-inv-slett { color: #c0392b; }

/* ================================================================
   Kontaktjakt (NoraJakt, assets/js/jakt.js) — modalen med oppsett,
   framdrift, aktive tråder og resultatliste
   ================================================================ */
.jakt-modal { width: min(720px, 94vw); max-height: 88vh; overflow: auto; }

.jakt-sp { font-size: 13px; font-weight: 600; margin: 14px 0 8px; }
.jakt-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.jakt-chip {
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-secondary); border-radius: 999px; padding: 6px 14px;
  font-size: 12.5px; font-family: inherit; cursor: pointer;
}
.jakt-chip:hover { border-color: var(--accent); color: var(--text-primary); }
.jakt-chip.aktiv {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.jakt-egen { margin-top: 10px; }
.jakt-forrige { margin-top: 14px; font-size: 12.5px; }

.jakt-topp { margin-top: 12px; }
.jakt-prog {
  height: 6px; border-radius: 3px; background: var(--border); overflow: hidden;
}
.jakt-prog-fill {
  height: 100%; border-radius: 3px; background: var(--accent);
  transition: width .4s ease;
}
.jakt-status { margin-top: 8px; font-size: 12.5px; color: var(--text-secondary); }

.jakt-traader { margin-top: 10px; display: flex; flex-direction: column; gap: 3px; }
.jakt-traad {
  display: flex; align-items: center; gap: 8px; font-size: 12px;
  color: var(--text-secondary); min-width: 0;
}
.jakt-fase {
  flex: 0 0 auto; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; border-radius: 4px; padding: 1px 6px;
  background: var(--surface-alt, var(--border)); color: var(--text-tertiary);
}
.jakt-fase-ai { background: var(--accent); color: #fff; }
.jakt-traad-navn { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.jakt-traad-side { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-tertiary); font-family: var(--mono, monospace); font-size: 11px; }

.jakt-resultater { margin-top: 14px; max-height: 44vh; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.jakt-res { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.jakt-res-hode { display: flex; align-items: center; gap: 8px; min-width: 0; }
.jakt-res-navn { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jakt-res-sted { color: var(--text-tertiary); font-size: 12px; }
.jakt-res-badge {
  margin-left: auto; flex: 0 0 auto; min-width: 22px; text-align: center;
  background: var(--accent); color: #fff; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; padding: 1px 7px;
}
.jakt-res-badge.jakt-res-null { background: var(--border); color: var(--text-tertiary); }
.jakt-kontakt {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px;
  font-size: 12.5px; margin-top: 6px;
}
.jakt-k-navn { font-weight: 600; }
.jakt-k-tittel { color: var(--text-secondary); }
.jakt-k-epost, .jakt-k-li { color: var(--accent); text-decoration: none; }
.jakt-k-epost:hover, .jakt-k-li:hover { text-decoration: underline; }
.jakt-k-tlf { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.jakt-res-feil { margin-top: 5px; font-size: 12px; color: var(--text-tertiary); }

/* ================================================================
   NoraUtvalg (assets/js/utvalg.js) — checkbox i produktenes
   trefflister + flytende handlingslinje for merkede selskaper
   ================================================================ */
/* Checkboxen skal stå til VENSTRE for firmanavnet (første celle har
   block-innhold som .co-name — float lar navnet legge seg ved siden av) */
.uv-check { float: left; padding: 0; margin: 2px 10px 0 0; }
th .uv-check.uv-check-alle { float: none; margin: 0 8px 0 0; vertical-align: middle; }
.uv-bar {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 110; display: none; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 10px 12px 10px 18px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.18);
  max-width: 94vw;
}
.uv-bar.open { display: flex; animation: modalIn .2s ease; }
.uv-antall { font-size: 13px; font-weight: 600; white-space: nowrap; }
.uv-lukk {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  border: none; background: transparent; color: var(--text-tertiary);
  cursor: pointer;
}
.uv-lukk:hover { background: var(--border); color: var(--text-primary); }
.uv-lukk svg { width: 14px; height: 14px; }

/* Kontaktjakter-fanen (NoraJakter) — kilde- og statusbadges i jaktlista */
.jkt-kilde {
  display: inline-block; font-size: 11.5px; font-weight: 600;
  border-radius: 999px; padding: 2px 10px; white-space: nowrap;
  background: var(--border); color: var(--text-secondary);
}
.jkt-kilde-firma { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.jkt-kilde-bi { background: color-mix(in srgb, var(--blue, #3b6ea5) 14%, transparent); color: var(--blue, #3b6ea5); }
.jkt-beskrivelse {
  max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text-secondary); font-size: 12.5px;
}
.jkt-status { font-size: 12px; font-weight: 600; }
.jkt-status-kjorer, .jkt-status-ny { color: var(--accent); }
.jkt-status-feil, .jkt-status-avbrutt { color: var(--red, #c0392b); }
.jkt-status-ok { color: var(--text-secondary); }
