/* Temavariabler. Standard følger system (Chrome). Kan overstyres med data-theme.
   Mykere toner enn før, på ønske. */
:root, :root[data-theme="light"] {
  --bg: #e9f3f1;
  --surface: #fdfefe;
  --surface-2: #e3efec;
  --line: #d4e6e1;
  --ink: #213133;
  --muted: #7c8f92;
  --teal: #2d8f8b;
  --teal-d: #217571;
  --green: #369a86;
  --violet: #6685b0;
  --amber: #98701f;
  --amber-bg: #f3efe2;
  --amber-line: #e4d6ad;
  --red: #b8544d;
  --red-bg: #f3eae8;
  --red-line: #e5cdc9;
  --shadow: rgba(30,70,65,.06);
}

:root[data-theme="dark"] {
  --bg: #182022;
  --surface: #202a2c;
  --surface-2: #273031;
  --line: #33413f;
  --ink: #d6e0df;
  --muted: #8ea09e;
  --teal: #4fbcb5;
  --teal-d: #6fcfc7;
  --green: #57c2a9;
  --violet: #8aa6d6;
  --amber: #d2af69;
  --amber-bg: #26241a;
  --amber-line: #443c23;
  --red: #db8b85;
  --red-bg: #271918;
  --red-line: #432825;
  --shadow: rgba(0,0,0,.32);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #182022;
    --surface: #202a2c;
    --surface-2: #273031;
    --line: #33413f;
    --ink: #d6e0df;
    --muted: #8ea09e;
    --teal: #4fbcb5;
    --teal-d: #6fcfc7;
    --green: #57c2a9;
    --violet: #8aa6d6;
    --amber: #d2af69;
    --amber-bg: #26241a;
    --amber-line: #443c23;
    --red: #db8b85;
    --red-bg: #271918;
    --red-line: #432825;
    --shadow: rgba(0,0,0,.32);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  width: 468px;            /* overstyres av innstilling via JS */
  min-height: 580px;       /* høyere nedtrekk (Chrome tillater opptil 600 px) */
  overflow-y: auto;
  font-family: -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 13px;
  color: var(--ink);
  background: var(--bg);
}

#ta-app { padding: 13px 15px 15px; }

.ta-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.ta-title { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 15px; }
.ta-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--teal); color: #fff; font-weight: 800; line-height: 1;
}
.ta-icon-btn {
  border: none; background: none; cursor: pointer;
  font-size: 17px; color: var(--muted); padding: 2px 5px; border-radius: 6px;
}
.ta-icon-btn:hover { background: var(--surface-2); }

.ta-status {
  font-size: 12px; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 9px; margin-bottom: 9px;
}
.ta-status.ok { color: var(--teal-d); }
.ta-status.warn { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-line); }

.ta-ctx { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 9px; margin-bottom: 9px; }
.ta-ctx label { display: flex; flex-direction: column; font-size: 11px; color: var(--muted); gap: 2px; }
.ta-ctx select {
  font-size: 12px; padding: 5px 6px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--surface); color: var(--ink);
}
.ta-check { flex-direction: row !important; align-items: center; gap: 5px !important; font-size: 12px !important; color: var(--ink) !important; }

/* Tidskalkulator */
.ta-kalk-rad { display: flex; gap: 10px; align-items: stretch; }
.ta-kalk-rad label { display: flex; flex-direction: column; font-size: 11px; color: var(--muted); gap: 2px; flex: 0 0 118px; }
.ta-kalk-rad input {
  font-size: 14px; font-weight: 600; padding: 7px 8px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--surface); color: var(--ink); width: 100%;
}
.ta-kalk-ut {
  flex: 1; display: flex; align-items: center;
  font-size: 12px; line-height: 1.35; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px;
}
.ta-kalk-ut.aktiv { color: var(--ink); border-left: 4px solid var(--teal); }
.ta-kalk-ut .ta-kalk-kode { font-weight: 700; color: var(--teal-d); }
.ta-kalk-ut .ta-kalk-sum { color: var(--muted); }

/* Faner */
.ta-tabs { display: flex; gap: 4px; margin-bottom: 11px; border-bottom: 1px solid var(--line); }
.ta-tab-btn {
  flex: 1; cursor: pointer; border: none; background: none;
  padding: 8px 6px; font-size: 12px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.ta-tab-btn:hover { color: var(--ink); }
.ta-tab-btn.aktiv { color: var(--teal-d); border-bottom-color: var(--teal); }

/* Kalkulator-modus */
.ta-kalk-modus { display: flex; gap: 14px; margin-bottom: 8px; }
.ta-kalk-modus label { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink); cursor: pointer; }
#ta-kalk-frati-rad label { flex: 0 0 auto; }
#ta-kalk-frati-rad input[type="time"] {
  font-size: 13px; padding: 6px 8px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--surface); color: var(--ink);
}

/* Legemiddelgjennomgang */
.ta-lmg-topp { display: flex; gap: 6px; margin-bottom: 9px; }
.ta-btn-kopier { background: var(--green); }
.ta-lmg-notat {
  width: 100%; height: 180px; resize: vertical;
  border: 1px solid var(--line); border-radius: 8px; padding: 9px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 11.5px; line-height: 1.45;
  background: var(--surface); color: var(--ink);
}
.ta-lmg-intro {
  width: 100%; resize: vertical;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px;
  font-size: 12px; font-family: inherit; line-height: 1.4;
  background: var(--surface); color: var(--ink);
}
.ta-lmg-liste { display: flex; flex-direction: column; gap: 4px; }
.ta-lmg-seksjon { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 6px 0 2px; }
.ta-lmg-rad {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 9px;
}
.ta-lmg-rad.inaktiv { opacity: .5; }
.ta-lmg-rad input[type="checkbox"] { flex: 0 0 auto; margin: 0; }
.ta-lmg-navn { flex: 0 0 auto; font-weight: 600; min-width: 92px; }
.ta-lmg-ind {
  flex: 1 1 auto; min-width: 0; font-size: 12px;
  border: 1px solid var(--line); border-radius: 6px; padding: 4px 7px;
  background: var(--bg); color: var(--ink);
}
.ta-lmg-ind::placeholder { color: var(--muted); }
.ta-lmg-funn { display: flex; flex-direction: column; gap: 5px; }
.ta-lmg-funn-kort {
  border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px;
  padding: 6px 9px; font-size: 11.5px; line-height: 1.4; background: var(--surface);
}
.ta-lmg-funn-kort.obs { border-left-color: var(--red); }
.ta-lmg-funn-kort.moderat { border-left-color: var(--amber); }
.ta-lmg-funn-kort.lav { border-left-color: var(--muted); }
.ta-lmg-funn-tittel { font-weight: 700; }
.ta-lmg-funn-tittel .ta-lmg-alvor { font-size: 10px; text-transform: uppercase; letter-spacing: .03em; margin-right: 6px; }
.ta-lmg-funn-kort.obs .ta-lmg-alvor { color: var(--red); }
.ta-lmg-funn-kort.moderat .ta-lmg-alvor { color: var(--amber); }
.ta-lmg-funn-tiltak { color: var(--muted); }

/* Oppslag */
.ta-opps-sokrad { margin-bottom: 8px; }
#ta-opps-sok {
  width: 100%; box-sizing: border-box; font-size: 13px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink);
}
.ta-opps-hint { font-size: 11px; color: var(--muted); margin-bottom: 10px; line-height: 1.4; }
.ta-opps-liste { display: flex; flex-direction: column; gap: 5px; }
.ta-opps-sit {
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden;
}
.ta-opps-sit-hode { display: flex; align-items: baseline; gap: 8px; padding: 8px 10px; cursor: pointer; }
.ta-opps-sit-hode:hover { background: var(--bg); }
.ta-opps-sit-navn { font-weight: 600; font-size: 12.5px; }
.ta-opps-sit-kat { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-left: auto; }
.ta-opps-sit-kropp { padding: 0 10px 10px; display: none; }
.ta-opps-sit.apen .ta-opps-sit-kropp { display: block; }
.ta-opps-sit-om { font-size: 11.5px; color: var(--muted); margin: 2px 0 8px; line-height: 1.45; }
.ta-opps-kode {
  display: flex; align-items: baseline; gap: 8px; padding: 5px 7px; border-radius: 6px;
  background: var(--bg); margin-bottom: 3px; cursor: pointer;
}
.ta-opps-kode:hover { outline: 1px solid var(--teal); }
.ta-opps-kode-kode { font-weight: 700; color: var(--teal-d); min-width: 46px; }
.ta-opps-kode-navn { flex: 1; font-size: 11.5px; }
.ta-opps-kode-rolle { font-size: 9.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.ta-opps-kode-n { font-size: 11px; color: var(--muted); margin-top: 1px; line-height: 1.4; }
.ta-opps-sit-kopier { margin-top: 6px; }
.ta-opps-takstkort {
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 8px 10px;
}
.ta-opps-takst-topp { display: flex; align-items: baseline; gap: 8px; }
.ta-opps-takst-kode { font-weight: 700; color: var(--teal-d); min-width: 46px; }
.ta-opps-takst-navn { flex: 1; font-size: 12px; font-weight: 600; }
.ta-opps-takst-pris { font-size: 11px; color: var(--muted); white-space: nowrap; }
.ta-opps-takst-dok { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.45; }
.ta-opps-tom { font-size: 11.5px; color: var(--muted); padding: 6px 2px; }

.ta-block { margin-bottom: 11px; }
.ta-block h2 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); margin: 0 0 5px; font-weight: 700;
}
.ta-hint { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--muted); }

.ta-liste { display: flex; flex-direction: column; gap: 4px; }
.ta-empty { color: var(--muted); font-size: 12px; font-style: italic; }

/* Kompakt takstkort */
.ta-kort {
  background: var(--surface); border: 1px solid var(--line);
  border-left-width: 4px; border-radius: 9px;
  box-shadow: 0 1px 2px var(--shadow);
}
.ta-kort.grunn { border-left-color: var(--green); }
.ta-kort.sterk { border-left-color: var(--teal); }
.ta-kort.vurder { border-left-color: var(--line); }
.ta-kort.ai { border-left-color: var(--violet); }

.ta-kort-head {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; cursor: pointer;
}
.ta-kort-head input { margin: 0; flex: 0 0 auto; }
.ta-kode { font-weight: 700; flex: 0 0 auto; }
.ta-antall { color: var(--teal-d); font-weight: 700; }
.ta-navn {
  flex: 1 1 auto; min-width: 0; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ta-flagg {
  flex: 0 0 auto; font-size: 11px; font-weight: 700;
  color: var(--amber); background: var(--amber-bg);
  border: 1px solid var(--amber-line); border-radius: 20px; padding: 0 6px; line-height: 16px;
}
.ta-flagg.ok { color: var(--green); background: transparent; border: none; }
.ta-belop { flex: 0 0 auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.ta-chev { flex: 0 0 auto; color: var(--muted); font-size: 10px; transition: transform .12s ease; }
.ta-kort.apen .ta-chev { transform: rotate(90deg); }

.ta-kort-detalj { display: none; padding: 0 10px 9px 10px; }
.ta-kort.apen .ta-kort-detalj { display: block; }
.ta-grunn { color: var(--muted); font-size: 11px; line-height: 1.4; margin-bottom: 6px; }
.ta-dok {
  font-size: 11px; color: var(--amber);
  background: var(--amber-bg); border: 1px solid var(--amber-line);
  border-radius: 6px; padding: 4px 7px; line-height: 1.4; margin-bottom: 6px;
}
.ta-krit { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.ta-krit li { display: flex; align-items: flex-start; gap: 6px; font-size: 11px; line-height: 1.35; }
.ta-krit li.ok { color: var(--green); }
.ta-krit li.mangler { color: var(--muted); }
.ta-krit-ikon { font-weight: 700; flex: 0 0 auto; width: 12px; text-align: center; }
.ta-dokforslag {
  font-size: 11px; line-height: 1.4; margin-top: 4px;
  background: var(--amber-bg); color: var(--amber);
  border: 1px solid var(--amber-line); border-radius: 7px; padding: 5px 8px;
}

.ta-konflikt {  background: var(--red-bg); color: var(--red);
  border: 1px solid var(--red-line); border-radius: 8px;
  padding: 7px 9px; font-size: 12px; margin-bottom: 9px; line-height: 1.4;
}
.ta-advarsler { margin: 0; padding-left: 16px; }
.ta-advarsler li { font-size: 11px; color: var(--amber); margin-bottom: 4px; line-height: 1.35; }

.ta-sum { display: flex; gap: 6px; margin: 4px 0 10px; }
.ta-sum > div { flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px; text-align: center; }
.ta-sum span { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; }
.ta-sum strong { font-size: 15px; }

.ta-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ta-btn {
  flex: 1; min-width: 88px; cursor: pointer;
  border: none; border-radius: 8px; padding: 8px 10px;
  font-size: 12px; font-weight: 600; background: var(--teal); color: #fff;
}
.ta-btn:hover { filter: brightness(1.05); }
.ta-btn-ai { background: var(--violet); }
.ta-btn-ai:disabled { opacity: .5; cursor: default; }
.ta-btn-ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.ta-btn-ghost:hover { background: var(--surface-2); }
.ta-btn-mini { flex: 0 0 auto; min-width: 0; padding: 4px 8px; font-size: 11px; }

.ta-settings, .ta-paste-box { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 11px; margin-top: 10px; }
.ta-settings h2 { margin: 0 0 9px; font-size: 13px; }
.ta-set-row { display: flex; flex-direction: column; gap: 3px; margin-bottom: 9px; font-size: 11px; color: var(--muted); }
.ta-set-row input, .ta-set-row select {
  font-size: 12px; padding: 6px 8px; border: 1px solid var(--line);
  border-radius: 6px; color: var(--ink); background: var(--surface);
}
.ta-key-rad { display: flex; gap: 6px; align-items: stretch; }
.ta-key-rad input { flex: 1; }
.ta-note { font-size: 11px; color: var(--muted); line-height: 1.4; margin: 0 0 9px; }

.ta-paste-box textarea {
  width: 100%; height: 110px; resize: vertical;
  border: 1px solid var(--line); border-radius: 6px; padding: 7px;
  font-size: 12px; font-family: inherit; margin-bottom: 8px;
  background: var(--surface); color: var(--ink);
}

.ta-foot {
  display: flex; justify-content: space-between; gap: 8px;
  margin-top: 11px; padding-top: 9px; border-top: 1px solid var(--line);
  font-size: 10px; color: var(--muted);
}

/* Lisens og prøveperiode */
.ta-prove-banner {
  font-size: 12px; padding: 8px 11px; margin-bottom: 9px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.ta-prove-banner.snart { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber); }
.ta-prove-banner button {
  flex: 0 0 auto; border: none; border-radius: 6px; cursor: pointer;
  background: var(--teal); color: #fff; font-size: 11px; font-weight: 600; padding: 4px 9px;
}

.ta-paywall {
  border: 1px solid var(--line); border-radius: 12px; padding: 16px;
  background: var(--surface); text-align: center; margin-bottom: 10px;
}
.ta-paywall h2 { margin: 0 0 6px; font-size: 16px; }
.ta-paywall p { margin: 0 0 12px; font-size: 12px; color: var(--muted); line-height: 1.45; }
.ta-btn-kjop { width: 100%; background: var(--teal); color: #fff; font-size: 14px; padding: 11px; }
.ta-lisens-inn { margin-top: 14px; text-align: left; }
.ta-lisens-inn label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.ta-paywall-feil { margin-top: 6px; font-size: 11px; color: var(--red); }

.ta-lisens-boks {
  border: 1px solid var(--line); border-radius: 9px; padding: 10px;
  margin-bottom: 12px; background: var(--surface-2);
}
.ta-lisens-status { font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.ta-lisens-status.ok { color: var(--green); }
.ta-lisens-status.prove { color: var(--teal-d); }
.ta-lisens-status.utlopt { color: var(--red); }
.ta-btn-kjop:hover { filter: brightness(1.05); }

/* ---------- v6.1: tettere topp, smalere layout, kalkulator på én rad, favoritter ---------- */

/* Tettere topp: mindre luft i header og status */
.ta-head { padding-top: 8px !important; padding-bottom: 8px !important; }
#ta-status { margin: 4px 0 6px !important; }
.ta-tabs { margin-bottom: 8px !important; }
#ta-hovedinnhold { padding-top: 0 !important; }

/* Faner: segmentert pille-stil (inspirert av et smalt panel) */
.ta-tabs {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px;
  padding: 3px; gap: 3px;
}
.ta-tab-btn {
  border-radius: 6px; padding: 6px 4px; font-size: 11.5px; margin-bottom: 0;
  border-bottom: none !important; color: var(--muted);
}
.ta-tab-btn.aktiv {
  background: var(--surface); color: var(--teal-d);
  box-shadow: 0 1px 2px var(--shadow); border-bottom: none !important;
}

/* Unngå at lange navn kappes stygt: la dem brytes eller få ellipsis */
.ta-liste .ta-kode-navn, .ta-forslag-navn { overflow: hidden; text-overflow: ellipsis; }
.ta-opps-sit-hode { flex-wrap: wrap; }
.ta-opps-sit-kat { flex: 0 0 auto; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Kalkulator: minutter og fra-til side ved side */
.ta-kalk-linje { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; }
.ta-kalk-felt { display: flex; flex-direction: column; gap: 3px; }
.ta-kalk-felt label { font-size: 10.5px; color: var(--muted); }
.ta-kalk-felt input[type="number"] { width: 92px; }
.ta-kalk-felt input[type="time"] {
  font-size: 13px; padding: 6px 8px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--surface); color: var(--ink);
}
.ta-kalk-skille { align-self: center; color: var(--muted); font-size: 11px; padding-bottom: 7px; }

/* Favoritter øverst */
.ta-fav-blokk { margin-bottom: 10px; }
.ta-fav-tittel { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 5px; }
.ta-fav-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.ta-fav-chip {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 10px; font-size: 11.5px;
}
.ta-fav-chip:hover { border-color: var(--teal); }
.ta-fav-chip b { color: var(--teal-d); }
.ta-fav-tom { font-size: 11px; color: var(--muted); }

/* Stjerne-knapp */
.ta-stjerne {
  cursor: pointer; border: none; background: none; color: var(--muted);
  font-size: 14px; line-height: 1; padding: 0 2px; flex: 0 0 auto;
}
.ta-stjerne.pa { color: var(--amber); }
.ta-opps-takst-topp .ta-stjerne { margin-left: 2px; }

/* Innstillinger: segmentert temavalg */
.ta-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.ta-seg button {
  border: none; background: var(--surface); color: var(--muted);
  padding: 6px 12px; font-size: 12px; cursor: pointer;
}
.ta-seg button.pa { background: var(--teal); color: #fff; }

/* Skjulte elementer skal ikke ta plass (fjerner tomme striper øverst) */
[hidden] { display: none !important; }
#ta-app > .ta-head { margin-bottom: 2px; }

/* ---------- v6.4: forfinet, mykere og mer moderne ---------- */

/* Situasjonskort à la et rent oppslagsverk */
.ta-opps-sit {
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface);
  box-shadow: 0 1px 2px var(--shadow); overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease, transform .04s ease;
}
.ta-opps-sit:hover { border-color: color-mix(in srgb, var(--teal) 35%, var(--line)); }
.ta-opps-sit.apen { box-shadow: 0 3px 10px var(--shadow); }
.ta-opps-sit.fav { border-left: 3px solid var(--amber); }
.ta-opps-sit-hode {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px;
  cursor: pointer; flex-wrap: nowrap;
}
.ta-opps-sit-tekst { flex: 1 1 auto; min-width: 0; }
.ta-opps-sit-navn { font-weight: 600; font-size: 13px; color: var(--ink); line-height: 1.25; }
.ta-opps-sit-kat {
  font-size: 11px; color: var(--muted); margin-top: 2px; letter-spacing: 0; text-transform: none;
  max-width: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ta-opps-sit-chevron { flex: 0 0 auto; color: var(--muted); font-size: 15px; line-height: 1; transition: transform .2s ease; }
.ta-opps-sit.apen .ta-opps-sit-chevron { transform: rotate(180deg); }
.ta-opps-sit-hode .ta-stjerne { font-size: 16px; }
.ta-opps-sit-kropp { padding: 2px 13px 13px; }
.ta-opps-sit-om { margin-top: 0; }

/* Kodrader inne i situasjon, litt mer luft */
.ta-opps-kode { padding: 6px 9px; border-radius: 8px; transition: background .12s ease, outline-color .12s ease; }
.ta-opps-kode:hover { background: var(--surface-2); outline: none; }

/* Generell mykhet: rundere blokker og knapper, jevne overganger */
.ta-block { border-radius: 11px; }
.ta-btn { border-radius: 9px; transition: background .14s ease, border-color .14s ease, transform .04s ease; }
.ta-btn:active { transform: translateY(1px); }
.ta-opps-takstkort { border-radius: 11px; box-shadow: 0 1px 2px var(--shadow); transition: border-color .15s ease; }
.ta-opps-takstkort:hover { border-color: color-mix(in srgb, var(--teal) 30%, var(--line)); }
#ta-opps-sok, .ta-lmg-notat, .ta-lmg-intro { border-radius: 10px; }
.ta-fav-chip { transition: border-color .14s ease, background .14s ease; }

/* Litt mer luft mellom seksjoner i oppslag */
.ta-opps-liste { gap: 7px; }

/* ---------- v6.5: utvidbar takst med fulltekst og merknader ---------- */
.ta-opps-takstkort.kanapne .ta-opps-takst-topp { cursor: pointer; }
.ta-opps-takstkort .ta-opps-sit-chevron { flex: 0 0 auto; margin-left: 2px; }
.ta-opps-takstkort.apen .ta-opps-sit-chevron { transform: rotate(180deg); }
.ta-opps-takst-kropp { display: none; margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--line); }
.ta-opps-takstkort.apen .ta-opps-takst-kropp { display: block; }
.ta-opps-takstkort.apen .ta-opps-takst-dok { display: none; }
.ta-opps-takst-full { font-size: 11.5px; line-height: 1.5; color: var(--ink); white-space: normal; }
.ta-opps-merk {
  margin-top: 9px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2);
  font-size: 11px; line-height: 1.5; color: var(--muted);
}
.ta-opps-merk-kode { display: block; font-weight: 700; color: var(--teal-d); margin-bottom: 3px; }
.ta-opps-takst-kopier { margin-top: 10px; }

/* ---------- v6.6: underfaner i oppslag + mykere blågrønt preg ---------- */
.ta-opps-seg { display: flex; width: 100%; margin-bottom: 10px; border-radius: 9px; }
.ta-opps-seg button { flex: 1; padding: 8px 6px; font-size: 12.5px; font-weight: 600; border-radius: 7px; }
.ta-opps-seg button.pa { background: var(--teal); color: #fff; box-shadow: 0 1px 2px var(--shadow); }
.ta-seg { border-radius: 9px; background: var(--surface-2); padding: 3px; gap: 3px; border-color: var(--line); }
.ta-seg button { border-radius: 7px; }

/* Subtilt blågrønt anstrøk i header for et roligere, mer moderne uttrykk */
.ta-head { background: color-mix(in srgb, var(--teal) 7%, var(--surface)); border-radius: 0 0 12px 12px; }

/* La aktiv fane og pille bruke teal konsekvent */
.ta-tab-btn.aktiv { color: var(--teal-d); }

/* ---------- v6.9: Skrift.md-inspirert estetikk (rolig mint-teal, luftig) ---------- */
body {
  background: linear-gradient(172deg, var(--bg) 0%, color-mix(in srgb, var(--surface) 55%, var(--bg)) 100%);
  background-attachment: fixed;
}

/* Luftigere, mer avrundede kort med mykere skygge */
.ta-block, .ta-opps-sit, .ta-opps-takstkort, .ta-paste-box, #ta-settings {
  border-radius: 14px;
  box-shadow: 0 1px 3px var(--shadow);
}
.ta-block { background: var(--surface); border: 1px solid var(--line); padding: 12px 13px; }

/* Header: rolig mint-tone som i forbildet */
.ta-head {
  background: color-mix(in srgb, var(--teal) 9%, var(--surface));
  border-radius: 0 0 16px 16px;
}

/* Faner og segment: myke piller */
.ta-tabs, .ta-seg { border-radius: 12px; }
.ta-tab-btn, .ta-seg button, .ta-opps-seg button { border-radius: 9px; }
.ta-tab-btn.aktiv, .ta-opps-seg button.pa, .ta-seg button.pa {
  box-shadow: 0 1px 3px var(--shadow);
}

/* Favoritt-chips: helt avrundede outline-piller à la forbildet */
.ta-fav-chip {
  border-radius: 999px; border-color: color-mix(in srgb, var(--teal) 40%, var(--line));
  background: var(--surface);
}
.ta-fav-chip:hover { border-color: var(--teal); background: color-mix(in srgb, var(--teal) 7%, var(--surface)); }
.ta-fav-chip b { color: var(--teal-d); }

/* Primærknapper i rolig teal, sekundære som teal-outline-piller */
.ta-btn { border-radius: 10px; }
.ta-btn-ghost {
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--teal) 35%, var(--line));
  color: var(--teal-d);
}
.ta-btn-ghost:hover { border-color: var(--teal); background: color-mix(in srgb, var(--teal) 6%, var(--surface)); }

/* Fremhevet situasjonskort: teal ramme i stedet for rav, mer i tråd med profilen */
.ta-opps-sit.fav { border-left: 3px solid var(--teal); }

/* Rolige fokusringer i teal */
#ta-opps-sok:focus, .ta-lmg-intro:focus, .ta-lmg-notat:focus,
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 16%, transparent);
}

/* Litt mer luft mellom blokker for et roligere oppsett */
.ta-block { margin-bottom: 11px; }

/* ---------- v7.0: finpuss mot skrift.md (rolig, tydelig, avrundet) ---------- */
/* Litt tydeligere, varmere header slik som forbildet */
.ta-head { background: linear-gradient(180deg, color-mix(in srgb, var(--teal) 12%, var(--surface)), color-mix(in srgb, var(--teal) 5%, var(--surface))); }
.ta-title { font-size: 15.5px; letter-spacing: -.01em; }
.ta-logo { border-radius: 8px; box-shadow: 0 1px 3px var(--shadow); }

/* Gjenbrukbar teal-badge à la «Skrift.md»-merket på det fremhevede kortet */
.ta-badge {
  display: inline-block; background: var(--teal); color: #fff;
  font-size: 10px; font-weight: 700; letter-spacing: .02em;
  padding: 2px 9px; border-radius: 999px;
}

/* Favorittittel med samme rolige preg */
.ta-fav-tittel { color: var(--teal-d); }

/* Mykere, litt større avrunding gjennomgående for et roligere uttrykk */
#ta-opps-sok, input[type="search"], select, .ta-lmg-notat, .ta-lmg-intro, .ta-paste-box textarea {
  border-radius: 11px;
}
.ta-btn:disabled { opacity: .55; cursor: default; }

/* ---------- v8.0: Kalkulatorer ---------- */
.ta-sk-forslag { margin: 2px 0 10px; }
.ta-sk-kat { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 10px; }
.ta-sk-katknapp {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 4px 10px; font-size: 11.5px; cursor: pointer;
}
.ta-sk-katknapp:hover { color: var(--ink); border-color: color-mix(in srgb, var(--teal) 40%, var(--line)); }
.ta-sk-katknapp.pa { background: var(--teal); border-color: var(--teal); color: #fff; }
.ta-sk-gruppe { font-size: 11px; font-weight: 700; color: var(--teal-d); margin: 12px 2px 5px; }
.ta-sk-gruppe:first-child { margin-top: 2px; }
.ta-sk-liste { display: flex; flex-direction: column; gap: 4px; }
.ta-sk-rad {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px;
}
.ta-sk-rad:hover, .ta-sk-rad:focus-visible { border-color: color-mix(in srgb, var(--teal) 45%, var(--line)); outline: none; }
.ta-sk-rad:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 18%, transparent); }
.ta-sk-rad-tekst { flex: 1 1 auto; min-width: 0; }
.ta-sk-rad-navn { font-weight: 600; font-size: 12.5px; line-height: 1.3; }
.ta-sk-rad-beskr { font-size: 11px; color: var(--muted); line-height: 1.35; margin-top: 1px; }
.ta-sk-fot { margin-top: 12px; }

.ta-sk-topp { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ta-sk-favknapp { font-size: 20px; padding: 2px 4px; }
.ta-sk-navn { font-size: 16px; margin: 0 0 3px; letter-spacing: -.01em; }
.ta-sk-beskr { font-size: 12px; color: var(--muted); margin: 0 0 10px; line-height: 1.45; }
.ta-sk-merknad { font-size: 11.5px; color: var(--amber); background: var(--amber-bg); border: 1px solid var(--amber-line); border-radius: 8px; padding: 6px 9px; margin: -2px 0 10px; }

.ta-sk-felt { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.ta-sk-overskrift { font-size: 11px; font-weight: 700; color: var(--teal-d); margin: 8px 2px 0; }
.ta-sk-legende { display: flex; flex-wrap: wrap; gap: 3px 12px; font-size: 11px; color: var(--muted); background: var(--surface-2); border-radius: 8px; padding: 6px 9px; }
.ta-sk-ja {
  display: flex; align-items: flex-start; gap: 9px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; line-height: 1.35;
}
.ta-sk-ja:hover { border-color: color-mix(in srgb, var(--teal) 40%, var(--line)); }
.ta-sk-ja.pa { border-color: var(--teal); background: color-mix(in srgb, var(--teal) 7%, var(--surface)); }
.ta-sk-ja input { margin: 2px 0 0; accent-color: var(--teal); width: 15px; height: 15px; flex: 0 0 auto; }
.ta-sk-ja-tekst { flex: 1 1 auto; font-size: 12.5px; }
.ta-sk-poeng { flex: 0 0 auto; font-size: 11px; font-weight: 700; color: var(--teal-d); font-variant-numeric: tabular-nums; padding-top: 1px; }
.ta-sk-felt-rad { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; }
.ta-sk-felt-rad.skjema { padding: 6px 10px; }
.ta-sk-etikett { display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px; line-height: 1.35; }
.ta-sk-felt-rad.skjema .ta-sk-etikett { font-weight: 500; margin-bottom: 4px; }
.ta-sk-seg { display: flex; flex-wrap: wrap; gap: 4px; }
.ta-sk-segknapp {
  flex: 1 1 0; min-width: 44px; border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  border-radius: 7px; padding: 6px 6px; font-size: 12px; cursor: pointer; font-variant-numeric: tabular-nums;
}
.ta-sk-seg.kompakt .ta-sk-segknapp { padding: 5px 4px; }
.ta-sk-segknapp:hover { border-color: color-mix(in srgb, var(--teal) 45%, var(--line)); }
.ta-sk-segknapp.pa { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 600; }
.ta-sk-radioer { display: flex; flex-direction: column; gap: 4px; }
.ta-sk-radio {
  display: flex; align-items: flex-start; gap: 8px; text-align: left; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 7px; padding: 6px 8px; font-size: 12px; line-height: 1.35;
}
.ta-sk-radio:hover { border-color: color-mix(in srgb, var(--teal) 45%, var(--line)); }
.ta-sk-radio-prikk { flex: 0 0 auto; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--muted); margin-top: 2px; }
.ta-sk-radio.pa { border-color: var(--teal); background: color-mix(in srgb, var(--teal) 8%, var(--surface)); }
.ta-sk-radio.pa .ta-sk-radio-prikk { border-color: var(--teal); background: radial-gradient(var(--teal) 45%, transparent 50%); }
.ta-sk-radio-tekst { flex: 1 1 auto; }
.ta-sk-tall { display: flex; align-items: center; gap: 8px; }
.ta-sk-tall input {
  width: 110px; font-size: 14px; font-weight: 600; padding: 6px 8px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg); color: var(--ink); font-variant-numeric: tabular-nums;
}
.ta-sk-tall input.utenfor { border-color: var(--amber); background: var(--amber-bg); }
.ta-sk-enhet { font-size: 12px; color: var(--muted); }

.ta-sk-res {
  position: sticky; bottom: 8px; z-index: 2;
  background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--muted);
  border-radius: 12px; padding: 10px 13px; margin: 4px 0 11px; box-shadow: 0 6px 18px var(--shadow);
}
.ta-sk-res.lav { border-left-color: var(--green); }
.ta-sk-res.mod { border-left-color: var(--amber); }
.ta-sk-res.hoy { border-left-color: var(--red); }
.ta-sk-res.info { border-left-color: var(--violet); }
.ta-sk-res.tom { box-shadow: none; }
.ta-sk-res-topp { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.ta-sk-skar { font-size: 26px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ta-sk-res.lav .ta-sk-skar { color: var(--green); }
.ta-sk-res.mod .ta-sk-skar { color: var(--amber); }
.ta-sk-res.hoy .ta-sk-skar { color: var(--red); }
.ta-sk-enhetut { font-size: 12px; color: var(--muted); }
.ta-sk-tolk { font-size: 12.5px; line-height: 1.45; margin-top: 3px; }
.ta-sk-res.tom .ta-sk-tolk { color: var(--muted); }
.ta-sk-detaljer { margin: 6px 0 0; padding-left: 16px; font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.ta-sk-detaljer:empty { display: none; }

.ta-sk-journal {
  width: 100%; resize: vertical; min-height: 64px; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 9px; font-family: inherit; font-size: 12.5px; line-height: 1.45; background: var(--bg); color: var(--ink);
}
.ta-sk-handling { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.ta-sk-handling > .ta-btn:first-child { flex: 0 0 auto; }
.ta-sk-sett { display: flex; gap: 0; flex: 1 1 auto; }
.ta-sk-sett select {
  border: 1px solid var(--line); border-right: none; border-radius: 9px 0 0 9px; padding: 6px 6px; font-size: 12px;
  background: var(--surface); color: var(--ink); max-width: 112px;
}
.ta-sk-sett .ta-btn { border-radius: 0 9px 9px 0; flex: 1 1 auto; }
.ta-sk-kilde { margin-top: 2px; }
.ta-sk-segknapp:focus-visible, .ta-sk-radio:focus-visible, .ta-sk-katknapp:focus-visible, .ta-sk-ja:focus-within {
  outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 22%, transparent);
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Utvidelse vs. skrivebordsapp */
.ta-kun-app { display: none !important; }
html.pwa .ta-kun-app { display: block !important; }
html.pwa .ta-kun-utvidelse { display: none !important; }

.ta-head-knapper { display: flex; align-items: center; gap: 2px; }
#ta-sk-sok {
  width: 100%; box-sizing: border-box; font-size: 13px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink);
}
#ta-sk-sok:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 16%, transparent); }
/* Bedre kontrast på valgte knapper i mørkt tema */
:root[data-theme="dark"] .ta-sk-segknapp.pa, :root[data-theme="dark"] .ta-sk-katknapp.pa { color: #0f1d1e; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] .ta-sk-segknapp.pa, :root[data-theme="system"] .ta-sk-katknapp.pa { color: #0f1d1e; }
}

.ta-sk-dato, .ta-sk-tekst {
  font-size: 13px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink);
}
.ta-sk-tekst { width: 100%; max-width: 320px; }
.ta-sk-detaljer li { white-space: pre-line; }

/* ---------- LMG-sjekklister (v9) ---------- */
.ta-lmg-sjekk { display: flex; flex-direction: column; gap: 6px; }
.ta-sj-kort { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.ta-sj-hode { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: baseline; gap: 8px; padding: 8px 10px; cursor: pointer; }
.ta-sj-hode:hover { background: var(--surface-2); }
.ta-sj-hode:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
.ta-sj-hode::before { content: "▸"; color: var(--muted); font-size: 11px; transition: transform .15s; }
.ta-sj-kort.apen .ta-sj-hode::before { transform: rotate(90deg); }
.ta-sj-tittel { font-weight: 600; color: var(--ink); }
.ta-sj-lm { color: var(--muted); font-size: 12px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ta-sj-teller { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 10px; padding: 0 7px; font-variant-numeric: tabular-nums; }
.ta-sj-teller.pa { color: var(--teal-d); border-color: var(--teal); }
.ta-sj-kropp { display: none; padding: 2px 10px 10px 26px; }
.ta-sj-kort.apen .ta-sj-kropp { display: block; }
.ta-sj-punkt { display: flex; gap: 8px; align-items: flex-start; padding: 3px 0; line-height: 1.35; cursor: pointer; }
.ta-sj-punkt input { margin-top: 2px; accent-color: var(--teal); flex: none; }
.ta-sj-kom { width: 100%; box-sizing: border-box; margin-top: 6px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); font: inherit; }
.ta-sj-verktoy { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.ta-sj-pas { border-style: dashed; }
.ta-sk-katantall { margin-left: 5px; opacity: .6; font-size: .85em; font-variant-numeric: tabular-nums; }

/* Logo: symbolbilde */
.ta-logo { background: none !important; padding: 0; overflow: visible; box-shadow: none !important; }
html:not(.nett) .ta-logo { width: 28px; height: 28px; }
.ta-logo img { width: 100%; height: 100%; display: block; }

/* v9.16: nedtrekksliste og infotekst i kalkulatorer */
.ta-sk-liste-velg { width: 100%; max-width: 520px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; }
.ta-sk-info { font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 8px; padding: 7px 10px; margin: 4px 0 8px; line-height: 1.45; }
.ta-set-row input[type="checkbox"] { width: auto; align-self: flex-start; }

/* ---------- v9.16: Kliniske pakker ---------- */
.ta-pk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 7px; margin: 0 0 9px; padding: 6px 30px 6px 9px; position: relative;
  background: color-mix(in srgb, var(--teal) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--teal) 30%, var(--line)); border-radius: 9px; font-size: 11.5px; color: var(--ink); }
.ta-pk-bar-merke { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--teal-d); margin-right: 2px; }
.ta-pk-bar-diag { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-right: 6px; color: var(--muted); }
.ta-pk-kode { display: inline-block; font-weight: 700; font-size: 11px; color: var(--teal-d); background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; margin-right: 3px; font-variant-numeric: tabular-nums; }
.ta-pk-chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 3px 9px; font: inherit; font-size: 11.5px; cursor: pointer; }
.ta-pk-chip.diag { border-color: var(--teal); color: var(--teal-d); font-weight: 600; }
.ta-pk-chip:hover { border-color: var(--teal); }
.ta-pk-bar-lukk { position: absolute; right: 5px; top: 4px; border: none; background: none; color: var(--muted); font-size: 15px; cursor: pointer; line-height: 1; padding: 2px 4px; }
.ta-pk-topp { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.ta-pk-sok { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; }
.ta-pk-grupper { display: flex; flex-wrap: wrap; gap: 5px; }
.ta-pk-forslag { border: 1px solid color-mix(in srgb, var(--teal) 30%, var(--line)); border-radius: 10px; padding: 8px; margin-bottom: 12px; background: color-mix(in srgb, var(--teal) 5%, var(--surface)); }
.ta-pk-forslag-hode { font-size: 11px; font-weight: 700; color: var(--teal-d); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 6px 2px; }
.ta-pk-forslag-diag { text-transform: none; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.ta-pk-gruppetittel { font-size: 12px; font-weight: 700; color: var(--muted); margin: 14px 2px 6px; text-transform: uppercase; letter-spacing: .04em; }
.ta-pk-rad { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); margin-bottom: 5px; cursor: pointer; }
.ta-pk-rad:hover, .ta-pk-rad:focus-visible { border-color: var(--teal); outline: none; }
.ta-pk-rad-tekst { flex: 1; min-width: 0; }
.ta-pk-rad-tittel { font-size: 13px; font-weight: 600; color: var(--ink); }
.ta-pk-rad-under { font-size: 11px; color: var(--muted); margin-top: 1px; }
.ta-pk-pil { color: var(--muted); font-size: 18px; }
.ta-pk-tom { font-size: 12px; color: var(--muted); padding: 6px 2px; }
.ta-pk-dhode { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.ta-pk-dtittel { font-size: 17px; margin: 4px 0 2px; color: var(--ink); }
.ta-pk-dmeta { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.ta-pk-kort { font-size: 12.5px; color: var(--ink); margin: 4px 0 8px; line-height: 1.45; }
.ta-pk-akutt { background: var(--red-bg); border: 1px solid var(--red-line); color: var(--red); border-radius: 9px; padding: 8px 10px; font-size: 12.5px; font-weight: 600; margin: 6px 0 10px; line-height: 1.4; }
.ta-pk-kolonner { display: flex; flex-direction: column; gap: 10px; }
.ta-pk-del { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 8px 10px 6px; margin-bottom: 8px; }
.ta-pk-del h3, .ta-pk-boks h3, .ta-pk-journal h3 { font-size: 12px; font-weight: 700; margin: 0 0 6px; color: var(--ink); display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ta-pk-felt { font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ta-pk-del.rode { border-color: var(--red-line); }
.ta-pk-del.rode h3 { color: var(--red); }
.ta-pk-sjekk { display: flex; align-items: flex-start; gap: 7px; font-size: 12.5px; padding: 4px 2px; cursor: pointer; line-height: 1.35; color: var(--ink); }
.ta-pk-sjekk input { margin-top: 2px; accent-color: var(--teal); flex: none; }
.ta-pk-sjekk.rod input { accent-color: var(--red); }
.ta-pk-sjekk.rod.pa span { color: var(--red); font-weight: 600; }
.ta-pk-sjekk.ingen { color: var(--muted); border-top: 1px dashed var(--line); margin-top: 3px; padding-top: 6px; }
.ta-pk-verdi { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 3px 2px; color: var(--ink); }
.ta-pk-verdi-t { flex: 1; min-width: 0; }
.ta-pk-verdi input { width: 46%; max-width: 190px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--ink); font: inherit; font-size: 12.5px; }
.ta-pk-verdi.pa input { border-color: var(--teal); background: var(--surface); }
.ta-pk-chips { display: flex; flex-wrap: wrap; gap: 5px 10px; }
.ta-pk-journal, .ta-pk-boks { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 8px 10px; margin-bottom: 8px; }
.ta-pk-tekst { width: 100%; box-sizing: border-box; min-height: 150px; resize: vertical; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font: inherit; font-size: 12.5px; line-height: 1.45; }
.ta-pk-knapper { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.ta-pk-hint, .ta-pk-liten { font-size: 11px; color: var(--muted); margin-top: 5px; line-height: 1.4; }
.ta-pk-takst { display: flex; gap: 6px; align-items: baseline; font-size: 12px; padding: 2px 0; line-height: 1.35; }
.ta-pk-takst-navn { color: var(--ink); }
.ta-pk-boks .ta-btn-mini { margin-top: 6px; }
.ta-pk-kilde { font-size: 10.5px; color: var(--muted); line-height: 1.4; margin: 4px 2px 10px; }
.ta-pk-krav { border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; font-size: 12px; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.ta-pk-krav strong { width: 100%; }
.ta-pk-krav.ok { background: color-mix(in srgb, var(--green) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--green) 40%, var(--line)); }
.ta-pk-krav.mangler { background: var(--amber-bg); border: 1px solid var(--amber-line); }
.ta-pk-kravchip { border-radius: 999px; padding: 1px 8px; font-size: 11.5px; background: var(--surface); border: 1px solid var(--line); }
.ta-pk-kravchip.ok { color: var(--green); border-color: var(--green); font-weight: 600; }
.ta-pk-kravchip.nei { color: var(--amber); }
.ta-pk-verktoy { font-size: 12px; }
.ta-pk-takst { align-items: center; }
.ta-pk-takst-navn { flex: 1; }
.ta-pk-pluss { flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--teal-d); border-radius: 6px; width: 24px; height: 22px; font-weight: 700; cursor: pointer; line-height: 1; }
.ta-pk-pluss:hover { border-color: var(--teal); }
.ta-pk-verktoy { border: none; border-bottom: 1px solid color-mix(in srgb, var(--teal) 45%, transparent); background: none; color: var(--teal-d); font: inherit; font-size: 12.5px; font-weight: 600; padding: 1px 0; cursor: pointer; }
.ta-pk-verktoy:hover { color: var(--teal); border-bottom-color: var(--teal); }
.ta-regning-info { font-size: 11.5px; color: var(--teal-d); background: color-mix(in srgb, var(--teal) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--teal) 25%, var(--line)); border-radius: 8px; padding: 5px 9px; margin: 0 0 8px; }
/* v9.19: autoutfylling, lab, takstforslag, favoritter */
.ta-pk-dhode-h { display: flex; gap: 6px; }
.ta-pk-verdi { position: relative; }
.ta-pk-verdi.auto input { border-style: dashed; border-color: var(--teal); background: color-mix(in srgb, var(--teal) 6%, var(--surface)); }
.ta-pk-auto { flex: none; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--teal-d); background: color-mix(in srgb, var(--teal) 12%, var(--surface)); border-radius: 4px; padding: 1px 4px; }
.ta-pk-labrad { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "n v" "m s"; gap: 0 8px; align-items: center; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 12px; }
.ta-pk-labrad:last-of-type { border-bottom: none; }
.ta-pk-labnavn { grid-area: n; font-weight: 600; color: var(--ink); }
.ta-pk-labverdi { grid-area: v; font-weight: 700; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.ta-pk-labmeta { grid-area: m; font-size: 11px; color: var(--muted); }
.ta-pk-spark { grid-area: s; width: 90px; height: 24px; justify-self: end; }
.ta-pk-spark polyline { fill: none; stroke: var(--teal); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.ta-pk-spark circle { fill: var(--teal-d); }
.ta-pk-takstforslag-hode { font-size: 11px; font-weight: 700; color: var(--teal-d); margin: 8px 0 3px; padding-top: 6px; border-top: 1px dashed var(--line); }
.ta-pk-registrert { flex: none; font-size: 10px; color: var(--green); border: 1px solid color-mix(in srgb, var(--green) 40%, var(--line)); border-radius: 999px; padding: 0 6px; }

/* ---------- v9.22: tilkobling, varsler, diagnose, statistikk ---------- */
.ta-tilkobling { display: flex; flex-wrap: wrap; gap: 4px; margin: -2px 0 8px; }
.ta-tk-chip { font-size: 10.5px; border-radius: 999px; padding: 1px 8px; border: 1px solid var(--line); color: var(--muted); background: var(--surface); }
.ta-tk-chip.ok { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, var(--line)); }
.ta-varsel-bar { margin: 0 0 9px; border: 1px solid #e9c48a; background: #fdf3e2; border-radius: 10px; color: #6b4a12; font-size: 12px; overflow: hidden; }
:root[data-theme="dark"] .ta-varsel-bar { background: #2e2616; border-color: #5a4622; color: #e8c98e; }
.ta-varsel-hode { display: flex; align-items: center; gap: 8px; width: 100%; border: none; background: none; color: inherit; font: inherit; padding: 7px 10px; cursor: pointer; text-align: left; }
.ta-varsel-ikon { flex: none; width: 18px; height: 18px; border-radius: 50%; background: #e3a23b; color: #fff; font-weight: 800; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.ta-varsel-antall { flex: none; font-weight: 700; }
.ta-varsel-forste { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .85; }
.ta-varsel-pil { flex: none; opacity: .7; }
.ta-varsel-liste { list-style: none; margin: 0; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 5px; }
.ta-varsel { display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px; border-radius: 8px; background: rgba(255,255,255,.55); line-height: 1.4; }
:root[data-theme="dark"] .ta-varsel { background: rgba(0,0,0,.18); }
.ta-varsel.obs { border-left: 3px solid #d9822b; }
.ta-varsel.info { border-left: 3px solid #e9c48a; }
.ta-varsel-tekst { flex: 1; min-width: 0; }
.ta-varsel-handling { flex: none; border: 1px solid #e0b46c; background: transparent; color: inherit; border-radius: 6px; font: inherit; font-size: 11px; padding: 2px 7px; cursor: pointer; }
.ta-varsel-lukk { flex: none; border: none; background: none; color: inherit; opacity: .6; cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; }
.ta-diag-liste { display: flex; flex-direction: column; gap: 3px; }
.ta-diag-rad { display: flex; align-items: center; gap: 7px; font-size: 12.5px; padding: 3px 2px; cursor: pointer; }
.ta-diag-rad input { accent-color: var(--teal); }
.ta-diag-tittel { flex: 1; min-width: 0; color: var(--ink); }
.ta-diag-grunn { font-size: 10.5px; color: var(--muted); }
.ta-diag-sok input { width: 100%; box-sizing: border-box; margin-top: 6px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 12.5px; }
.ta-btn-overfor { background: var(--teal-d) !important; color: #fff !important; }
.ta-stat summary { cursor: pointer; font-weight: 700; font-size: 12.5px; color: var(--ink); }
.ta-stat select { margin: 8px 0; padding: 4px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); }
.ta-stat-tab { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 8px; }
.ta-stat-tab td { padding: 3px 4px; border-bottom: 1px dashed var(--line); }
.ta-stat-tab td:nth-child(n+3) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ta-pk-sjekk.auto input { outline: 1px dashed var(--teal); outline-offset: 1px; }
.ta-tk-feil { font-size: 10.5px; border: 0; background: none; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 1px 4px; margin-left: auto; }
.ta-tk-feil:hover { color: var(--ink); }
.ta-versjon-varsel { font-size: 11.5px; margin: 4px 0; padding: 6px 10px; border-radius: 8px; background: color-mix(in srgb, #e8912d 14%, var(--surface)); border: 1px solid color-mix(in srgb, #e8912d 45%, var(--line)); color: var(--ink); }

/* ---------- v9.25: Pasient-fanen ---------- */
.ta-ps-topp { margin: 2px 0 8px; }
.ta-ps-topp h2 { font-size: 16px; margin: 0 0 2px; }
.ta-ps-grid { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
.ta-ps-boks { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 8px 10px; margin-bottom: 8px; }
.ta-ps-boks h3 { font-size: 12.5px; margin: 0 0 6px; display: flex; gap: 8px; align-items: baseline; }
.ta-ps-hint { font-weight: 400; font-size: 11px; color: var(--muted); }
.ta-ps-tom, .ta-ps-liten { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.ta-ps-rad { display: flex; flex-wrap: wrap; gap: 5px 8px; align-items: center; margin-top: 4px; }
.ta-ps-tag { font-size: 10.5px; border-radius: 999px; padding: 1px 7px; background: var(--surface-2); border: 1px solid var(--line); margin-left: 4px; }
.ta-ps-kalk { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.ta-ps-kort { border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--bg); display: flex; flex-direction: column; gap: 3px; }
.ta-ps-kort.lav { border-left-color: var(--green); }
.ta-ps-kort.mod { border-left-color: var(--amber); }
.ta-ps-kort.hoy { border-left-color: var(--red); }
.ta-ps-kort.info { border-left-color: var(--teal); }
.ta-ps-kort-topp { display: flex; justify-content: space-between; gap: 6px; font-size: 12.5px; }
.ta-ps-kort-navn { font-weight: 600; }
.ta-ps-kort-skar { font-weight: 700; white-space: nowrap; }
.ta-ps-kort.hoy .ta-ps-kort-skar { color: var(--red); } .ta-ps-kort.mod .ta-ps-kort-skar { color: var(--amber); }
.ta-ps-kort-tekst { font-size: 11.5px; line-height: 1.35; }
.ta-ps-kort-auto { font-size: 10.5px; color: var(--muted); line-height: 1.35; }
.ta-ps-kort-knapper { display: flex; gap: 5px; align-items: center; margin-top: auto; padding-top: 3px; }
.ta-ps-grunn { font-size: 10.5px; color: var(--muted); margin-left: auto; }
.ta-ps-lm { list-style: none; margin: 0; padding: 0; }
.ta-ps-lm li { padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.ta-ps-lm li:last-child { border-bottom: 0; }
.ta-ps-lm-kom { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.ta-ps-merke { font-size: 10.5px; border-radius: 6px; padding: 1px 6px; border: 1px solid var(--line); background: var(--surface-2); }
.ta-ps-merke.obs { background: var(--red-bg); border-color: var(--red-line); color: var(--red); }
.ta-ps-merke.mod { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber); }
.ta-ps-lab { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.ta-ps-lab td { padding: 3px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ta-ps-lab-navn { font-weight: 500; }
.ta-ps-lab-verdi { font-weight: 600; white-space: nowrap; }
.ta-ps-lab-verdi.hoy, .ta-ps-lab-verdi.lav { color: var(--red); }
.ta-ps-lab-verdi.hoy::after { content: " ↑"; } .ta-ps-lab-verdi.lav::after { content: " ↓"; }
.ta-ps-ktr { margin-bottom: 7px; }
.ta-ps-ktr-hode { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin-bottom: 2px; }
.ta-ps-ktr-rad { display: grid; grid-template-columns: 10px 1fr auto; gap: 6px; align-items: center; font-size: 11.5px; padding: 1px 0; }
.ta-ps-ktr-prikk { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.ta-ps-ktr-rad.ok .ta-ps-ktr-prikk { background: var(--green); }
.ta-ps-ktr-rad.snart .ta-ps-ktr-prikk { background: var(--amber); }
.ta-ps-ktr-rad.forfalt .ta-ps-ktr-prikk { background: #e8912d; }
.ta-ps-ktr-rad.forfalt { font-weight: 500; }
.ta-ps-ktr-rad.info .ta-ps-ktr-prikk { background: var(--teal); }
.ta-ps-ki-opp { font-size: 12px; margin: 0 0 5px; line-height: 1.45; }
.ta-ps-flagg { font-size: 12px; color: var(--red); background: var(--red-bg); border: 1px solid var(--red-line); border-radius: 7px; padding: 4px 8px; margin-bottom: 4px; }
.ta-ps-varsler { margin: 0; }
.ta-ps-grunn { white-space: nowrap; }
.ta-ps-kort-knapper { flex-wrap: wrap; }
html[data-fane="pasient"] #ta-varsel-bar, html[data-fane="pasient"] #ta-pk-bar { display: none !important; }
.ta-tabs { flex-wrap: wrap; }
.ta-tab-btn { flex: 1 1 auto; white-space: nowrap; }
@media (max-width: 560px) { .ta-ps-lab td:nth-child(4), .ta-ps-lab td:nth-child(5) { display: none; } .ta-ps-kalk { grid-template-columns: 1fr 1fr; } }
@media (max-width: 380px) { .ta-ps-kalk { grid-template-columns: 1fr; } }
/* v9.26: API-nøkler skjules uten passordfelt, så Chrome ikke spør om å lagre passord */
.ta-skjult-nokkel { -webkit-text-security: disc; text-security: disc; }
.ta-skjult-nokkel:focus { -webkit-text-security: none; }
.ta-tk-chip.eldre { color: var(--amber); border-color: var(--amber-line); background: var(--amber-bg); }
.ta-ps-eldre { font-size: 11.5px; color: var(--amber); background: var(--amber-bg); border: 1px solid var(--amber-line); border-radius: 7px; padding: 4px 8px; margin-bottom: 6px; }
.ta-ps-forlop { list-style: none; margin: 4px 0 0; padding: 0; }
.ta-ps-forlop li { border-bottom: 1px solid var(--line); font-size: 11.5px; padding: 3px 0; }
.ta-ps-forlop summary { cursor: pointer; line-height: 1.4; }
.ta-ps-forlop-tekst { white-space: pre-wrap; font-size: 11.5px; color: var(--ink); background: var(--bg); border-radius: 6px; padding: 6px 8px; margin: 4px 0; max-height: 320px; overflow: auto; }
.ta-ps-forlop-mal, .ta-ps-forlop-skar { font-size: 11.5px; line-height: 1.5; margin-bottom: 4px; }
.ta-ps-forlop-skar { color: var(--teal-d); }
.ta-sk-forrige { color: var(--teal-d); }
