/* app.css – brukergrensesnitt i Sweco-stil
 * Farger og typografi fra Sweco visual identity manual (Sweco Digital Platforms 5.x):
 * tekst #3a3a3a, mørk grå #3f3f42, grå #a4a4a6, lys grå #e2e0da, ochre #dec55b / #a4852f,
 * grønn #9dd354 / #708b55, rosa #f2b1dc / #b586a4, blå #8aa3b9 / #7e8dab. Font: Sweco Sans → Arial.
 */
:root {
  --text: #3a3a3a;
  --ink: #1f1f1f;
  --dark: #3f3f42;
  --gray: #a4a4a6;
  --line: #e2e0da;
  --soft: #f4f3ef;
  --soft2: #faf9f6;
  --ochre: #dec55b;
  --ochre-d: #a4852f;
  --green: #9dd354;
  --green-d: #708b55;
  --pink: #f2b1dc;
  --pink-d: #b586a4;
  --blue: #8aa3b9;
  --blue-d: #7e8dab;
  --alert: #821307;
  --link: #916a84;
  --radius: 0;
  --font: "SwecoSans-Regular", Arial, Helvetica, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: #fff; color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.45; }
a { color: var(--link); }
button, input, select, textarea { font: inherit; color: inherit; }
#print-root { display: none; }

/* ---------- Topp ---------- */
.topbar { position: sticky; top: 56px; z-index: 30; background: #fff; border-bottom: 1px solid var(--line); }
.topbar .tb-in { max-width: 1440px; margin: 0 auto; height: 60px; padding: 0 24px; display: flex; align-items: center; gap: 20px; }
.logo { display: inline-flex; align-items: center; }
.logo img { height: 22px; display: block; }
.logo .logotxt { display: none; font-weight: 700; font-size: 24px; letter-spacing: -0.5px; color: var(--ink); }
.logo.txt .logotxt { display: inline; }
.appname { font-size: 15px; color: var(--text); padding-left: 20px; border-left: 1px solid var(--line); }
.crumb { color: var(--gray); font-size: 14px; }
.crumb a { color: var(--text); text-decoration: none; }
.crumb a:hover { text-decoration: underline; }
.spacer { flex: 1; }
.savestate { font-size: 13px; color: var(--gray); }
.savestate.dirty { color: var(--ochre-d); }

.wrap { max-width: 1440px; margin: 0 auto; padding: 28px 24px 80px; }
h1.page { font-size: 30px; font-weight: 400; margin: 0 0 4px; color: var(--ink); letter-spacing: -0.3px; }
.sub { color: #6b6b6e; margin: 0 0 24px; }
h2.sec { font-size: 19px; font-weight: 500; margin: 0 0 14px; color: var(--ink); }
h3.sec { font-size: 15px; font-weight: 700; margin: 0 0 10px; color: var(--ink); }
.muted { color: #77777a; }
.small { font-size: 13px; }

/* ---------- Knapper ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--dark); background: #fff; color: var(--dark); cursor: pointer; font-size: 14px; white-space: nowrap; text-decoration: none; transition: background .12s; }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--dark); color: #fff; }
.btn.primary:hover { background: #000; }
.btn.accent { background: var(--ochre); border-color: var(--ochre); color: var(--ink); }
.btn.accent:hover { background: #d4b944; }
.btn.ghost { border-color: transparent; }
.btn.ghost:hover { background: var(--soft); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.danger { border-color: var(--alert); color: var(--alert); }
.btn.icon { width: 30px; padding: 0; justify-content: center; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Faner ---------- */
.projhead { display: flex; gap: 24px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 18px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 26px; overflow-x: auto; }
.tabs a { padding: 12px 18px 11px; text-decoration: none; color: #6b6b6e; border-bottom: 3px solid transparent; white-space: nowrap; font-size: 15px; }
.tabs a .n { display: inline-block; width: 20px; height: 20px; line-height: 20px; text-align: center; border-radius: 50%; background: var(--line); color: var(--text); font-size: 12px; margin-right: 8px; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--ochre); }
.tabs a.on .n { background: var(--ochre); }
.tabs a:hover { color: var(--ink); }

/* ---------- Kort og skjema ---------- */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 20px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; background: #fff; }
.card.soft { background: var(--soft2); }
.card + .card { margin-top: 0; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form .full { grid-column: 1 / -1; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #5a5a5d; }
label.f > span.hint { font-size: 12px; color: var(--gray); }
.in, select.in, textarea.in { height: 38px; border: 1px solid #cfcdc6; border-radius: var(--radius); padding: 0 10px; background: #fff; font-size: 14px; color: var(--ink); width: 100%; }
textarea.in { height: auto; min-height: 80px; padding: 8px 10px; resize: vertical; line-height: 1.45; }
.in:focus, textarea.in:focus, select.in:focus { outline: 2px solid var(--ochre); outline-offset: -1px; border-color: var(--ochre-d); }
.chk { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }
.chk input { width: 16px; height: 16px; accent-color: var(--dark); }
.seg { display: inline-flex; border: 1px solid #cfcdc6; border-radius: var(--radius); overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 7px 12px; cursor: pointer; font-size: 13px; border-right: 1px solid #cfcdc6; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--dark); color: #fff; }

/* ---------- Prosjektliste ---------- */
.plist { width: 100%; border-collapse: collapse; }
.plist th { text-align: left; font-weight: 500; font-size: 13px; color: #6b6b6e; padding: 10px 12px; border-bottom: 1px solid var(--dark); }
.plist td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.plist tr.row { cursor: pointer; }
.plist tr.row:hover td { background: var(--soft2); }
.plist .nm { font-size: 16px; color: var(--ink); }
.empty { padding: 48px 24px; text-align: center; border: 1px dashed #cfcdc6; border-radius: var(--radius); color: #6b6b6e; }
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.search { max-width: 320px; }

/* ---------- Prøvetabell (regneark) ---------- */
.sheetwrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; max-height: calc(100vh - 290px); }
table.sheet { border-collapse: separate; border-spacing: 0; font-size: 13.5px; min-width: 100%; }
table.sheet th { position: sticky; top: 0; z-index: 2; background: var(--soft); text-align: left; font-weight: 500; font-size: 12px; color: #55555a; padding: 8px 8px; border-bottom: 1px solid #cfcdc6; border-right: 1px solid var(--line); white-space: nowrap; line-height: 1.25; }
table.sheet th small { color: var(--gray); font-weight: 400; }
table.sheet th.calc { background: #ecebe5; }
table.sheet td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 0; height: 34px; white-space: nowrap; }
table.sheet td.num { text-align: right; }
table.sheet td input.c, table.sheet td select.c { width: 100%; height: 33px; border: 0; padding: 0 8px; background: transparent; font-size: 13.5px; }
table.sheet td input.c.r { text-align: right; }
table.sheet td select.c { min-width: 62px; padding: 0 4px; }
table.sheet td input.c:focus, table.sheet td select.c:focus { outline: 2px solid var(--ochre); outline-offset: -2px; background: #fffdf3; }
table.sheet td.cv { background: var(--soft2); padding: 0 8px; text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
table.sheet td.cv.b { font-weight: 700; }
table.sheet td.idx { color: var(--gray); text-align: center; padding: 0 6px; font-size: 12px; background: var(--soft2); }
table.sheet tr.exc td { background: #f1f0ec; color: var(--gray); }
table.sheet tr.exc td input.c { color: var(--gray); text-decoration: line-through; }
table.sheet td.w { text-align: center; padding: 0 4px; }
.wi { display: inline-block; width: 18px; height: 18px; border-radius: 50%; background: var(--ochre); color: var(--ink); font-size: 12px; line-height: 18px; text-align: center; font-weight: 700; cursor: help; }
.wi.e { background: var(--alert); color: #fff; }
.dev.hi { color: var(--ochre-d); font-weight: 700; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .sep { width: 1px; height: 26px; background: var(--line); margin: 0 4px; }
.tip { background: var(--soft2); border-left: 3px solid var(--ochre); padding: 10px 14px; font-size: 13px; margin-bottom: 14px; color: #55555a; }
.statusline { display: flex; gap: 24px; font-size: 13px; color: #6b6b6e; margin-top: 10px; flex-wrap: wrap; }
.statusline b { color: var(--ink); }

/* ---------- Konstruksjonsdeler ---------- */
.matrixwrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; max-height: 70vh; margin-bottom: 26px; }
table.matrix { border-collapse: separate; border-spacing: 0; font-size: 13.5px; min-width: 100%; }
table.matrix th, table.matrix td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 7px 10px; }
table.matrix thead th { position: sticky; top: 0; background: #fff; z-index: 2; vertical-align: bottom; text-align: left; font-weight: 500; font-size: 12px; color: #55555a; }
table.matrix thead th.ccol { min-width: 170px; text-align: center; vertical-align: top; border-top: 4px solid var(--cc, var(--ochre)); background: var(--soft2); }
table.matrix .cname { font-size: 13.5px; color: var(--ink); font-weight: 700; white-space: normal; line-height: 1.25; margin-bottom: 6px; }
table.matrix .cstat { font-size: 12px; color: #55555a; line-height: 1.5; }
table.matrix .cstat b { font-size: 16px; color: var(--ink); }
table.matrix .cls { display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: 10px; background: var(--dark); color: #fff; font-size: 12px; font-weight: 700; }
table.matrix td.ck { text-align: center; padding: 0; }
table.matrix td.ck label { display: block; padding: 7px 0; cursor: pointer; }
table.matrix td.ck input { width: 17px; height: 17px; accent-color: var(--dark); cursor: pointer; }
table.matrix td.ck.on { background: color-mix(in srgb, var(--cc, var(--ochre)) 22%, #fff); }
table.matrix td.ck.out { background: #f8e3e0; }
table.matrix tbody tr:hover td { background-color: var(--soft2); }
table.matrix tbody tr:hover td.ck.on { background: color-mix(in srgb, var(--cc, var(--ochre)) 32%, #fff); }
table.matrix tfoot td { background: var(--soft); text-align: center; position: sticky; bottom: 0; }
.ccards { display: grid; grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); gap: 20px; }
.ccard { border: 1px solid var(--line); border-top: 4px solid var(--cc, var(--ochre)); border-radius: var(--radius); padding: 18px 20px; }
.ccard .head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.ccard .head input { font-size: 17px; font-weight: 500; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 14px 0 10px; }
.kpis > div { background: #fff; padding: 10px 12px; }
.kpis .k { font-size: 11.5px; color: #6b6b6e; }
.kpis .v { font-size: 18px; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpis .v.big { font-weight: 700; }
ul.warn { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: #6b5310; }
ul.warn li { margin: 2px 0; }

/* ---------- Beregninger ---------- */
.calccard { border: 1px solid var(--line); border-top: 4px solid var(--cc, var(--ochre)); border-radius: var(--radius); padding: 22px 26px; margin-bottom: 26px; }
.calccard > h2 { margin: 0 0 4px; font-size: 21px; font-weight: 500; color: var(--ink); }

/* ---------- Rapport ---------- */
.repgrid { display: grid; grid-template-columns: 400px 1fr; gap: 24px; align-items: start; }
.repedit { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; padding-right: 6px; }
.repedit .card { margin-bottom: 14px; }
.repedit textarea.in { min-height: 96px; font-size: 13.5px; }
.paperbg { background: #ecebe5; padding: 24px; border-radius: var(--radius); overflow: auto; }
.paper { background: #fff; width: 210mm; max-width: 100%; margin: 0 auto; padding: 18mm 18mm 22mm; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.imglist { display: grid; gap: 10px; }
.imgrow { display: grid; grid-template-columns: 64px 1fr 30px; gap: 8px; align-items: center; }
.imgrow img { width: 64px; height: 48px; object-fit: cover; border: 1px solid var(--line); }

/* ---------- Historikk ---------- */
.revs { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow: auto; }
.revs li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.revs li .t { flex: 1; }

/* ---------- Toast / modal ---------- */
#toast { position: fixed; right: 24px; bottom: 24px; background: var(--dark); color: #fff; padding: 12px 18px; border-radius: var(--radius); font-size: 14px; opacity: 0; transform: translateY(10px); transition: all .2s; pointer-events: none; z-index: 100; max-width: 420px; }
#toast.on { opacity: 1; transform: none; }
.modalbg { position: fixed; inset: 0; background: rgba(31,31,31,.45); display: flex; align-items: center; justify-content: center; z-index: 90; }
.modal { background: #fff; border-radius: var(--radius); padding: 24px 26px; width: min(560px, 92vw); max-height: 86vh; overflow: auto; }
.modal h2 { margin: 0 0 12px; font-weight: 500; font-size: 20px; }

@media (max-width: 1100px) {
  .repgrid { grid-template-columns: 1fr; }
  .repedit { position: static; max-height: none; }
  .form { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .wrap { padding: 20px 16px 60px; }
  .topbar .tb-in { padding: 0 16px; }
  .appname { display: none; }
  .ccards { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
}

/* ---------- Utskrift ---------- */
@media print {
  #app, #toast { display: none !important; }
  #print-root { display: block; }
  html, body { background: #fff; }
}

/* ======================= v1.1: navigasjon, stegviser, dashbord ======================= */
.logolink { display: inline-flex; align-items: center; text-decoration: none; padding: 6px 0; }
.logolink:hover { opacity: .75; }
.topnav { display: flex; gap: 4px; margin-left: 4px; }
.topnav a { text-decoration: none; color: #6b6b6e; font-size: 14px; padding: 6px 12px; border-radius: var(--radius); }
.topnav a:hover { background: var(--soft); color: var(--ink); }
.topnav a.on { color: var(--ink); background: var(--soft); }
.topbar .crumb { margin-left: 8px; padding-left: 16px; border-left: 1px solid var(--line); }

.stepper { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 6px 0 12px; }
.stepper .step { display: flex; gap: 12px; align-items: center; padding: 12px 16px; text-decoration: none; color: var(--text); border-right: 1px solid var(--line); background: #fff; position: relative; min-width: 0; }
.stepper .step:last-child { border-right: 0; }
.stepper .step:hover { background: var(--soft2); }
.stepper .step .n { flex: 0 0 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; background: var(--line); color: var(--text); }
.stepper .step .tx { display: flex; flex-direction: column; min-width: 0; }
.stepper .step .tx b { font-weight: 500; font-size: 15px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper .step .tx small { font-size: 12px; color: #77777a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper .step.done .n { background: var(--green-d); color: #fff; }
.stepper .step.todo small { color: var(--ochre-d); }
.stepper .step.warn .n { background: var(--ochre); }
.stepper .step.warn small { color: var(--ochre-d); }
.stepper .step.on { background: var(--soft); }
.stepper .step.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--ochre); }
.stepper .step.on .n { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ochre); }
.stephelp { margin: 0 0 22px; color: #55555a; font-size: 14px; }
.tabnav { display: flex; justify-content: space-between; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }

.dash-head { max-width: 760px; margin: 8px 0 26px; }
.dash-head .sub { font-size: 16px; }
.dash-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 40px; }
.dcard { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: left; padding: 22px 22px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; cursor: pointer; text-decoration: none; color: var(--text); font: inherit; transition: border-color .15s, transform .15s; }
.dcard:hover { border-color: var(--dark); transform: translateY(-1px); }
.dcard .ic { width: 38px; height: 38px; border-radius: 50%; background: var(--soft); display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--ink); margin-bottom: 8px; }
.dcard b { font-size: 17px; font-weight: 500; color: var(--ink); }
.dcard span:last-of-type { font-size: 13.5px; color: #6b6b6e; }
.dcard.primary { background: var(--dark); border-color: var(--dark); }
.dcard.primary b, .dcard.primary span { color: #fff; }
.dcard.primary .ic { background: var(--ochre); }
.dash-lh { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 10px; }

/* Skjemakort */
.chead { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.chead .cn { flex: 0 0 30px; height: 30px; border-radius: 50%; background: var(--soft); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: var(--ink); }
.card.soft .chead .cn { background: #fff; }
.chead h2.sec { margin: 3px 0 2px; }
.csub { margin: 0; font-size: 13px; color: #77777a; }
i.req { font-style: normal; color: var(--ochre-d); font-weight: 700; }
label.f.need .in { border-color: var(--ochre); background: #fffdf3; }
label.f > span:first-child { display: block; }

/* Prøvetabell med grupper */
table.sheet tr.grp th { height: 30px; padding: 6px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; font-weight: 700; color: #55555a; border-bottom: 0; }
table.sheet tr.cols th { top: 30px; }
table.sheet th.gh { border-top: 3px solid var(--line); }
table.sheet th.g-i.gh { border-top-color: var(--blue); }
table.sheet th.g-m.gh { border-top-color: var(--green); }
table.sheet th.g-p.gh { border-top-color: var(--ochre); }
table.sheet th.g-c.gh { border-top-color: var(--gray); background: #ecebe5; }
table.sheet th.g-v.gh { border-top-color: var(--pink); }
table.sheet td.need { background: #fff7d6; }
table.sheet td.need input::placeholder { color: var(--ochre-d); font-style: italic; font-size: 12px; }
.wi.ok { background: #e6efd9; color: var(--green-d); }
.wi.m { background: #fff0b8; color: var(--ochre-d); letter-spacing: -1px; }
.howto { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; background: var(--soft2); }
.howto summary { cursor: pointer; padding: 12px 16px; font-weight: 500; color: var(--ink); list-style: none; }
.howto summary::before { content: "▸"; display: inline-block; width: 18px; color: var(--ochre-d); transition: transform .15s; }
.howto[open] summary::before { transform: rotate(90deg); }
.howsteps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; padding: 4px 16px 6px; }
.howsteps > div { position: relative; padding-left: 36px; }
.howsteps .hn { position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--ochre); color: var(--ink); font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.howsteps b { color: var(--ink); font-weight: 500; }
.howsteps p { margin: 4px 0 0; font-size: 13px; color: #55555a; }
.legendrow { display: flex; flex-wrap: wrap; gap: 6px 20px; padding: 10px 16px 14px; font-size: 12.5px; color: #55555a; border-top: 1px solid var(--line); margin-top: 10px; align-items: center; }
.legendrow .sw { display: inline-block; width: 14px; height: 14px; border: 1px solid #cfcdc6; vertical-align: -2px; margin-right: 6px; }
.legendrow .sw.need { background: #fff7d6; }
.legendrow .sw.calc { background: var(--soft2); }
.startcards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.scard { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 26px; border: 1px dashed #bdbab2; border-radius: var(--radius); background: #fff; cursor: pointer; font: inherit; color: var(--text); }
.scard:hover { border-style: solid; border-color: var(--dark); }
.scard b { font-size: 17px; font-weight: 500; color: var(--ink); }
.scard span { font-size: 13.5px; color: #6b6b6e; }
.alert { background: #fff7d6; border-left: 3px solid var(--ochre); padding: 10px 14px; font-size: 13.5px; margin-bottom: 14px; }
.modal .seg button { padding: 8px 18px; font-size: 14px; }
.modal .form { margin-top: 8px; }

@media (max-width: 1100px) {
  .stepper { grid-template-columns: repeat(5, minmax(120px, 1fr)); overflow-x: auto; }
  .dash-cards { grid-template-columns: 1fr 1fr; }
  .howsteps { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .topnav { display: none; }
  .dash-cards, .startcards, .howsteps { grid-template-columns: 1fr; }
}

/* ======================= «Slik beregnes det» ======================= */
.ghead { max-width: 820px; margin: 8px 0 24px; }
.ghead .sub { font-size: 16px; }
.gflow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 6px; margin-bottom: 18px; }
.gflow .garr { align-self: center; color: var(--gray); font-size: 16px; }
.gnode { flex: 1 1 120px; max-width: 170px; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; padding: 12px 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; cursor: pointer; font: inherit; color: var(--text); transition: border-color .12s, background .12s; }
.gnode:hover { border-color: var(--dark); }
.gnode b { font-size: 14px; font-weight: 500; color: var(--ink); line-height: 1.25; }
.gnode small { font-size: 12px; color: #77777a; line-height: 1.3; }
.gnode.on { background: var(--dark); border-color: var(--dark); }
.gnode.on b, .gnode.on small { color: #fff; }
.gn { width: 24px; height: 24px; border-radius: 50%; background: var(--ochre); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex: 0 0 auto; }
.gn.big { width: 40px; height: 40px; font-size: 17px; }
.gpanel { border: 1px solid var(--line); border-top: 4px solid var(--ochre); border-radius: var(--radius); padding: 24px 28px; margin-bottom: 40px; scroll-margin-top: 80px; }
.gph { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.gph h2 { margin: 0; font-size: 22px; font-weight: 500; color: var(--ink); }
.gref { font-size: 12px; color: #8a8a8d; }
.gpanel p, .gpanel li { max-width: 760px; }
.gpanel ul, .gpanel ol { padding-left: 20px; }
.gpanel li { margin-bottom: 6px; }
.gcols { display: grid; grid-template-columns: 1.5fr 1fr; gap: 28px; align-items: start; }
.gcols.three { grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 14px; }
.gnote { background: var(--soft2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; font-size: 14px; }
.gnote.center { text-align: center; }
.gnote p { margin: 6px 0 0; }
.geq { font-family: "Cambria Math", "Times New Roman", serif; font-size: 17px; background: var(--soft2); border-left: 3px solid var(--ochre); padding: 8px 14px; margin: 10px 0; color: var(--ink); }
.gpnav { display: flex; justify-content: space-between; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.gtab { border-collapse: collapse; font-size: 13px; margin: 8px 0; }
.gtab th, .gtab td { border: 1px solid var(--line); padding: 4px 8px; text-align: center; }
.gtab th { background: #fff; font-weight: 500; }
.gtab.wide { width: 100%; }
.gtab.wide td:first-child { text-align: left; }
.gtab tr.on td { background: var(--ochre); font-weight: 700; }
.gsl { display: block; font-size: 15px; margin-bottom: 8px; }
.gsl input { width: 100%; accent-color: var(--dark); margin-top: 6px; }
.gkpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 10px; }
.gkpis > div { background: #fff; padding: 8px 12px; display: flex; flex-direction: column; }
.gkpis > div.wide { grid-column: 1 / -1; background: var(--soft2); font-size: 13px; }
.gkpis span { font-size: 12px; color: #77777a; }
.gkpis b { font-size: 20px; color: var(--ink); font-weight: 500; }
.gform { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 8px 0; }
.gform label, .gin label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: #5a5a5d; }
.gform select, .gform input, .gin select, .gin input, .gin textarea { border: 1px solid #cfcdc6; border-radius: var(--radius); padding: 7px 9px; font: inherit; font-size: 14px; background: #fff; }
.gbig { font-size: 15px; padding: 10px 0 4px; }
.gbig b { font-size: 28px; color: var(--ink); }
.gbig small { display: block; font-size: 12px; color: #77777a; margin-top: 2px; }
.glegend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: #55555a; margin-top: 4px; }
.glegend .ln { display: inline-block; width: 22px; vertical-align: middle; margin-right: 6px; border-top: 2.5px solid var(--dark); }
.glegend .ln.astm { border-top: 2px dashed var(--blue-d); }

svg.gchart { width: 100%; height: auto; display: block; }
svg.gill { width: 180px; height: auto; }
svg .ggl { stroke: #eceae4; }
svg .gtk { font: 11px var(--font); fill: #77777a; text-anchor: middle; }
svg .gns { fill: none; stroke: #3f3f42; stroke-width: 2.5; }
svg .gnsp { fill: #3f3f42; }
svg .gastm { fill: none; stroke: #7e8dab; stroke-width: 2; stroke-dasharray: 6 4; }
svg .gastmp { fill: #fff; stroke: #7e8dab; stroke-width: 2; }
svg .gcur { stroke: #a4852f; stroke-width: 1.5; stroke-dasharray: 3 3; }
svg .gcurp { fill: #dec55b; stroke: #3f3f42; stroke-width: 1.5; }
svg .plate { fill: #a4a4a6; }
svg .cyl { fill: #e2e0da; stroke: #3f3f42; stroke-width: 1.5; }
svg .cyltop { fill: #f4f3ef; stroke: #3f3f42; stroke-width: 1.5; }
svg .arrow { stroke: #a4852f; stroke-width: 3; }
svg .arrowh { fill: none; stroke: #a4852f; stroke-width: 3; }
svg .dim { stroke: #77777a; stroke-width: 1; }
svg .gt { font: 13px var(--font); fill: #3a3a3a; }
svg .gbell { fill: none; stroke: #3f3f42; stroke-width: 2; }
svg .gtail { fill: #f2b1dc; opacity: .8; }
svg .gax { stroke: #3a3a3a; }
svg .gmean { stroke: #3a3a3a; stroke-width: 1.4; }
svg .gfck { stroke: #a4852f; stroke-width: 2.5; stroke-dasharray: 6 3; }
svg .glab { font: 12px var(--font); fill: #3a3a3a; text-anchor: middle; }
svg .glab.small { font-size: 11px; fill: #b586a4; font-weight: 700; }
svg .glab.fck { fill: #a4852f; font-weight: 700; }

/* Beslutningstre */
svg.gtree { width: 100%; max-width: 920px; height: auto; display: block; margin: 8px auto; }
svg.gtree .tn rect { fill: #fff; stroke: #cfcdc6; stroke-width: 1.2; }
svg.gtree .tn.q rect { fill: var(--soft2); }
svg.gtree .tn .t1 { font: 600 13px var(--font); fill: #77777a; text-anchor: middle; }
svg.gtree .tn .t2 { font: 11.5px var(--font); fill: #9a9a9d; text-anchor: middle; }
svg.gtree .tn.on rect { stroke: #3f3f42; stroke-width: 2; }
svg.gtree .tn.on .t1 { fill: #1f1f1f; }
svg.gtree .tn.on .t2 { fill: #55555a; }
svg.gtree .tn.on.res rect { fill: #dec55b; stroke: #3f3f42; }
svg.gtree .te polyline { fill: none; stroke: #d8d6cf; stroke-width: 1.5; }
svg.gtree .te text { font: 11px var(--font); fill: #9a9a9d; }
svg.gtree .te.on polyline { stroke: #a4852f; stroke-width: 3; }
svg.gtree .te.on text { fill: #a4852f; font-weight: 700; }

/* Regneeksempel */
.gtry { border: 1px solid var(--dark); border-radius: var(--radius); padding: 26px 28px; scroll-margin-top: 80px; }
.gtryh h2 { margin: 2px 0 4px; font-size: 24px; font-weight: 500; color: var(--ink); }
.kicker { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--ochre-d); font-weight: 700; }
.gtrygrid { display: grid; grid-template-columns: 340px 1fr; gap: 28px; margin-top: 20px; align-items: start; }
.gin { display: flex; flex-direction: column; gap: 12px; }
.gin textarea { font-family: ui-monospace, Consolas, monospace; font-size: 15px; line-height: 1.5; resize: vertical; }
.gin .g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: #77777a; }
.gres { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.gres > div { background: #fff; padding: 12px 14px; display: flex; flex-direction: column; }
.gres > div.hl { background: #faf3d6; }
.gres span { font-size: 12px; color: #77777a; }
.gres b { font-size: 26px; color: var(--ink); font-weight: 700; line-height: 1.15; }
.gres small { font-size: 12px; color: #77777a; }
.gres small.okc { color: var(--green-d); } .gres small.nokc { color: var(--alert); }
.gres .gmeth { grid-column: 1 / -1; background: #fff; margin: 0; padding: 10px 14px; font-size: 13.5px; }
.gfull { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 12px; }
.gfull summary { cursor: pointer; font-weight: 500; color: var(--ink); padding: 6px 0; }
.gfull .report { margin-top: 10px; }
@media (max-width: 1100px) { .gcols, .gcols.three, .gtrygrid { grid-template-columns: 1fr; } .gres { grid-template-columns: repeat(3, 1fr); } }

.gres .gmeth b { font-size: inherit; font-weight: 700; line-height: inherit; }
.howto summary::-webkit-details-marker { display: none; }
.gfull summary::-webkit-details-marker { color: var(--ochre-d); }
.lvls { display: grid; gap: 8px; }
.lvl { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 10px 12px 11px; border: 1px solid #cfcdc6; border-radius: var(--radius); background: #fff; cursor: pointer; font: inherit; color: var(--text); }
.lvl b { font-size: 14.5px; font-weight: 500; color: var(--ink); }
.lvl span { font-size: 12.5px; color: #6b6b6e; }
.lvl:hover { border-color: var(--dark); }
.lvl.on { border-color: var(--dark); box-shadow: inset 3px 0 0 var(--dark); background: var(--soft2); }

/* ======================= v1.5: dashbord med prosjektkort ======================= */
.dash { padding-bottom: 40px; }
.dhero { background: var(--soft); border-bottom: 1px solid var(--line); position: relative; overflow: hidden; }
.dhero::after { content: ""; position: absolute; right: -120px; top: -160px; width: 520px; height: 520px; border-radius: 50%; background: radial-gradient(circle, rgba(222,197,91,.28), rgba(222,197,91,0) 65%); pointer-events: none; }
.dhero .dh-in { max-width: 1440px; margin: 0 auto; padding: 52px 24px 48px; display: flex; justify-content: space-between; align-items: flex-end; gap: 40px; position: relative; z-index: 1; }
.dhero h1 { font-size: 40px; font-weight: 400; letter-spacing: -0.6px; margin: 6px 0 12px; color: var(--ink); line-height: 1.1; }
.dhero p { max-width: 640px; font-size: 16.5px; color: #55555a; margin: 0 0 24px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; }
.dh-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; min-width: 380px; }
.dh-stats > div { background: #fff; padding: 18px 22px; display: flex; flex-direction: column; }
.dh-stats b { font-size: 34px; font-weight: 400; color: var(--ink); line-height: 1; }
.dh-stats span { font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: #77777a; margin-top: 8px; }
.kicker { display: inline-block; font-size: 11.5px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--ochre-d); font-weight: 700; }
.projhead .kicker { margin-bottom: 4px; }

.dsec { margin-top: 40px; }
.dsec h2 { font-size: 22px; font-weight: 400; color: var(--ink); margin: 0 0 16px; }
.dsec-h { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.dsec-h h2 { margin: 0; }
.dtools { display: flex; gap: 8px; }
.dtools .search { width: 300px; }

.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 20px; align-items: start; }
.pcard { background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--pc, var(--ochre)); border-radius: 6px; display: flex; flex-direction: column; transition: box-shadow .15s, border-color .15s; }
.pcard:hover { box-shadow: 0 6px 22px rgba(31,31,31,.08); }
.pch { display: flex; justify-content: space-between; gap: 12px; padding: 18px 20px 14px; }
.pct { min-width: 0; }
.pnum { display: inline-block; font-size: 11.5px; letter-spacing: .5px; color: #6b6b6e; background: var(--soft); border-radius: 3px; padding: 2px 7px; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.pch h3 { margin: 0 0 3px; font-size: 19px; font-weight: 500; color: var(--ink); line-height: 1.25; }
.pcl { font-size: 13px; color: #77777a; }
.pca { display: flex; gap: 2px; opacity: .45; transition: opacity .15s; align-self: flex-start; }
.pcard:hover .pca { opacity: 1; }
.ib { width: 30px; height: 30px; border: 0; background: transparent; border-radius: 4px; cursor: pointer; color: #55555a; font-size: 15px; line-height: 1; }
.ib:hover { background: var(--soft); color: var(--ink); }
.ptests { padding: 0 12px 6px; }
.ptl { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: #8a8a8d; padding: 0 8px 6px; border-bottom: 1px solid var(--line); }
.trow { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.trow:last-child { border-bottom: 0; }
.tlink { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 11px 8px; text-decoration: none; color: var(--text); border-radius: 4px; }
.trow:hover .tlink { background: var(--soft2); }
.tdot { flex: 0 0 10px; height: 10px; border-radius: 50%; background: var(--gray); }
.tdot.s-work { background: var(--ochre); }
.tdot.s-done { background: var(--green-d); }
.tname { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tname b { font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tname small { font-size: 12px; color: #77777a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tres { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.chip { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 10px; background: var(--dark); color: #fff; line-height: 1.2; }
.chip.more { background: var(--line); color: var(--text); }
.tarr { color: var(--gray); font-size: 18px; }
.tact { display: flex; opacity: 0; transition: opacity .12s; }
.trow:hover .tact { opacity: 1; }
.tact .ib { width: 26px; height: 26px; font-size: 13px; }
.pcf { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px 16px; margin-top: auto; border-top: 1px solid var(--line); }
.pnew { border: 1px dashed #bdbab2; border-top: 1px dashed #bdbab2; align-items: center; justify-content: center; text-align: center; gap: 6px; padding: 40px 24px; cursor: pointer; font: inherit; color: var(--text); min-height: 220px; background: transparent; }
.pnew:hover { border-color: var(--dark); background: #fff; }
.pnew .ic { width: 44px; height: 44px; border-radius: 50%; background: var(--ochre); display: flex; align-items: center; justify-content: center; font-size: 24px; color: var(--ink); margin-bottom: 6px; }
.pnew b { font-size: 17px; font-weight: 500; color: var(--ink); }
.pnew span:last-child { font-size: 13px; color: #77777a; max-width: 280px; }

.shortcuts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.sc { display: flex; gap: 14px; align-items: center; text-align: left; padding: 18px 20px; border: 1px solid var(--line); border-radius: 6px; background: #fff; text-decoration: none; color: var(--text); cursor: pointer; font: inherit; }
.sc:hover { border-color: var(--dark); }
.sc .ic { flex: 0 0 40px; height: 40px; border-radius: 50%; background: var(--soft); display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--ink); }
.sc b { display: block; font-weight: 500; color: var(--ink); font-size: 15px; }
.sc small { font-size: 13px; color: #77777a; }

.sitefoot { border-top: 1px solid var(--line); background: var(--soft2); margin-top: 40px; }
.sitefoot .sf-in { max-width: 1440px; margin: 0 auto; padding: 18px 24px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13px; color: #6b6b6e; }
.sitefoot b { color: var(--ink); font-weight: 500; }
.sitefoot a { color: var(--link); }

@media (max-width: 1100px) { .dhero .dh-in { flex-direction: column; align-items: flex-start; } .dh-stats { min-width: 0; width: 100%; } .shortcuts { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .pgrid { grid-template-columns: 1fr; } .dhero h1 { font-size: 30px; } .dtools .search { width: 100%; } .tact { opacity: 1; } }
.dash > .wrap { padding-top: 4px; }
.user { display: inline-flex; align-items: center; gap: 10px; padding-left: 16px; margin-left: 4px; border-left: 1px solid var(--line); }
.user .av { width: 32px; height: 32px; border-radius: 50%; background: var(--dark); color: #fff; font-size: 12.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; letter-spacing: .5px; }
.user .un { font-size: 14px; color: var(--ink); white-space: nowrap; }
.pch { cursor: pointer; border-radius: 6px 6px 0 0; transition: background .12s; }
.pch:hover { background: var(--soft2); }
.pch:hover h3 { text-decoration: underline; text-decoration-color: var(--gray); text-underline-offset: 3px; }
@media (max-width: 640px) { .user .un { display: none; } }

/* Utarbeidet av – øverst til høyre */
.user { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; padding-left: 16px; margin-left: 4px; border-left: 1px solid var(--line); text-decoration: none; line-height: 1.25; }
.user .ul { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: #8a8a8d; }
.user .un { font-size: 13.5px; color: var(--ink); white-space: nowrap; }
.user .um { color: var(--link); }
.user:hover .um { text-decoration: underline; }
@media (max-width: 900px) { .user .um { display: none; } }

/* Rapportmal (status) */
.tplst { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; background: #e7f2d8; color: #4f6b2c; margin-right: 4px; }
.tplst.bad { background: #f6ecc4; color: #6b5414; }

/* Rapportarkiv (v1.7) */
.preps:not(:empty) { border-top: 1px solid var(--line); padding: 10px 16px 12px; }
.preps .rprow { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }
.preps .rprow a { color: inherit; text-decoration: none; } .preps .rprow a:hover { text-decoration: underline; }
.rplist > div { display: flex; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.rplist small { margin-left: auto; }

/* Klassifiserte prosjekter: bare eier og administratorer har tilgang */
.lockic { width: 12px; height: 12px; vertical-align: -1px; }
.lockchip { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; background: var(--dark); color: #fff; padding: 2px 8px; width: max-content; }
.lockchip .lockic { width: 10px; height: 10px; }
.pct .lockchip { display: flex; }
.pcard.locked { border-top-color: var(--dark); background: var(--soft2); }
.pcard.locked .pch { cursor: default; } .pcard.locked .pch:hover { background: none; } .pcard.locked .pch:hover h3 { text-decoration: none; }
.plocked { display: flex; gap: 12px; align-items: flex-start; padding: 4px 20px 20px; font-size: 13px; color: #6b6b6e; }
.plocked .lockic { width: 26px; height: 26px; flex: none; color: var(--gray); }
.access { border: 1px solid var(--line); border-left: 4px solid var(--dark); background: var(--soft2); padding: 12px 14px; margin-top: 16px; }
.access .chk { display: flex; gap: 8px; align-items: center; }
