/* Esigned – portalen.
   Papperet är huvudsaken: dokument har skugga och verkliga proportioner, gränssnittet runt dem är
   platt med hårfina linjer. Kobolt är handling, grönt betyder signerat, markeringspennans gult visar
   var mottagaren har läst. Mona Sans för gränssnittet, Instrument Serif för dokumentens namn. */

@font-face { font-family: 'Mona Sans'; src: url("../../assets/fonts/MonaSans-VF.woff2") format("woff2"); font-weight: 200 900; font-stretch: 75% 125%; font-display: swap; }
@font-face { font-family: 'Mona Sans Mono'; src: url("../../assets/fonts/MonaSansMono-VF.woff2") format("woff2"); font-weight: 200 900; font-display: swap; }
@font-face { font-family: 'Instrument Serif'; src: url("../../assets/fonts/InstrumentSerif-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Instrument Serif'; src: url("../../assets/fonts/InstrumentSerif-Italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --ink: #0B1534;
  --text: #3B4663;
  --muted: #5F6A85;
  --faint: #8A94AC;
  --desk: #F3F5FA;
  --surface: #FFFFFF;
  --surface-2: #F7F8FC;
  --hover: #F0F3FA;
  --line: #E3E8F2;
  --line-strong: #CBD3E4;

  --brand: #2340D9;
  --brand-dark: #1A2FAE;
  --brand-hi: #4C6BFF;
  --brand-tint: #EBEFFF;
  --brand-tint-2: #DCE3FF;

  --ok: #0A7A52;
  --ok-tint: #E3F4EB;
  --ok-hi: #3DDC97;
  --warn: #9A5200;
  --warn-tint: #FDF1DC;
  --bad: #B42336;
  --bad-tint: #FCE9EC;

  --deep: #070E24;
  --deep-2: #0E1A3D;
  --on-deep: #C9D0E6;
  --on-deep-muted: #8892B6;

  --marker: #FFD84D;
  --marker-soft: rgba(255, 216, 77, .42);
  --marker-ink: #6D5200;

  --font: 'Mona Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --mono: 'Mona Sans Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --shadow-paper: 0 1px 2px rgba(11, 21, 52, .06), 0 2px 0 rgba(11, 21, 52, .02), 0 22px 44px -26px rgba(11, 21, 52, .38);
  --shadow-pop: 0 2px 6px rgba(7, 14, 36, .07), 0 22px 50px -18px rgba(7, 14, 36, .38);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --side-w: 248px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--desk);
  color: var(--text);
  font: 400 15px/1.5 var(--font);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body.has-modal { overflow: hidden; }
::selection { background: var(--brand); color: #fff; }
img, svg { display: block; max-width: 100%; }
a { color: var(--brand); text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; color: var(--ink); text-wrap: balance; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
time, .num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.icon--lg { width: 22px; height: 22px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: -0.01em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Knappar ---------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: none;
  font: 620 14.5px/1 var(--font);
  letter-spacing: -0.005em;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn .icon { width: 17px; height: 17px; }
.btn--brand { background: var(--brand); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 8px 18px -10px rgba(35, 64, 217, .8); }
.btn--brand:hover:not(:disabled) { background: var(--brand-dark); }
.btn--ok { background: var(--ok); color: #fff; }
.btn--ok:hover:not(:disabled) { background: #086645; }
.btn--ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn--ghost:hover:not(:disabled) { border-color: var(--ink); }
.btn--quiet { color: var(--ink); }
.btn--quiet:hover:not(:disabled) { background: var(--hover); }
.btn--danger { background: var(--bad); color: #fff; }
.btn--danger:hover:not(:disabled) { background: #951B2C; }
.btn--light { background: #fff; color: var(--ink); }
.btn--sm { min-height: 34px; padding: 0 12px; gap: 6px; font-size: 13.5px; border-radius: 9px; }
.btn--xs { min-height: 30px; padding: 0 13px 0 11px; gap: 6px; font-size: 12.5px; border-radius: 8px; }
.btn--xs .icon { width: 15px; height: 15px; }
.btn--block { width: 100%; }
.btn.is-busy { color: transparent !important; pointer-events: none; }
.btn.is-busy::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: spin .7s linear infinite;
}
.btn--ghost.is-busy::after, .btn--quiet.is-busy::after { border-color: var(--line-strong); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px; height: 36px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn[aria-pressed="true"], .icon-btn.is-active { background: var(--brand-tint); color: var(--brand); }
.icon-btn--sm { width: 30px; height: 30px; border-radius: 8px; }

/* ---------- Formulär ---------- */

.field { display: grid; gap: 6px; }
.field + .field { margin-top: 14px; }
.field > label, .label { color: var(--ink); font-size: 13px; font-weight: 600; }
.field__hint { color: var(--muted); font-size: 12.5px; }
.field__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field__row > .field + .field { margin-top: 0; }

.input, .select, .textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: 450 14.5px/1.4 var(--font);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: #AEB9D1; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(35, 64, 217, .14); }
.input[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(180, 35, 54, .12); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235F6A85' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
}
.input--sm, .select--sm { min-height: 34px; padding: 6px 10px; font-size: 13.5px; border-radius: 9px; }
.select--sm { padding-right: 30px; background-position: right 8px center; }

.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; color: var(--ink); font-size: 14px; line-height: 1.4; }
.check input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--brand); cursor: pointer; }
.check small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 11px;
  background: #E8ECF5;
  gap: 2px;
}
.seg button {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 30px; padding: 0 12px;
  border: 0; border-radius: 8px;
  background: none; color: var(--muted);
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(11, 21, 52, .12); }
.seg__n { color: var(--faint); font-variant-numeric: tabular-nums; }

/* ---------- Statusetiketter ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
  padding: 0 10px 0 8px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.chip i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip--muted { background: #EDF0F6; color: var(--muted); }
.chip--warn { background: var(--warn-tint); color: var(--warn); }
.chip--brand { background: var(--brand-tint); color: var(--brand); }
.chip--ok { background: var(--ok-tint); color: var(--ok); }
.chip--bad { background: var(--bad-tint); color: var(--bad); }

.live-dot {
  position: relative;
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ok-hi);
  box-shadow: 0 0 0 0 rgba(61, 220, 151, .6);
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(61, 220, 151, 0); } 100% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0); } }

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--brand-tint);
  color: var(--brand);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .02em;
}
.avatar--ok { background: var(--ok-tint); color: var(--ok); }
.avatar--bad { background: var(--bad-tint); color: var(--bad); }
.avatar--muted { background: #EDF0F6; color: var(--muted); }

/* ---------- Appens skal ---------- */

.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }

.side {
  position: sticky;
  top: 0;
  /* sticky skapar en egen stapelkontext – utan z-index hamnar språkpanelen under listans dokumentikoner */
  z-index: 50;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 20px 14px 14px;
  background:
    radial-gradient(120% 50% at 0% 100%, rgba(76, 107, 255, .2), transparent 60%),
    var(--deep);
  color: var(--on-deep);
  overflow-y: auto;
}
.side__logo { display: block; width: 122px; margin: 2px 8px 22px; }
.side__logo img { width: 100%; height: auto; }
.side__new { width: 100%; margin-bottom: 18px; background: var(--brand-hi); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 10px 24px -12px rgba(76, 107, 255, .9); }
.side__new:hover:not(:disabled) { background: var(--brand); }
.nav { display: grid; gap: 2px; }
.nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--on-deep);
  font-size: 14px;
  font-weight: 560;
  text-decoration: none;
}
.nav a .icon { color: var(--on-deep-muted); }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a[aria-current="page"] { background: rgba(76, 107, 255, .16); color: #fff; }
.nav a[aria-current="page"] .icon { color: #AFC0FF; }
.nav__count { margin-left: auto; color: var(--on-deep-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.nav__heading { margin: 22px 12px 6px; color: var(--on-deep-muted); font-size: 12px; font-weight: 600; }
.side :focus-visible { outline-color: #fff; }

.side__notice {
  margin: 18px 4px 0;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 12px;
  color: var(--on-deep);
  font-size: 12.5px;
  line-height: 1.45;
}
.side__notice a { color: #AFC0FF; font-weight: 600; }
.side__notice b { display: block; color: #fff; font-weight: 600; margin-bottom: 2px; }

.side__foot { margin-top: auto; padding-top: 14px; }
.who {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: #fff;
  text-align: left;
  cursor: pointer;
}
.who:hover { background: rgba(255, 255, 255, .06); }
.who .avatar { background: rgba(76, 107, 255, .25); color: #DCE3FF; }
.who__text { min-width: 0; flex: 1; }
.who__name { display: block; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who__org { display: block; color: var(--on-deep-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mobilebar { display: none; }

.main { min-width: 0; }
.page { width: min(100% - 64px, 1240px); margin: 0 auto; padding: 36px 0 80px; }
.page--narrow { width: min(100% - 64px, 900px); }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.page-head h1 { font-size: 34px; font-weight: 560; font-stretch: 104%; letter-spacing: -0.035em; line-height: 1.05; }
.page-head p { margin-top: 8px; color: var(--muted); font-size: 15px; }
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.back {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 18px;
  color: var(--muted); font-size: 13.5px; font-weight: 600; text-decoration: none;
}
.back:hover { color: var(--ink); }

.section-title {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  margin: 0 0 14px;
}
.section-title h2 { font-size: 17px; font-weight: 640; letter-spacing: -0.015em; }
.section-title p { color: var(--muted); font-size: 13.5px; }

.panel { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.panel__pad { padding: 20px 22px; }

/* ---------- Översikt: dokumentets resa ---------- */

.journey {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 30px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}
.journey__step {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 18px 22px 18px 24px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.journey__step + .journey__step { border-left: 1px solid var(--line); }
.journey__step + .journey__step::before {
  content: "";
  position: absolute;
  left: -7px; top: 50%;
  width: 12px; height: 12px;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: var(--surface);
  transform: translateY(-50%) rotate(45deg);
}
.journey__step:hover { background: var(--surface-2); }
.journey__step:hover::before { background: var(--surface-2); }
.journey__step[aria-pressed="true"] { background: var(--brand-tint); }
.journey__step[aria-pressed="true"]::before { background: var(--brand-tint); }
.journey__label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.journey__label i { width: 8px; height: 8px; border-radius: 50%; }
.journey__n { color: var(--ink); font-size: 30px; font-weight: 560; font-stretch: 104%; letter-spacing: -0.03em; line-height: 1.1; }
.journey__sub { color: var(--faint); font-size: 12.5px; }

.overview { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }

/* Registret: dokumenten som en förteckning, inte kort */
.ledger { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.ledger__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search .input { padding-left: 36px; min-height: 36px; font-size: 14px; }
.ledger table { width: 100%; border-collapse: collapse; }
.ledger th {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
.ledger td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ledger tr:last-child td { border-bottom: 0; }
.ledger tbody tr { cursor: pointer; transition: background-color .12s; }
.ledger tbody tr:hover { background: var(--surface-2); }
.ledger .t-right { text-align: right; }
.doc-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.doc-cell__thumb {
  position: relative;
  flex: none;
  width: 30px; height: 38px;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 0 0 1px var(--line), 0 4px 8px -4px rgba(11, 21, 52, .25);
}
.doc-cell__thumb::before {
  content: "";
  position: absolute;
  left: 6px; right: 6px; top: 8px;
  height: 14px;
  background: repeating-linear-gradient(to bottom, #D5DBE8 0 1.5px, transparent 1.5px 4px);
}
.doc-cell__thumb--pdf::after {
  content: "PDF";
  position: absolute;
  left: 3px; bottom: 4px;
  padding: 0 3px;
  border-radius: 2px;
  background: var(--bad);
  color: #fff;
  font-size: 7px;
  font-weight: 700;
  line-height: 11px;
}
.doc-cell__text { min-width: 0; }
.doc-cell__title { display: block; color: var(--ink); font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 380px; }
.doc-cell__sub { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 380px; }
.read-meter { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.when { color: var(--muted); font-size: 13px; white-space: nowrap; }
.when b { display: block; color: var(--ink); font-weight: 560; }
.viewing { display: inline-flex; align-items: center; gap: 7px; color: var(--ok); font-size: 12.5px; font-weight: 600; white-space: nowrap; }

.empty { padding: 56px 24px 60px; text-align: center; }
.empty h3 { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }
.empty p { max-width: 420px; margin: 8px auto 0; color: var(--muted); }
.empty__actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 22px; }

/* Marginalanteckningar: händelser som de sker */
.margin-notes h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 15px; font-weight: 640; }
.notes { display: grid; }
.note {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.4;
  text-decoration: none;
}
.note:hover .note__doc { color: var(--brand); }
.note__icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: #EDF0F6; color: var(--muted); }
.note__icon .icon { width: 15px; height: 15px; }
.note__icon--ok { background: var(--ok-tint); color: var(--ok); }
.note__icon--brand { background: var(--brand-tint); color: var(--brand); }
.note__icon--warn { background: var(--warn-tint); color: var(--warn); }
.note__icon--bad { background: var(--bad-tint); color: var(--bad); }
.note__icon--live { background: rgba(61, 220, 151, .16); color: var(--ok); }
.note b { color: var(--ink); font-weight: 600; }
.note__doc { color: var(--ink); font-weight: 600; }
.note time { display: block; margin-top: 2px; color: var(--faint); font-size: 12px; }
.note.is-new { animation: arrive .9s var(--ease); }
@keyframes arrive { from { background: var(--brand-tint); } }
.notes__empty { padding: 16px 0; color: var(--muted); font-size: 13.5px; }

/* ---------- Dokumentets sida ---------- */

.doc-title {
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(36px, 4.4vw, 54px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.015em;
}
/* Offerter och fakturor: titeln i vanlig text, som sidrubrikerna */
.doc-title--plain { font-family: inherit; font-size: 34px; font-weight: 560; font-stretch: 104%; letter-spacing: -0.035em; line-height: 1.05; }
.doc-meta { display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap; margin-top: 14px; color: var(--muted); font-size: 13.5px; }
.doc-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.doc-meta .icon { width: 15px; height: 15px; color: var(--faint); }

.doc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.stack { display: grid; gap: 28px; }

.people { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.person { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 18px 20px; }
.person + .person { border-top: 1px solid var(--line); }
.person__name { color: var(--ink); font-weight: 600; }
.person__sub { color: var(--muted); font-size: 13px; }
.person__id { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--ok); font-size: 12.5px; font-weight: 600; }
.person__id .icon { width: 15px; height: 15px; }
.person__actions { display: flex; gap: 4px; }

/* Stegen Skickad → Öppnad → Signerad */
.steps { display: flex; align-items: center; gap: 0; margin-top: 12px; grid-column: 2 / -1; }
.step { display: flex; align-items: center; gap: 7px; color: var(--faint); font-size: 12.5px; white-space: nowrap; }
.step i { display: grid; place-items: center; width: 18px; height: 18px; border: 1.5px solid var(--line-strong); border-radius: 50%; }
.step i .icon { width: 11px; height: 11px; stroke-width: 2.6; }
.step.is-done { color: var(--ink); }
.step.is-done i { border-color: var(--brand); background: var(--brand); color: #fff; }
.step.is-signed i { border-color: var(--ok); background: var(--ok); }
.step.is-bad i { border-color: var(--bad); background: var(--bad); color: #fff; }
.step time { color: var(--muted); }
.step__line { flex: 1; min-width: 18px; max-width: 64px; height: 1.5px; margin: 0 10px; background: var(--line-strong); }
.step__line.is-done { background: var(--brand); }

.facts { display: grid; gap: 0; }
.fact { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.fact:last-child { border-bottom: 0; }
.fact dt { color: var(--muted); }
.fact dd { margin: 0; color: var(--ink); font-weight: 560; text-align: right; }

/* Läsning: var mottagaren lade sin tid, som markeringspenna */
.reading { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.reading__doc { position: relative; padding: 22px; background: var(--desk); border-right: 1px solid var(--line); max-height: 640px; overflow: auto; }
.reading__doc .doc-host { margin: 0 auto; }
.reading__list { padding: 20px 22px; }
.reading__total { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 18px; }
.reading__total div { display: grid; gap: 2px; }
.reading__total b { color: var(--ink); font-size: 22px; font-weight: 560; letter-spacing: -0.02em; }
.reading__total span { color: var(--muted); font-size: 12.5px; }
.sections { display: grid; gap: 12px; }
.sec { display: grid; gap: 5px; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.sec__row { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.sec__name { color: var(--ink); font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec__time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sec__bar { position: relative; height: 10px; border-radius: 3px; background: #EEF1F7; overflow: hidden; }
.sec__bar i {
  position: absolute; inset: 0 auto 0 0;
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(255, 216, 77, .75), var(--marker));
  transform-origin: left;
}
.sec:hover .sec__name { color: var(--brand); }
.sec.is-top .sec__name::after { content: " · mest läst"; color: var(--marker-ink); font-weight: 600; }
.reading__hint { margin-top: 16px; color: var(--muted); font-size: 12.5px; }
.reading__empty { padding: 34px 22px; color: var(--muted); font-size: 14px; }

.marker-overlay { position: absolute; pointer-events: none; mix-blend-mode: multiply; background: var(--marker); border-radius: 2px; }

/* Händelselogg */
.timeline { display: grid; }
.tl { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.tl:last-child { border-bottom: 0; }
.tl__icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: #EDF0F6; color: var(--muted); }
.tl__icon .icon { width: 15px; height: 15px; }
.tl__text b { color: var(--ink); font-weight: 600; }
.tl__detail { display: block; color: var(--faint); font-size: 12px; margin-top: 1px; }
.tl time { color: var(--muted); font-size: 12.5px; white-space: nowrap; }

/* Frågor */
.thread { display: grid; gap: 10px; max-height: 360px; overflow: auto; padding: 4px 2px 10px; }
.bubble { max-width: 86%; padding: 10px 13px; border-radius: 14px; background: #EEF1F7; color: var(--ink); font-size: 14px; line-height: 1.45; white-space: pre-wrap; }
.bubble--me { justify-self: end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.bubble--them { border-bottom-left-radius: 4px; }
.bubble small { display: block; margin-top: 4px; opacity: .7; font-size: 11.5px; }
.composer { display: grid; gap: 8px; justify-items: end; margin-top: 8px; }
.composer .textarea { min-height: 64px; }

/* ---------- Mallar ---------- */

.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 26px 22px; }
.tpl { display: grid; gap: 12px; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.tpl__paper {
  display: block;
  position: relative;
  aspect-ratio: 210 / 297;
  border-radius: 3px;
  background: #fff;
  box-shadow: var(--shadow-paper);
  overflow: hidden;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.tpl:hover .tpl__paper { transform: translateY(-3px); box-shadow: 0 1px 2px rgba(11, 21, 52, .06), 0 30px 50px -24px rgba(11, 21, 52, .45); }
.tpl__paper iframe { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; pointer-events: none; }
.tpl__blank { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); }
.tpl__name { color: var(--ink); font-size: 15px; font-weight: 620; letter-spacing: -0.01em; }
.tpl__desc { margin-top: 2px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.tpl__tag { margin-left: 6px; color: var(--faint); font-size: 12px; font-weight: 500; }
.tpl-actions { display: flex; gap: 6px; margin-top: 8px; }

/* Nytt dokument */
.create-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.create {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.create:hover { border-color: var(--brand); background: var(--brand-tint); }
.create .icon { width: 22px; height: 22px; color: var(--brand); }
.create b { color: var(--ink); font-size: 15px; font-weight: 620; }
.create span { color: var(--muted); font-size: 13px; line-height: 1.45; }
.drop {
  display: grid;
  place-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 26px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-md);
  color: var(--muted);
  text-align: center;
  font-size: 13.5px;
}
.drop.is-over { border-color: var(--brand); background: var(--brand-tint); color: var(--brand); }

/* ---------- Inställningar ---------- */

.settings { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 36px; align-items: start; }
.subnav { position: sticky; top: 24px; display: grid; gap: 2px; }
.subnav a { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 12px; border-radius: 10px; color: var(--text); font-size: 14px; font-weight: 560; text-decoration: none; }
.subnav a:hover { background: var(--hover); color: var(--ink); }
.subnav a[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.form-card { padding: 26px 28px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.form-card + .form-card { margin-top: 22px; }
.form-card h2 { font-size: 18px; font-weight: 640; letter-spacing: -0.015em; }
.form-card > p { margin: 6px 0 20px; color: var(--muted); font-size: 14px; }
.sub { display: grid; grid-template-columns: minmax(0, 1.3fr) repeat(2, minmax(0, 1fr)); gap: 12px; }
.sub > * { padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }
.sub__plan { display: grid; gap: 4px; align-content: center; }
.sub__name { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--ink); font-size: 20px; font-weight: 650; letter-spacing: -0.02em; }
.sub__price { color: var(--muted); font-size: 13.5px; }
.sub__meter { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-content: center; font-size: 13px; color: var(--muted); }
.sub__meter b { color: var(--ink); font-weight: 650; }
.sub__meter i { grid-column: 1 / -1; height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.sub__meter s { display: block; height: 100%; border-radius: 6px; background: var(--brand); transition: width .5s var(--ease); }
.sub__meter s.is-full { background: var(--warn); }
.sub__term { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; color: var(--muted); font-size: 13px; }
.sub__term .icon { width: 14px; height: 14px; }
.sub__term.is-ending { color: var(--warn); font-weight: 600; }
.sub__end { display: flex; align-items: center; gap: 14px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.sub__end > div { display: grid; gap: 3px; flex: 1; min-width: 0; font-size: 13.5px; color: var(--muted); }
.sub__end b { color: var(--ink); font-weight: 600; font-size: 14px; }
.sub__end-btn { color: var(--bad); flex: none; }
.sub__end-btn:hover:not(:disabled) { border-color: var(--bad); }
.sub__end.is-done { align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--warn-tint); }
.sub__pick { display: flex; justify-content: center; margin-top: 26px; }
.form-card .plans { margin-top: 22px; }
@media (max-width: 1440px) { .form-card .plans { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 20px; } .form-card .plans__rows, .form-card .plans__shared { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) { .sub { grid-template-columns: minmax(0, 1fr); } .sub__end { flex-wrap: wrap; } .form-card .plans { grid-template-columns: minmax(0, 1fr); } }
.form-card__foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }

/* Kunder (Esigneds administration) */
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.card-head > div > p { margin: 6px 0 20px; color: var(--muted); font-size: 14px; }
.limit-pick { display: flex; gap: 8px; }
.limit-pick .select { flex: 1; min-width: 0; }
.limit-pick .input { width: 96px; flex: none; }
.status-row b .chip { margin-left: 4px; vertical-align: 1px; }
.status-row--link { color: inherit; text-decoration: none; border-radius: 8px; transition: background-color .12s; }
.status-row--link:hover { background: var(--surface-2); }
.logo-drop { display: flex; align-items: center; gap: 18px; }
.logo-drop__img { display: grid; place-items: center; width: 168px; height: 74px; padding: 10px; border: 1px dashed var(--line-strong); border-radius: 12px; background: var(--surface-2); }
.logo-drop__img img { max-height: 100%; width: auto; object-fit: contain; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatch { width: 30px; height: 30px; border: 0; border-radius: 50%; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.color-input { width: 44px; height: 34px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; cursor: pointer; }
.status-list { display: grid; }
.status-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.status-row:last-child { border-bottom: 0; }
.status-row b { display: block; color: var(--ink); font-weight: 600; }
.status-row span { color: var(--muted); font-size: 13.5px; }
.status-row code { font-family: var(--mono); font-size: 12px; padding: 1px 5px; border-radius: 5px; background: #EDF0F6; color: var(--ink); }

/* ---------- Banner (utkorg i utvecklingsläge) ---------- */

.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  padding: 12px 16px;
  border: 1px solid #F2DDB5;
  border-radius: 12px;
  background: var(--warn-tint);
  color: #6A3A00;
  font-size: 13.5px;
}
.banner .icon { color: var(--warn); }
.banner a { color: inherit; font-weight: 700; }

/* ---------- Dialoger, menyer och notiser ---------- */

.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(7, 14, 36, .48); animation: fade .18s ease; }
.modal__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 560px);
  max-height: calc(100vh - 40px);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  animation: rise .26s var(--ease);
}
.modal__panel--sm { width: min(100%, 440px); }
.modal__panel--lg { width: min(100%, 760px); }
.modal__panel--xl { width: min(100%, 980px); }
.modal__head { display: flex; justify-content: space-between; gap: 16px; padding: 22px 24px 4px; }
.modal__head h2 { font-size: 20px; font-weight: 620; letter-spacing: -0.02em; }
.modal__lead { margin-top: 4px; color: var(--muted); font-size: 14px; }
.modal__x { margin: -6px -8px 0 0; }
.modal__body { padding: 16px 24px 22px; overflow: auto; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px 20px; border-top: 1px solid var(--line); }
.modal.is-leaving .modal__panel { animation: sink .18s ease forwards; }
.modal.is-leaving .modal__backdrop { animation: fade .18s ease reverse forwards; }
/* Tvåstegsverifiering: guidad inställning i tre steg */
.totp-steps { display: grid; gap: 22px; margin: 4px 0 0; padding: 0; list-style: none; counter-reset: totp; }
.totp-steps:focus { outline: none; }
.totp-step { position: relative; padding-left: 40px; counter-increment: totp; }
.totp-step::before {
  content: counter(totp);
  position: absolute; left: 0; top: -2px;
  display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand-tint); color: var(--brand);
  font-size: 13px; font-weight: 700;
}
.totp-step:not(:last-child)::after { content: ""; position: absolute; left: 12.5px; top: 30px; bottom: -18px; width: 1px; background: var(--line); }
.totp-step h3 { margin: 0 0 4px; font-size: 15px; font-weight: 620; letter-spacing: -0.01em; color: var(--ink); }
.totp-step p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.totp-apps { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.totp-apps li { padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--ink); font-size: 12.5px; font-weight: 560; }
.totp-scan { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; margin-top: 12px; }
.totp-qr { flex: none; width: 156px; height: 156px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.totp-alt { flex: 1; min-width: 200px; display: grid; gap: 4px; font-size: 13.5px; }
.totp-alt b { font-weight: 600; color: var(--ink); }
.totp-alt b:not(:first-child) { margin-top: 10px; }
.totp-key { display: flex; align-items: center; gap: 6px; margin-top: 2px; padding: 6px 6px 6px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }
.totp-key code { flex: 1; display: flex; flex-wrap: wrap; gap: 2px 8px; font: 600 13.5px/1.5 Menlo, Consolas, monospace; color: var(--ink); }
.totp-key code span { white-space: nowrap; }
.totp-code { margin-top: 10px; max-width: 220px; font: 600 18px/1 Menlo, Consolas, monospace; letter-spacing: .12em; }
@media (max-width: 560px) { .totp-step { padding-left: 34px; } .totp-step::before { width: 24px; height: 24px; font-size: 12px; } .totp-step::after { left: 11.5px; } .totp-qr { width: 132px; height: 132px; padding: 8px; } .totp-alt { min-width: 0; flex-basis: 100%; } .totp-code { max-width: none; } }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.985); } }
@keyframes sink { to { opacity: 0; transform: translateY(8px) scale(.99); } }

.menu {
  position: absolute;
  z-index: 120;
  min-width: 210px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}
.menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 520;
  text-align: left;
  cursor: pointer;
}
.menu__item .icon { width: 16px; height: 16px; color: var(--muted); }
.menu__item:hover, .menu__item:focus-visible { background: var(--hover); outline: none; }
.menu__item:disabled { opacity: .45; cursor: default; }
.menu__item--danger, .menu__item--danger .icon { color: var(--bad); }
.menu__item kbd { margin-left: auto; color: var(--faint); font: 500 11.5px var(--font); }
.menu__sep { margin: 5px 4px; border: 0; border-top: 1px solid var(--line); }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 420px;
  padding: 11px 10px 11px 14px;
  border-radius: 12px;
  background: var(--deep);
  color: #fff;
  font-size: 14px;
  box-shadow: var(--shadow-pop);
  pointer-events: auto;
  animation: rise .3s var(--ease);
}
.toast .icon { color: var(--ok-hi); }
.toast--error .icon { color: #FF8A99; }
.toast--info .icon, .toast--live .icon { color: #AFC0FF; }
.toast__msg { flex: 1; line-height: 1.4; }
.toast__action { padding: 4px 8px; border: 0; border-radius: 7px; background: rgba(255, 255, 255, .12); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; }
.toast__close { display: grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 7px; background: none; color: rgba(255, 255, 255, .6); cursor: pointer; }
.toast__close:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.toast__close .icon { width: 15px; height: 15px; color: currentColor; }
.toast.is-leaving { animation: sink .22s ease forwards; }

.skeleton { border-radius: 6px; background: linear-gradient(90deg, #ECEFF6 25%, #F5F7FB 50%, #ECEFF6 75%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Inloggning ---------- */

.auth {
  display: flex; flex-direction: column; align-items: center; gap: 28px;
  min-height: 100vh; padding: clamp(28px, 7vh, 72px) 16px 28px;
  background: radial-gradient(70% 45% at 50% 0%, var(--brand-tint), transparent 70%), var(--desk);
}
.auth__logo { width: 128px; animation: auth-in .6s var(--ease) both; }
.auth__logo img { display: block; width: 100%; height: auto; }
.auth__card {
  width: min(100%, 420px); margin: auto 0;
  padding: 40px clamp(22px, 6vw, 40px) 34px;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--shadow-paper);
  animation: auth-in .7s .06s var(--ease) both;
}
.auth__card.is-shake { animation: auth-shake .42s var(--ease); }
.auth__card h1 { color: var(--ink); font-size: 28px; font-weight: 580; font-stretch: 104%; letter-spacing: -0.03em; line-height: 1.1; }
.auth__card > p { margin-top: 8px; color: var(--muted); font-size: 14.5px; }
.auth__card form { margin-top: 26px; }
.auth__card .input { min-height: 46px; }
.auth__card .input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-tint); outline: none; }
.auth__label { display: flex; justify-content: space-between; align-items: baseline; }
.auth__label label { color: var(--ink); font-size: 13px; font-weight: 600; }
.auth__label a { font-size: 13px; font-weight: 600; }
.auth__pw { position: relative; }
.auth__pw .input { padding-inline-end: 46px; }
.auth__eye {
  position: absolute; inset-inline-end: 5px; top: 50%; translate: 0 -50%;
  display: grid; place-items: center; width: 36px; height: 36px;
  border: 0; border-radius: 8px; background: none; color: var(--faint); cursor: pointer;
  transition: color .15s, background-color .15s;
}
.auth__eye:hover { color: var(--ink); background: var(--hover); }
.auth__eye .icon { width: 18px; height: 18px; }
.auth__eye[aria-pressed="true"] { color: var(--brand); }
.auth__card .btn--block { margin-top: 24px; min-height: 48px; }
.auth__card > .auth__alt { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; text-align: center; }
.auth__alt a { font-weight: 600; }
.auth__error { display: flex; gap: 10px; align-items: flex-start; margin-top: 18px; padding: 11px 14px; border-radius: 10px; background: var(--bad-tint); color: var(--bad); font-size: 14px; animation: auth-in .35s var(--ease) both; }
.auth__error .icon { flex: none; margin-top: 1px; }
.auth__fine { display: flex; align-items: center; gap: 7px; color: var(--faint); font-size: 12.5px; animation: auth-in .7s .14s var(--ease) both; }
.auth__fine .icon { width: 14px; height: 14px; }
.auth__card > * { transition: opacity .2s, transform .2s var(--ease); }
.auth__card.is-leaving > * { opacity: 0; transform: translateY(-6px); }

.auth__card { transition: width .35s var(--ease); }
.auth__card.is-swap { animation: auth-in .45s var(--ease) both; }
.auth__card--wide { width: min(100%, 1120px); padding-inline: clamp(18px, 4vw, 40px); }
.auth__head { display: grid; justify-items: center; text-align: center; }
.auth__head > p { max-width: 34em; margin-top: 8px; color: var(--muted); font-size: 14.5px; }
.auth__head .billing { margin-top: 22px; }
.auth__next { display: flex; justify-content: center; margin-top: 26px; }
.auth__next .btn { min-width: 260px; min-height: 48px; }
.auth__plan { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; padding: 10px 12px 10px 14px; border-radius: var(--r-sm); background: var(--brand-tint); color: var(--brand-dark); font-size: 13.5px; }
.auth__plan b { font-weight: 650; }
.auth__plan button { border: 0; background: none; color: var(--brand); font: 600 13px/1 var(--font); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* Prenumeration: månad/år-växel och plankort. */
.billing { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.billing input { position: absolute; opacity: 0; pointer-events: none; }
.billing span { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 16px; border-radius: 999px; color: var(--muted); font-size: 13.5px; font-weight: 600; cursor: pointer; transition: background-color .2s, color .2s, box-shadow .2s; }
.billing em { padding: 3px 7px; border-radius: 999px; background: var(--ok-tint); color: var(--ok); font-size: 11.5px; font-style: normal; font-weight: 650; }
.billing input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(11, 21, 52, .1), 0 0 0 1px var(--line); }
.billing input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

.plans { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 28px; }
.plan {
  position: relative; display: flex; flex-direction: column;
  padding: 22px 20px 20px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); cursor: pointer;
  transition: border-color .2s, box-shadow .2s, transform .25s var(--ease);
}
.plan:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.plan > input { position: absolute; opacity: 0; pointer-events: none; }
.plan:has(> input:checked) { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), 0 18px 40px -24px rgba(35, 64, 217, .55); }
.plan:has(> input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 3px; }
.plan--contact { cursor: default; background: var(--surface-2); }
.plan--contact:hover { transform: none; border-color: var(--line); }
.plan__radio { position: absolute; top: 20px; right: 18px; width: 20px; height: 20px; border: 1.5px solid var(--line-strong); border-radius: 50%; transition: border-color .2s, background-color .2s; }
.plan__radio::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: #fff; transform: scale(0); transition: transform .25s var(--ease); }
.plan:has(> input:checked) .plan__radio { border-color: var(--brand); background: var(--brand); }
.plan:has(> input:checked) .plan__radio::after { transform: scale(1); }
.plan__badge { position: absolute; top: -10px; left: 18px; padding: 4px 9px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 650; letter-spacing: .01em; }
.plan__badge--current { background: var(--ok); }
.plan__name { color: var(--ink); font-size: 17px; font-weight: 650; letter-spacing: -0.015em; }
.plan__tag { margin-top: 3px; color: var(--muted); font-size: 13px; }
.plan__price { display: grid; gap: 4px; margin-top: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.plan__price b { color: var(--ink); font-size: 30px; font-weight: 600; font-stretch: 104%; letter-spacing: -0.035em; line-height: 1; }
.plan__price small { min-height: 2.6em; color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.plan__list { display: grid; gap: 9px; margin-top: 16px; font-size: 13.5px; color: var(--text); }
.plan__list li { overflow-wrap: break-word; display: flex; gap: 8px; align-items: flex-start; line-height: 1.35; }
.plan__list .icon { flex: none; width: 15px; height: 15px; margin-top: 2px; color: var(--ok); }
.plan__list li.is-missing { color: var(--faint); }
.plan__list li.is-missing > span:last-child { text-decoration: line-through; text-decoration-color: rgba(138, 148, 172, .55); }
.plan__no { position: relative; flex: none; width: 15px; height: 15px; margin-top: 2px; }
.plan__no::before { content: ""; position: absolute; left: 3px; right: 3px; top: 7px; height: 1.5px; border-radius: 2px; background: var(--line-strong); }
.plan__seats + .plan__list { margin-top: 14px; }
.plan__tag--missing { color: var(--faint); }
.plan__price { border-bottom: 0; padding-bottom: 0; }
.plan__seats { display: flex; align-items: center; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--ink); font-size: 14px; font-weight: 600; }
.plan__seats .icon { width: 17px; height: 17px; color: var(--brand); }
.plans__shared { display: grid; grid-template-columns: auto 1fr; gap: 10px 24px; align-items: baseline; margin-top: 16px; padding: 16px 20px; border-radius: var(--r-md); background: var(--surface-2); }
.plans__shared > span { color: var(--ink); font-size: 13px; font-weight: 650; }
.plans__shared ul { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13.5px; color: var(--text); }
.plans__shared li { display: flex; gap: 6px; align-items: center; }
.plans__shared .icon { width: 15px; height: 15px; color: var(--ok); }
.plans__rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.plans__rows--single { grid-template-columns: minmax(0, 1fr); }
.plan--row { flex-direction: row; align-items: center; gap: 14px; padding: 16px 18px; }
.plan--row:hover { transform: none; }
.plan--row > span:not([class]) { display: grid; gap: 2px; flex: 1; min-width: 0; }
.plan--row .plan__name { font-size: 15px; }
.plan--row .plan__tag { margin: 0; font-size: 12.5px; }
.plan--row .plan__radio { position: relative; top: auto; right: auto; flex: none; }
.plan--row .plan__badge { left: 14px; }
.plan--row .btn { flex: none; }
.plan__icon { display: grid; place-items: center; flex: none; width: 20px; color: var(--muted); }
@media (max-width: 1000px) { .plans { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 20px; } .plans__rows, .plans__shared { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) {
  .plans { grid-template-columns: minmax(0, 1fr); gap: 10px; row-gap: 16px; }
  .plans .plan { padding: 18px 14px 14px; }
  .plans .plan__tag { display: none; }
  .plans .plan__price { margin-top: 12px; }
  .plans .plan__price b { font-size: 24px; }
  .plans .plan__price small { min-height: 0; }
  .plans .plan__seats { margin-top: 12px; padding-top: 12px; font-size: 13px; }
  .plans .plan__list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 12px; font-size: 12.5px; }
  .plans .plan__price { grid-template-columns: auto 1fr; align-items: baseline; gap: 8px; }
  .plans .plan__radio { top: 16px; right: 12px; width: 18px; height: 18px; }
  .plan--row { flex-wrap: wrap; }
  .plan--contact .btn { width: 100%; }
  .auth__next .btn { width: 100%; min-width: 0; }
}

/* Bekräftelse: ringen ritas, fylls grön och bocken dras – sedan vidare. */
.auth__done { display: grid; justify-items: center; padding: 10px 0 6px; text-align: center; }
.auth__done h1 { margin-top: 22px; animation: auth-in .5s .55s var(--ease) both; }
.auth__done p { margin-top: 8px; color: var(--muted); font-size: 14.5px; animation: auth-in .5s .65s var(--ease) both; }
.auth__check { width: 76px; height: 76px; border-radius: 50%; animation: auth-fill .4s .5s ease-out both, auth-pop .5s .5s var(--ease) both; }
.auth__check circle { fill: none; stroke: var(--ok); stroke-width: 3; stroke-dasharray: 214; stroke-dashoffset: 214; transform: rotate(-90deg); transform-origin: center; animation: auth-draw .55s var(--ease) forwards; }
.auth__check path { fill: none; stroke: #fff; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 44; stroke-dashoffset: 44; animation: auth-draw .38s .72s var(--ease) forwards; }
.auth__bar { width: 120px; height: 3px; margin-top: 24px; border-radius: 3px; background: var(--line); overflow: hidden; animation: auth-in .4s .8s var(--ease) both; }
.auth__bar i { display: block; height: 100%; background: var(--ok); transform-origin: left; animation: auth-bar 1s .85s var(--ease) both; }
.auth__done .auth__alt { align-self: stretch; margin-top: 26px; animation: auth-in .5s .8s var(--ease) both; }

@keyframes auth-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes auth-draw { to { stroke-dashoffset: 0; } }
@keyframes auth-fill { to { background: var(--ok); box-shadow: 0 0 0 10px var(--ok-tint); } }
@keyframes auth-pop { 0% { transform: scale(1); } 45% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes auth-bar { from { transform: scaleX(0); } }
@keyframes auth-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------- Fakturor ---------- */

.nav__badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--brand-hi); color: #fff; font-size: 11.5px; font-weight: 700; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.nav__badge[hidden] { display: none; }
.doc-cell__thumb--inv { display: grid; place-items: center; color: var(--brand); }
.doc-cell__thumb--inv::before { display: none; }
.doc-cell__thumb--inv .icon { width: 17px; height: 17px; }
.ledger .t-act { width: 1%; white-space: nowrap; }
.when.is-late b, .doc-meta .is-late, .doc-meta .is-late .icon { color: var(--bad); }
.doc-meta > a { display: inline-flex; align-items: center; gap: 6px; color: var(--brand); font-weight: 600; text-decoration: none; }
.doc-meta > a:hover { text-decoration: underline; }
.doc-meta > a .icon { color: currentColor; }
.inv-preview { padding: 22px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--desk); max-height: 860px; overflow: auto; }
.inv-preview .doc-host { margin: 0 auto; }
.doc-grid > .stack { grid-template-columns: minmax(0, 1fr); }
.inv-form { display: grid; gap: 12px; }
.inv-form .field + .field { margin-top: 0; }
.inv-form .field__row { gap: 10px; }
.fact__big { font-size: 17px; letter-spacing: -0.01em; }
.inv-links { display: grid; }
.inv-link { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 18px; color: inherit; text-decoration: none; }
.inv-link + .inv-link { border-top: 1px solid var(--line); }
.inv-link:hover { background: var(--surface-2); }
.inv-link > .icon { color: var(--brand); }
.inv-link b { display: block; color: var(--ink); font-weight: 600; }
.inv-link small { color: var(--muted); font-size: 12.5px; }
.inv-send__sum { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 18px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.inv-send__sum > div { display: grid; gap: 2px; padding: 14px 16px; }
.inv-send__sum > div + div { border-left: 1px solid var(--line); }
.inv-send__sum span { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.inv-send__sum b { color: var(--ink); font-size: 22px; font-weight: 560; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.inv-send__sum small { color: var(--faint); font-size: 12px; }
.banner--ok { border-color: #BFE3D2; background: var(--ok-tint); color: #064D34; }
.banner--ok .icon { color: var(--ok); }
.checkline { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13.5px; color: var(--ink); }
.checkline .icon { width: 17px; height: 17px; margin-top: 1px; }
.checkline.is-warn { background: var(--warn-tint); }
.checkline.is-warn .icon { color: var(--warn); }
.checkline a { color: inherit; font-weight: 700; }

/* Fakturaformuläret (upplagt som i Fortnox) */
.invx { display: grid; gap: 18px; margin-bottom: 34px; }
.invx__top, .invx__bottom { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.invx__bottom { grid-template-columns: minmax(0, 1fr) 380px; }
.invx__box { min-width: 0; padding: 20px 22px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.invx__box h2 { margin-bottom: 14px; color: var(--ink); font-size: 15px; font-weight: 640; letter-spacing: -0.01em; }
.invx__h2 { margin-top: 22px; }
.invx__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.invx__grid .span-2 { grid-column: span 2; }
.invx__f { display: grid; gap: 5px; min-width: 0; }
.invx__f > span { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.invx__check { align-self: center; font-size: 14px; }
.invx__hwfields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.invx__hwfields[hidden] { display: none; }
.invx__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.invx__head .muted { font-size: 13px; }
.invx__scroll { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
.invx__rows { width: 100%; min-width: 860px; border-collapse: collapse; table-layout: fixed; }
.invx__rows th { padding: 0 6px 8px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; white-space: nowrap; }
.invx__rows th small { font-weight: 500; }
.invx__rows td { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.invx__rows th:first-child, .invx__rows td:first-child { padding-left: 0; }
.invx__rows .num { text-align: right; }
.invx__rows input.num { text-align: right; font-variant-numeric: tabular-nums; }
.invx__rows .input, .invx__rows .select { width: 100%; min-width: 0; }
.invx__rows tr.is-text .input { font-weight: 600; background: var(--surface-2); }
.invx__amt { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.invx__hw { text-align: center; }
.invx__hw input { width: 18px; height: 18px; accent-color: var(--brand); }
.invx__act { text-align: right; padding-right: 0 !important; }
.invx__add { display: flex; gap: 8px; margin-top: 14px; }
.invx__sum { display: grid; gap: 0; }
.invx__line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.invx__line span { color: var(--muted); }
.invx__line small { margin-left: 4px; color: var(--faint); font-size: 12px; }
.invx__line b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.invx__line--in .input { width: 130px; text-align: right; font-variant-numeric: tabular-nums; }
.invx__line--total { padding: 12px 0; border-bottom: 0; border-top: 1.5px solid var(--ink); }
.invx__line--total span { color: var(--ink); font-weight: 640; }
.invx__line--total b { font-size: 20px; font-weight: 640; letter-spacing: -0.01em; }
.invx__line--ok span, .invx__line--ok b { color: var(--ok); }
.invx__sum .invx__check { margin-top: 10px; }
.invx-preview { margin-bottom: 34px; }

/* ---------- Mindre skärmar ---------- */

@media (max-width: 1180px) {
  .invx__top, .invx__bottom { grid-template-columns: minmax(0, 1fr); }
  .overview, .doc-grid { grid-template-columns: minmax(0, 1fr); }
  .margin-notes { order: -1; }
  .reading { grid-template-columns: minmax(0, 1fr); }
  .reading__doc { border-right: 0; border-bottom: 1px solid var(--line); max-height: 420px; }
}

@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; z-index: 90; width: min(86vw, 300px); transform: translateX(-102%); transition: transform .3s var(--ease); }
  .shell.is-nav-open .side { transform: none; box-shadow: var(--shadow-pop); }
  .mobilebar {
    position: sticky; top: 0; z-index: 80;
    display: flex; align-items: center; gap: 10px;
    min-height: 56px; padding: 0 12px;
    background: var(--deep); color: #fff;
  }
  .mobilebar img { width: 108px; }
  .mobilebar .icon-btn { color: #fff; }
  .mobilebar .icon-btn:hover { background: rgba(255, 255, 255, .1); }
  .mobilebar .btn { margin-left: auto; }
  .page, .page--narrow { width: min(100% - 32px, 1240px); padding-top: 24px; }
  .settings { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .subnav { position: static; display: flex; overflow-x: auto; }
  .journey { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .journey__step:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .journey__step:nth-child(4) { border-top: 1px solid var(--line); }
  .journey__step:nth-child(3)::before { display: none; }
  .create-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  .page-head h1, .doc-title--plain { font-size: 28px; }
  .ledger thead { display: none; }
  .ledger table, .ledger tbody, .ledger tr, .ledger td { display: block; }
  .ledger tr { position: relative; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .ledger td { padding: 3px 0; border: 0; }
  .ledger td.t-value, .ledger td.t-read, .ledger td.t-hide-m, .ledger th.t-hide-m { display: none; }
  .ledger td.t-status { position: absolute; right: 14px; top: 14px; }
  .doc-cell__title, .doc-cell__sub { max-width: calc(100vw - 190px); }
  .person { grid-template-columns: auto minmax(0, 1fr); }
  .person__actions { grid-column: 1 / -1; }
  .steps { flex-wrap: wrap; row-gap: 8px; }
  .field__row { grid-template-columns: minmax(0, 1fr); }
  .invx__grid, .invx__hwfields { grid-template-columns: minmax(0, 1fr); }
  .invx__grid .span-2 { grid-column: auto; }
  .invx__box { padding: 16px; }
  .invx__scroll { margin: 0 -16px; padding: 0 16px; }
  .field__row > .field + .field { margin-top: 14px; }
  .form-card { padding: 20px; }
  .toasts { left: 12px; right: 12px; justify-items: stretch; }
}

/* ---------- Språkväljare (byggs av /assets/js/i18n.js) ---------- */
.lang-menu { position: relative; }
.lang { gap: 7px; padding-inline: 10px; }
.lang .flag { width: 18px; height: 18px; flex: none; }
.lang__code { letter-spacing: .02em; font-weight: 600; }
.lang__chev { width: 14px; height: 14px; flex: none; transition: transform .2s ease; }
.lang[aria-expanded="true"] .lang__chev { transform: rotate(180deg); }
.lang-list {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  z-index: 120;
  width: min(480px, calc(100vw - 24px));
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-pop);
  color: #0B1534;
  text-align: start;
}
.lang-list[hidden] { display: none; }
.lang-search { position: relative; display: flex; align-items: center; margin-bottom: 8px; }
.lang-search__icon { position: absolute; inset-inline-start: 12px; width: 17px; height: 17px; color: #5F6A85; pointer-events: none; }
.lang-search input {
  width: 100%;
  min-height: 42px;
  padding-block: 0;
  padding-inline: 38px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #F7F8FC;
  color: inherit;
  font: inherit;
  font-size: 15px;
}
.lang-search input:focus { outline: 2px solid var(--brand); outline-offset: -1px; background: #fff; }
.lang-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.lang-grid li {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 48px;
  padding: 7px 10px;
  border-radius: 10px;
  cursor: pointer;
}
.lang-grid li[hidden] { display: none; }
.lang-grid li:hover, .lang-grid li:focus-visible { background: var(--brand-tint); color: var(--brand); outline: none; }
.lang-grid .flag { width: 20px; height: 20px; flex: none; }
.lang-opt__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.lang-opt__name { font-size: 14.5px; font-weight: 600; overflow-wrap: break-word; }
.lang-opt__sub { margin-top: 2px; color: #5F6A85; font-size: 12.5px; font-weight: 450; overflow-wrap: break-word; }
.lang-opt__sub[hidden] { display: none; }
.lang-grid li[aria-selected="true"] { background: var(--brand-tint); }
.lang-grid li[aria-selected="true"]::after {
  content: "";
  flex: none;
  width: 6px; height: 10px;
  margin-inline: auto 4px;
  border: solid var(--brand);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translateY(-2px);
}
.lang-empty { margin: 6px 4px 4px; color: #5F6A85; font-size: 14px; }
.lang-empty[hidden] { display: none; }
.auth__lang { position: absolute; top: 18px; inset-inline-end: 18px; z-index: 5; }
.sg-lang { flex: none; }
.side__lang { margin-bottom: 8px; }
.side__lang .lang { width: 100%; justify-content: flex-start; background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .12); color: #fff; }
.side__lang .lang:hover { background: rgba(255, 255, 255, .1); }
.side__lang .lang__chev { margin-inline-start: auto; }
/* Sidomenyn scrollar och skulle klippa panelen – den öppnas därför bredvid menyn */
.side__lang .lang-list { position: fixed; top: auto; bottom: 16px; inset-inline-start: calc(var(--side-w) + 12px); inset-inline-end: auto; }
@media (max-width: 960px) {
  /* Menyn är en utfälld låda (transform) – panelen ligger inuti den */
  .side__lang .lang-list { inset-inline: 12px; bottom: 76px; width: auto; max-height: calc(100% - 100px); overflow: auto; }
}
[dir="rtl"] .icon--dir { scale: -1 1; }
@media (max-width: 720px) {
  .sg-lang .lang__chev { display: none; }
  .sg-lang .lang { padding-inline: 8px; }
  .lang-list { position: fixed; top: 64px; inset-inline: 12px; width: auto; max-height: calc(100vh - 76px); overflow: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
