/* Egen kod, idé från affectUI Invoice and Credit Note (Pro), ingen kod tagen */
.nbin-root {
  --nbin-k: 0, 0, 0;
  --nbin-card: #ffffff;
  --nbin-soft: #FAFAF8;
  --nbin-strong: #000000;
  --nbin-ink: rgba(0, 0, 0, 0.88);
  --nbin-text: rgba(0, 0, 0, 0.61);
      --nbin-line: rgba(0, 0, 0, 0.06);
  --nbin-wash: rgba(0, 0, 0, 0.03);
  --nbin-tray: #F2F1EE;
  --nbin-ember: #D9601C;
  --nbin-ember-ink: #A8460F;
  --nbin-ember-tint: rgba(217, 96, 28, 0.10);
  --nbin-ok: #1E7A4C;
  --nbin-ok-tint: rgba(30, 122, 76, 0.10);
  --nbin-wait: #8A5200;
  --nbin-wait-tint: rgba(178, 106, 0, 0.10);
  --nbin-bad: #B3261E;
  --nbin-solid: rgba(0, 0, 0, 0.88);
  --nbin-on-solid: #fcfcfc;
  --nbin-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.06), 0 1px 1px -1px rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(var(--nbin-k), 0.05);
  --nbin-shadow-hover: 0 0 0 0.5px rgba(0, 0, 0, 0.1), 0 1px 1px -1px rgba(0, 0, 0, 0.12), 0 1px 3px 0 rgba(var(--nbin-k), 0.07);
  --nbin-focus: rgba(217, 96, 28, 0.4);
  --nbin-ease: cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  box-sizing: border-box;
  container-type: inline-size;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 400;
  line-height: 20px;
  color: var(--nbin-ink);
  text-align: left;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

/* Mörkt läge, samma konvention som affectUI */
:where(.dark, [data-theme="dark"]) .nbin-root {
  --nbin-k: 255, 255, 255;
  --nbin-card: #1C1B1A;
  --nbin-soft: #201F1E;
  --nbin-strong: rgba(255, 255, 255, 0.94);
  --nbin-ink: rgba(255, 255, 255, 0.9);
  --nbin-text: rgba(255, 255, 255, 0.64);
      --nbin-line: rgba(255, 255, 255, 0.08);
  --nbin-wash: rgba(255, 255, 255, 0.04);
  --nbin-tray: #161615;
  --nbin-ember: #D9601C;
  --nbin-ember-ink: #F08A4B;
  --nbin-ember-tint: rgba(240, 138, 75, 0.14);
  --nbin-ok: #3EC27A;
  --nbin-ok-tint: rgba(62, 194, 122, 0.13);
  --nbin-wait: #F0B232;
  --nbin-wait-tint: rgba(240, 178, 50, 0.13);
  --nbin-bad: #F07A6E;
  --nbin-solid: rgba(255, 255, 255, 0.9);
  --nbin-on-solid: #161615;
  --nbin-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.1), 0 1px 2px rgba(0, 0, 0, 0.4);
  --nbin-shadow-hover: 0 0 0 0.5px rgba(255, 255, 255, 0.16), 0 1px 3px rgba(0, 0, 0, 0.5);
  --nbin-focus: rgba(240, 138, 75, 0.55);
  color-scheme: dark;
}
.nbin-root *, .nbin-root *::before, .nbin-root *::after { box-sizing: border-box; }
.nbin-root [hidden] { display: none !important; }
:where(.nbin-root) button { margin: 0; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:where(.nbin-root) input, :where(.nbin-root) textarea { font: inherit; color: inherit; margin: 0; }
:where(.nbin-root) svg { display: block; flex: none; }
:where(.nbin-root) h2, :where(.nbin-root) h3, :where(.nbin-root) h4, :where(.nbin-root) p, :where(.nbin-root) ul, :where(.nbin-root) ol, :where(.nbin-root) dl, :where(.nbin-root) dd, :where(.nbin-root) fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
:where(.nbin-root) ul, :where(.nbin-root) ol { list-style: none; }
.nbin-root button:focus-visible, .nbin-root input:focus-visible, .nbin-root textarea:focus-visible, .nbin-root [tabindex]:focus-visible { outline: 2px solid var(--nbin-focus); outline-offset: 1px; }
.nbin-sr { position: absolute; left: 0; top: 0; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.nbin-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 28px; padding: 4px 10px; border-radius: 6px;
  background: var(--nbin-card); box-shadow: var(--nbin-shadow);
  font-weight: 500; white-space: nowrap; color: var(--nbin-ink);
  transition: background-color 140ms ease, box-shadow 140ms ease, transform 160ms var(--nbin-ease), opacity 140ms ease;
}
.nbin-btn:hover { box-shadow: var(--nbin-shadow-hover); }
.nbin-btn:active { transform: scale(0.97); }
.nbin-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nbin-btn--solid { background: var(--nbin-solid); color: var(--nbin-on-solid); box-shadow: none; }
.nbin-btn--solid:hover { background: rgba(var(--nbin-k), 0.8); box-shadow: none; }
.nbin-btn:disabled { opacity: 0.4; cursor: default; transform: none; }

.nbin-seg { display: inline-flex; padding: 2px; border-radius: 8px; background: rgba(var(--nbin-k), 0.045); max-width: 100%; }
.nbin-seg-opt { height: 26px; padding: 0 11px; border-radius: 6px; font-weight: 500; color: var(--nbin-text); white-space: nowrap; transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease; }
.nbin-seg-opt:hover { color: var(--nbin-ink); }
.nbin-seg-opt[aria-selected="true"], .nbin-seg-opt[aria-checked="true"] { background: var(--nbin-card); color: var(--nbin-strong); box-shadow: var(--nbin-shadow); }

.nbin-pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; font-weight: 500; line-height: 16px; white-space: nowrap;
  background: rgba(var(--nbin-k), 0.05); color: var(--nbin-text);
}
.nbin-pill[data-tone="ok"] { background: var(--nbin-ok-tint); color: var(--nbin-ok); }
.nbin-pill[data-tone="ember"] { background: var(--nbin-ember-tint); color: var(--nbin-ember-ink); }
.nbin-pill[data-tone="wait"] { background: var(--nbin-wait-tint); color: var(--nbin-wait); }
@media (prefers-reduced-motion: reduce) {
  .nbin-root *, .nbin-root *::before, .nbin-root *::after { transition: none !important; animation: none !important; }
}

/* Faktura och kreditfaktura som papper i en bricka */
.nbin-root.nbin-root.nbin-root { max-width: 660px; }
.nbin-root { padding: 8px 8px 10px; border-radius: 14px; background: var(--nbin-tray); box-shadow: var(--nbin-shadow); }
.nbin-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 2px 10px; flex-wrap: wrap; }
.nbin-actions { display: flex; gap: 6px; }

.nbin-stack { position: relative; padding-top: 6px; }
/* Ett papper bakom, så det ser ut som en bunt */
.nbin-stack::before { content: ""; position: absolute; left: 14px; right: 14px; top: 0; height: 24px; border-radius: 10px 10px 0 0; background: var(--nbin-soft); box-shadow: var(--nbin-shadow); }
.nbin-paper { position: relative; padding: 24px 26px 22px; border-radius: 10px; background: var(--nbin-card); box-shadow: var(--nbin-shadow), 0 6px 16px -10px rgba(0, 0, 0, 0.12); }
.nbin-paper[hidden] { display: none; }
.nbin-paper[data-in] { animation: nbin-paper 380ms var(--nbin-ease); }

.nbin-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 18px; border-bottom: 0.5px solid var(--nbin-line); }
.nbin-amount { font-size: 26px; line-height: 32px; font-weight: 500; letter-spacing: -0.02em; color: var(--nbin-strong); white-space: nowrap; }
.nbin-due { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 4px !important; color: var(--nbin-text); }
.nbin-status { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 500; background: rgba(var(--nbin-k), 0.05); color: var(--nbin-text); }
.nbin-status[data-tone="wait"] { background: var(--nbin-wait-tint); color: var(--nbin-wait); }
.nbin-status[data-tone="ok"] { background: var(--nbin-ok-tint); color: var(--nbin-ok); }
.nbin-status[data-tone="ember"] { background: var(--nbin-ember-tint); color: var(--nbin-ember-ink); }
.nbin-seller { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--nbin-strong); text-align: right; }
.nbin-mark { display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 6px; background: var(--nbin-solid); color: var(--nbin-on-solid); font-size: 12px; font-weight: 600; line-height: 1; position: relative; }
.nbin-mark::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 7px; height: 7px; border-radius: 2px; background: var(--nbin-ember); box-shadow: 0 0 0 1.5px var(--nbin-card); }

.nbin-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px 0; }
.nbin-parties p { color: var(--nbin-text); }
.nbin-h { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--grey); margin-bottom: 4px !important; }

.nbin-terms { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 16px; padding: 14px 0; border-top: 0.5px solid var(--nbin-line); }
.nbin-terms div { min-width: 0; }
.nbin-terms dt { font-size: 12px; line-height: 16px; color: var(--grey); }
.nbin-terms dd { font-weight: 500; color: var(--nbin-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nbin-lines { width: 100%; border-collapse: collapse; margin-top: 6px; }
.nbin-lines th { height: 30px; padding: 0 0 0 12px; font-size: 12px; font-weight: 500; color: var(--grey); text-align: left; border-bottom: 0.5px solid var(--nbin-line); white-space: nowrap; }
.nbin-lines th:first-child, .nbin-lines td:first-child { padding-left: 0; }
.nbin-lines td { padding: 9px 0 9px 12px; border-bottom: 0.5px solid var(--nbin-line); color: var(--nbin-ink); vertical-align: top; }
.nbin-lines td.nbin-r { white-space: nowrap; color: var(--nbin-text); }
.nbin-lines td:last-child { color: var(--nbin-ink); }
.nbin-r { text-align: right !important; }

.nbin-sum { margin-left: auto !important; width: min(260px, 100%); padding-top: 10px; }
.nbin-sum div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; color: var(--nbin-text); }
.nbin-sum dd { white-space: nowrap; color: var(--nbin-ink); }
.nbin-sum-total { margin-top: 4px; padding-top: 8px !important; border-top: 0.5px solid var(--nbin-line); }
.nbin-sum-total dt, .nbin-sum-total dd { font-weight: 600; color: var(--nbin-strong) !important; }

.nbin-pay { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 14px; margin-top: 18px; padding: 12px 14px; border-radius: 8px; background: var(--nbin-soft); box-shadow: inset 0 0 0 0.5px rgba(var(--nbin-k), 0.06); }
.nbin-pay div { display: flex; flex-direction: column; min-width: 0; }
.nbin-k { font-size: 12px; line-height: 16px; color: var(--grey); }
.nbin-v { font-weight: 500; white-space: nowrap; color: var(--nbin-ink); }
.nbin-mono { font-family: var(--mono); font-size: 13px; letter-spacing: 0.02em; }
.nbin-ex { display: block; line-height: 16px; font-style: normal; font-family: var(--sans); font-size: 12px; font-weight: 500; letter-spacing: 0; color: var(--nbin-ember-ink); }
.nbin-fine { grid-column: 1 / -1; font-size: 12px; line-height: 16px; color: var(--grey); }

/* Kreditfakturan */
.nbin-pick { padding-top: 14px; border-top: 0.5px solid var(--nbin-line); }
.nbin-pick-head, .nbin-pick-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 110px; align-items: center; gap: 12px; }
.nbin-pick-head { height: 26px; font-size: 12px; font-weight: 500; color: var(--grey); border-bottom: 0.5px solid var(--nbin-line); }
.nbin-pick-row { min-height: 44px; border-bottom: 0.5px solid var(--nbin-line); }
.nbin-pick-row[data-off] .nbin-pick-name span, .nbin-pick-row[data-off] .nbin-pick-was { color: var(--grey); }
.nbin-pick-name { display: flex; align-items: center; gap: 10px; min-width: 0; cursor: pointer; }
.nbin-pick-name span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nbin-pick-was { color: var(--nbin-text); white-space: nowrap; }
.nbin-check { appearance: none; -webkit-appearance: none; display: grid; place-items: center; width: 16px; height: 16px; flex: none; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(var(--nbin-k), 0.22); background: var(--nbin-card); cursor: pointer; transition: background-color 140ms ease; }
.nbin-check:checked { background: var(--nbin-ember); box-shadow: none; }
.nbin-check:checked::after { content: ""; width: 8px; height: 4px; border: 1.7px solid var(--nbin-card); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.nbin-amt { width: 100%; height: 30px; padding: 0 8px; border: 0; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(var(--nbin-k), 0.1); background: var(--nbin-card); text-align: right; font-variant-numeric: tabular-nums; outline: none; }
.nbin-amt:focus-visible { box-shadow: inset 0 0 0 1px rgba(217, 96, 28, 0.6), 0 0 0 3px rgba(217, 96, 28, 0.15); outline: none; }
.nbin-amt:disabled { background: var(--nbin-wash); color: var(--grey); box-shadow: none; }
.nbin-amt[aria-invalid="true"] { box-shadow: inset 0 0 0 1px var(--nbin-bad); }
.nbin-issue { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 0.5px solid var(--nbin-line); }
.nbin-note { font-size: 12px; line-height: 16px; color: var(--grey); }
.nbin-note[data-tone="bad"] { color: var(--nbin-bad); }
.nbin-note[data-tone="ok"] { color: var(--nbin-ok); }
.nbin-issue-btn[data-done] { background: var(--nbin-ok); }
.nbin-paper[data-issued] .nbin-amt, .nbin-paper[data-issued] .nbin-check { pointer-events: none; }
.nbin-flash { animation: nbin-flash 900ms var(--nbin-ease); border-radius: 4px; }

@keyframes nbin-paper { from { opacity: 0; transform: translateY(8px) scale(0.99); } }
@keyframes nbin-flash { 0% { background: var(--nbin-ember-tint); } 100% { background: transparent; } }

@container (max-width: 520px) {
  .nbin-paper { padding: 18px 16px 16px; }
  .nbin-head { flex-direction: column-reverse; gap: 12px; }
  .nbin-seller { text-align: left; }
  .nbin-amount { font-size: 24px; }
  .nbin-terms { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nbin-lines thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .nbin-lines tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 9px 0; border-bottom: 0.5px solid var(--nbin-line); }
  .nbin-lines td { display: block; padding: 0 !important; border: 0; }
  .nbin-lines td:first-child { grid-column: 1; grid-row: 1; }
  .nbin-lines td:last-child { grid-column: 2; grid-row: 1; text-align: right; font-weight: 500; }
  .nbin-lines td:nth-child(2), .nbin-lines td:nth-child(3), .nbin-lines td:nth-child(4) { display: inline; grid-row: 2; font-size: 12px; line-height: 16px; text-align: left !important; color: var(--grey); }
  .nbin-lines td:nth-child(2)::before, .nbin-lines td:nth-child(3)::before, .nbin-lines td:nth-child(4)::before { content: attr(data-l) " "; }
  .nbin-lines td:nth-child(2) { grid-column: 1; }
  .nbin-lines td:nth-child(3) { display: none; }
  .nbin-lines td:nth-child(4) { grid-column: 2; text-align: right !important; }
  .nbin-sum { width: 100%; }
  .nbin-pay { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nbin-pick-head { display: none; }
  .nbin-pick-row { grid-template-columns: minmax(0, 1fr) 104px; grid-template-rows: auto auto; gap: 0 10px; padding: 8px 0; }
  .nbin-pick-name { grid-column: 1; grid-row: 1; }
  .nbin-pick-was { grid-column: 1; grid-row: 2; padding-left: 26px; font-size: 12px; line-height: 16px; color: var(--grey); text-align: left !important; }
  .nbin-pick-was::before { content: "Fakturerat "; }
  .nbin-amt { grid-column: 2; grid-row: 1 / 3; }
  .nbin-issue { flex-direction: column; align-items: stretch; }
}

/* Inga bokstavsavatarer: namnet står som text */
.nbin-mark { display: none !important; }
