.cv.ed .w .x {
  visibility: visible;
  opacity: 1;
}
.nt {
  display: grid;
  grid-template-columns: 300px 1fr 104px;
  height: 100%;
  position: relative;
}
.nl {
  border-right: 0.5px solid var(--ln);
  overflow: auto;
  background: var(--bg);
}
.nl button {
  display: block;
  width: 100%;
  padding: 11px 16px;
  border-bottom: 0.5px solid var(--ln);
}
.nl .on {
  background: var(--ac);
  color: #fff;
}
.nl .on .sub {
  color: rgba(255, 255, 255, 0.75);
}
.nl b,
.nl .sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  margin: 0;
}
.ed {
  padding: 26px 44px;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.ed textarea {
  flex: 1;
  border: 0;
  background: none;
  color: var(--tx);
  font: inherit;
  font-size: 17px;
  line-height: 1.6;
  resize: none;
  outline: 0;
}
.cv.ed .it:not(.dg) {
  animation: wig 0.26s ease-in-out infinite alternate;
  cursor: grab;
}
.cv.ed .it:nth-child(even):not(.dg) {
  animation-delay: -0.13s;
}
.ed {
  min-width: 0;
}
.rte {
  flex: 1;
  min-height: 0;
  overflow: auto;
  font-size: 17px;
  line-height: 1.6;
  outline: 0;
  padding-right: 6px;
  user-select: text;
  -webkit-user-select: text;
  word-break: break-word;
}
.rte div {
  min-height: 1.6em;
}
.wc {
  font-size: 12px;
  color: var(--mu);
  text-align: right;
  padding-top: 8px;
}
.rte h1 {
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.2;
  margin: 8px 0 4px;
}
.rte h2 {
  font-size: 22px;
  font-weight: 680;
  letter-spacing: -0.025em;
  line-height: 1.25;
  margin: 6px 0 3px;
}
.rte ul,
.rte ol {
  padding-left: 28px;
  margin: 4px 0;
}
.rte hr {
  border: 0;
  border-top: 1px solid var(--ln);
  margin: 14px 0;
}
.rte .ck {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 2px 0;
}
.rte .ck input {
  width: 18px;
  height: 18px;
  margin: 5px 0 0;
  accent-color: var(--ac);
  flex: none;
  cursor: pointer;
}
.rte .ck .ct {
  flex: 1;
  min-width: 0;
  outline: 0;
}
.rte .ck.done .ct {
  text-decoration: line-through;
  opacity: 0.45;
}
.rte .dbk {
  margin: 10px 0;
  border-radius: 14px;
  background: var(--sf2);
  padding: 8px;
  max-width: 640px;
  user-select: none;
  -webkit-user-select: none;
}
.rte .dbk canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 9px;
  background: var(--sf);
  cursor: crosshair;
  touch-action: none;
}
.rte .dbk .dt {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 4px 0;
}
.rt {
  border-left: 0.5px solid var(--ln);
  background: var(--bg);
  overflow: auto;
  padding: 12px 10px;
  display: grid;
  grid-template-columns: repeat(2, 34px);
  gap: 6px;
  align-content: start;
  justify-content: center;
}
.rt hr {
  grid-column: 1/-1;
  border: 0;
  border-top: 0.5px solid var(--ln);
  margin: 4px 0;
}
.rbn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--tx);
  text-align: center;
  transition:
    background 0.15s,
    transform 0.1s;
}
.rbn:hover {
  background: var(--sf2);
}
.rbn:active {
  transform: scale(0.92);
}
.rbn.on {
  background: var(--ac);
  color: #fff;
}
.rbn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.rp {
  position: absolute;
  right: 112px;
  z-index: 9;
  background: color-mix(in srgb, var(--sf) 90%, transparent);
  backdrop-filter: blur(30px) saturate(1.8);
  -webkit-backdrop-filter: blur(30px) saturate(1.8);
  border-radius: 14px;
  padding: 10px;
  box-shadow:
    0 0 0 0.5px var(--ln),
    0 18px 44px rgba(0, 0, 0, 0.25);
  min-width: 210px;
  animation: pop 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.rp[hidden] {
  display: none;
}
.rp small {
  display: block;
  color: var(--mu);
  font-size: 11.5px;
  font-weight: 600;
  margin: 2px 4px 6px;
}
.rp .fl button {
  display: block;
  width: 100%;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 15px;
}
.rp .fl button:hover {
  background: var(--ac);
  color: #fff;
}
.rp .fl.sz {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.rp .fl.sz button {
  width: auto;
  font-size: 13px;
}
.rp .sg {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  max-width: 220px;
}
.rp .sg button {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--ln);
  transition: transform 0.12s;
}
.rp .sg button:hover {
  transform: scale(1.18);
}
.rp .sg .nn {
  background: linear-gradient(
    135deg,
    var(--sf) 45%,
    #ff3b30 45%,
    #ff3b30 55%,
    var(--sf) 55%
  );
}
.rp .eg {
  display: grid;
  grid-template-columns: repeat(8, 34px);
  gap: 2px;
  max-height: 230px;
  overflow: auto;
}
.rp .eg button {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 20px;
  text-align: center;
  display: grid;
  place-items: center;
}
.rp .eg button:hover {
  background: var(--sf2);
}
.szr {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 4px 8px;
}
.szr input {
  width: 60px;
  margin: 0;
  padding: 6px 4px;
  text-align: center;
  border: 1px solid var(--ln);
  border-radius: 8px;
  background: var(--sf);
  color: var(--tx);
  font: inherit;
}
.szr input:focus {
  border-color: var(--ac);
  outline: 0;
}
.szr button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--sf2);
  text-align: center;
  display: grid;
  place-items: center;
  font-size: 17px;
}
.szr button:hover {
  background: var(--ln);
}
.szr button.ok {
  width: auto;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 600;
}
.szr span {
  color: var(--mu);
  font-size: 12px;
}
.rp .dfl {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--ac);
  font-weight: 600;
  text-align: left;
}
.rp .dfl:hover {
  background: var(--sf2);
}

/* ===== Notater: scroll-fiks + ny sidebar ===== */

/* Rutenettet hadde ingen begrenset rad, så editoren vokste i stedet for å scrolle.
   Med minmax(0,1fr) og min-height:0 får .rte sin egen scrollbar, og man kan scrolle opp igjen. */
.nt {
  grid-template-rows: minmax(0, 1fr);
}
.ed,
.rt,
.nl {
  min-height: 0;
}
.ed {
  overflow: hidden;
}
.rte {
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding-bottom: 80px;
  padding-bottom: 60px;
}
.rt {
  overflow-y: auto;
}

.nl {
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--sf2) 55%, var(--bg));
}
.nsr {
  position: relative;
  padding: 12px 12px 8px;
  flex: none;
}
.nsr svg {
  position: absolute;
  left: 22px;
  top: 21px;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--mu);
  stroke-width: 2.2;
  stroke-linecap: round;
}
.nsr input {
  width: 100%;
  padding: 7px 10px 7px 31px;
  border: 0;
  border-radius: 9px;
  background: var(--sf);
  color: var(--tx);
  font: inherit;
  box-shadow: 0 0 0 0.5px var(--ln);
}
.nsr input:focus {
  outline: 2px solid color-mix(in srgb, var(--ac) 40%, transparent);
}
.nlst {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 10px 110px;
}
.ngr {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--mu);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 14px 8px 5px;
}
.nl .nci {
  display: block;
  width: 100%;
  padding: 9px 12px 8px;
  margin-bottom: 4px;
  border: 0;
  border-radius: 11px;
  background: var(--sf);
  box-shadow: 0 0 0 0.5px var(--ln);
  position: relative;
  transition:
    transform 0.15s,
    box-shadow 0.15s,
    background 0.15s;
}
.nl .nci:hover {
  transform: translateX(2px);
  box-shadow:
    0 0 0 0.5px var(--ln),
    0 4px 12px rgba(0, 0, 0, 0.07);
}
.nl .nci.on {
  background: var(--ac);
  color: #fff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--ac) 40%, transparent);
}
.nl .nci b {
  font-weight: 650;
}
.nl .nci .npv {
  display: block;
  font-size: 12.5px;
  color: var(--mu);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nl .nci.on .npv,
.nl .nci.on .sub {
  color: rgba(255, 255, 255, 0.78);
}
.nl .nci .sub {
  font-size: 11.5px;
  margin-top: 2px;
}

/* ===== Notater v4 ===== */
.nt {
  padding-bottom: 0;
}
.nl {
  /* listen går helt ned til bunnen; menylinjen flyter over, derfor luft nederst i selve listen */
  border-right: 0.5px solid var(--ln);
}
.ed {
  padding: 0 34px;
  background: var(--bg);
}
.edh {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 4px 10px;
  border-bottom: 0.5px solid var(--ln);
  font-size: 12px;
  font-weight: 560;
  color: var(--mu);
  flex: none;
}
.edh .wc {
  padding: 0;
  font-variant-numeric: tabular-nums;
}
.rte {
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  padding: 18px 6px 130px;
}
.ed.nempty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--mu);
  text-align: center;
  padding-bottom: 90px;
}
.ed.nempty b {
  color: var(--tx);
  font-size: 18px;
  letter-spacing: -0.02em;
}
.ed.nempty .btn {
  margin-top: 12px;
}
.nei {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--ac) 12%, transparent);
  margin-bottom: 8px;
}
.nei svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: var(--ac);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Verktøylinjen til høyre: ingen sidelengs rulling, en rolig flate */
.rt {
  overflow-x: hidden;
  grid-template-columns: repeat(2, 36px);
  gap: 6px 4px;
  padding: 16px 6px 120px;
  background: color-mix(in srgb, var(--sf2) 45%, var(--bg));
}
.rbn {
  width: 36px;
  height: 36px;
}

/* ===== v3.9 Notater 2.0 ===== */
.nt.col {
  grid-template-columns: 0 1fr 104px;
}
.nt.col .nl {
  visibility: hidden;
  border: 0;
}
.nsd {
  position: absolute;
  z-index: 5;
  left: 258px;
  top: 14px;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--mu);
  background: var(--sf);
  box-shadow: 0 0 0 0.5px var(--ln);
  transition:
    left 0.25s,
    color 0.15s;
}
.nsd:hover {
  color: var(--ac);
}
.nsd svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nt.col .nsd {
  left: 12px;
}
.nt .nsr {
  padding-right: 50px;
}
.nfb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 12px 10px;
  flex: none;
}
.nl .nfc {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  padding: 4px 10px;
  border: 0;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  color: var(--mu);
  background: var(--sf);
  box-shadow: 0 0 0 0.5px var(--ln);
}
.nl .nfc i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fc);
}
.nl .nfc em {
  font-style: normal;
  opacity: 0.6;
  font-size: 11px;
}
.nl .nfc.on {
  background: var(--fc, var(--ac));
  color: #fff;
  box-shadow: none;
}
.nl .nfc.on i {
  background: #fff;
}
.nl .nfc.add {
  color: var(--ac);
  background: transparent;
  box-shadow: 0 0 0 1px dashed var(--ln);
  border: 1px dashed color-mix(in srgb, var(--ac) 45%, transparent);
}
.nfi {
  width: 120px;
  padding: 4px 10px;
  border-radius: 99px;
  border: 0;
  font: inherit;
  font-size: 12px;
  background: var(--sf);
  color: var(--tx);
  outline: 2px solid color-mix(in srgb, var(--ac) 50%, transparent);
}
.nl .nci {
  position: relative;
}
.nl .nci .nfd {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fc);
  margin-right: 6px;
  vertical-align: 1px;
}
.nl .nci.on .nfd {
  background: #fff;
}
.nmeta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.nmeta .sub {
  display: inline !important;
}
.ntg {
  font-size: 10.5px;
  font-weight: 650;
  padding: 1px 6px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--ac) 14%, transparent);
  color: var(--ac);
}
.nl .nci.on .ntg {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}
.nemp {
  padding: 22px 16px;
  color: var(--mu);
  font-size: 13px;
  line-height: 1.45;
}
/* maler */
.ntplw {
  position: relative;
  display: inline-block;
}
.ntpl {
  position: absolute;
  right: 0;
  top: 40px;
  z-index: 50;
  width: 300px;
  padding: 10px;
  border-radius: 16px;
  background: var(--sf);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.3),
    0 0 0 0.5px var(--ln);
  animation: pop 0.18s cubic-bezier(0.2, 1.2, 0.4, 1);
  text-align: left;
}
.ntpl > b {
  display: block;
  font-size: 13px;
  padding: 4px 8px 8px;
}
.ntpl button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border-radius: 10px;
  text-align: left;
}
.ntpl button:hover {
  background: color-mix(in srgb, var(--ac) 12%, transparent);
}
.ntpl .te {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 18px;
  background: var(--sf2);
  flex: none;
}
.ntpl button b {
  display: block;
  font-size: 13.5px;
}
.ntpl button small {
  display: block;
  font-size: 11.5px;
  color: var(--mu);
}
/* høyreklikk-meny */
.nctx {
  position: fixed;
  z-index: 9000;
  min-width: 210px;
  padding: 6px;
  border-radius: 14px;
  background: var(--sf);
  color: var(--tx);
  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.3),
    0 0 0 0.5px var(--ln);
  animation: pop 0.14s ease-out;
}
.nctx > button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
  text-align: left;
}
.nctx > button:hover {
  background: var(--ac);
  color: #fff;
}
.nctx > button > span:first-child {
  width: 18px;
  text-align: center;
  display: inline-grid;
  place-items: center;
}
.nctx > button i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.nctx > button.red {
  color: #ff453a;
}
.nctx > button.red:hover {
  background: #ff453a;
  color: #fff;
}
.cxs {
  font-size: 11px;
  color: var(--mu);
  font-weight: 650;
  padding: 8px 10px 4px;
}
.cxl {
  height: 0.5px;
  background: var(--ln);
  margin: 5px 4px;
}
.cxc {
  display: flex;
  gap: 6px;
  padding: 4px 10px 6px;
}
.cxc button {
  width: 18px;
  height: 18px;
  border-radius: 50%;
}
.cxc button.on {
  box-shadow:
    0 0 0 2px var(--sf),
    0 0 0 4px var(--tx);
}
/* øv-knapp + flippekort */
.fcbt {
  margin-left: auto;
  margin-right: 12px;
  padding: 4px 11px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 650;
  color: #fff;
  background: linear-gradient(135deg, #5e5ce6, #bf5af2);
  box-shadow: 0 4px 14px rgba(94, 92, 230, 0.35);
}
.md.fcmd {
  width: min(520px, 94vw);
}
.fcp {
  height: 6px;
  border-radius: 3px;
  background: var(--sf2);
  overflow: hidden;
  margin: 6px 0 8px;
}
.fcp i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #5e5ce6, #bf5af2);
  transition: width 0.3s;
}
.fcm {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--mu);
  font-weight: 600;
  margin-bottom: 12px;
}
.fcc {
  position: relative;
  width: 100%;
  height: 220px;
  perspective: 1000px;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.3, 1.3, 0.5, 1);
}
.fcc.fl {
  transform: rotateY(180deg);
}
.fcc .ff,
.fcc .fb {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  border-radius: 20px;
  backface-visibility: hidden;
  font-size: 21px;
  font-weight: 650;
  line-height: 1.35;
  text-align: center;
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.22),
    0 0 0 0.5px var(--ln);
}
.fcc .ff {
  background: var(--sf);
  color: var(--tx);
}
.fcc .fb {
  transform: rotateY(180deg);
  background: linear-gradient(135deg, #5e5ce6, #bf5af2);
  color: #fff;
}
.fca {
  display: flex;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  align-items: center;
  margin-top: 14px;
}
.fca button {
  flex: 1;
  padding: 11px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
}
.fca .no {
  background: color-mix(in srgb, #ff453a 16%, transparent);
  color: #ff453a;
}
.fca .ok {
  background: #34c759;
  color: #fff;
}
.fcd {
  text-align: center;
  padding: 16px 6px 4px;
  display: grid;
  gap: 8px;
}
.fcd .fce {
  font-size: 56px;
}
.fcd b {
  font-size: 17px;
}
.fcd span {
  color: var(--mu);
  font-size: 13px;
}
.fcb {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
}
.fcb .btn {
  width: auto;
  margin: 0;
}
@media (max-width: 760px) {
  .nsd {
    display: none;
  }
  .nt.col .nl {
    visibility: visible;
  }
}
.ntg {
  white-space: nowrap;
}
.fca button {
  text-align: center;
  justify-content: center;
  display: flex;
}
