/* Mønsterverkstedet
   Oppsett: toppstripe med stegene i rekkefølge, et strikket bånd, og én visning om gangen.
   Plagget står på et «skjærebrett» av rutepapir i midten, med innstillinger til venstre og sonen til høyre. */
:root {
  --bg: #eceff1; --surface: #fbfbfa; --sunk: #e2e6e9; --stage: #e4e8eb; --dot: rgba(36, 52, 84, .13);
  --ink: #17203a; --muted: #586276; --line: #d0d6dc;
  --accent: #24427f; --accent-ink: #ffffff; --accent-soft: #dde5f3;
  --rose: #b0303a;
  --warn: #ac2f29; --warn-soft: #f4ddda; --ok: #2b7247; --ok-soft: #dbeee1;
  --f-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --f-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --r: 8px; --shadow: 0 1px 2px rgba(20, 28, 48, .06), 0 4px 16px rgba(20, 28, 48, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #11161f; --surface: #19202c; --sunk: #212938; --stage: #161c27; --dot: rgba(160, 180, 220, .10);
  --ink: #e6e9ef; --muted: #98a2b4; --line: #2d3647;
  --accent: #9cb6ec; --accent-ink: #0e1830; --accent-soft: #233150; --rose: #e2666d;
  --warn: #f08378; --warn-soft: #3d2427; --ok: #7fcf9c; --ok-soft: #1c3327;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25); color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #11161f; --surface: #19202c; --sunk: #212938; --stage: #161c27; --dot: rgba(160, 180, 220, .10);
  --ink: #e6e9ef; --muted: #98a2b4; --line: #2d3647;
  --accent: #9cb6ec; --accent-ink: #0e1830; --accent-soft: #233150; --rose: #e2666d;
  --warn: #f08378; --warn-soft: #3d2427; --ok: #7fcf9c; --ok-soft: #1c3327;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25); color-scheme: dark;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 17px; line-height: 1.45; font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 700; text-wrap: balance; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 2.4vw, 2.1rem); font-weight: 800; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
a { color: var(--accent); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- toppstripe og steg ---------- */
.top { display: flex; align-items: center; gap: .6rem 1.4rem; padding: .7rem 16px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .55rem; font-family: var(--f-display); font-weight: 800; font-size: 1.25rem; color: var(--ink); text-decoration: none; letter-spacing: -.02em; white-space: nowrap; }
.brand .mark { width: 22px; height: 22px; border-radius: 5px; background:
  conic-gradient(from 45deg, var(--rose) 0 25%, transparent 0 50%, var(--rose) 0 75%, transparent 0) 0 0/11px 11px, var(--accent); }
.steps { display: flex; gap: .2rem; flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; counter-reset: s; }
.steps button { position: relative; display: flex; align-items: center; gap: .5rem; border: 0; background: none; padding: .45rem .8rem .45rem .45rem; border-radius: 999px; cursor: pointer; color: var(--muted); font-weight: 700; white-space: nowrap; }
.steps button i { font-style: normal; display: grid; place-items: center; width: 1.65rem; height: 1.65rem; border-radius: 50%; border: 1.5px solid var(--line); font-size: .85rem; color: var(--muted); background: var(--surface); }
.steps button small { font-weight: 400; font-size: .75rem; color: var(--muted); }
.steps button:hover { color: var(--ink); background: var(--sunk); }
.steps button[aria-current="step"] { color: var(--ink); background: var(--accent-soft); }
.steps button[aria-current="step"] i { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.steps button + button::before { content: ""; position: absolute; left: -.2rem; top: 50%; width: .2rem; height: 1.5px; background: var(--line); }
.top-right { display: flex; align-items: center; gap: .6rem; margin-left: auto; }
.savestate { font-size: .85rem; color: var(--muted); white-space: nowrap; }
.menuwrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: .35rem; min-width: 230px; display: flex; flex-direction: column; }
.menu button { border: 0; background: none; text-align: left; padding: .55rem .7rem; border-radius: 6px; cursor: pointer; }
.menu button:hover { background: var(--sunk); }
#menuBtn.minn { position: relative; }
#menuBtn.minn::after { content: ""; position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--rose); }
#band { display: block; width: 100%; height: 32px; }

main { max-width: 1680px; margin: 0 auto; padding: 22px 16px 56px; }
.vhead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .8rem 1.2rem; margin-bottom: 20px; }
.vhead p { margin: .3rem 0 0; color: var(--muted); max-width: 70ch; }
.vhead.tight { align-items: center; margin-bottom: 14px; }
.titlefield { flex: 1 1 260px; min-width: 0; display: flex; }
.titlefield input { flex: 1; min-width: 0; font-family: var(--f-display); font-weight: 700; font-size: 1.45rem; border: 1px solid transparent; background: transparent; border-radius: var(--r); padding: .2rem .45rem; color: var(--ink); }
.titlefield input:hover { border-color: var(--line); }
.titlefield input:focus { border-color: var(--accent); outline: none; background: var(--surface); }
.emptystate { max-width: 520px; margin: 8vh auto; text-align: center; display: flex; flex-direction: column; gap: .8rem; align-items: center; }
.emptystate p { color: var(--muted); margin: 0; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--accent); color: var(--accent-ink); padding: .7rem 1rem; border-radius: 10px; margin-bottom: 16px; font-weight: 600; }
.banner .btn { background: transparent; color: inherit; border-color: currentColor; }
.velkommen { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 2rem; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--rose); border-radius: 12px; padding: 16px 20px; margin-bottom: 20px; box-shadow: var(--shadow); }
.velkommen > div:first-child { max-width: 72ch; display: flex; flex-direction: column; gap: .45rem; }
.velkommen p { margin: 0; color: var(--muted); }

/* ---------- knapper og felt ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: .45rem .85rem; cursor: pointer; min-height: 2.4rem; font-weight: 700; font-size: .94rem; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.next { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 2rem; padding: .25rem .65rem; font-size: .86rem; }
.btn.danger { color: var(--warn); }
.btn:disabled { opacity: .45; cursor: default; }
.linkbtn { border: 0; background: none; color: var(--accent); padding: 0; cursor: pointer; text-align: left; font-size: .88rem; text-decoration: underline; text-underline-offset: 2px; }
.seg { display: flex; flex-wrap: wrap; gap: .3rem; }
.seg > button:not(.btn) { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: .35rem .65rem; cursor: pointer; min-height: 2.2rem; font-size: .9rem; }
.seg > button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); font-weight: 700; }
.field { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; color: var(--muted); }
.field > span { font-weight: 600; }
.field.inline { flex-direction: row; align-items: center; }
input[type=text], input[type=number], select, textarea { border: 1px solid var(--line); background: var(--bg); border-radius: var(--r); padding: .42rem .55rem; min-height: 2.4rem; color: var(--ink); width: 100%; }
input[type=color] { width: 100%; min-height: 2.4rem; padding: 2px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 1.1rem; height: 1.1rem; }
select.indent { margin-left: 1.6rem; width: calc(100% - 1.6rem); }
.check { display: flex; align-items: center; gap: .45rem; font-size: .92rem; cursor: pointer; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.hint { font-size: .85rem; color: var(--muted); margin: 0; }
.lead { color: var(--muted); max-width: 75ch; margin: 0; font-size: .95rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 1.1rem; }
.stack.s { gap: .5rem; } .stack.xs { gap: .35rem; }
.swatch { width: 2.3rem; height: 2.3rem; border-radius: 6px; border: 1px solid rgba(0, 0, 0, .25); cursor: pointer; display: grid; place-items: center; font-size: .95rem; padding: 0; flex: none; }
.swatch.sm { width: 1.75rem; height: 1.75rem; border-radius: 5px; }
.swatch.on { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.swatch.add { background: var(--surface); color: var(--muted); font-weight: 700; border-style: dashed; }
.iconbtn { border: 0; background: none; cursor: pointer; color: var(--muted); padding: .25rem .35rem; border-radius: 6px; font-size: .85rem; min-width: 1.9rem; min-height: 1.9rem; }
.iconbtn:hover { background: var(--sunk); color: var(--ink); }
.dot { display: inline-block; width: .95rem; height: .95rem; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .25); vertical-align: -2px; margin-right: .35rem; flex: none; }
.fit { display: grid; grid-template-columns: auto 1fr; gap: .5rem; align-items: start; font-size: .88rem; padding: .45rem .55rem; border-radius: var(--r); background: var(--sunk); }
.fit .pill { font-size: .7rem; font-weight: 700; padding: .1rem .45rem; border-radius: 99px; letter-spacing: .03em; text-transform: uppercase; margin-top: .12rem; white-space: nowrap; }
.fit.ok .pill { background: var(--ok-soft); color: var(--ok); }
.fit.warn .pill { background: var(--warn-soft); color: var(--warn); }
.empty { border: 1px dashed var(--line); border-radius: 12px; padding: 1.6rem; color: var(--muted); text-align: center; grid-column: 1/-1; margin: 0; }

/* ---------- seksjoner og kort ---------- */
.sect { display: flex; flex-direction: column; gap: .8rem; margin-bottom: 32px; }
.sect > header { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; }
.subpanel { display: flex; flex-direction: column; gap: .7rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; max-width: 920px; }
#lagerCanvas { max-width: 100%; height: auto; cursor: crosshair; border-radius: 8px; display: block; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.cards.wide { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: .4rem; box-shadow: var(--shadow); }
.cardhit { border: 0; padding: 0; background: none; cursor: pointer; border-radius: 8px; display: block; }
.card canvas { width: 100%; height: 130px; display: block; background: var(--sunk); border-radius: 8px; }
.plaggkort .cardhit { height: 180px; display: grid; place-items: center; background: radial-gradient(circle, var(--dot) 1px, transparent 1.2px) 0 0/14px 14px, var(--stage); }
.plaggkort canvas { width: auto; height: auto; background: none; border-radius: 0; }
.card .ct { font-weight: 700; line-height: 1.25; }
.card .cm { font-size: .82rem; color: var(--muted); }
.card .cb { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: auto; padding-top: .2rem; }
.grupper { display: flex; flex-direction: column; gap: .7rem; }
.gruppetittel { font-size: 1rem; color: var(--muted); margin-top: .5rem; }
.grupper > .gruppetittel:first-child { margin-top: 0; }
.typegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.typebtn { display: flex; flex-direction: column; align-items: center; gap: .35rem; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: .7rem .4rem .6rem; cursor: pointer; font-weight: 700; box-shadow: var(--shadow); }
.typebtn:hover { border-color: var(--accent); }
.typebtn .ikon { height: 72px; width: 100%; display: grid; place-items: center; }
.typebtn canvas { display: block; }
.tablewrap { overflow-x: auto; }
table.edit { border-collapse: collapse; font-size: .9rem; min-width: 620px; width: 100%; }
table.edit th { text-align: left; font-weight: 600; color: var(--muted); padding: .3rem; font-size: .82rem; }
table.edit td { padding: .22rem; }
table.edit input, table.edit select { min-height: 2.1rem; padding: .25rem .4rem; }
table.edit input[type=color] { width: 3rem; }
table.edit input[type=number] { max-width: 8rem; }
td.meter { color: var(--muted); white-space: nowrap; }
.nostcell { min-width: 190px; }
.nost { display: flex; align-items: center; gap: .2rem; }
.nost .iconbtn { font-size: 1.1rem; font-weight: 700; border: 1px solid var(--line); min-width: 2rem; }
.nostvis { display: inline-flex; align-items: center; gap: 2px; width: 8.6rem; padding: 0 .3rem; flex: none; }
.nostvis .flere { font-size: .75rem; color: var(--muted); margin: 0 2px; }
.nostrad { display: flex; align-items: center; gap: .5rem; margin-top: .2rem; }
.nostrad input { width: 110px; }
.nostrad b { font-size: .85rem; white-space: nowrap; }
.crumb { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font-weight: 600; margin-bottom: .4rem; font-size: .95rem; }
.crumb:hover { text-decoration: underline; }
.yarngrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr)); gap: .4rem; margin: .5rem 0; }
.yarngrid button { border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: .3rem; cursor: pointer; font-size: .74rem; display: flex; flex-direction: column; align-items: center; gap: .2rem; line-height: 1.2; text-align: center; }
.yarngrid button span { width: 100%; height: 1.8rem; border-radius: 5px; border: 1px solid rgba(0, 0, 0, .2); }
.yarngrid button.picked { outline: 3px solid var(--accent); }
.yarngrid button.has { outline: 2px solid var(--ok); }
.yarngrid .nr { color: var(--muted); }
.kartgrid { max-height: 420px; overflow: auto; margin: 0; padding: 3px; }

/* ---------- tegn ---------- */
.work { display: grid; grid-template-columns: 270px minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.palette { display: flex; flex-direction: column; gap: .35rem; }
.pcolor { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr); gap: .2rem .5rem; align-items: center; padding: .3rem; border-radius: var(--r); border: 2px solid transparent; }
.pcolor.sel { border-color: var(--accent); background: var(--accent-soft); }
.pcolor .swatch { grid-row: span 2; width: 2.6rem; height: 2.6rem; }
.pcolor input { min-height: 2rem; padding: .2rem .4rem; font-size: .9rem; }
.pline { display: flex; align-items: center; justify-content: space-between; gap: .3rem; }
.pcount { font-size: .75rem; color: var(--muted); }
.pmeta { display: flex; }
.opsgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .35rem; }
.arrows { display: grid; grid-template-columns: repeat(4, 1fr); gap: .35rem; }
.canvas-col { display: flex; flex-direction: column; gap: .6rem; min-width: 0; }
.edbar { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .5rem .8rem; }
.edbar .zoom { display: flex; align-items: center; gap: .45rem; font-size: .9rem; }
.edbar .zoom input { width: 110px; }
.hoverinfo { margin-left: auto; font-size: .86rem; color: var(--muted); min-height: 1.3em; min-width: 11.5em; text-align: right; white-space: nowrap; }
.canvas-wrap { overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; max-height: 78vh; }
#editor { display: block; touch-action: none; cursor: crosshair; }
.side canvas { max-width: 100%; display: block; border-radius: 6px; }
.checks { display: flex; flex-direction: column; gap: .45rem; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .25rem .8rem; font-size: .9rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; }

/* ---------- fra bilde ---------- */
.bilde-grid { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 16px; align-items: start; }
.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 1rem; text-align: center; display: flex; flex-direction: column; gap: .5rem; align-items: center; background: var(--bg); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop img { max-height: 180px; border-radius: 6px; max-width: 100%; }
.drop p { margin: 0; color: var(--muted); font-size: .9rem; }
.lbl { display: flex; justify-content: space-between; }
.lbl output { color: var(--ink); font-weight: 400; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .35rem; }
legend { font-size: .9rem; font-weight: 600; color: var(--muted); margin-bottom: .3rem; padding: 0; }
.variants { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.vcard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: .45rem; box-shadow: var(--shadow); }
.vcard canvas { width: 100%; height: auto; border-radius: 6px; background: var(--sunk); }
.vcard .vt { font-weight: 700; font-family: var(--f-display); }
.vcard .vs { display: flex; gap: .2rem; flex-wrap: wrap; }
.vcard .vs span { width: 1.2rem; height: 1.2rem; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .2); }

/* ---------- plagg ---------- */
.pl-grid { display: grid; grid-template-columns: 290px minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.pl-center { display: flex; flex-direction: column; gap: .5rem; min-width: 0; position: sticky; top: 12px; }
.pl-stage { border-radius: 14px; border: 1px solid var(--line); display: grid; place-items: center; padding: 12px; min-height: 420px; overflow: auto;
  background: radial-gradient(circle, var(--dot) 1px, transparent 1.3px) 0 0/18px 18px, var(--stage); }
#plCanvas { display: block; touch-action: none; }
.pl-under { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.pl-sum { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; font-size: .92rem; color: var(--muted); }
.pl-sum b { color: var(--ink); font-family: var(--f-display); font-size: 1.15rem; }
.masker { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.masker b { font-family: var(--f-display); font-size: 1.5rem; min-width: 2.6ch; text-align: center; }
.masker .check { margin-left: auto; }
.pfarge { display: flex; align-items: center; gap: .55rem; }
.pfarge .pfn { flex: 1; font-size: .92rem; min-width: 0; }
.pfarge em { font-style: normal; font-size: .75rem; color: var(--muted); margin-left: .25rem; }
table.yarn { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.yarn td { padding: .3rem .2rem; border-bottom: 1px solid var(--line); }
table.yarn td.n { text-align: right; white-space: nowrap; }
.have { font-size: .78rem; white-space: nowrap; }
.have.ok { color: var(--ok); } .have.short { color: var(--warn); font-weight: 700; }
.sonehead { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.sonehead .hint { margin-top: .15rem; }
.tips { margin: 0; padding-left: 1.1rem; color: var(--muted); font-size: .9rem; display: flex; flex-direction: column; gap: .3rem; }
.motivvalg { display: grid; grid-template-columns: 96px 1fr; gap: .7rem; align-items: center; }
.motivvalg canvas { width: 96px; height: 72px; border-radius: 6px; }
.motivvalg > div { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.motivgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; max-height: 330px; overflow: auto; padding: 2px; }
.motivgrid button { border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: .3rem; cursor: pointer; display: flex; flex-direction: column; gap: .2rem; font-size: .74rem; line-height: 1.2; text-align: left; }
.motivgrid button.on { outline: 2.5px solid var(--accent); }
.motivgrid canvas { width: 100%; height: 52px; border-radius: 4px; }
.motivgrid small { color: var(--muted); font-size: .7rem; }
.seg.filter > button { min-height: 1.9rem; padding: .2rem .55rem; font-size: .82rem; }
.fvalg { display: flex; flex-wrap: wrap; gap: .3rem; }
.fmap { display: grid; grid-template-columns: auto 1fr; gap: .25rem .45rem; align-items: center; font-size: .86rem; padding: .35rem 0; border-top: 1px solid var(--line); }
.fmap:first-of-type { border-top: 0; }
.fmap .fmn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.fmap .arrow { display: none; }
.fmap .fvalg { grid-column: 1 / -1; }
.flytt { display: grid; grid-template-columns: repeat(4, 2.4rem) 1fr; gap: .3rem; }
.hoyde { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; color: var(--ink); }
.hoyde b { font-family: var(--f-display); font-size: 1.2rem; }
.sonebtns { padding-top: .3rem; border-top: 1px solid var(--line); }
.feltvalg > button, .delvalg > button { flex: 1; }
.soneliste { border-top: 1px solid var(--line); padding-top: .5rem; }
.soneliste summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--muted); padding: .2rem 0; }
.soneliste ol { list-style: none; margin: .4rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow: auto; }
.soneliste li button { width: 100%; display: grid; grid-template-columns: auto 1fr auto; gap: .5rem; align-items: center; border: 1px solid transparent; background: none; border-radius: 6px; padding: .3rem .4rem; cursor: pointer; text-align: left; font-size: .86rem; }
.soneliste li button:hover { background: var(--sunk); }
.soneliste li button.on { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.sl-farger { display: flex; gap: 2px; }
.sl-farger i { width: .9rem; height: .9rem; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .25); }
.sl-navn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-omg { color: var(--muted); font-size: .78rem; white-space: nowrap; }

/* ---------- strikk ---------- */
.knit { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
.knit-chart { overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; max-height: 80vh; }
.rowbig { font-family: var(--f-display); font-size: 1.5rem; font-weight: 700; }
.rowbig b { font-size: 2.8rem; }
.rowbig .of { color: var(--muted); font-size: 1.1rem; font-weight: 500; }
.knitnav { display: grid; grid-template-columns: 1fr 1.5fr; gap: .5rem; }
.knitnav .btn { min-height: 3.2rem; font-size: 1.05rem; }
.instr { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.instr .run { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--line); border-radius: var(--r); padding: .3rem .55rem; font-weight: 700; background: var(--bg); }
.instr .run i { width: 1.1rem; height: 1.1rem; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .25); }
.instr .rep { font-weight: 700; color: var(--accent); margin-right: .2rem; }
.note { background: var(--accent-soft); border-radius: var(--r); padding: .5rem .7rem; font-size: .92rem; }
.allrows { max-height: 360px; overflow: auto; font-size: .88rem; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.allrows li { padding: .35rem .25rem; border-bottom: 1px solid var(--line); cursor: pointer; display: grid; grid-template-columns: 4.4rem 1fr; gap: .4rem; }
.allrows li.cur { background: var(--accent-soft); }
.allrows li .rn { color: var(--muted); }
.allrows li em { display: block; font-style: normal; color: var(--accent); font-size: .82rem; }

/* ---------- dialoger ---------- */
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); padding: 20px; max-width: min(580px, calc(100vw - 32px)); box-shadow: var(--shadow); }
dialog.wide { max-width: min(820px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 14, 24, .45); }
.dlg-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }
.dlgsub { font-size: .85rem; color: var(--muted); margin: .8rem 0 0; font-family: var(--f-body); font-weight: 600; }
.help { max-width: 70ch; display: flex; flex-direction: column; gap: .6rem; }
.help h3 { margin-top: .5rem; }
.help p { margin: 0; line-height: 1.6; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: .65rem 1rem; border-radius: 10px; font-size: .93rem; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100vw - 32px); z-index: 50; }
.toast.show { opacity: 1; }
.toast.act { pointer-events: auto; display: flex; align-items: center; gap: .9rem; }
.toastbtn { border: 1px solid currentColor; background: transparent; color: inherit; border-radius: 6px; padding: .2rem .7rem; font-weight: 700; cursor: pointer; }

/* ---------- smale skjermer ---------- */
@media (max-width: 1280px) {
  .pl-grid { grid-template-columns: 270px minmax(0, 1fr); }
  .pl-grid .pl-sone { grid-column: 2; }
  .pl-center { position: static; }
}
@media (max-width: 1180px) { .work { grid-template-columns: 260px minmax(0, 1fr); } .work .side { grid-column: 1/-1; } }
@media (max-width: 900px) {
  .pl-grid, .knit, .bilde-grid, .work { grid-template-columns: minmax(0, 1fr); }
  .pl-grid .pl-sone { grid-column: auto; }
  .steps button span, .steps button small { display: none; }
  .steps button[aria-current="step"] span { display: inline; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- utskrift ---------- */
#printArea { display: none; }
@media print {
  body { background: #fff; color: #000; }
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block; font-family: var(--f-body); color: #000; }
  #printArea h1 { font-size: 22pt; margin-bottom: 6pt; }
  #printArea h2 { font-size: 15pt; margin: 14pt 0 4pt; }
  #printArea img { max-width: 100%; break-inside: avoid; }
  #printArea .pdel { break-before: page; }
  #printArea .pdel:first-of-type { break-before: auto; }
  #printArea .pf { display: inline-flex; align-items: center; gap: 4px; margin-right: 14px; }
  #printArea .pf span { display: inline-block; width: 12px; height: 12px; border: 1px solid #444; }
  #printArea table { border-collapse: collapse; font-size: 10pt; }
  #printArea td { padding: 2pt 6pt; border-bottom: 1px solid #ccc; vertical-align: top; }
  #printArea .small { font-size: 9pt; color: #555; }
}
