:root {
  /* Loyalty-profil (målt fra intern mal: AI-strategi i Loyalty) */
  --bg:        #181530;   /* dyp indigo/navy */
  --surface:   #211d42;   /* panel/kort */
  --surface-2: #2a2552;   /* innfelt flate */
  --line:      #353066;
  --text:      #f4f3fa;
  --muted:     #a7a3c5;   /* lavendelgrå */
  --green:     #1bd41b;   /* lysegrønn aksent */
  --green-2:   #46e646;   /* lysere grønn, hover */
  --teal:      #1f8c99;   /* sekundær */
  --cyan:      #34b6c6;
  --accent:    var(--green);
  --churn-low: #57cf7e;
  --churn-mid: #e0b341;
  --churn-high:#ff6b5e;
  --radius:    14px;
  --shadow:    0 12px 32px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Space Grotesk", system-ui, sans-serif;
  background:
    radial-gradient(1100px 600px at 84% -14%, #271f52 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

h1, h2, h3 { margin: 0; font-weight: 600; }
a { color: var(--green-2); }

.muted { color: var(--muted); font-size: .85rem; margin: .35rem 0 0; }

/* ── Topbar ──────────────────────────────────────────── */
.topbar {
  border-bottom: 1px solid var(--line);
  background: rgba(24,21,48,.85);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.topbar__inner {
  max-width: 1180px; margin: 0 auto;
  padding: .9rem 1.4rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .85rem; }
.brand__mark {
  font-size: 1.5rem; line-height: 1;
  width: 44px; height: 44px; display: grid; place-items: center;
  background: var(--green); color: #0f1226;
  border-radius: 12px; box-shadow: var(--shadow);
}
.brand h1 { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; font-size: 1.75rem; letter-spacing: .2px; color: var(--text); }
.brand__tag { margin: 0; color: var(--muted); font-size: .82rem; }
.topbar__meta { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.topbar__meta .dot { margin: 0 .4rem; opacity: .5; }

/* ── Layout ──────────────────────────────────────────── */
.layout {
  max-width: 1180px; margin: 0 auto;
  padding: 1.6rem 1.4rem 3rem;
  display: grid; grid-template-columns: 290px 1fr; gap: 1.6rem;
  align-items: start;
}

/* ── Panel ───────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.2rem 1.4rem;
  position: sticky; top: 84px;
}
.panel__group { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.panel__group:first-child { padding-top: 0; }
.panel__group:last-of-type { border-bottom: 0; }
.panel h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .9px; color: var(--cyan); margin-bottom: .7rem; }

.formula {
  margin: 0; font-size: 1rem;
  background: var(--surface-2); border: 1px solid var(--line);
  padding: .6rem .7rem; border-radius: 10px; color: var(--text);
}
.formula b { color: var(--green-2); font-weight: 600; }

.slider { display: block; margin: .75rem 0; }
.slider__top { display: flex; justify-content: space-between; font-size: .9rem; margin-bottom: .25rem; }
.slider__top output { color: var(--green-2); font-weight: 600; font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--green); cursor: pointer; }

.toggle { display: flex; align-items: center; gap: .55rem; font-size: .9rem; cursor: pointer; }
.toggle input { accent-color: var(--green); width: 18px; height: 18px; }

.sok {
  width: 100%; padding: .55rem .7rem; font: inherit; font-size: .9rem;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 10px;
}
.sok::placeholder { color: var(--muted); }
.sok:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: .28rem .6rem; font-size: .8rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-2); color: var(--muted); cursor: pointer; user-select: none;
}
.chip input:checked + span { background: var(--green); border-color: var(--green); color: #0f1226; font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--green-2); outline-offset: 1px; }

.reset {
  margin-top: 1.1rem; width: 100%;
  padding: .55rem; font: inherit; font-size: .85rem;
  background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.reset:hover { color: var(--text); border-color: var(--green); }

/* ── Results ─────────────────────────────────────────── */
.results__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 1rem; }
.results__head h2 { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; font-size: 1.6rem; color: var(--text); }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.row {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: .9rem; align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px; padding: .7rem .9rem;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.row:hover { border-color: var(--green); transform: translateX(2px); }
.row--top { border-color: var(--green); border-left: 4px solid var(--green); box-shadow: var(--shadow); }

.rank { font-family: "Instrument Serif", Georgia, serif; font-size: 1.35rem; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.row--top .rank { color: var(--green-2); }

.who { min-width: 0; }
.who__name { font-weight: 600; font-size: 1rem; color: var(--text); }
.who__firma { color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who__meta { display: flex; flex-wrap: wrap; gap: .4rem .7rem; margin-top: .35rem; font-size: .78rem; color: var(--muted); align-items: center; }
.who__phone { font-variant-numeric: tabular-nums; }

.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .45rem; border-radius: 999px; font-size: .72rem; font-weight: 500; border: 1px solid transparent; }
.badge--type { background: var(--surface-2); border-color: var(--line); color: var(--cyan); }
.churn { font-weight: 600; }
.churn--low  { color: var(--churn-low); }
.churn--mid  { color: var(--churn-mid); }
.churn--high { color: var(--churn-high); }

.row__right { display: flex; flex-direction: column; align-items: flex-end; gap: .55rem; }
.score { text-align: right; min-width: 92px; }
.score__num { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; color: var(--text); }
.score__calc { font-size: .72rem; color: var(--muted); margin-top: .2rem; font-variant-numeric: tabular-nums; }
.score__bar { height: 4px; border-radius: 2px; background: var(--surface-2); margin-top: .4rem; overflow: hidden; }
.score__bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--green)); }

.tom { color: var(--muted); text-align: center; padding: 2rem; }

/* ── Knapper ─────────────────────────────────────────── */
.row__btns { display: flex; gap: .4rem; }
.btn {
  font: inherit; font-size: .8rem; font-weight: 600;
  padding: .4rem .7rem; border-radius: 9px; cursor: pointer;
  border: 1px solid transparent; white-space: nowrap; transition: filter .15s, background .15s, border-color .15s;
}
.btn--ring { background: var(--green); color: #0f1226; }
.btn--ring:hover { filter: brightness(1.1); }
.btn--prep { background: transparent; color: var(--text); border-color: var(--line); }
.btn--prep:hover { border-color: var(--green); color: var(--green-2); }
.btn:focus-visible { outline: 2px solid var(--green-2); outline-offset: 2px; }

/* ── Modal ───────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 1.2rem; }
.modal[hidden] { display: none; }
.modal__overlay { position: absolute; inset: 0; background: rgba(8,6,20,.66); backdrop-filter: blur(3px); }
.modal__box {
  position: relative; z-index: 1;
  width: min(540px, 100%); max-height: 88vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); padding: 1.6rem;
  animation: pop .16s ease-out;
}
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal__x {
  position: absolute; top: .8rem; right: .8rem;
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-size: .9rem;
}
.modal__x:hover { color: var(--text); border-color: var(--green); }

/* ── Ringeskjerm ─────────────────────────────────────── */
.call { text-align: center; padding: 1rem 0 .4rem; }
.call__avatar {
  width: 84px; height: 84px; margin: 0 auto 1rem;
  border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); border: 2px solid var(--green);
  font-size: 1.9rem; font-weight: 700; color: var(--green-2);
}
.call__name { font-size: 1.4rem; font-weight: 600; }
.call__firma { color: var(--muted); margin-top: .15rem; }
.call__phone { color: var(--cyan); font-variant-numeric: tabular-nums; margin-top: .5rem; letter-spacing: .5px; }
.call__status { margin-top: 1.4rem; color: var(--muted); font-size: .95rem; min-height: 1.4em; }
.call__status--on { color: var(--green-2); font-weight: 600; }
.call__timer { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: .3rem; }
.dots i { animation: blink 1.4s infinite both; }
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }
.call__hang {
  margin-top: 1.6rem; font: inherit; font-weight: 600; font-size: .95rem;
  padding: .65rem 2rem; border-radius: 999px; cursor: pointer;
  background: var(--churn-high); color: #fff; border: 0;
}
.call__hang:hover { filter: brightness(1.08); }

/* ── Forbered samtale ────────────────────────────────── */
.prep__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding-right: 2rem; }
.prep__name { font-family: "Instrument Serif", Georgia, serif; font-size: 1.7rem; }
.prep__firma { color: var(--muted); margin-top: .1rem; }
.prep__facts { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.1rem 0 .6rem; }
.fact {
  flex: 1 1 auto; min-width: 96px;
  display: flex; flex-direction: column; gap: .1rem;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  padding: .5rem .65rem; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px;
}
.fact b { font-size: 1.05rem; font-weight: 700; color: var(--text); text-transform: none; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.fact b.churn--low { color: var(--churn-low); }
.fact b.churn--mid { color: var(--churn-mid); }
.fact b.churn--high { color: var(--churn-high); }
.prep__owner { font-size: .85rem; color: var(--muted); margin-bottom: 1rem; }
.prep__owner b { color: var(--text); }
.prep section h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .9px; color: var(--cyan); margin: 0 0 .5rem; }
.prep__next p {
  margin: 0 0 1.3rem; padding: .7rem .8rem;
  background: rgba(27,212,27,.08); border: 1px solid rgba(27,212,27,.35);
  border-radius: 10px; color: var(--text);
}
.notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.note { border-left: 2px solid var(--line); padding: .1rem 0 .1rem .8rem; }
.note__meta { font-size: .75rem; color: var(--muted); }
.note__dato { color: var(--cyan); font-variant-numeric: tabular-nums; }
.note__tekst { margin-top: .15rem; font-size: .92rem; }

/* ── Toast ───────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 1.6rem; transform: translate(-50%, 1rem);
  z-index: 60; background: var(--surface); color: var(--text);
  border: 1px solid var(--green); border-radius: 999px;
  padding: .6rem 1.1rem; font-size: .85rem; box-shadow: var(--shadow);
  opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none;
}
.toast.vis { opacity: 1; transform: translate(-50%, 0); }

/* ── Footer ──────────────────────────────────────────── */
.foot { border-top: 1px solid var(--line); }
.foot p { max-width: 1180px; margin: 0 auto; padding: 1.2rem 1.4rem; color: var(--muted); font-size: .82rem; }

/* ── Responsiv ───────────────────────────────────────── */
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .panel { position: static; }
  .row { grid-template-columns: 30px 1fr; }
  .row__right { grid-column: 2 / 3; align-items: flex-start; margin-top: .4rem; }
  .score { text-align: left; }
  .score__bar { width: 160px; max-width: 100%; }
  .modal__box { padding: 1.3rem; }
  .prep__name { font-size: 1.4rem; }
}
