:root { --rood: #d00; --blauw: #06f; }
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, Arial, sans-serif; display: flex; height: 100vh; color: #222; background: #f4f4f2; }

#side { width: 290px; padding: 14px; border-right: 1px solid #ddd; overflow: auto; background: #fff; flex: none; }
.brand { font-weight: 700; font-size: 17px; margin-bottom: 4px; }
h3 { margin: 16px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #666; }
.small { font-size: 12px; color: #666; line-height: 1.45; }
.keys { margin-top: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 7px 8px; border: 1px solid #ccc; border-radius: 6px;
       background: #fafafa; cursor: pointer; font-size: 13px; text-align: center; color: #222; }
.btn:hover { background: #f0f0f0; }
.btn.primary { background: #222; color: #fff; border-color: #222; }
.btn.danger { color: #c00; border-color: #e3b3b3; }
.btn.big { padding: 10px 18px; font-size: 15px; margin: 12px 0 6px; }

.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tools button { padding: 8px 6px; border: 1px solid #ccc; border-radius: 6px; background: #fafafa; cursor: pointer; font-size: 13px; text-align: left; }
.tools button.on { border-color: var(--rood); background: #fff0f0; color: var(--rood); font-weight: 600; }
.tools kbd { float: right; color: #999; font-size: 11px; font-family: inherit; }
.row { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.row button { flex: 1; padding: 7px; border: 1px solid #ccc; border-radius: 6px; background: #fafafa; cursor: pointer; }
.row button.on { background: #222; color: #fff; }
#floorSettings label { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 13px; margin: 4px 0; }
#floorSettings input[type=text], #floorSettings select { width: 140px; padding: 4px 6px; border: 1px solid #ccc; border-radius: 5px; }
#floorSettings input[type=range] { width: 140px; }

#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#tabs { display: flex; gap: 4px; padding: 8px 10px; border-bottom: 1px solid #ddd; background: #fff; flex-wrap: wrap; align-items: center; min-height: 48px; }
#tabs .tab { border: 1px solid #ccc; background: #fafafa; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 14px; }
#tabs .tab.on { background: #222; color: #fff; border-color: #222; }
#zoombar { margin-left: auto; display: flex; gap: 4px; }
#zoombar button { min-width: 36px; padding: 6px 10px; border: 1px solid #ccc; background: #fafafa; border-radius: 6px; cursor: pointer; }
#wrap { flex: 1; overflow: hidden; position: relative; min-height: 0; }
#wrap.drop { outline: 3px dashed var(--blauw); outline-offset: -8px; }
#empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #555; font-size: 16px; }
svg.plan { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background: #fff; cursor: crosshair; user-select: none; }
svg.plan .planlayer * { vector-effect: non-scaling-stroke; }
.sym { cursor: move; }
.sym.selected .ink { stroke: var(--blauw); }
.sym.selected text { fill: var(--blauw); }

#lijst { font-size: 12px; max-height: 240px; overflow: auto; border: 1px solid #eee; border-radius: 6px; padding: 4px; }
#lijst div { padding: 2px 4px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
#lijst div:hover { background: #f3f3f3; }
.rowdel { border: 0; background: none; color: #c00; cursor: pointer; font-size: 13px; padding: 0 4px; }
#todo { font-size: 12px; line-height: 1.6; }
#todo span { display: inline-block; padding: 0 5px; margin: 1px; border-radius: 4px; background: #fff3e0; border: 1px solid #f0d2a8; }

#pop { position: fixed; display: none; flex-direction: column; gap: 5px; background: #fff; border: 1px solid #bbb; border-radius: 8px;
       padding: 6px; box-shadow: 0 4px 16px rgba(0,0,0,.2); z-index: 10; width: 280px; }
.poprow { display: flex; gap: 4px; align-items: center; }
#popcode { flex: 1; width: 60px; font-size: 17px; padding: 5px 7px; border: 2px solid var(--blauw); border-radius: 6px; text-transform: uppercase; }
#pop button { padding: 5px 8px; border: 1px solid #ccc; border-radius: 5px; background: #fafafa; cursor: pointer; }
#popdel { color: #c00; }
#popn { font-size: 13px; color: #555; }
#popn button { min-width: 30px; }
#popn button.on { background: #222; color: #fff; border-color: #222; }
#sugg { max-height: 240px; overflow: auto; border-top: 1px solid #eee; }
#sugg div { padding: 4px 6px; font-size: 13px; cursor: pointer; border-radius: 4px; display: flex; justify-content: space-between; gap: 6px; }
#sugg div.hi { background: #e8f0ff; }
#sugg .d { color: #666; font-size: 12px; }
#sugg .ok { color: #2a8a2a; }
#sugg .half { color: #c77700; }

#toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: #222; color: #fff; padding: 8px 14px;
         border-radius: 8px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 20; }
#toast.show { opacity: .92; }

/* ---------------- ééndraadschema */
#tabs .tab.schema { border-color: #c9a400; background: #fff8d6; }
#tabs .tab.schema.on { background: #c9a400; color: #fff; border-color: #c9a400; }
#wrap.schemamode #seEditor { position: absolute; left: 0; top: 0; bottom: 0; width: 560px; overflow: auto; background: #fbfbfa;
  border-right: 1px solid #ddd; padding: 10px; font-size: 13px; }
#wrap.schemamode svg.plan { left: 560px; cursor: grab; }
#seEditor input, #seEditor select { font: inherit; padding: 4px 6px; border: 1px solid #ccc; border-radius: 5px; background: #fff; }
#seEditor button { font: inherit; padding: 3px 8px; border: 1px solid #ccc; border-radius: 5px; background: #fafafa; cursor: pointer; }
#seEditor button:hover { background: #eee; }
#seEditor button.del { color: #c00; }
.se-main, .se-group { background: #fff; border: 1px solid #e2e2e2; border-radius: 8px; padding: 8px; margin-bottom: 10px; }
.se-title { font-weight: 700; margin-bottom: 4px; }
.se-main label { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 3px 0; }
.se-main input { width: 300px; }
.se-ghead { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.se-ghead input { flex: 1; }
.se-circ { border-left: 3px solid #c9a400; padding: 4px 0 4px 8px; margin: 8px 0 10px; }
.se-chead { display: flex; gap: 4px; align-items: center; margin-bottom: 4px; }
.se-chead .letter { width: 38px; font-weight: 700; text-align: center; text-transform: uppercase; }
.se-chead input { width: 90px; }
.se-chead .desc { flex: 1; width: auto; }
.se-point { display: flex; gap: 4px; align-items: center; margin: 3px 0; flex-wrap: wrap; }
.se-point .nr { width: 30px; font-weight: 600; color: #555; }
.se-point .chips { display: flex; gap: 3px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 2px; background: #eef3ff; border: 1px solid #cbd8f5; border-radius: 12px; padding: 1px 2px 1px 8px; font-size: 12px; }
.chip select { padding: 0 2px !important; font-size: 12px; }
.chip button { border: 0 !important; background: none !important; color: #888; padding: 0 4px !important; }
.se-point .plabel { width: 120px; }
.se-add { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.se-add button { font-size: 12px !important; color: #555; }
.se-add.big button { padding: 7px 10px !important; font-size: 13px !important; }
.se-point { flex-wrap: nowrap; }
.se-point .chips { flex: 1; min-width: 0; }
.se-point select[data-a="addEl"] { width: 44px; flex: none; }
.se-point .plabel { width: 110px; flex: none; }
.se-point button { flex: none; }

/* ---------------- symbolenpalet */
.palette { display: flex; flex-direction: column; gap: 6px; }
.pal-search { width: 100%; padding: 6px 8px; border: 1px solid #ccc; border-radius: 6px; font: inherit; }
.pal-cats { display: flex; flex-wrap: wrap; gap: 3px; }
.pal-cats button { padding: 3px 7px; border: 1px solid #ddd; border-radius: 12px; background: #fafafa; cursor: pointer; font-size: 11.5px; }
.pal-cats button.on { background: #222; color: #fff; border-color: #222; }
.pal-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; max-height: 300px; overflow: auto; }
.pal-item { position: relative; display: flex; align-items: center; gap: 4px; padding: 3px 18px 3px 3px; border: 1px solid #ddd; border-radius: 6px;
            background: #fff; cursor: pointer; font-size: 11.5px; line-height: 1.15; color: #222; min-height: 40px; }
.pal-item:hover { border-color: #999; }
.pal-item.on { border-color: var(--rood); background: #fff0f0; color: var(--rood); }
.pal-item svg { flex: none; }
.pal-item kbd { position: absolute; left: 2px; top: 1px; font-size: 9px; color: #999; font-family: inherit; }
.pal-star { position: absolute; right: 1px; top: 1px; border: 0; background: none; cursor: pointer; color: #bbb; font-size: 13px; padding: 0 2px; }
.pal-star.on { color: #e0a000; }
.pal-empty { grid-column: 1 / -1; font-size: 12px; color: #777; padding: 6px; }
.se-pick { position: fixed; display: none; flex-direction: column; width: 320px; max-height: 420px; background: #fff; border: 1px solid #bbb;
           border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.2); padding: 8px; z-index: 30; }
.se-pick .pal-grid { max-height: 310px; }
.chip svg { margin-right: 2px; }
.addel { font-weight: 700; }
.pal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); overflow-x: hidden; }
.pal-name { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ---------------- hoofdtabbladen */
body { flex-direction: column; }
#topbar { display: flex; align-items: center; gap: 16px; padding: 0 12px; height: 50px; background: #1f2328; color: #fff; flex: none; }
#topbar .brand { font-size: 16px; margin: 0; }
#modes { display: flex; gap: 2px; align-self: flex-end; }
#modes button { border: 0; padding: 10px 22px; font-size: 15px; background: #3a4049; color: #ddd; cursor: pointer; border-radius: 8px 8px 0 0; }
#modes button.on { background: #f4f4f2; color: #111; font-weight: 600; }
#topbar .topfile { margin-left: auto; display: flex; gap: 6px; }
#topbar .topfile .btn { background: #3a4049; color: #fff; border-color: #555; }
#app { flex: 1; display: flex; min-height: 0; }
body[data-mode="schema"] .planonly { display: none !important; }
body[data-mode="plan"] .schemaonly { display: none !important; }
#tabs .tabtitle { font-weight: 600; padding: 6px 4px; }
#tabs .addfloor { border-style: dashed; color: #555; }

/* ---------------- exportmenu in de bovenbalk */
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); background: #fff; color: #222; border: 1px solid #ccc; border-radius: 8px;
             box-shadow: 0 6px 18px rgba(0,0,0,.2); padding: 4px; min-width: 180px; z-index: 40; display: flex; flex-direction: column; }
.menu-list button { text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 5px; cursor: pointer; font-size: 13px; }
.menu-list button:hover { background: #f0f0f0; }
.menu-list button.danger { color: #c00; }
.menu-list hr { border: 0; border-top: 1px solid #eee; margin: 3px 0; }

/* ééndraadschema: geen zijbalk, het formulier en de tekening krijgen de volle breedte */
body[data-mode="schema"] #side { display: none; }
#todo { display: flex; flex-wrap: wrap; gap: 3px; }
.todo-item { padding: 2px 7px; border-radius: 4px; background: #fff3e0; border: 1px solid #f0d2a8; font-size: 12px; cursor: pointer; }
.todo-item:hover { border-color: #c77700; }
.todo-item.on { background: #c77700; color: #fff; border-color: #c77700; }

/* ---------------- AREI-controle */
#seChecks { background: #fff; border: 1px solid #e2e2e2; border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; font-size: 12.5px; }
.chk-head { display: flex; align-items: center; gap: 8px; }
.chk-toggle { margin-left: auto; font-size: 12px !important; }
#seChecks ul { margin: 6px 0 0; padding-left: 18px; }
#seChecks li { margin: 2px 0; cursor: pointer; }
#seChecks li:hover { text-decoration: underline; }
.c-fout { color: #c00; }
.c-letop { color: #b06a00; }
.c-ok { color: #2a8a2a; }
.chk-note { color: #888; font-size: 11px; margin-top: 4px; }
.se-circ.flash { background: #fff3c4; transition: background .3s; }
details.layers { margin: 6px 0; font-size: 13px; }
details.layers summary { cursor: pointer; color: #444; }
#fsLayers { max-height: 180px; overflow: auto; border: 1px solid #eee; border-radius: 6px; padding: 4px 6px; margin-top: 4px; }
#fsLayers label.layer { display: flex !important; justify-content: flex-start !important; gap: 6px; margin: 1px 0 !important; font-size: 12px; }
#fsLayers label.layer i { margin-left: auto; color: #999; font-style: normal; }

/* ---------------- projectgegevens */
#infoDlg { border: 1px solid #ccc; border-radius: 10px; padding: 16px 18px; width: 420px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
#infoDlg h3 { margin: 0 0 4px; color: #222; font-size: 15px; text-transform: none; letter-spacing: 0; }
#infoDlg label { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 6px 0; font-size: 13px; }
#infoDlg input { width: 250px; padding: 5px 7px; border: 1px solid #ccc; border-radius: 5px; font: inherit; }
#infoDlg .row { justify-content: flex-end; margin-top: 12px; }
#infoDlg .row .btn { flex: none; }

/* ---------------- beveiligingen en kabels: velden om te typen of te kiezen */
.se-row { display: flex; align-items: center; gap: 4px; margin: 4px 0; flex-wrap: wrap; }
.se-k { color: #555; font-size: 12px; min-width: 0; margin-right: 2px; }
.se-row .se-k { width: 118px; }
.cbx { display: inline-flex; align-items: center; gap: 2px; }
.cbx i, i.lbl { font-style: normal; color: #777; font-size: 12px; }
#seEditor input.cb { padding: 3px 4px !important; font-size: 12.5px; }
.se-dev { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: 0 0 6px 46px; }
.se-dev .se-k:not(:first-child) { margin-left: 8px; }
.se-ghead { flex-wrap: wrap; }
.se-ghead .se-dif { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.se-ghead .sp { flex: 1; }
.se-nodif { color: #777; font-size: 12px; }
.se-ghead input.cb { flex: none; }
#wrap.schemamode #seEditor { width: 660px; }
#wrap.schemamode svg.plan { left: 660px; }
.se-dev { margin-left: 8px; }

/* ---------------- eigen keuzelijst */
.combo { display: inline-flex; align-items: stretch; border: 1px solid #ccc; border-radius: 5px; background: #fff; }
.combo:focus-within { border-color: #06f; }
#seEditor .combo input.cb { border: 0 !important; border-radius: 5px 0 0 5px; outline: none; background: transparent; }
#seEditor .combo .cbbtn { border: 0 !important; border-left: 1px solid #e3e3e3 !important; border-radius: 0 5px 5px 0 !important; padding: 0 5px !important;
  background: #f6f6f6 !important; color: #555; font-size: 10px !important; cursor: pointer; }
.cb-menu { position: fixed; display: none; z-index: 60; background: #fff; border: 1px solid #bbb; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.18);
  max-height: 220px; overflow: auto; padding: 3px 0; font-size: 13px; }
.cb-opt { padding: 4px 10px; cursor: pointer; white-space: nowrap; }
.cb-opt:hover, .cb-opt.hi { background: #e8f0ff; }
.cb-opt.cur { font-weight: 600; }

/* ---------------- materiaallijst */
body[data-mode="mat"] #side { display: none; }
#matView { position: absolute; inset: 0; overflow: auto; padding: 16px 24px 40px; background: #f4f4f2; }
.mat-top { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.mat-top .sp { flex: 1; }
#matView h2 { font-size: 15px; margin: 22px 0 8px; }
table.mat { border-collapse: collapse; width: 100%; max-width: 1100px; background: #fff; border: 1px solid #e2e2e2; border-radius: 8px; font-size: 13px; margin-bottom: 8px; }
table.mat.small { max-width: 520px; }
table.mat th { text-align: left; background: #f7f7f7; font-weight: 600; color: #444; padding: 7px 10px; border-bottom: 1px solid #e2e2e2; }
table.mat td { padding: 6px 10px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
table.mat .r { text-align: right; }
table.mat td.ic { width: 30px; }
table.mat td.codes { color: #777; font-size: 12px; }
table.mat td.leeg { color: #888; }
table.mat tr.verschil td { color: #c00; }
.mat-len { width: 70px; padding: 3px 6px; border: 1px solid #ccc; border-radius: 5px; text-align: right; font: inherit; }
.mat-note { font-size: 12px; color: #777; }
body[data-mode="mat"] #zoombar { display: none; }

/* ---------------- tabblad Exporteren */
body[data-mode="export"] #side, body[data-mode="export"] #zoombar { display: none; }
#exView { position: absolute; inset: 0; display: flex; }
.ex-side { width: 320px; flex: none; overflow: auto; padding: 14px 16px 30px; background: #fff; border-right: 1px solid #ddd; }
.ex-side h3:first-child { margin-top: 0; }
.ex-chk { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin: 5px 0; cursor: pointer; }
.ex-chk.dis { color: #aaa; }
.ex-row { display: flex; align-items: center; gap: 6px; margin: 6px 0; font-size: 13px; }
.ex-row span { width: 112px; color: #555; }
.ex-side select, .ex-prevhead select { padding: 4px 6px; border: 1px solid #ccc; border-radius: 5px; font: inherit; font-size: 13px; }
.ex-info { margin: 10px 0 0; padding: 8px 10px; background: #f7f7f7; border-radius: 6px; font-size: 12.5px; color: #444; }
.ex-info .btn { margin-top: 6px; }
.ex-big { width: 100%; padding: 10px; font-size: 14px; margin-bottom: 4px; }
.ex-hint { font-size: 11.5px; color: #888; margin-bottom: 8px; }
.ex-danger { margin-top: 24px; border-top: 1px solid #eee; padding-top: 10px; }
.ex-prev { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #8a8d91; }
.ex-prevhead { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #f4f4f2; border-bottom: 1px solid #ddd; font-size: 13px; }
.ex-prevhead .sp { flex: 1; }
#exFrame { flex: 1; border: 0; width: 100%; background: #8a8d91; }
