/* Etikett – designeren. Lerretet er rullen: hvit etikett på blågrått bakpapir. */
@font-face { font-family: 'Schibsted Grotesk'; src: url(/fonts/schibsted-grotesk-400.woff) format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Schibsted Grotesk'; src: url(/fonts/schibsted-grotesk-500.woff) format('woff'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Schibsted Grotesk'; src: url(/fonts/schibsted-grotesk-600.woff) format('woff'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Schibsted Grotesk'; src: url(/fonts/schibsted-grotesk-700.woff) format('woff'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Schibsted Grotesk'; src: url(/fonts/schibsted-grotesk-800.woff) format('woff'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'L Inter'; src: url(/fonts/inter-600.woff) format('woff'); }
@font-face { font-family: 'L Archivo'; src: url(/fonts/archivo-700.woff) format('woff'); }
@font-face { font-family: 'L Bricolage'; src: url(/fonts/bricolage-grotesque-700.woff) format('woff'); }
@font-face { font-family: 'L Fraunces'; src: url(/fonts/fraunces-700.woff) format('woff'); }
@font-face { font-family: 'L Mono'; src: url(/fonts/jetbrains-mono-700.woff) format('woff'); }

:root {
  --liner: #d9e1ea;      /* bakpapiret på rullen */
  --liner-deep: #c7d2de;
  --paper: #ffffff;
  --ink: #18233a;        /* blekk-blå tekst */
  --muted: #66738a;
  --line: #e3e8ef;
  --app: #f4f6f9;
  --accent: #3046f0;     /* ultramarin: valg og handlinger */
  --accent-soft: #e8ebfe;
  --guide: #e2365b;      /* hjelpelinjer, som skjæremerker */
  --danger: #c4314f;
  --radius-s: 8px; --radius-m: 12px; --radius-l: 18px;
  --shadow-label: 0 1px 0 rgba(24, 35, 58, .06), 0 6px 18px rgba(24, 35, 58, .12);
  font-family: 'Schibsted Grotesk', system-ui, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--app); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
[hidden] { display: none !important; }

/* ---------- Knapper og felt ---------- */
.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); font-weight: 600; white-space: nowrap; transition: border-color .12s, background .12s; }
.btn:hover { border-color: #c9d2df; }
.btn.pri { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.pri:hover { background: #2238d8; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(24, 35, 58, .06); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.danger { color: var(--danger); }
.btn svg { width: 16px; height: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > span, .lbl { font-size: 12px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=number], input[type=password], textarea, select {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--paper); outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; min-height: 64px; padding: 8px 10px; resize: vertical; line-height: 1.4; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mm { position: relative; }
.mm input { padding-right: 34px; }
.mm::after { content: attr(data-unit); position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--muted); pointer-events: none; }
.mm .k { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 700; color: var(--muted); pointer-events: none; }
.mm.has-k input { padding-left: 24px; }
.mm[data-unit=''] input { padding-right: 8px; }
.mm[data-unit='']::after { display: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.seg { display: flex; background: var(--app); border: 1px solid var(--line); border-radius: 10px; padding: 2px; gap: 2px; }
.seg button { flex: 1; height: 28px; border: 0; background: none; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.seg button.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(24, 35, 58, .12); }
.seg button svg { width: 15px; height: 15px; }
.tog { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; margin-bottom: 10px; }
.tog input { width: 16px; height: 16px; accent-color: var(--accent); }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.paperchip { white-space: nowrap; }

/* ---------- Ramme ---------- */
.shell { display: grid; grid-template-rows: 56px 1fr; height: 100vh; }
.top { display: flex; align-items: center; gap: 12px; padding: 0 14px 0 16px; background: var(--paper); border-bottom: 1px solid var(--line); min-width: 0; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 17px; letter-spacing: -.01em; text-decoration: none; color: var(--ink); }
.brand img { width: 26px; height: 26px; }
.tname { min-width: 0; max-width: 340px; height: 34px; border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 0 8px; font-weight: 600; font-size: 15px; }
.tname:hover { border-color: var(--line); }
.paperchip { height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--app); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.paperchip:hover { color: var(--ink); }
.saved { font-size: 12.5px; color: var(--muted); }
.top .spacer { flex: 1; }
.pstat { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #aab4c3; }
.dot.on { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.qbtn { position: relative; }
.qbtn .n { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; display: grid; place-items: center; padding: 0 5px; }

.work { display: grid; grid-template-columns: 248px 1fr 304px; min-height: 0; }
.side { background: var(--paper); overflow: auto; min-height: 0; }
.side.left { border-right: 1px solid var(--line); }
.side.right { border-left: 1px solid var(--line); }
.sec { padding: 14px 14px 6px; border-bottom: 1px solid var(--line); }
.sec:last-child { border-bottom: 0; }
.sec h3 { margin: 0 0 10px; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; }
.tlist { display: flex; flex-direction: column; gap: 2px; margin: 0 -6px 8px; }
.tlist a { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 9px; text-decoration: none; color: var(--ink); }
.tlist a:hover { background: var(--app); }
.tlist a.on { background: var(--accent-soft); }
.tlist .mini { flex: none; background: var(--paper); border: 1.5px solid #c9d2df; border-radius: 3px; }
.tlist a.on .mini { border-color: var(--accent); }
.tlist b { font-weight: 600; display: block; line-height: 1.25; }
.tlist small { color: var(--muted); font-size: 11.5px; }
.adds { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 10px; }
.adds button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 0 7px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); font-size: 11px; font-weight: 600; color: var(--muted); }
.adds button:hover { border-color: var(--accent); color: var(--accent); }
.adds svg { width: 20px; height: 20px; }
.layers { display: flex; flex-direction: column; margin: 0 -6px 8px; }
.layers button { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border: 0; background: none; border-radius: 8px; text-align: left; font-size: 13px; }
.layers button:hover { background: var(--app); }
.layers button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.layers button.off { opacity: .45; }
.layers svg { width: 15px; height: 15px; flex: none; color: var(--muted); }
.layers .eye { margin-left: auto; padding: 2px; border-radius: 5px; }
.layers .eye:hover { background: rgba(24, 35, 58, .08); }

/* ---------- Lerretet: rullen ---------- */
.stage { position: relative; overflow: hidden; background: var(--app); min-height: 0; }
.stage .scroll { position: absolute; inset: 0 0 46px 0; overflow: auto; }
.canvas { position: relative; overflow: hidden; }
.ruler { position: absolute; z-index: 3; background: rgba(244, 246, 249, .92); }
.ruler.h { height: 22px; left: 22px; right: 0; top: 0; border-bottom: 1px solid var(--line); }
.ruler.v { width: 22px; top: 22px; bottom: 46px; left: 0; border-right: 1px solid var(--line); }
.ruler canvas { display: block; }
.corner { position: absolute; z-index: 4; left: 0; top: 0; width: 22px; height: 22px; background: var(--app); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.liner { position: absolute; background: var(--liner); border-radius: 4px; box-shadow: inset 0 0 0 1px var(--liner-deep); }
.liner::before, .liner::after { content: ''; position: absolute; left: 0; right: 0; height: 40px; pointer-events: none; }
.liner::before { top: 0; background: linear-gradient(var(--app), transparent); }
.liner::after { bottom: 0; background: linear-gradient(transparent, var(--app)); }
.ghostlabel { position: absolute; background: rgba(255, 255, 255, .55); box-shadow: 0 0 0 1px rgba(24, 35, 58, .05); }
.label { position: absolute; background: var(--paper); box-shadow: var(--shadow-label); overflow: hidden; }
.label img { position: absolute; inset: 0; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; pointer-events: none; image-rendering: auto; }
.label.trykk img { image-rendering: pixelated; }
.margin { position: absolute; border: 1px dashed rgba(48, 70, 240, .35); pointer-events: none; }
.cut { position: absolute; left: -6px; right: -6px; height: 0; border-top: 1.5px dashed #9aa7b8; }
.overlay { position: absolute; }
.el { position: absolute; cursor: move; border-radius: 2px; }
.el:hover { box-shadow: 0 0 0 1px rgba(48, 70, 240, .45); }
.el.sel { box-shadow: 0 0 0 1.5px var(--accent); }
.el.warn { box-shadow: 0 0 0 1.5px var(--guide); }
.hd { position: absolute; width: 10px; height: 10px; background: var(--paper); border: 1.5px solid var(--accent); border-radius: 3px; margin: -5px 0 0 -5px; }
.hd[data-h=n], .hd[data-h=s] { cursor: ns-resize; } .hd[data-h=e], .hd[data-h=w] { cursor: ew-resize; }
.hd[data-h=nw], .hd[data-h=se] { cursor: nwse-resize; } .hd[data-h=ne], .hd[data-h=sw] { cursor: nesw-resize; }
.badge { position: absolute; left: 0; top: calc(100% + 6px); white-space: nowrap; background: var(--ink); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; pointer-events: none; }
.badge.warn { background: var(--guide); }
.guide { position: absolute; background: var(--guide); pointer-events: none; z-index: 2; }
.guide.v { width: 1px; } .guide.hz { height: 1px; }
.zoombar { position: absolute; left: 0; right: 0; bottom: 0; height: 46px; display: flex; align-items: center; gap: 10px; padding: 0 14px; background: var(--paper); border-top: 1px solid var(--line); }
.zoombar .seg { width: auto; }
.zoombar .seg button { flex: none; padding: 0 10px; }
.zoombar .hint { margin-left: auto; font-size: 12px; color: var(--muted); }
.empty-stage { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; color: var(--muted); }

/* ---------- Inspektør ---------- */
.anchor { display: grid; grid-template-columns: repeat(3, 26px); gap: 3px; padding: 4px; background: var(--app); border: 1px solid var(--line); border-radius: 10px; width: max-content; }
.anchor button { width: 26px; height: 22px; border: 0; border-radius: 6px; background: transparent; display: grid; place-items: center; }
.anchor button i { width: 6px; height: 6px; border-radius: 2px; background: #b4bfce; }
.anchor button:hover { background: var(--paper); }
.anchor button:hover i { background: var(--accent); }
.place { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.place .grid2 { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin: -4px 0 12px; }
.chips button { height: 24px; padding: 0 8px; border-radius: 6px; border: 1px dashed #b9c4d3; background: var(--paper); font-size: 12px; color: var(--muted); }
.chips button:hover { border-color: var(--accent); color: var(--accent); }
.fontsel option { font-size: 14px; }
.foot { display: flex; gap: 6px; padding: 12px 14px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--paper); }
.note { font-size: 12px; color: var(--guide); margin: -6px 0 12px; }
.papers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; }
.paper { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 92px; padding: 8px 4px 7px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.paper:hover { border-color: #c4cddb; }
.paper.on { border-color: var(--accent); background: var(--accent-soft); }
.paper .sh { background: var(--paper); border: 1.5px solid #9eabbd; border-radius: 3px; }
.paper.on .sh { border-color: var(--accent); }
.paper b { font-size: 12px; font-weight: 700; line-height: 1; }
.paper small { font-size: 10.5px; color: var(--muted); line-height: 1; }
.grp { font-size: 12px; font-weight: 600; color: var(--muted); margin: 4px 0 6px; }

/* ---------- Kø-skuff ---------- */
.drawer { position: fixed; z-index: 20; top: 56px; right: 0; bottom: 0; width: min(380px, 100vw); background: var(--paper); border-left: 1px solid var(--line); box-shadow: -12px 0 30px rgba(24, 35, 58, .08); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .2s ease; }
.drawer.open { transform: none; }
.drawer header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.drawer header h2 { margin: 0; font-size: 15px; }
.drawer .list { overflow: auto; padding: 8px 10px; }
.job { display: flex; gap: 10px; padding: 8px 6px; border-radius: 10px; align-items: center; }
.job:hover { background: var(--app); }
.job img { width: 74px; flex: none; border-radius: 3px; box-shadow: 0 0 0 1px var(--line); background: #fff; }
.job b { font-weight: 600; display: block; font-size: 13px; }
.job small { color: var(--muted); font-size: 12px; display: block; }
.job .st { font-size: 11.5px; font-weight: 700; }
.job .st.ko { color: var(--accent); } .job .st.feilet, .job .st.usikker { color: var(--danger); } .job .st.skrevet { color: var(--muted); }
.job .acts { margin-left: auto; display: flex; gap: 4px; }

/* ---------- Innlogging og innstillinger ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; background: var(--liner); padding: 24px; }
.gate .card { width: min(380px, 100%); background: var(--paper); border-radius: var(--radius-l); padding: 28px 26px 22px; box-shadow: var(--shadow-label); position: relative; }
.gate .card::before, .gate .card::after { content: ''; position: absolute; top: 50%; width: 16px; height: 16px; margin-top: -8px; border-radius: 50%; background: var(--liner); }
.gate .card::before { left: -8px; } .gate .card::after { right: -8px; }
.gate h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.02em; }
.gate p { margin: 0 0 18px; color: var(--muted); }
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 0 0 8px; }
.page { max-width: 760px; margin: 0 auto; padding: 28px 18px 60px; overflow: auto; }
.page h1 { font-size: 26px; letter-spacing: -.02em; margin: 0 0 18px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 18px 18px 8px; margin-bottom: 14px; }
.panel h2 { margin: 0 0 6px; font-size: 16px; }
.panel p { margin: 0 0 12px; }
.code { font-family: ui-monospace, 'JetBrains Mono', monospace; font-size: 12.5px; background: var(--app); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; overflow-x: auto; white-space: pre; margin-bottom: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tok { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); gap: 10px; }
.tag { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.tag.skriver { background: #fde7ec; color: var(--danger); }
dialog { border: 0; border-radius: var(--radius-l); padding: 22px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(24, 35, 58, .25); }
dialog::backdrop { background: rgba(24, 35, 58, .35); }
dialog h2 { margin: 0 0 12px; font-size: 18px; }
#toast { position: fixed; left: 50%; bottom: 62px; transform: translate(-50%, 20px); opacity: 0; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 13.5px; transition: opacity .18s, transform .18s; pointer-events: none; z-index: 50; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--danger); }

@media (max-width: 1100px) { .work { grid-template-columns: 210px 1fr 280px; } }
@media (max-width: 880px) {
  .shell { height: auto; min-height: 100vh; grid-template-rows: auto 1fr; }
  .top { gap: 6px; padding: 8px 10px; min-height: 56px; }
  .top .saved, .top .pstat, .brand span, .top .btn span:not(.n) { display: none; }
  .tname { flex: 1; max-width: none; font-size: 14px; }
  .work { grid-template-columns: 1fr; }
  .stage { order: 1; height: 58vh; }
  .side.right { order: 2; border-left: 0; border-bottom: 1px solid var(--line); }
  .side.left { order: 3; border-right: 0; }
  .zoombar .hint { display: none; }
  .drawer { top: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Tabelltall bare der tall står i kolonner – ellers får komma og kolon luft rundt seg */
input, .ruler, .rul, [data-num], .mm, .sz { font-feature-settings: 'tnum' 1; }
