/* Ressursbris CRM — visual system lifted from the marketing site */
:root {
  --paper: #f5f1ea;
  --paper-2: #ece4d6;
  --card: #fffdf9;
  --ink: #273133;
  --muted: #6f7a7b;
  --muted-2: #97a0a0;
  --teal: #3f7d84;
  --teal-deep: #2c5f66;
  --teal-ink: #23454a;
  --coral: #e2a07d;
  --coral-deep: #d2895f;
  --coral-ink: #b06b44;
  --line: #e1dac9;
  --line-soft: #ece6d9;

  /* status palette — kept within the brand's warm/teal family */
  --st-ny: #c5743f;        --st-ny-bg: #f6e3d6;
  --st-kontaktet: #b78a2e; --st-kontaktet-bg: #f1e7cd;
  --st-samtale: #3f7d84;   --st-samtale-bg: #d9e8e8;
  --st-aktiv: #4f8a5f;     --st-aktiv-bg: #dcebdc;
  --st-avsluttet: #7d8a8a; --st-avsluttet-bg: #e7e7e2;

  --font-display: "Spectral", Georgia, serif;
  --font-body: "Public Sans", system-ui, sans-serif;
  --radius: 8px;
  --shadow-sm: 0 2px 8px -4px rgba(35,69,74,.22);
  --shadow-md: 0 18px 44px -26px rgba(35,69,74,.4);
  --shadow-lg: 0 30px 80px -28px rgba(35,69,74,.5);

  --sidebar-w: 256px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
a { color: inherit; }
::selection { background: color-mix(in srgb, var(--coral) 45%, transparent); }

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--card);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sb-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  padding: 22px 22px 20px;
  text-decoration: none;
  border-bottom: 1px solid var(--line-soft);
}
.sb-brand img { height: 24px; width: auto; display: block; }
.sb-brand .nm { font-family: var(--font-display); font-size: 21px; font-weight: 500; color: var(--teal-deep); line-height: 1; }
.sb-brand .tg { font-size: 8.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--coral-ink); margin-top: 4px; }

.sb-nav { padding: 16px 14px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.sb-sec { font-size: 10.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted-2); padding: 14px 12px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 7px;
  color: var(--muted); text-decoration: none;
  font-size: 14.5px; font-weight: 500;
  border: 0; background: none; width: 100%; text-align: left;
  transition: .15s;
}
.nav-item svg { width: 18px; height: 18px; flex: 0 0 auto; stroke: currentColor; }
.nav-item:hover { background: var(--paper); color: var(--ink); }
.nav-item.is-active { background: color-mix(in srgb, var(--teal) 12%, transparent); color: var(--teal-deep); }
.nav-item .count {
  margin-left: auto; font-size: 12px; font-weight: 700;
  background: var(--st-ny-bg); color: var(--st-ny);
  border-radius: 999px; padding: 1px 8px; min-width: 22px; text-align: center;
}
.nav-item.is-active .count { background: color-mix(in srgb, var(--teal) 20%, transparent); color: var(--teal-deep); }

.sb-user {
  display: flex; align-items: center; gap: 11px;
  padding: 16px 18px; border-top: 1px solid var(--line-soft);
}
.sb-user img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; object-position: center top; box-shadow: 0 0 0 1px var(--line); }
.sb-user .u-name { font-family: var(--font-display); font-style: italic; font-size: 16px; color: var(--teal-deep); line-height: 1.1; }
.sb-user .u-role { font-size: 11.5px; color: var(--muted); }

/* ---------- Main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 20px 36px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 80%, transparent);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.topbar > div:first-child { flex: 0 0 auto; }
.topbar h1 { font-family: var(--font-display); font-weight: 500; font-size: 26px; letter-spacing: -.01em; margin: 0; white-space: nowrap; }
.topbar .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.topbar .spacer { flex: 1; }

.search {
  position: relative; display: flex; align-items: center;
}
.search svg { position: absolute; left: 12px; width: 16px; height: 16px; stroke: var(--muted-2); pointer-events: none; }
.search input {
  font-family: inherit; font-size: 14px;
  padding: 9px 14px 9px 34px; width: 200px;
  border: 1.5px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--ink); transition: .18s;
}
.search input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 22%, transparent); width: 230px; }

.content { padding: 32px 36px 64px; max-width: 1180px; width: 100%; }

/* ---------- Buttons ---------- */
.btn {
  font-size: 14px; font-weight: 600; border: 1.5px solid transparent;
  border-radius: 999px; padding: 10px 20px; background: var(--teal); color: #fff;
  transition: .18s; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px;
}
.btn svg { width: 16px; height: 16px; stroke: currentColor; }
.btn:hover { background: var(--teal-deep); transform: translateY(-1px); box-shadow: 0 10px 24px -12px rgba(44,95,102,.6); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: transparent; border-color: var(--teal); color: var(--teal-deep); box-shadow: none; transform: none; }
.btn-coral { background: var(--coral); }
.btn-coral:hover { background: var(--coral-deep); box-shadow: 0 10px 24px -12px rgba(210,137,95,.6); }
.btn-sm { padding: 7px 14px; font-size: 13px; }

/* ---------- Stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 36px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 22px 20px; position: relative; overflow: hidden;
}
.stat .lab { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stat .num { font-family: var(--font-display); font-size: 44px; font-weight: 500; line-height: 1; margin: 14px 0 6px; color: var(--teal-deep); }
.stat .meta { font-size: 13px; color: var(--muted); }
.stat.accent .num { color: var(--coral-ink); }
.stat::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--teal); }
.stat.accent::after { background: var(--coral); }

/* ---------- Section heads ---------- */
.block { margin-bottom: 40px; }
.block-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; }
.block-head h2 { font-family: var(--font-display); font-weight: 500; font-size: 22px; margin: 0; letter-spacing: -.01em; }
.block-head .hint { font-size: 13px; color: var(--muted); }
.block-head .more { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--teal-deep); background: none; border: 0; }
.block-head .more:hover { color: var(--coral-ink); }

/* ---------- Attention list ---------- */
.att-list { display: flex; flex-direction: column; gap: 10px; }
.att {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; cursor: pointer; transition: .15s; text-align: left;
}
.att:hover { border-color: var(--teal); box-shadow: var(--shadow-sm); transform: translateX(2px); }
.att .av { width: 42px; height: 42px; border-radius: 50%; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 17px; font-weight: 500; color: #fff; }
.att .who { min-width: 0; }
.att .who .n { font-weight: 600; font-size: 15px; }
.att .who .d { font-size: 13px; color: var(--muted); }
.att .reason { margin-left: auto; font-size: 13px; color: var(--coral-ink); display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.att .reason svg { width: 15px; height: 15px; stroke: currentColor; }

/* ---------- Pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; padding: 4px 12px; border-radius: 999px;
  white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ny { color: var(--st-ny); background: var(--st-ny-bg); }
.pill.kontaktet { color: var(--st-kontaktet); background: var(--st-kontaktet-bg); }
.pill.samtale { color: var(--st-samtale); background: var(--st-samtale-bg); }
.pill.aktiv { color: var(--st-aktiv); background: var(--st-aktiv-bg); }
.pill.avsluttet { color: var(--st-avsluttet); background: var(--st-avsluttet-bg); }

/* ---------- Toolbar (filters / view toggle) ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--card); color: var(--muted); transition: .15s;
  display: inline-flex; align-items: center; gap: 7px;
}
.chip .c { font-size: 11.5px; opacity: .7; }
.chip:hover { border-color: var(--teal); color: var(--ink); }
.chip.is-active { background: var(--teal-ink); border-color: var(--teal-ink); color: #fff; }
.chip.is-active .c { opacity: .85; }

.view-toggle { margin-left: auto; display: flex; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--card); }
.view-toggle button { border: 0; background: none; padding: 8px 16px; font-size: 13px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.view-toggle button svg { width: 15px; height: 15px; stroke: currentColor; }
.view-toggle button.is-active { background: var(--teal); color: #fff; }

/* ---------- List view ---------- */
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list-row {
  display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.1fr auto; gap: 16px; align-items: center;
  padding: 15px 22px; border-bottom: 1px solid var(--line-soft); cursor: pointer; transition: .12s; width: 100%; border-left: 0; border-right: 0; border-top: 0; background: none; text-align: left;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--paper); }
.list-head { background: var(--paper-2); cursor: default; }
.list-head:hover { background: var(--paper-2); }
.list-head span { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.lr-name { display: flex; align-items: center; gap: 13px; min-width: 0; }
.lr-name .av { width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 15px; font-weight: 500; color: #fff; }
.lr-name .n { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr-name .r { font-size: 12.5px; color: var(--muted); }
.lr-meta { font-size: 13.5px; color: var(--muted); }
.lr-when { font-size: 13px; }
.lr-when.due { color: var(--coral-ink); font-weight: 600; }
.lr-chev { width: 18px; height: 18px; stroke: var(--muted-2); justify-self: end; }

/* ---------- Board view ---------- */
.board { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; align-items: start; }
.col { background: var(--paper-2); border-radius: var(--radius); padding: 6px; min-height: 120px; transition: .15s; }
.col.drag-over { background: color-mix(in srgb, var(--teal) 16%, var(--paper-2)); outline: 2px dashed var(--teal); outline-offset: -2px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px; }
.col-head .t { font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.col-head .c { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--card); border-radius: 999px; padding: 1px 8px; }
.col-head .bar { width: 8px; height: 8px; border-radius: 50%; }
.cards { display: flex; flex-direction: column; gap: 8px; padding: 0 4px 8px; }
.tcard {
  background: var(--card); border: 1px solid var(--line); border-radius: 7px;
  padding: 13px 14px; cursor: grab; transition: .12s; box-shadow: var(--shadow-sm);
}
.tcard:hover { border-color: var(--teal); transform: translateY(-1px); }
.tcard.dragging { opacity: .4; }
.tcard .tc-top { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.tcard .av { width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 13px; font-weight: 500; color: #fff; }
.tcard .n { font-weight: 600; font-size: 13.5px; line-height: 1.2; }
.tcard .r { font-size: 11.5px; color: var(--muted); }
.tcard .sit { font-size: 12.5px; color: var(--muted); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tcard .tc-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 11.5px; color: var(--muted-2); }
.tcard .tc-foot .due { color: var(--coral-ink); font-weight: 600; }

.empty-col { text-align: center; font-size: 12px; color: var(--muted-2); padding: 16px 8px; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 80px 20px; color: var(--muted); }
.empty h3 { font-family: var(--font-display); font-weight: 500; font-size: 22px; color: var(--ink); margin: 0 0 8px; }

/* ---------- Detail drawer ---------- */
.drawer-overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(35,69,74,.4);
  backdrop-filter: blur(3px); display: none; opacity: 0; transition: opacity .25s;
}
.drawer-overlay.is-open { display: block; opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 480px; max-width: 94vw; z-index: 210;
  background: var(--paper); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .3s cubic-bezier(.2,.7,.2,1);
}
.drawer.is-open { transform: none; }
.dr-top { background: var(--teal-ink); color: var(--paper); padding: 24px 26px 22px; position: relative; }
.dr-top::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--teal), var(--coral)); }
.dr-close { position: absolute; top: 16px; right: 16px; border: 0; background: rgba(255,255,255,.12); color: #fff; width: 32px; height: 32px; border-radius: 50%; font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center; transition: .15s; }
.dr-close:hover { background: rgba(255,255,255,.24); }
.dr-id { display: flex; align-items: center; gap: 14px; }
.dr-id .av { width: 54px; height: 54px; border-radius: 50%; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 22px; font-weight: 500; color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.dr-id h2 { font-family: var(--font-display); font-weight: 500; font-size: 24px; margin: 0; }
.dr-id .rel { font-size: 13px; color: #c4d4d3; margin-top: 3px; }
.dr-contact { display: flex; gap: 10px; margin-top: 20px; }
.dr-contact a {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(255,255,255,.12); color: #fff; text-decoration: none;
  font-size: 13.5px; font-weight: 600; padding: 10px; border-radius: 7px; transition: .15s;
}
.dr-contact a:hover { background: rgba(255,255,255,.22); }
.dr-contact a svg { width: 16px; height: 16px; stroke: currentColor; }

.dr-body { flex: 1; overflow-y: auto; padding: 24px 26px 40px; }
.dr-block { margin-bottom: 26px; }
.dr-block > .lab { font-size: 11.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 12px; }

/* status selector */
.status-row { display: flex; flex-wrap: wrap; gap: 7px; }
.status-row .opt {
  font-size: 12.5px; font-weight: 600; padding: 7px 13px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--card); color: var(--muted); transition: .14s;
}
.status-row .opt:hover { border-color: var(--teal); }
.status-row .opt.is-on { border-color: transparent; }
.status-row .opt.is-on.ny { background: var(--st-ny-bg); color: var(--st-ny); }
.status-row .opt.is-on.kontaktet { background: var(--st-kontaktet-bg); color: var(--st-kontaktet); }
.status-row .opt.is-on.samtale { background: var(--st-samtale-bg); color: var(--st-samtale); }
.status-row .opt.is-on.aktiv { background: var(--st-aktiv-bg); color: var(--st-aktiv); }
.status-row .opt.is-on.avsluttet { background: var(--st-avsluttet-bg); color: var(--st-avsluttet); }

/* info grid */
.info-grid { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.info-grid .ig { display: flex; gap: 14px; padding: 13px 16px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.info-grid .ig:last-child { border-bottom: 0; }
.info-grid .ig .k { width: 88px; flex: 0 0 auto; color: var(--muted); font-size: 13px; }
.info-grid .ig .v { font-weight: 500; }

.situasjon { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; font-family: var(--font-display); font-size: 16px; line-height: 1.6; color: #36403f; }

/* follow-up */
.followup { display: flex; align-items: center; gap: 10px; }
.followup input { font-family: inherit; font-size: 14px; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 7px; background: var(--card); color: var(--ink); }
.followup input:focus { outline: none; border-color: var(--teal); }

/* notes */
.note-form { margin-bottom: 14px; }
.note-form textarea {
  width: 100%; box-sizing: border-box; font-family: inherit; font-size: 14px; line-height: 1.5;
  padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--card);
  color: var(--ink); resize: vertical; min-height: 72px;
}
.note-form textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 18%, transparent); }
.note-form .row { display: flex; justify-content: flex-end; margin-top: 8px; }

.timeline { display: flex; flex-direction: column; gap: 0; position: relative; }
.tl-item { position: relative; padding: 0 0 18px 26px; }
.tl-item::before { content: ""; position: absolute; left: 5px; top: 5px; bottom: -2px; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-item .node { position: absolute; left: 0; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 2px solid var(--teal); }
.tl-item.sys .node { border-color: var(--coral); }
.tl-item .when { font-size: 12px; color: var(--muted-2); margin-bottom: 4px; }
.tl-item .txt { font-size: 14px; line-height: 1.55; color: var(--ink); }
.tl-item.sys .txt { color: var(--muted); font-style: italic; }
.tl-empty { font-size: 13.5px; color: var(--muted-2); padding: 4px 0; }

/* ---------- Modal (new contact) ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 300; background: rgba(35,69,74,.5);
  backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; padding: 24px;
}
.modal-overlay.is-open { display: flex; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--paper); border-radius: var(--radius); width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); padding: 32px 34px 30px;
  position: relative; animation: rise .3s cubic-bezier(.2,.7,.2,1);
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.modal h2 { font-family: var(--font-display); font-weight: 500; font-size: 24px; margin: 0 0 4px; }
.modal .sub { font-size: 14px; color: var(--muted); margin: 0 0 22px; }
.modal .mclose { position: absolute; top: 16px; right: 16px; border: 0; background: transparent; font-size: 24px; color: var(--muted); width: 34px; height: 34px; border-radius: 50%; }
.modal .mclose:hover { background: rgba(0,0,0,.05); color: var(--ink); }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; box-sizing: border-box; font-family: inherit; font-size: 14.5px;
  padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 7px; background: var(--card); color: var(--ink);
}
.field textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 18%, transparent); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--teal-ink); color: #fff; padding: 13px 22px; border-radius: 999px;
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow-md); z-index: 400;
  opacity: 0; pointer-events: none; transition: .3s; display: flex; align-items: center; gap: 10px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast svg { width: 17px; height: 17px; stroke: var(--coral); }

/* ---------- Payment methods ---------- */
.method { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 5px; white-space: nowrap; letter-spacing: .01em; }
.method.klarna { background: #ffb3c7; color: #160e0a; }
.method.faktura { background: var(--paper-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.method.vipps { background: #ff5b24; color: #fff; }

/* finance status pills */
.pill.utkast { color: var(--st-avsluttet); background: var(--st-avsluttet-bg); }
.pill.sendt { color: var(--st-samtale); background: var(--st-samtale-bg); }
.pill.betalt { color: var(--st-aktiv); background: var(--st-aktiv-bg); }
.pill.forfalt { color: #b23a26; background: #f6ddd5; }

/* method breakdown panel */
.paypanel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; }
.paypanel .pp-top { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.paypanel .pp-top .t { font-family: var(--font-display); font-size: 18px; font-weight: 500; }
.paypanel .pp-top .sum { font-size: 13px; color: var(--muted); }
.paybar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--paper-2); }
.paybar span { display: block; height: 100%; transition: .3s; }
.paybar span.klarna { background: #ffb3c7; }
.paybar span.faktura { background: var(--teal); }
.paybar span.vipps { background: #ff5b24; }
.paylegend { display: flex; gap: 26px; margin-top: 18px; flex-wrap: wrap; }
.paylegend .pl { display: flex; align-items: center; gap: 9px; }
.paylegend .pl .sw { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 auto; }
.paylegend .pl .sw.klarna { background: #ffb3c7; }
.paylegend .pl .sw.faktura { background: var(--teal); }
.paylegend .pl .sw.vipps { background: #ff5b24; }
.paylegend .pl .nm { font-size: 13px; font-weight: 600; }
.paylegend .pl .vl { font-size: 13px; color: var(--muted); }
.paylegend .pl .vl b { color: var(--ink); font-weight: 700; }

/* finance list rows */
.list-row.fin { grid-template-columns: 1.5fr .9fr .8fr .9fr .9fr auto; }
.list-head.fin span { font-size: 11.5px; }
.lr-amount { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--ink); }
.lr-nr { font-size: 12px; color: var(--muted-2); font-family: var(--font-body); }
.lr-due-fin { font-size: 13px; }
.lr-due-fin.over { color: #b23a26; font-weight: 600; }

/* drawer invoices */
.fak-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.fak-item { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 7px; padding: 11px 14px; }
.fak-item .fk-amt { font-family: var(--font-display); font-size: 15.5px; font-weight: 600; }
.fak-item .fk-nr { font-size: 11.5px; color: var(--muted-2); }
.fak-item .fk-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.fak-empty { font-size: 13.5px; color: var(--muted-2); padding: 2px 0 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .board { grid-template-columns: repeat(3, 1fr); }
  .topbar .search { display: none; }
}
@media (max-width: 820px) {
  :root { --sidebar-w: 0px; }
  .app { grid-template-columns: 1fr; }

  /* Sidemeny -> fast bunnmeny */
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    height: auto; flex-direction: row; z-index: 100;
    border-right: 0; border-top: 1px solid var(--line);
    box-shadow: 0 -6px 20px -14px rgba(35,69,74,.4);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sb-brand, .sb-user, .sb-sec { display: none; }
  .sb-nav { flex-direction: row; justify-content: space-around; gap: 2px; padding: 6px; flex: 1; }
  .nav-item {
    flex-direction: column; gap: 3px; padding: 7px 6px 6px;
    font-size: 10.5px; font-weight: 600; text-align: center; border-radius: 10px;
  }
  .nav-item svg { width: 21px; height: 21px; }
  .nav-item > span { line-height: 1.1; }
  .nav-item .count { display: none; }

  .content { padding: 22px 18px 92px; } /* plass til bunnmeny */

  /* Topbar: kompakt tittel; "Ny"-knappen blir en flytende +-knapp (FAB).
     backdrop-filter fjernes så FAB-ens position:fixed festes til viewporten. */
  .topbar { padding: 14px 18px; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--paper); }
  .topbar h1 { font-size: 21px; white-space: normal; }
  .topbar .btn {
    position: fixed; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom));
    width: 56px; height: 56px; border-radius: 50%;
    padding: 0; gap: 0; justify-content: center; font-size: 0;
    box-shadow: 0 12px 26px -8px rgba(44,95,102,.6); z-index: 120;
  }
  .topbar .btn svg { width: 24px; height: 24px; }

  .stat { padding: 18px 18px 16px; }
  .stat .num { font-size: 36px; }

  /* Seksjonshoder stables */
  .block-head { flex-wrap: wrap; gap: 4px 12px; }
  .block-head .hint { flex: 1 1 100%; }

  /* Attention-rader: status på egen linje under navnet */
  .att { flex-wrap: wrap; }
  .att .who { flex: 1 1 auto; }
  .att .reason { flex: 1 0 100%; margin: 8px 0 0; padding-left: 58px; white-space: normal; }

  /* Detaljpanel i full bredde */
  .drawer { width: 100%; max-width: 100%; }

  .list-row { grid-template-columns: 1.4fr auto; }
  .list-row .lr-meta, .list-row .lr-when, .list-head { display: none; }
  .list-row.fin { grid-template-columns: 1fr auto auto; }
  .list-row.fin .fin-method, .list-row.fin .lr-due-fin { display: none; }
  .board { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
}
