:root{--bg:#fff;--fg:#111;--mut:#666;--line:#ccc;--h2:#e8e8e8;--warn:#a00;--ok:#0a6b2d;--auto:#8a5a00;--side:340px}
*{box-sizing:border-box}
body{margin:0;font-family:Arial,Helvetica,sans-serif;font-size:13px;color:var(--fg);background:var(--bg)}
a{color:#0645ad}
.top{display:flex;justify-content:space-between;align-items:center;padding:6px 12px;border-bottom:2px solid #333;background:#f6f6f6;position:sticky;top:0;z-index:5}
.top nav a{margin-left:14px;text-decoration:none;color:#333;padding:4px 6px;border-radius:3px}
.top nav a.on{background:#333;color:#fff}
.muted{color:var(--mut)} .small{font-size:11px} .hidden{display:none!important}
main{padding:0}
#tab-rum{display:flex;min-height:calc(100vh - 38px)}
.side{width:var(--side);flex:none;border-right:1px solid var(--line);padding:8px;display:flex;flex-direction:column;gap:6px;height:calc(100vh - 38px);position:sticky;top:38px}
.side input[type=search]{width:100%;padding:6px;font-size:14px}
.side .row{display:flex;gap:6px}.side select{flex:1;padding:4px}
.list{list-style:none;margin:0;padding:0;overflow:auto;flex:1;border-top:1px solid var(--line)}
.list li{padding:4px 6px;border-bottom:1px solid #eee;cursor:pointer;display:flex;gap:6px;align-items:baseline}
.list li:hover{background:#f2f6ff}.list li.sel{background:#dde7ff}
.list .nr{font-weight:bold;min-width:44px}.list .nm{flex:1}.list .pl{color:var(--mut);font-size:11px}
.dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:#bbb;flex:none}
.dot.granskad{background:var(--ok)}.dot.auto{background:#e0a100}.dot.konf{outline:2px solid var(--warn)}
.room{flex:1;padding:10px 16px;max-width:1000px}
.empty{color:var(--mut);padding:40px}
h1{font-size:20px;margin:4px 0}
h2{font-size:14px;background:var(--h2);padding:3px 6px;margin:14px 0 4px}
h3{font-size:13px;margin:8px 0 2px}
table{border-collapse:collapse;width:100%}
td,th{border:1px solid #bbb;padding:3px 5px;vertical-align:top;text-align:left}
.kv th{width:24%;background:#f6f6f6}
.src{color:#555;font-size:11px;margin-top:2px}
.src::before{content:"Källa: "}
.warn{color:var(--warn)} .ok{color:var(--ok)} .autoc{color:var(--auto)}
.badge{display:inline-block;border:1px solid #999;border-radius:3px;padding:1px 6px;margin-right:4px;font-size:11px;background:#fafafa}
.badge.warn{border-color:var(--warn);color:var(--warn);background:#fff3f3}
.badge.ok{border-color:var(--ok);color:var(--ok);background:#effaf2}
.badge.auto{border-color:#c98a00;color:var(--auto);background:#fff8e6}
.box{border:1px solid #bbb;padding:6px 8px;margin:6px 0;background:#fcfcfc}
.box.conf{border:2px solid var(--warn);background:#fff6f6}
.box.status{border-left:5px solid #999}
.code{font-weight:bold;white-space:nowrap}
.saknas{color:var(--warn);font-style:italic}
.imgs{display:flex;gap:6px;flex-wrap:wrap}.imgs figure{margin:0;flex:1 1 45%}.imgs img{width:100%;max-height:420px;object-fit:contain;border:1px solid #ccc}
.imgs figcaption{font-size:11px;color:var(--mut)}
.printbar{display:flex;flex-wrap:wrap;gap:8px;align-items:center;border:1px dashed #bbb;padding:4px 8px;margin:6px 0;font-size:12px}
.printbar button{padding:3px 10px}
details>summary{cursor:pointer;color:#333}
.cur td,.cur th{font-size:12px}
.filters{display:flex;gap:8px;padding:8px 12px;align-items:center;flex-wrap:wrap;position:sticky;top:38px;background:#fff;border-bottom:1px solid var(--line)}
.filters input{min-width:320px;padding:5px}
#tab-handlingar,#tab-koder,#tab-om{padding:0 12px 20px}
table.docs td,table.docs th{font-size:12px}
table.docs th{background:#f0f0f0;position:sticky;top:78px}
tr.saknas td{color:#888;background:#fafafa}
.codecard{border:1px solid #ddd;margin:6px 0;padding:6px 8px}
.om{max-width:900px;line-height:1.45}
@media print{
  .noprint,.top,.side{display:none!important}
  .room{max-width:none;padding:0}
  body{font-size:9pt}
  h2{-webkit-print-color-adjust:exact;print-color-adjust:exact;break-after:avoid}
  .mod.off{display:none!important}
  details{display:block}details>*{display:block}
  .box.conf{-webkit-print-color-adjust:exact;print-color-adjust:exact}
  a{color:inherit;text-decoration:none}
  @page{size:A3 portrait;margin:5mm}
}

table.docs td:nth-child(4){white-space:nowrap}

/* Granskat underlag först; strukturerad jämförelse följer samma öppet/stängt-val i webb och utskrift. */
.compare{border:1px dashed #bbb;padding:6px;margin-top:8px;background:#fafafa}
.compare>summary{font-size:12px;color:#666}
.mod.off{display:none!important}
.batch-actions{display:flex;flex-wrap:wrap;gap:5px;margin:6px 0}
.batch-actions button{padding:4px 6px}
.batch-controls{font-size:12px;border:1px solid #bbb;padding:6px}
.module-options{display:grid;grid-template-columns:1fr 1fr;gap:4px;margin:6px 0}
.room-select{margin:0;flex:none;cursor:pointer}
.hk-definition{color:#666;margin-top:4px;max-width:580px}
.print-footer{font-size:10px;color:#555;margin-top:14px;border-top:1px solid #aaa;padding-top:5px}
.room-subtitle{font-size:11px;color:#555;margin-bottom:6px}
.imgs figure.clip-kakel,.imgs figure.clip-typ{flex-basis:100%}
.imgs figure.clip-typvy{flex:0 1 250px}
.imgs .clip-kakel img,.imgs .clip-typ img,.imgs .clip-typvy img{max-height:none;height:auto;object-fit:contain}
#batch-print{display:none}
@media print{
  body.batch-mode>header,body.batch-mode>main{display:none!important}
  body.batch-mode #batch-print{display:block!important}
  .print-room{display:block;max-width:none;width:100%;break-after:page;page-break-after:always}
  .print-room:last-child{break-after:auto;page-break-after:auto}
  .print-room h1{break-after:avoid}
  .print-footer{break-inside:avoid}
  figure{break-inside:avoid}
  .imgs figure.clip-kakel{break-before:page}
  .imgs figure.clip-typ img,.imgs figure.clip-typvy img{max-height:235mm;width:100%;object-fit:contain}
  .imgs figure.clip-kakel img{max-height:220mm;width:100%;object-fit:contain}
  .room table{font-size:9pt}
}

@media print{
  @page{margin:5mm;@bottom-center{content:none}}
}

.installations td{font-size:11px;overflow-wrap:anywhere}.installations th{font-size:11px}
@media print{.installations td{font-size:8pt}.installations th{font-size:8pt}}

.installations{table-layout:fixed}
.installations th:nth-child(1){width:13%}.installations th:nth-child(2){width:12%}
.installations th:nth-child(3){width:22%}.installations th:nth-child(4){width:8%}
.installations th:nth-child(5){width:12%}.installations th:nth-child(6){width:33%}

.imgs figure.clip-a40{flex-basis:100%}.imgs .auto-clip img{max-height:640px}.imgs .auto-clip figcaption{padding:4px 0 10px}
@media print{.imgs .auto-clip{break-inside:avoid}.imgs .auto-clip img{max-height:220mm;object-fit:contain}}

/* Separata disciplinmoduler och tydliga ritningsresultat, även i utskrift. */
.reconciliation .check-difference{background:#fff3e3}.reconciliation .check-ok{background:#edf7ef}.reconciliation td{vertical-align:top}.discipline-clips .imgs{align-items:start}.discipline-clips figure{break-inside:avoid}.discipline-clips img{max-width:100%;height:auto}
@media print{.discipline-clips.off{display:none!important}.discipline-clips .imgs{display:block}.discipline-clips figure{max-width:100%;margin:0 0 8mm}.discipline-clips img{max-height:230mm;object-fit:contain}.reconciliation{font-size:8pt}}

/* Kompakta urklipp: samma läsbara figur/källtext i rum och batch. */
.room .imgs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;align-items:start}
.room .imgs figure{margin:0;min-width:0;max-width:100%;break-inside:avoid;page-break-inside:avoid}
.room .imgs img{display:block;width:100%;height:auto;max-height:380px;object-fit:contain}
.room .imgs figcaption{font-size:11px;line-height:1.35;overflow-wrap:anywhere;padding:4px 0 8px}
@media screen and (max-width:1199px){.room .imgs{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media screen and (max-width:680px){.room .imgs{grid-template-columns:minmax(0,1fr)}}
@media print{
 @page{size:A3 portrait;margin:5mm}
 .room .imgs,.room .discipline-clips .imgs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4mm;align-items:start}
 .room .imgs figure,.room .imgs figure.clip-kakel{break-before:auto;break-inside:avoid;page-break-inside:avoid;margin:0;max-width:100%}
 .room .imgs img,.room .imgs figure.clip-typ img,.room .imgs figure.clip-typvy img,.room .imgs figure.clip-kakel img,.room .discipline-clips img{width:100%;height:auto;max-height:95mm;object-fit:contain}
 .room .imgs figcaption{font-size:8pt;line-height:1.25;break-before:avoid}
}

.room .discipline-modules-grid>section{min-width:0;break-inside:avoid;page-break-inside:avoid}
.room .discipline-modules-grid>section .imgs{grid-template-columns:minmax(0,1fr)}
.room .discipline-modules-grid h2{margin-top:4px;font-size:12px}
@media print{.room .discipline-modules-grid>section .imgs{grid-template-columns:minmax(0,1fr)}}

/* Separate A3 print projection. These dimensions also make pre-print fit measurable. */
body.print-preparing #batch-print{display:block!important;position:absolute;left:-10000px;top:0}
#batch-print .print-room{width:287mm;max-width:none;padding:0;margin:0;display:block}
#batch-print .print-sheet{width:287mm;height:409mm;box-sizing:border-box;margin:0;padding:0;break-inside:avoid;page-break-inside:avoid}
#batch-print .print-sheet-header{height:9mm;border-bottom:.2mm solid #777;display:flex;justify-content:space-between;align-items:center;gap:3mm;font:8pt Arial}
#batch-print .print-sheet-header h1{font: bold 13pt Arial;margin:0;white-space:nowrap}
#batch-print .a3-footer{height:6mm;display:flex;align-items:center;border-top:.15mm solid #aaa;font:7pt Arial;box-sizing:border-box}
#batch-print .print-clip-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:repeat(3,minmax(0,1fr));gap:2mm;height:393mm;padding:1mm 0;box-sizing:border-box}
#batch-print .print-clip-grid figure{min-width:0;min-height:0;margin:0;display:flex;flex-direction:column;break-inside:avoid;border:.15mm solid #ddd;padding:.4mm;box-sizing:border-box}
#batch-print .print-clip-grid figure>a{display:block;flex:1;min-height:0}
#batch-print .print-clip-grid img{display:block;width:100%;height:100%;max-height:none;object-fit:contain;border:0}
#batch-print .print-clip-grid figcaption{height:7mm;box-sizing:border-box;font:8pt/1.05 Arial;padding:.7mm .2mm 0;overflow-wrap:anywhere}
@media print{
 @page{size:A3 portrait;margin:5mm;@bottom-center{content:none}}
 @page roomInfo{size:A3 portrait;margin:5mm;@bottom-center{content:none}}
 @page roomClips{size:A3 portrait;margin:5mm;@bottom-center{content:none}}
 body.batch-mode #batch-print{width:287mm}
 #batch-print .print-info-page{page:roomInfo;break-after:page}
 #batch-print .print-clips-page{page:roomClips;break-after:page}
 #batch-print .print-sheet:last-child{break-after:auto}
 #batch-print .print-room{break-after:page;page-break-after:always}
 #batch-print .print-room:last-child{break-after:auto;page-break-after:auto}
 #batch-print .noprint,#batch-print .mod.off{display:none!important}
}
/* t103: common category palette, yellow references and separately selectable type views. */
.reference-highlight{background:#fff176;color:inherit;padding:0 .06em;-webkit-print-color-adjust:exact;print-color-adjust:exact}
h2[data-category],h3[data-category],th[data-category]{background:var(--category-color);color:#111;border-left:2px solid #555;-webkit-print-color-adjust:exact;print-color-adjust:exact}
.type-modules-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.type-clip-module{min-width:0}.type-clip{margin:5px 0}.type-clip img{display:block;width:100%;height:500px;object-fit:contain;border:1px solid #ccc}.type-clip figcaption,.type-status,.type-missing{font-size:11px;line-height:1.25}.type-status{font-weight:bold}
@media screen and (max-width:680px){.type-modules-grid{grid-template-columns:1fr}}
#batch-print .print-type-pair{height:200mm;padding-top:3mm;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:3mm}
#batch-print .print-type-card{height:196mm;display:flex;flex-direction:column;border:.2mm solid #777;min-width:0;min-height:0;padding:.6mm;break-inside:avoid}
#batch-print .print-type-card h2{font:bold 9pt Arial;margin:0;padding:.5mm;background:var(--category-color);-webkit-print-color-adjust:exact;print-color-adjust:exact}
#batch-print .print-type-card figure{display:flex;flex-direction:column;flex:1;min-height:0;margin:0;border:0}
#batch-print .print-type-card figure>a{display:block;flex:1;min-height:0}
#batch-print .print-type-card img{width:100%;height:100%;max-height:none;object-fit:contain;display:block;border:0}
#batch-print .print-type-card figcaption{font:8pt/1.05 Arial;padding:.6mm 0;height:11mm;flex:none}
/* Disable CSS multicol entirely: count:1 with a fixed height would create hidden overflow columns. */
/* No type drawing is invented: compact gap labels free the unused lower area for facts. */

#batch-print .types-unavailable>.print-type-pair{height:16mm}
#batch-print .types-unavailable .print-type-card{height:12mm}

/* t104: numeric source counters are not drawing references. */
.print-source-ref{background:transparent;color:inherit}

/* t105 native/browser print and the button use the same isolated projection.
   Quarter-A3 rules are scoped only to type cards, never to plan-clip grids. */
@media print{
 body.batch-mode>header,body.batch-mode>main{display:none!important}
 body.batch-mode #batch-print{display:block!important}
 #batch-print .print-clips-page>.print-clip-grid{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;grid-template-rows:repeat(3,minmax(0,1fr))!important;height:393mm!important}
 #batch-print .print-clips-page>.print-clip-grid>figure{height:auto!important;width:auto!important;max-width:none!important;break-before:auto!important;break-inside:avoid!important}
 #batch-print .print-clips-page>.print-clip-grid img{height:100%!important;max-height:none!important;width:100%!important;object-fit:contain!important}
}

/* Compact factual mode keeps one reading column but joins short installation rows. */

/* t106: whole-page readable information; optional drawings are the final appendix. */
#batch-print .print-type-page{width:410mm;height:287mm}
#batch-print .print-type-page>.print-type-pair{height:272mm;padding:1mm 0;box-sizing:border-box;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(var(--type-rows),minmax(0,1fr));gap:3mm}
#batch-print .print-type-page .print-type-card{height:auto;padding:1mm;box-sizing:border-box}
#batch-print .print-type-page .type-count-1{grid-template-columns:1fr}
#batch-print .print-type-page .print-type-card figure img{object-fit:contain!important;max-height:none!important}
@media print{
 @page roomTypes{size:A3 landscape;margin:5mm}
 #batch-print .print-type-page{page:roomTypes;break-after:page}
 #batch-print .print-type-page:last-child{break-after:auto}
}


#batch-print .print-type-page{width:409mm;height:286mm}
#batch-print .print-type-page>.print-type-pair{height:271mm}





/* t109: details are opt-in in screen AND all print projections. */
.source-detail.off,[data-source-summary].off{display:none!important}

/* t110: information is the WEB DOM, uniformly scaled from the desktop content
   width (968px) to 287mm. Natural paged flow, not another information layout. */
.source-detail.detail-off,[data-source-summary].detail-off,.explanation-reference-only.detail-off,.explanation-off,details.compare.off{display:none!important}
.comparison-primary>summary{display:none!important}
#batch-print .print-web-info{width:287mm;height:auto;page:roomInfo;break-after:page;overflow:visible}
#batch-print .print-web-info:last-child{break-after:auto}
#batch-print .web-information{width:968px;zoom:1.1205830676124162;font:13px Arial,Helvetica,sans-serif;line-height:normal;color:#111;overflow:visible;max-width:none;padding:0;margin:0}
#batch-print .web-information table{font-size:13px;table-layout:auto}
#batch-print .web-information .small,#batch-print .web-information .src{font-size:11px}
#batch-print .web-information .cur td,#batch-print .web-information .cur th{font-size:12px}
#batch-print .web-information .installations td,#batch-print .web-information .installations th{font-size:11px}
#batch-print .web-information h2{font-size:14px;padding:3px 6px;margin:14px 0 4px}
#batch-print .web-information h3{font-size:13px;margin:8px 0 2px}
#batch-print .web-information a{color:#0645ad;text-decoration:underline}
#batch-print .web-information .mod,#batch-print .web-information table{break-inside:auto}
#batch-print .web-information tr{break-inside:avoid;page-break-inside:avoid}
#batch-print .web-information h1,#batch-print .web-information h2,#batch-print .web-information h3{break-after:avoid;page-break-after:avoid}
#batch-print .web-information details{display:block}
#batch-print .web-information details:not([open])>:not(summary){display:none!important}
#batch-print .web-information details>summary{display:list-item}
#batch-print .web-information details.comparison-primary>summary{display:none!important}
#batch-print .web-information details.compare.noprint{display:block!important}
#batch-print .web-information details.compare.off{display:none!important}
#batch-print .web-information,#batch-print .web-information *{-webkit-print-color-adjust:exact;print-color-adjust:exact}

.empty-modules{display:none!important}

#batch-print .web-information .installations{table-layout:fixed}

/* t111: shared source views are shown once, without stranded category headings. */
.shared-view-off,.shared-module-off{display:none!important}

/* t119 handlingsavvikelse (plan ↔ rumslista); skild från .box.conf */
.box.handling-dev{border:2px solid #b45309;background:#fff7ed}
.box.handling-dev>b{color:#9a3412}
.badge.handling-strength{border-color:#b45309;color:#9a3412;background:#ffedd5}
@media print{.box.handling-dev,.badge.handling-strength{-webkit-print-color-adjust:exact;print-color-adjust:exact;break-inside:avoid}}
/* STYR typum / typdriftkort (t190): kort text under identitet + blad-1-klipp i disciplinrutnätet. */
.styr-typum .styr-row{margin:2px 0 4px;line-height:1.35}
.styr-typum .styr-src{color:#555;font-size:12px}
.styr-typum .styr-objects{font-size:12.5px}
.styr-typum .styr-flag{margin:3px 0;padding:3px 6px;border-radius:3px;font-size:12.5px}
.styr-typum .styr-flag-uncertain{border:1px solid var(--warn);background:#fff3f3;color:var(--warn);font-weight:600}
.styr-typum .styr-flag-note{border:1px solid #c98a00;background:#fff8e6;color:#6b4815}
.styr-typum .styr-uncertain b{color:var(--warn)}
.styr-clips figure.clip-styr img{background:#fff}
@media print{.styr-typum .styr-flag{-webkit-print-color-adjust:exact;print-color-adjust:exact;break-inside:avoid}}
