/* Cortexa CRM: felles stil for admin og manus-appen. Svart-hvitt flytende glass i mørk og lys modus.
   Fargene er de samme som variablene «Cortexa Glass» i Figma (modusene Mørk og Lys).
   Grønt og rødt brukes bare på tall som er bra eller dårlige. Nettsiden bruker ikke denne filen. */
:root, [data-theme="dark"] {
  --bg: #050505;
  --bg-2: #0a0a0a;
  --ink: #f7f7f7;
  --ink-2: rgba(247, 247, 247, .6);
  --ink-3: rgba(247, 247, 247, .36);
  --line: rgba(255, 255, 255, .08);
  --tint: rgba(255, 255, 255, .08);
  --hi: rgba(255, 255, 255, .16);
  --up: #4ade80;
  --down: #f87171;
  --up-tint: rgba(74, 222, 128, .08);
  --down-tint: rgba(248, 113, 113, .08);
  --g-bg: linear-gradient(165deg, rgba(255, 255, 255, .085), rgba(255, 255, 255, .02) 71.4%);
  --g-bg-2: linear-gradient(162deg, rgba(255, 255, 255, .19), rgba(255, 255, 255, .07) 71.4%);
  --g-fill: rgba(255, 255, 255, .05);
  --g-raised: rgba(255, 255, 255, .11);
  --g-card: linear-gradient(160deg, rgba(255, 255, 255, .15), rgba(255, 255, 255, .05) 71.4%);
  --sep: rgba(255, 255, 255, .22);
  --hr: rgba(255, 255, 255, .05);
  --line-soft: rgba(255, 255, 255, .06);
  --ptl-base: rgba(255, 255, 255, .1);
  --ptl-from: rgba(255, 255, 255, .25);
  --ptl-tick: rgba(255, 255, 255, .4);
  --step-line: rgba(255, 255, 255, .14);
  --ray-a: .85;
  --ray-b: .22;
  --step-ring: rgba(255, 255, 255, .2);
  --now-glow: rgba(255, 255, 255, .6);
  --g-plate: rgba(16, 17, 19, .78);
  --rim-1: rgba(255, 255, 255, .34);
  --rim-2: rgba(255, 255, 255, .06);
  --rim-3: rgba(255, 255, 255, .14);
  --g-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), inset 0 0 18px rgba(255, 255, 255, .05), 0 24px 60px rgba(0, 0, 0, .55);
  --g-shadow-bar: inset 0 1px 0 rgba(255, 255, 255, .24), inset 0 0 18px rgba(255, 255, 255, .05), 0 18px 44px rgba(0, 0, 0, .55);
  --g-shadow-2: inset 0 1px 0 rgba(255, 255, 255, .3), 0 6px 16px rgba(0, 0, 0, .4);
  --solid: rgba(255, 255, 255, .16);
  --solid-ink: #f7f7f7;
  --glow-1: rgba(255, 255, 255, .065);
  --glow-2: rgba(255, 255, 255, .03);
  --field: rgba(255, 255, 255, .04);
  --scrim: rgba(0, 0, 0, .62);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #ececec;
  --bg-2: #f5f5f5;
  --ink: #0f0f0f;
  --ink-2: rgba(15, 15, 15, .6);
  --ink-3: rgba(15, 15, 15, .4);
  --line: rgba(15, 15, 15, .08);
  --tint: rgba(15, 15, 15, .05);
  --hi: rgba(15, 15, 15, .07);
  --up: #15803d;
  --down: #b91c1c;
  --up-tint: rgba(21, 128, 61, .07);
  --down-tint: rgba(185, 28, 28, .06);
  --g-bg: linear-gradient(165deg, rgba(255, 255, 255, .86), rgba(255, 255, 255, .55) 71.4%);
  --g-bg-2: linear-gradient(162deg, #ffffff, rgba(255, 255, 255, .82) 71.4%);
  --g-fill: rgba(255, 255, 255, .55);
  --g-raised: rgba(255, 255, 255, .82);
  --g-card: linear-gradient(160deg, #ffffff, rgba(255, 255, 255, .7) 71.4%);
  --sep: rgba(15, 15, 15, .14);
  --hr: rgba(15, 15, 15, .06);
  --line-soft: rgba(15, 15, 15, .06);
  --ptl-base: rgba(15, 15, 15, .1);
  --ptl-from: rgba(15, 15, 15, .25);
  --ptl-tick: rgba(15, 15, 15, .4);
  --step-line: rgba(15, 15, 15, .14);
  --ray-a: .34;
  --ray-b: .1;
  --step-ring: rgba(15, 15, 15, .2);
  --now-glow: rgba(15, 15, 15, .25);
  --g-plate: rgba(250, 250, 250, .9);
  --rim-1: rgba(255, 255, 255, 1);
  --rim-2: rgba(255, 255, 255, .55);
  --rim-3: rgba(15, 15, 15, .07);
  --g-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 16px 40px rgba(0, 0, 0, .07);
  --g-shadow-bar: inset 0 1px 0 rgba(255, 255, 255, .95), 0 12px 32px rgba(0, 0, 0, .07);
  --g-shadow-2: inset 0 1px 0 #ffffff, 0 4px 12px rgba(0, 0, 0, .06);
  --solid: #0f0f0f;
  --solid-ink: #ffffff;
  --glow-1: rgba(255, 255, 255, .95);
  --glow-2: rgba(255, 255, 255, .55);
  --field: rgba(255, 255, 255, .6);
  --scrim: rgba(20, 20, 20, .28);
  color-scheme: light;
}
:root {
  --font-sans: "Geist", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r-panel: 24px;
  --r-pill: 999px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { background: var(--bg); }
body {
  min-height: 100dvh;
  color: var(--ink);
  font: 400 14px/20px var(--font-sans);
  letter-spacing: -0.1px;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1100px 720px at 72% -12%, var(--glow-1), transparent 62%),
    radial-gradient(900px 640px at 18% 112%, var(--glow-2), transparent 64%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  background-attachment: fixed;
  transition: color .2s ease;
}
[hidden] { display: none !important; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--hi); }
:focus-visible { outline: 2px solid var(--ink-2); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
* { scrollbar-width: thin; scrollbar-color: var(--hi) transparent; }
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -0.02em; text-wrap: balance; }
p { margin: 0; }

/* Tekst */
.label { font-family: var(--font-mono); font-size: 10.5px; line-height: 14px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--ink-3); font-weight: 500; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.dim { color: var(--ink-3); }
.mid { color: var(--ink-2); }
.up { color: var(--up) !important; }
.dn { color: var(--down) !important; }
.flat { color: var(--ink-3) !important; }
/* Setningen øverst på hver side: tallene lyser, bindeordene er dempet */
.say { font-size: 22px; line-height: 30px; letter-spacing: -0.4px; color: var(--ink-3); font-weight: 300; text-wrap: pretty; }
.say b { color: var(--ink); font-weight: 500; }
.say b.lead { font-weight: 400; }
.say b.up { color: var(--up); }
.say b.dn { color: var(--down); }

/* Glass: fyll som en gradient, lys kant som en gradient, og blur bak */
.g, .btn, .seg, .field, .pill {
  position: relative;
  isolation: isolate;
}
.g { background: var(--g-bg); border-radius: var(--r-panel); box-shadow: var(--g-shadow); -webkit-backdrop-filter: blur(26px) saturate(150%); backdrop-filter: blur(26px) saturate(150%); }
.g::before, .btn::before, .seg::before, .field::before, .pill::before, .g2::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(172deg, var(--rim-1), var(--rim-2) 42%, var(--rim-3));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.g2 { position: relative; isolation: isolate; background: var(--g-bg-2); box-shadow: var(--g-shadow-2); }

/* Knapper: glass-piller */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 14px; border: 0; border-radius: var(--r-pill);
  background: var(--g-fill); box-shadow: var(--g-shadow-2);
  font-size: 14px; line-height: 20px; font-weight: 500; letter-spacing: -0.1px; color: var(--ink);
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .15s ease, transform .15s ease, opacity .15s ease;
}
.btn:hover { background: var(--g-bg-2); }
.btn:active { transform: scale(.98); }
.btn svg { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-xs { height: 26px; padding: 0 10px; font-size: 12px; }
.btn-dark, .btn-primary { background: var(--solid); color: var(--solid-ink); }
.btn-dark:hover, .btn-primary:hover { background: var(--solid); opacity: .9; }
.btn-sq { border-radius: 10px; }
.btn-hi { background: var(--g-bg-2); }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-ghost::before { display: none; }
.btn-ghost:hover { background: var(--tint); }
.btn.danger { color: var(--down); }
.btn.danger[data-confirm] { background: var(--down); color: #fff; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.icon-btn { width: 38px; padding: 0; }
.linkish { border: 0; background: none; padding: 0; cursor: pointer; color: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; text-align: left; font: inherit; }
.textbtn { border: 0; background: none; padding: 0; cursor: pointer; color: var(--ink-2); font-size: 13px; display: inline-flex; align-items: center; gap: 5px; }
.textbtn:hover { color: var(--ink); }

/* Segmentvelger */
.seg { display: inline-flex; gap: 2px; padding: 4px; border-radius: var(--r-pill); background: linear-gradient(168deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02) 71.4%); box-shadow: var(--g-shadow-2); }
[data-theme="light"] .seg { background: var(--g-fill); }
.seg button { position: relative; isolation: isolate; border: 0; background: none; height: 32px; padding: 0 12px; border-radius: var(--r-pill); font-size: 14px; line-height: 20px; cursor: pointer; color: var(--ink-2); display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--g-bg-2); color: var(--ink); font-weight: 500; box-shadow: var(--g-shadow-2); }
.seg button[aria-pressed="true"]::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; padding: 1px; background: linear-gradient(172deg, var(--rim-1), var(--rim-2) 42%, var(--rim-3)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.seg button .c { font-family: var(--font-mono); font-size: 12.5px; line-height: 18px; letter-spacing: 0; color: var(--ink-3); font-weight: 400; margin-left: -1px; }
.seg.mono button { height: 30px; font-family: var(--font-mono); font-size: 12.5px; line-height: 18px; letter-spacing: 0; }
.seg.mono button[aria-pressed="true"] { font-weight: 400; }
.seg svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* Søkefelt og andre felt i glass */
.field { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: var(--r-pill); background: var(--field); }
.field svg { width: 15px; height: 15px; flex: none; stroke: var(--ink-3); fill: none; stroke-width: 1.7; stroke-linecap: round; }
.field input { flex: 1; min-width: 0; border: 0; background: none; outline: none; height: 100%; font-size: 14px; color: var(--ink); }
.field input::placeholder { color: var(--ink-3); }
.field input::-webkit-search-cancel-button { filter: grayscale(1); opacity: .5; }
.field:focus-within { background: var(--g-bg-2); }
.kbd { font-family: var(--font-mono); font-size: 12.5px; line-height: 18px; color: var(--ink-3); border-radius: 6px; padding: 2px 6px; background: var(--tint); }

/* Status med prikk. Grønn bare for betalt, rød bare for forfalt. */
.st { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.st::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: none; }
.st.on { color: var(--ink); }
.st.good { color: var(--up); }
.st.warn { color: var(--down); }
.st.off { color: var(--ink-3); }
/* Pille med kant, til rolle og prosjektstatus */
.pill { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 11px; border-radius: var(--r-pill); background: var(--g-bg); box-shadow: var(--g-shadow-2); font-size: 12.5px; font-weight: 500; color: var(--ink); white-space: nowrap; }
.pill.dot::after { content: none; }
.pill i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-family: var(--font-mono); font-size: 11px; font-weight: 400; white-space: nowrap; font-variant-numeric: tabular-nums; }
.delta.good { color: var(--up); }
.delta.bad { color: var(--down); }
.delta.flat { color: var(--ink-3); }
.delta span[aria-hidden] { display: none; }
.dpill { position: relative; isolation: isolate; display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px 0 12px; border-radius: var(--r-pill); font-size: 14px; line-height: 20px; font-weight: 500; white-space: nowrap; box-shadow: var(--g-shadow-2); }
.dpill::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; padding: 1px; background: linear-gradient(172deg, var(--rim-1), var(--rim-2) 42%, var(--rim-3)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.dpill svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dpill.good { color: var(--up); background: var(--up-tint); }
.dpill.bad { color: var(--down); background: var(--down-tint); }
.dpill.flat { color: var(--ink-2); background: var(--tint); }

/* Avatar med initialer */
.av { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-family: var(--font-mono); font-size: 13px; line-height: 18px; font-weight: 500; letter-spacing: 0; background: linear-gradient(135deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .05) 71.4%); box-shadow: var(--g-shadow-2), inset 0 0 0 1px var(--hi); color: var(--ink); }

/* Dialog */
dialog { border: 0; padding: 0; border-radius: 26px; width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); color: var(--ink); background: var(--g-plate); box-shadow: inset 0 0 0 1px var(--hi), 0 40px 100px -30px rgba(0, 0, 0, .7); -webkit-backdrop-filter: blur(40px) saturate(150%); backdrop-filter: blur(40px) saturate(150%); overflow: hidden; }
dialog::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.sheet { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; max-height: calc(100dvh - 48px); }
.sheet > header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 20px 24px 14px; }
.sheet > header h2 { font-size: 19px; letter-spacing: -0.02em; }
.sheet .x, .x { border: 0; background: var(--tint); font-size: 18px; line-height: 1; cursor: pointer; color: var(--ink-2); width: 32px; height: 32px; border-radius: 50%; flex: none; }
.sheet .x:hover, .x:hover { color: var(--ink); background: var(--hi); }
.sheet .body { overflow-y: auto; padding: 8px 24px 22px; display: grid; gap: 22px; }
.sheet > footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 24px 18px; border-top: 1px solid var(--line); }
.sheet > footer > div { display: flex; gap: 8px; }
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.f { display: grid; gap: 6px; min-width: 0; align-content: start; }
.f.full { grid-column: 1 / -1; }
.f label, .f .lbl { font-size: 12.5px; color: var(--ink-2); }
.f label .req { color: var(--ink-3); }
.f input, .f select, .f textarea { width: 100%; height: 42px; border: 0; border-radius: 14px; padding: 0 14px; background: var(--field); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); outline: none; transition: box-shadow .15s ease, background .15s ease; }
.f textarea { height: auto; min-height: 90px; padding: 11px 14px; resize: vertical; line-height: 1.45; }
.f select { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.f select option { background: var(--bg-2); color: var(--ink); }
.f input:focus, .f select:focus, .f textarea:focus { box-shadow: inset 0 0 0 1px var(--ink-3); background: var(--g-bg-2); }
.f input::placeholder, .f textarea::placeholder { color: var(--ink-3); }
.f .hint { font-size: 12px; color: var(--ink-3); }
input[type="date"], input[type="time"] { color-scheme: inherit; }
.checks { border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line); background: var(--field); max-height: 190px; overflow-y: auto; }
.checks label { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--ink); cursor: pointer; }
.checks label:last-child { border-bottom: 0; }
.f .checks input, .checks input { width: 16px; height: 16px; padding: 0; flex: none; accent-color: var(--ink); box-shadow: none; }
.checks label span { color: var(--ink-3); font-size: 13px; margin-left: auto; }
.checks .none { padding: 12px 14px; font-size: 13px; color: var(--ink-3); }
.related { display: grid; gap: 10px; }
.related header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.related ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.related li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; cursor: pointer; }
.related li:hover { color: var(--ink-2); }
.related li span { color: var(--ink-3); font-size: 13px; text-align: right; }
.related .none { font-size: 13.5px; color: var(--ink-3); padding: 6px 0; }
.err { color: var(--down); font-size: 13px; line-height: 1.35; flex: 1; text-align: right; }
.note { font-size: 13px; color: var(--ink-3); max-width: 78ch; line-height: 1.55; }
@media (max-width: 600px) {
  dialog { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 26px 26px 0 0; }
  .sheet { max-height: 92dvh; }
  .sheet > footer { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .fgrid { grid-template-columns: minmax(0, 1fr); }
  .f input, .f select, .f textarea { font-size: 16px; }
}

/* Innlogging */
.gate { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; overflow-y: auto; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
.gate-card { width: min(420px, 100%); padding: clamp(26px, 5vw, 38px); display: grid; gap: 22px; border-radius: 28px; }
.gate-card > img, .gate-card .logo { height: 32px; width: auto; }
.gate-card .ttl { display: grid; gap: 6px; }
.gate-card h1, .gate-card h2 { font-size: 28px; letter-spacing: -0.035em; font-weight: 600; }
.gform { display: grid; gap: 14px; }
.gform .btn { height: 44px; width: 100%; margin-top: 4px; }
.gsub { color: var(--ink-3); font-size: 13.5px; line-height: 1.55; }
.gmsg { font-size: 13.5px; color: var(--down); }
.gmsg:empty { display: none; }
.gmsg.info { color: var(--ink-3); }

/* Melding nederst */
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 60; padding: 11px 18px; border-radius: var(--r-pill); font-size: 14px; color: var(--ink); background: var(--g-plate); box-shadow: inset 0 0 0 1px var(--hi), 0 20px 50px -20px rgba(0, 0, 0, .6); -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px); max-width: calc(100vw - 32px); }

/* Logo etter modus */
.logo-light { display: none; }
[data-theme="light"] .logo-light { display: block; }
[data-theme="light"] .logo-dark { display: none; }

/* Ikoner */
.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

[data-theme="light"] .av { background: var(--g-bg-2); }
