/* Egen kod, idé från affectUI CRM (Pro), ingen kod tagen */
/* Appram: sidomeny och huvudyta, delas av skärmarna men med eget prefix */
.nscr-root {
  --nscr-k: 0, 0, 0;
  --nscr-card: #ffffff;
  --nscr-soft: #FAFAF8;
  --nscr-strong: #000000;
  --nscr-ink: rgba(0, 0, 0, 0.88);
  --nscr-text: rgba(0, 0, 0, 0.61);
      --nscr-line: rgba(0, 0, 0, 0.06);
  --nscr-wash: rgba(0, 0, 0, 0.03);
  --nscr-side: #F2F1EE;
  --nscr-ember: #D9601C;
  --nscr-ember-ink: #A8460F;
  --nscr-ember-tint: rgba(217, 96, 28, 0.10);
  --nscr-ok: #1E7A4C;
  --nscr-ok-tint: rgba(30, 122, 76, 0.10);
  --nscr-wait: #8A5200;
  --nscr-wait-tint: rgba(178, 106, 0, 0.10);
  --nscr-bad: #B3261E;
  --nscr-solid: rgba(0, 0, 0, 0.88);
  --nscr-on-solid: #fcfcfc;
  --nscr-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(--nscr-k), 0.05);
  --nscr-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(--nscr-k), 0.07);
  --nscr-focus: rgba(217, 96, 28, 0.4);
  --nscr-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(--nscr-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"]) .nscr-root {
  --nscr-k: 255, 255, 255;
  --nscr-card: #1C1B1A;
  --nscr-soft: #201F1E;
  --nscr-strong: rgba(255, 255, 255, 0.94);
  --nscr-ink: rgba(255, 255, 255, 0.9);
  --nscr-text: rgba(255, 255, 255, 0.64);
      --nscr-line: rgba(255, 255, 255, 0.08);
  --nscr-wash: rgba(255, 255, 255, 0.04);
  --nscr-side: #161615;
  --nscr-ember: #D9601C;
  --nscr-ember-ink: #F08A4B;
  --nscr-ember-tint: rgba(240, 138, 75, 0.14);
  --nscr-ok: #3EC27A;
  --nscr-ok-tint: rgba(62, 194, 122, 0.13);
  --nscr-wait: #F0B232;
  --nscr-wait-tint: rgba(240, 178, 50, 0.13);
  --nscr-bad: #F07A6E;
  --nscr-solid: rgba(255, 255, 255, 0.9);
  --nscr-on-solid: #161615;
  --nscr-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.1), 0 1px 2px rgba(0, 0, 0, 0.4);
  --nscr-shadow-hover: 0 0 0 0.5px rgba(255, 255, 255, 0.16), 0 1px 3px rgba(0, 0, 0, 0.5);
  --nscr-focus: rgba(240, 138, 75, 0.55);
  color-scheme: dark;
}
.nscr-root *, .nscr-root *::before, .nscr-root *::after { box-sizing: border-box; }
.nscr-root [hidden] { display: none !important; }
:where(.nscr-root) button { margin: 0; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:where(.nscr-root) input, :where(.nscr-root) textarea, :where(.nscr-root) select { font: inherit; color: inherit; margin: 0; }
:where(.nscr-root) svg { display: block; flex: none; }
:where(.nscr-root) h2, :where(.nscr-root) h3, :where(.nscr-root) p, :where(.nscr-root) ul, :where(.nscr-root) ol, :where(.nscr-root) dl, :where(.nscr-root) dd { margin: 0; padding: 0; }
:where(.nscr-root) ul, :where(.nscr-root) ol { list-style: none; }
.nscr-root button:focus-visible, .nscr-root input:focus-visible, .nscr-root textarea:focus-visible, .nscr-root [tabindex]:focus-visible { outline: 2px solid var(--nscr-focus); outline-offset: 1px; }
.nscr-ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.nscr-app {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  height: 540px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--nscr-side);
  box-shadow: var(--nscr-shadow);
}

/* Sidomeny */
.nscr-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 10px 8px; }
.nscr-ws { display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 6px; font-weight: 500; color: var(--nscr-strong); }
.nscr-ws-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nscr-ws-mark {
  display: grid; place-items: center; flex: none;
  width: 20px; height: 20px; border-radius: 5px;
  background: var(--nscr-solid); color: var(--nscr-on-solid);
  font-size: 12px; font-weight: 600; line-height: 1;
}
.nscr-nav { display: flex; flex-direction: column; gap: 1px; }
.nscr-nav-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; height: 30px; padding: 0 8px; border-radius: 6px;
  color: var(--nscr-text); text-align: left;
  transition: background-color 140ms ease, color 140ms ease;
}
.nscr-nav-item:hover { background: rgba(var(--nscr-k), 0.04); color: var(--nscr-ink); }
.nscr-nav-item[aria-current="page"] { background: var(--nscr-card); color: var(--nscr-strong); font-weight: 500; box-shadow: var(--nscr-shadow); }
.nscr-nav-item[aria-current="page"] .nscr-ico { color: var(--nscr-ember); }
.nscr-nav-label { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nscr-badge { font-size: 12px; line-height: 16px; color: var(--grey); font-variant-numeric: tabular-nums; }
.nscr-me { display: flex; align-items: center; gap: 8px; margin-top: auto; height: 32px; padding: 0 6px; color: var(--nscr-ink); font-weight: 500; }
.nscr-av {
  display: grid; place-items: center; flex: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(var(--nscr-k), 0.07); color: var(--nscr-text);
  font-size: 12px; font-weight: 600; line-height: 1; letter-spacing: 0.02em;
}


.nscr-sec { display: flex; flex-direction: column; gap: 1px; margin-top: 6px; }
.nscr-sec-l { padding: 0 8px 4px; font-size: 12px; line-height: 16px; color: var(--grey); }
.nscr-nav-item--sub { height: 28px; }
.nscr-nav-item--sub .nscr-ico { width: 15px; height: 15px; color: var(--grey); }
.nscr-goal { display: flex; flex-direction: column; gap: 2px; margin-top: auto; padding: 10px 10px 12px; border-radius: 9px; background: var(--nscr-card); box-shadow: var(--nscr-shadow); }
.nscr-goal-t { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--nscr-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nscr-goal-s { font-size: 12px; line-height: 16px; color: var(--grey); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nscr-goal-bar { display: block; height: 3px; margin-top: 7px; border-radius: 2px; background: var(--nscr-line); overflow: hidden; }
.nscr-goal-bar i { display: block; height: 100%; border-radius: 2px; background: var(--nscr-ember); }
.nscr-goal + .nscr-me { margin-top: 0; }

/* Huvudyta: ett vitt kort */
.nscr-main {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  margin: 6px 6px 6px 0; border-radius: 10px;
  background: var(--nscr-card); box-shadow: var(--nscr-shadow);
  overflow: hidden;
}
.nscr-top {
  display: flex; align-items: center; gap: 8px; flex: none;
  height: 44px; padding: 0 14px;
  border-bottom: 0.5px solid var(--nscr-line);
}
.nscr-crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; color: var(--grey); white-space: nowrap; overflow: hidden; }
.nscr-crumbs strong { font-weight: 500; color: var(--nscr-strong); overflow: hidden; text-overflow: ellipsis; }
.nscr-body { flex: 1; min-height: 0; overflow: auto; }

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

.nscr-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(--nscr-k), 0.05); color: var(--nscr-text);
}
.nscr-pill[data-tone="ok"] { background: var(--nscr-ok-tint); color: var(--nscr-ok); }
.nscr-pill[data-tone="ember"] { background: var(--nscr-ember-tint); color: var(--nscr-ember-ink); }
.nscr-pill[data-tone="wait"] { background: var(--nscr-wait-tint); color: var(--nscr-wait); }
.nscr-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; }

/* Smal bredd: sidomenyn blir en rad överst, ramen växer med innehållet */
@container (max-width: 600px) {
  .nscr-app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; height: auto; }
  .nscr-side { flex-direction: row; align-items: center; gap: 4px; padding: 6px 6px 0; overflow-x: auto; scrollbar-width: none; }
  .nscr-side::-webkit-scrollbar { display: none; }
  .nscr-ws-name, .nscr-me, .nscr-sec, .nscr-goal { display: none; }
  .nscr-ws { padding: 0 4px; }
  .nscr-nav { flex-direction: row; gap: 2px; }
  .nscr-nav-item { width: auto; padding: 0 8px; }
  .nscr-nav-label { overflow: visible; }
  .nscr-main { margin: 6px; }
  .nscr-top { padding: 0 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .nscr-root *, .nscr-root *::before, .nscr-root *::after { transition: none !important; animation: none !important; }
}

/* CRM: flikar, sök och en redigerbar tabell */
.nscr-search { display: flex; align-items: center; gap: 6px; width: 150px; height: 28px; padding: 0 8px; border-radius: 6px; background: var(--nscr-wash); color: var(--grey); }
.nscr-search .nscr-ico { width: 14px; height: 14px; }
.nscr-search:focus-within { box-shadow: 0 0 0 2px var(--nscr-focus); }
.nscr-q { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--nscr-ink); }
.nscr-q::placeholder { color: var(--grey); }
.nscr-q::-webkit-search-cancel-button { display: none; }

.nscr-tabs { display: flex; align-items: center; gap: 2px; flex: none; padding: 8px 10px; border-bottom: 0.5px solid var(--nscr-line); }
.nscr-tab { height: 26px; padding: 0 10px; border-radius: 6px; color: var(--nscr-text); font-weight: 500; transition: background-color 140ms ease, color 140ms ease; }
.nscr-tab:hover { background: var(--nscr-wash); color: var(--nscr-ink); }
.nscr-tab[aria-selected="true"] { background: rgba(var(--nscr-k), 0.05); color: var(--nscr-strong); }
.nscr-count { margin-left: auto; font-size: 12px; color: var(--grey); white-space: nowrap; padding-right: 4px; }

.nscr-body { display: flex; flex-direction: column; }
.nscr-scroll { flex: 0 1 auto; min-height: 0; overflow: auto; }
.nscr-table { width: 100%; min-width: 500px; border-collapse: collapse; }
.nscr-table th { position: sticky; top: 0; z-index: 1; background: var(--nscr-card); height: 34px; padding: 0 10px; border-bottom: 0.5px solid var(--nscr-line); font-size: 12px; font-weight: 500; line-height: 16px; color: var(--grey); text-align: left; white-space: nowrap; }
.nscr-table td { height: 36px; padding: 0 10px; border-bottom: 0.5px solid var(--nscr-line); white-space: nowrap; color: var(--nscr-text); }
.nscr-table tbody tr { transition: background-color 120ms ease; }
.nscr-table tbody tr:hover { background: var(--nscr-wash); }
.nscr-table tbody tr[data-sel] { background: var(--nscr-ember-tint); }
.nscr-table tbody tr[data-new] { animation: nscr-row 520ms var(--nscr-ease); }
.nscr-table th:nth-child(n+3), .nscr-table td:nth-child(n+3) { box-shadow: inset 0.5px 0 0 var(--nscr-line); }
.nscr-c-check { width: 34px; padding-right: 0 !important; }
.nscr-c-num { text-align: right !important; }
.nscr-table td.nscr-c-num { font-variant-numeric: tabular-nums; color: var(--nscr-ink); }
.nscr-sort { display: inline-flex; align-items: center; gap: 2px; font-weight: 500; color: inherit; border-radius: 4px; }
.nscr-sort svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nscr-sort[data-dir] { color: var(--nscr-ink); }

.nscr-check { appearance: none; -webkit-appearance: none; display: grid; place-items: center; width: 14px; height: 14px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(var(--nscr-k), 0.22); background: var(--nscr-card); cursor: pointer; }
.nscr-check:checked { background: var(--nscr-ember); box-shadow: none; }
.nscr-check:checked::after { content: ""; width: 7px; height: 4px; border: 1.6px solid var(--nscr-card); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }

.nscr-co { display: flex; align-items: center; gap: 8px; color: var(--nscr-strong); font-weight: 500; }
.nscr-co-mark { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; background: rgba(var(--nscr-k), 0.06); color: var(--nscr-text); font-size: 12px; font-weight: 600; line-height: 1; }
.nscr-cell { display: inline-block; min-width: 70px; padding: 2px 4px; margin: -2px -4px; border-radius: 4px; cursor: text; }
.nscr-cell:hover { background: rgba(var(--nscr-k), 0.04); }
.nscr-edit { width: 90px; height: 26px; padding: 0 6px; border: 0; border-radius: 5px; box-shadow: 0 0 0 2px var(--nscr-focus); text-align: right; font-variant-numeric: tabular-nums; outline: none; background: var(--nscr-card); }
.nscr-saved { animation: nscr-flash 900ms var(--nscr-ease); }

.nscr-empty { padding: 28px 16px; text-align: center; color: var(--grey); }
.nscr-empty[hidden] { display: none; }
.nscr-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex: none; height: 40px; padding: 0 12px; }
.nscr-add { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px; border-radius: 6px; color: var(--nscr-text); font-weight: 500; }
.nscr-add:hover { background: var(--nscr-wash); color: var(--nscr-ink); }
.nscr-add svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.nscr-hint { font-size: 12px; color: var(--grey); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@keyframes nscr-row { from { background: var(--nscr-ember-tint); } }
@keyframes nscr-flash { 0% { background: var(--nscr-ember-tint); } 100% { background: transparent; } }

@container (max-width: 600px) {
  .nscr-search { width: 110px; }
  .nscr-scroll { max-height: 380px; }
  .nscr-table { min-width: 0; }
  .nscr-table th:nth-child(1), .nscr-table td:nth-child(1), .nscr-table th:nth-child(3), .nscr-table td:nth-child(3), .nscr-table th:nth-child(6), .nscr-table td:nth-child(6) { display: none; }
  .nscr-table th:nth-child(2), .nscr-table td:nth-child(2) { padding-left: 12px; }
  .nscr-co-mark { display: none; }
  .nscr-co-n { display: block; max-width: 112px; overflow: hidden; text-overflow: ellipsis; }
  .nscr-table th, .nscr-table td { padding: 0 6px; }
  .nscr-cell { min-width: 0; }
  .nscr-hint { display: none; }
}

/* Inga bokstavsavatarer: namnet står som text */
.nscr-ws-mark, .nscr-av, .nscr-co-mark { display: none !important; }
