:root {
    --zoom: 1;
    --bg-main: #edf2f7;
    --navy-header: #0f172a;
    --navy-header-light: #1e293b;
    --primary-blue: #0066ff;
    --primary-blue-hover: #0052cc;
    --primary-blue-light: #e6f0ff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --panel-bg: #ffffff;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.12);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    user-select: none;
}

/* 1. BOVENSTE NAVIGATIEBALK */
.app-header {
    background: var(--navy-header);
    color: #ffffff;
    height: 60px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: white;
}

.brand-icon {
    width: 34px;
    height: 34px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.brand-title {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.2px;
}

.brand-subtitle {
    font-size: 11px;
    color: #94a3b8;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 20px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: #94a3b8;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    color: #ffffff;
    background: rgba(255,255,255,0.05);
}

.nav-btn.active {
    background: var(--primary-blue);
    color: #ffffff;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.floor-selector {
    display: flex;
    background: rgba(255,255,255,0.1);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
}

.floor-btn {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #cbd5e1;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.floor-btn.active {
    background: #ffffff;
    color: var(--navy-header);
    box-shadow: var(--shadow-sm);
}

.save-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #cbd5e1;
    background: rgba(255,255,255,0.08);
    padding: 6px 14px;
    border-radius: 20px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 8px #22c55e;
}

.user-profile {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #334155;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    border: 2px solid rgba(255,255,255,0.2);
}

/* DASHBOARD CONTAINER */
.dashboard-container {
    display: flex;
    flex: 1;
    height: calc(100vh - 60px);
    padding: 16px;
    gap: 16px;
    overflow: hidden;
}

/* 2. LINKER ZIJPANEEL */
.sidebar-left {
    width: 330px;
    background: var(--panel-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
}

.sidebar-scroll {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 10px 0;
}

.tools-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tool-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background: #f8fafc;
    color: var(--text-main);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
}

.tool-btn:hover {
    background: #f1f5f9;
}

.tool-btn.active {
    background: var(--primary-blue) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(0,102,255,0.25);
}

.tool-btn .icon {
    font-size: 16px;
    width: 20px;
    display: inline-block;
    text-align: center;
}

/* Zone Filter Blok in Overzicht */
.zone-filter-box {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.zone-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 130px;
    overflow-y: auto;
}

.zone-chip {
    font-size: 11.5px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.zone-chip:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.zone-chip.sel {
    background: var(--primary-blue);
    color: #fff;
    border-color: var(--primary-blue);
}

/* Categorie accordions */
details.cat-details {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #ffffff;
    margin-bottom: 8px;
}

details.cat-details summary {
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    background: #f8fafc;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

details.cat-details summary::-webkit-details-marker { display: none; }

details.cat-details[open] summary {
    border-bottom: 1px solid var(--border-color);
    background: #f1f5f9;
}

.cat-scroll-container {
    max-height: 320px;
    overflow-y: auto;
    padding: 4px 8px;
}

.cat-scroll-container::-webkit-scrollbar {
    width: 5px;
}

.cat-scroll-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.cat-badge-count {
    background: #e2e8f0;
    color: var(--text-main);
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 700;
}

.btn-secondary-full {
    width: 100%;
    padding: 9px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #ffffff;
    color: var(--text-main);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-secondary-full:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-danger-light {
    color: #dc2626;
    background: #fef2f2;
    border-color: #fecaca;
}

.btn-danger-light:hover {
    background: #fee2e2;
}

/* 3. CENTRAAL WERKGEBIED */
.main-workspace {
    flex: 1;
    background: #e2e8f0;
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.03);
    transition: flex 0.25s ease;
}

.floating-toolbar {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(8px);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    gap: 12px;
}

.tb-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tb-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
}

.tb-btn:hover {
    background: #f1f5f9;
}

.tb-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.tb-divider {
    width: 1px;
    height: 20px;
    background: var(--border-color);
}

.plan-wrapper {
    position: relative;
    display: inline-block;
    max-height: 100%;
    max-width: 100%;
    transform-origin: center center;
}

.plan-wrapper img {
    max-height: calc(100vh - 120px);
    max-width: 100%;
    object-fit: contain;
    display: block;
    box-shadow: var(--shadow-lg);
    -webkit-user-drag: none;
    user-select: none;
    transform-origin: center center;
    border-radius: 4px;
}

.icon-layer, .zone-labels, .zone-handles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    transform-origin: center center;
}

.icon-layer { z-index: 5; }
.zone-labels { z-index: 4; }
.zone-handles { z-index: 6; }

.icon-symbol {
    position: absolute;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    cursor: pointer;
    pointer-events: auto;
    user-select: none;
    z-index: 5;
    transform-origin: center center;
    transform: translate(-50%, -50%);
    scale: 1;                       
    transition: scale 0.15s ease, opacity 0.25s ease;
}

.icon-symbol:hover {
    scale: 1.35;
    z-index: 20;
}

.icon-symbol.sel {
    outline: 3px solid var(--primary-blue);
    outline-offset: 2px;
    z-index: 21;
}

.icon-elek { background: #fef08a; border: 2px solid #ca8a04; color: #854d0e; }
.icon-water { background: #bfdbfe; border: 2px solid #2563eb; color: #1e40af; }
.icon-afvoer { background: #f3e8ff; border: 2px solid #9333ea; color: #6b21a8; }
.icon-utp { background: #dcfce7; border: 2px solid #16a34a; color: #166534; }
.icon-alarm { background: #fee2e2; border: 2px solid #dc2626; color: #991b1b; }
.icon-airco { background: #cffafe; border: 2px solid #0891b2; color: #155e75; }
.icon-algemeen { background: #e2e8f0; border: 2px solid #475569; color: #1e293b; }
.icon-kabels { background: #f1f5f9; border: 2px solid #64748b; color: #334155; }

.zone-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
    touch-action: none;
    transform-origin: center center;
}

.zone-layer.drawing { pointer-events: auto; cursor: crosshair; }
.zone-layer .zone { pointer-events: all; cursor: pointer; transition: opacity 0.25s ease; }
.zone-layer.drawing .zone { pointer-events: none; }
.zone-layer.editing .zone { cursor: move; }
.zone-layer .zone.sel { stroke-dasharray: 6 3; fill-opacity: 0.35; }
.zone-layer .zone.line.sel { stroke-dasharray: 10 5; }
.zone-layer .draft { fill-opacity: 0.15; stroke-dasharray: 4 3; pointer-events: none; }
.zone-layer .draft.line { fill-opacity: 0; stroke-dasharray: 8 4; }

.zone-label {
    position: absolute;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(0, 102, 255, 0.9);
    color: #ffffff !important;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transform-origin: center center;
}

.handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ffffff;
    border: 2px solid var(--primary-blue);
    border-radius: 50%;
    pointer-events: auto;
    cursor: grab;
    transform-origin: center center;
    transform: translate(-50%, -50%);
}

.handle.dot {
    pointer-events: none;
    background: var(--primary-blue);
    width: 6px;
    height: 6px;
}

.midpoint-handle {
    width: 8px;
    height: 8px;
    background: #f59e0b;
    border: 1px solid #ffffff;
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.knik-handle {
    width: 10px;
    height: 10px;
    background: #22c55e;
    border: 2px solid #ffffff;
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* 4. RECHTER EIGENSCHAPPENPANEEL */
.sidebar-right {
    width: 420px;
    background: var(--panel-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
    transition: margin-right 0.25s ease, opacity 0.25s ease;
}

.sidebar-right.closed {
    display: none;
}

.info-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.info-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
}

.info-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

input[type="text"], input[type="number"], select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 13px;
    color: var(--text-main);
    background: #ffffff;
    transition: border-color 0.15s;
}

input[type="text"]:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
}

textarea {
    min-height: 70px;
    resize: vertical;
}

/* KAMERS BEHEER STYLING */
.rooms-manager-box {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rooms-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
}

.room-row-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.room-code-input {
    width: 70px !important;
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
    padding: 6px 8px !important;
}

.room-name-input {
    flex: 1;
    padding: 6px 8px !important;
}

.btn-icon-del {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748b;
    font-size: 12px;
}

.btn-icon-del:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fecaca;
}

#place-banner {
    position: absolute;
    top: 64px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    background: var(--primary-blue);
    color: white;
    padding: 8px 18px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    display: none;
    align-items: center;
    gap: 12px;
}

#place-banner button {
    border: none;
    padding: 4px 10px;
    border-radius: 12px;
    background: #ffffff;
    color: var(--primary-blue);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.item-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    font-size: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.item-row.sel { background: var(--primary-blue-light); }
.item-row.off .item-title { color: #94a3b8; text-decoration: line-through; }
.item-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.item-floor { font-size: 10px; background: #e2e8f0; border-radius: 3px; padding: 1px 4px; }
.btn-mini { padding: 2px 6px; font-size: 11px; cursor: pointer; border-radius: 4px; border: 1px solid #cbd5e1; background: #f8fafc; }
.btn-open-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary-blue);
    background: var(--primary-blue-light);
    border: 1px solid rgba(0, 102, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-left: auto;
}
.btn-open-item:hover {
    background: var(--primary-blue);
    color: #ffffff;
    border-color: var(--primary-blue);
}
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chip { cursor: pointer; padding: 2px 6px; border: 1px solid #cbd5e1; border-radius: 4px; background: #fff; font-size: 13px; }

/* Cirkelvormige iconen in lijst */
.cat-ic-circle {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
}

.eye-btn {
    background: transparent;
    border: none;
    cursor: context-menu;
    font-size: 14px;
    padding: 2px 4px;
    color: #64748b;
    border-radius: 4px;
}
.eye-btn:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

/* Modals */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000;
    display: none; align-items: center; justify-content: center; backdrop-filter: blur(4px);
}
.modal-content {
    background: #fff; padding: 24px; border-radius: var(--radius-lg); width: 460px;
    box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 16px;
    max-height: 90vh; overflow-y: auto;
}
.modal-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px;
}
.modal-grid-btn {
    padding: 12px; border: 1px solid var(--border-color); border-radius: var(--radius-md);
    background: #f8fafc; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600; color: var(--text-main); transition: all 0.15s;
}
.modal-grid-btn:hover { background: var(--primary-blue-light); border-color: var(--primary-blue); color: var(--primary-blue); }

/* FLOATING KRING TRIGGER KNOP */
.floating-kring-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 90;
    background: #0f172a;
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 30px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: all 0.2s ease;
}

.floating-kring-btn:hover {
    background: #1e293b;
    transform: translateY(-2px);
}

.pulse-icon {
    display: inline-block;
    color: #f59e0b;
    font-size: 16px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* KRING & AI DRAWER RECHTSONDER */
.kring-drawer {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 380px;
    max-height: 80vh;
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: 0 12px 32px rgba(0,0,0,0.18);
    z-index: 95;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.kring-drawer.closed {
    transform: translateY(120%);
    opacity: 0;
    pointer-events: none;
}

.kring-drawer-header {
    padding: 14px 16px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kring-drawer-body {
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* AI STATUS & RESULTS */
.ai-status-card {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-md);
    padding: 10px 12px;
}

.ai-badge {
    background: #16a34a;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

.ai-results-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 460px;
    overflow-y: auto;
}

.ai-item-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 10px;
    font-size: 12px;
}

.ai-item-card.warning {
    background: #fffbeb;
    border-color: #fde68a;
}

.ai-item-card.missing {
    background: #fef2f2;
    border-color: #fecaca;
}

.ai-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    margin-bottom: 4px;
}

/* ===== KRING ENGINE v2: tekstweergave ===== */
.ai-type-line { font-size: 13px; margin: 2px 0 6px; }
.ai-list { margin: 4px 0 0 16px; padding: 0; font-size: 12px; line-height: 1.5; }
.ai-list li { margin-bottom: 3px; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.ai-chip { background: #e2e8f0; border-radius: 10px; padding: 2px 8px; font-size: 11px; font-weight: 600; }
.ai-room { border-top: 1px solid #e2e8f0; padding: 6px 0; }
.ai-room:first-of-type { border-top: none; }
.ai-room-title { font-weight: 700; font-size: 12.5px; margin-bottom: 4px; }
.ai-group { margin: 4px 0 6px 6px; padding-left: 8px; border-left: 3px solid #fde68a; font-size: 11.5px; line-height: 1.5; }
.ai-chain { color: #475569; font-size: 11px; }
.ai-tag { background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 4px; padding: 0 5px; font-size: 10.5px; color: #475569; }
.ai-tag.ok { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.ai-steps { margin: 6px 0 0 18px; padding: 0; font-size: 11.5px; line-height: 1.45; }
.ai-steps li { margin-bottom: 5px; }
.ai-note { color: #64748b; font-size: 11px; }
.ai-item-card.ai-ok { background: #f0fdf4; border-color: #bbf7d0; }

/* =====================================================================
   EENDRAADSCHEMA TABBLAD + KRINGGROEPEN
   ===================================================================== */
.main-workspace.schema-mode > *:not(#schema-view) { display: none !important; }
#schema-view { display: none; flex-direction: column; flex: 1; align-self: stretch; min-width: 0; min-height: 0; width: 100%; height: 100%; background: #f1f5f9; border-radius: inherit; }
.main-workspace.schema-mode #schema-view { display: flex; }
body.schema-active .sidebar-right { display: none; }
body.schema-active .floor-selector { display: none; }

.sch-bar { display: flex; gap: 6px; align-items: center; padding: 8px 12px; background: #fff; border-bottom: 1px solid #cbd5e1; flex-wrap: wrap; }
#schema-scroll { flex: 1; overflow: auto; padding: 16px; }
#schema-paper { background: #fff; box-shadow: 0 1px 6px #0003; display: inline-block; user-select: none; -webkit-user-select: none; touch-action: none; }
.sch-empty { padding: 60px; color: #64748b; text-align: center; width: 600px; line-height: 1.5; }

#schema-view button, .sch-side button { background: #2563eb; color: #fff; border: 0; border-radius: 6px; padding: 6px 9px; font-weight: 600; cursor: pointer; font-size: 12px; }
#schema-view button.sec, .sch-side button.sec { background: #e2e8f0; color: #0f172a; }
.sch-side button.danger { background: #fee2e2; color: #b91c1c; }
#schema-view button:disabled, .sch-side button:disabled { opacity: .4; cursor: default; }
.sch-row { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 5px; }
.sch-side label { display: block; font-size: 11px; color: #64748b; margin: 6px 0 2px; }
.sch-side input, .sch-side select { width: 100%; padding: 5px 6px; border: 1px solid #cbd5e1; border-radius: 5px; font-size: 12px; background: #fff; }
.sch-hint { color: #64748b; font-size: 11px; line-height: 1.45; }
.sch-msg { color: #b45309; font-size: 11px; min-height: 14px; line-height: 1.4; }
.sch-card { border: 1px solid #bfdbfe; background: #eff6ff; border-radius: 8px; padding: 9px; margin-bottom: 6px; }
.sch-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.sch-pb { background: #f8fafc !important; border: 1px solid #e2e8f0 !important; color: #334155 !important; padding: 3px 2px !important; font-size: 10px !important; font-weight: 500 !important; display: flex; flex-direction: column; align-items: center; border-radius: 6px !important; }
.sch-pb:hover { border-color: #2563eb !important; background: #eff6ff !important; }
#schema-paper .blk { cursor: grab; }
#schema-paper .ed { cursor: text; }
#schema-paper .ed:hover text { fill: #2563eb; }
#schema-paper .blk:hover > .hit { fill: rgba(37,99,235,.07); }
#schema-paper .blk.sel > .hit { fill: rgba(37,99,235,.14); stroke: #2563eb; stroke-dasharray: 4 3; }
#schema-paper .blk.dragging { opacity: .35; }
#schema-paper .blk.drop > .hit { fill: rgba(22,163,74,.22); stroke: #16a34a; stroke-width: 2; }
body.dnd, body.dnd * { cursor: grabbing !important; }
.sch-edit { position: fixed; z-index: 2000; width: 170px; padding: 5px 7px; border: 2px solid #2563eb; border-radius: 5px; font-size: 13px; box-shadow: 0 4px 14px #0004; }

/* Kringgroepen in de lijst Elektriciteit (overzicht) */
.kring-group { border: 1px solid #e2e8f0; border-radius: 8px; margin: 4px 0; background: #fff; }
.kring-group > summary { display: flex; align-items: center; gap: 6px; padding: 6px 8px; cursor: pointer; list-style: none; font-size: 12px; }
.kring-group > summary::-webkit-details-marker { display: none; }
.kring-group > summary::before { content: '▸'; color: #94a3b8; font-size: 10px; }
.kring-group[open] > summary::before { content: '▾'; }
.kring-sum { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kring-title { color: #64748b; font-weight: 400; }
.kring-items { padding: 2px 6px 6px; }

@media print {
    body.schema-active .app-header, body.schema-active .sidebar-left, body.schema-active .sch-bar { display: none !important; }
    body.schema-active, body.schema-active .dashboard-container, body.schema-active .main-workspace { display: block !important; height: auto !important; overflow: visible !important; background: #fff; }
    body.schema-active #schema-scroll { padding: 0; overflow: visible; }
    body.schema-active #schema-paper { box-shadow: none; }
    body.schema-active #schema-paper svg { max-width: 100%; height: auto !important; width: 100% !important; }
    body.schema-active #schema-paper .blk.sel > .hit, body.schema-active #schema-paper .blk:hover > .hit { fill: transparent; stroke: none; }
    @page { size: A3 landscape; margin: 8mm; }
}

/* Zijbalk: inhoud niet laten krimpen (extra filtervak), maar scrollen */
.sidebar-scroll > * { flex-shrink: 0; }
.kring-items .item-row { margin: 0; }

/* =====================================================================
   SCHAKELAARGROEPEN (wandplaat met vierkante schakelaars)
   ===================================================================== */
.sw-plate {
    position: absolute; transform: translate(-50%, -50%);
    display: block; padding: 4px;
    background: #fff; border: 1.5px solid #64748b; border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0,0,0,.3);
    pointer-events: auto; cursor: pointer; z-index: 5; user-select: none;
}
.sw-cells { display: flex; gap: 3px; }
.sw-plate.sw-v .sw-cells { flex-direction: column; }
.sw-pin { display: none; }

/* Overzicht: ingeklapt als cirkel met symbool; bij hover klapt de volledige plaat open */
.sw-plate.sw-collapsed {
    width: 26px; height: 26px; padding: 0; box-sizing: border-box;
    display: flex; align-items: center; justify-content: center;
    background: #fde68a; border: 2px solid #ca8a04; border-radius: 50%;
}
.sw-collapsed .sw-cells { display: none; }
.sw-collapsed .sw-pin { display: flex; align-items: center; justify-content: center; position: relative; width: 100%; height: 100%; }
.sw-pin-n { position: absolute; right: -7px; bottom: -7px; min-width: 14px; height: 14px; padding: 0 3px; box-sizing: border-box; border-radius: 7px; background: #78350f; color: #fff; font-size: 9px; font-weight: 700; line-height: 14px; text-align: center; }
.sw-plate.sw-collapsed:hover {
    width: auto; height: auto; padding: 4px; display: block; z-index: 40;
    background: #fff; border: 1.5px solid #64748b; border-radius: 5px;
    box-shadow: 0 4px 14px rgba(0,0,0,.35); animation: sw-pop .12s ease-out;
}
.sw-collapsed:hover .sw-pin { display: none; }
.sw-collapsed:hover .sw-cells { display: flex; }
.sw-plate.sw-collapsed:hover.sw-v .sw-cells { flex-direction: column; }
@keyframes sw-pop { from { transform: translate(-50%, -50%) scale(.6); } to { transform: translate(-50%, -50%) scale(1); } }
.sw-plate.sel { outline: 3px solid #2563eb; outline-offset: 2px; }
.sw-cell { display: flex; width: 24px; height: 24px; border: 1.5px solid #475569; border-radius: 3px; background: #f1f5f9; overflow: hidden; }
.sw-plate.sw-v .sw-cell.double { flex-direction: column; }
.sw-slot { flex: 1; min-width: 0; min-height: 0; background: #f1f5f9; cursor: pointer; }
.sw-slot.filled { background: #fde68a; }
.sw-slot.empty { background: repeating-linear-gradient(45deg, #f8fafc, #f8fafc 3px, #e2e8f0 3px, #e2e8f0 6px); }
.sw-slot.selitem { background: #93c5fd; }
.sw-slot.dim { background: #e2e8f0; opacity: .25; pointer-events: none; }
.sw-slot:hover:not(.dim) { filter: brightness(.9); }
.sw-cell.double .sw-slot + .sw-slot { border-left: 1.5px solid #475569; }
.sw-plate.sw-v .sw-cell.double .sw-slot + .sw-slot { border-left: none; border-top: 1.5px solid #475569; }

/* rechterpaneel */
.sw-big { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px; background: #fff; border: 2px solid #64748b; border-radius: 8px; justify-content: center; }
.sw-big.sw-v { flex-direction: column; align-items: center; }
.sw-bigcell { flex: none; display: flex; width: 124px; height: 74px; border: 2px solid #475569; border-radius: 6px; background: #f1f5f9; overflow: hidden; }
.sw-big.sw-v .sw-bigcell.double { flex-direction: column; height: 124px; }
.sw-bigcell.single { width: 82px; }
.sw-zone { position: relative; flex: 1; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 3px; text-align: center; cursor: pointer; }
.sw-zone.empty { background: repeating-linear-gradient(45deg, #f8fafc, #f8fafc 4px, #e2e8f0 4px, #e2e8f0 8px); color: #94a3b8; font-size: 18px; }
.sw-zone.filled { background: #fde68a; }
.sw-zone.over { outline: 3px dashed #2563eb; outline-offset: -3px; background: #dbeafe; }
.sw-zone-t { font-size: 10px; line-height: 1.15; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; word-break: break-word; }
.sw-bigcell.double .sw-zone + .sw-zone { border-left: 2px solid #475569; }
.sw-big.sw-v .sw-bigcell.double .sw-zone + .sw-zone { border-left: none; border-top: 2px solid #475569; }
.sw-x { position: absolute; top: 1px; right: 1px; width: 16px; height: 16px; padding: 0; line-height: 1; font-size: 10px; border: 0; border-radius: 50%; background: #fff; color: #b91c1c; cursor: pointer; opacity: .85; }
.sw-hint { font-size: 12px; color: #1d4ed8; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 6px; padding: 6px 8px; margin-top: 6px; }
.sw-counters { display: flex; flex-direction: column; gap: 6px; }
.sw-counter { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.sw-counter > span { flex: 1; }
.sw-counter b { min-width: 20px; text-align: center; }
.sw-slotrow { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.sw-slotrow select { flex: 1; min-width: 0; }
.sw-slotnr { width: 18px; text-align: center; font-weight: 700; color: #64748b; font-size: 12px; }
.sw-pool { display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow-y: auto; margin-top: 6px; }
.sw-chip { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border: 1px solid #e2e8f0; border-radius: 6px; background: #fff; cursor: grab; font-size: 12px; }
.sw-chip:hover { border-color: #2563eb; }
.sw-chip.pick { background: #dbeafe; border-color: #2563eb; }
.sw-chip-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw-chip small { background: #e2e8f0; border-radius: 4px; padding: 1px 5px; color: #475569; }

/* Eendraadschema: achtergrond slepen = pannen */
#schema-scroll { cursor: grab; }
body.sch-pan, body.sch-pan * { cursor: grabbing !important; user-select: none; }

/* =====================================================================
   VERBANDEN (overzicht) + STOPCONTACTPLAATJES
   ===================================================================== */
.link-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; overflow: visible; }
.icon-symbol.rel-hl { box-shadow: 0 0 0 3px #f59e0b, 0 0 12px 2px rgba(245, 158, 11, .8); z-index: 20; }
.sw-slot.rel-hl { background: #f59e0b !important; }
.sw-plate.rel-hl { outline: 3px solid #f59e0b; outline-offset: 2px; z-index: 20; }

.sk-plate.sw-collapsed { background: #dbeafe; border-color: #2563eb; }
.sk-plate .sw-pin-n { background: #1e3a8a; }
.sk-faces { flex-wrap: wrap; gap: 4px; max-width: 124px; padding: 2px; }
.sk-face { display: block; flex: none; }
.sk-plate.sw-collapsed:hover { border-radius: 8px; padding: 5px; }

/* =====================================================================
   ZONES BEWERKEN: bolletjes op hoekpunten en zijden
   ===================================================================== */
.zn-corner, .zn-side { position: absolute; transform: translate(-50%, -50%); border-radius: 50%; box-sizing: border-box; pointer-events: auto; touch-action: none; }
.zn-corner { width: 14px; height: 14px; background: #fff; border: 3px solid #2563eb; box-shadow: 0 1px 4px rgba(0,0,0,.45); cursor: move; z-index: 8; }
.zn-side { width: 10px; height: 10px; background: rgba(255,255,255,.9); border: 2px solid #2563eb; z-index: 7; opacity: .85; }
.zn-corner:hover { background: #2563eb; }
.zn-side:hover { background: #2563eb; opacity: 1; }
.zn-panel { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 8px 10px; margin-top: 10px; }
.zn-hint { font-size: 12px; line-height: 1.5; color: #475569; }

/* =====================================================================
   VERPLAATSEN: rest van de kaart vergrijsd en niet aanklikbaar
   ===================================================================== */
.plan-wrapper.dim-others .icon-symbol:not(.moving),
.plan-wrapper.dim-others .sw-plate:not(.moving) { opacity: .28 !important; filter: grayscale(1); pointer-events: none !important; }
.plan-wrapper.dim-others .sw-plate:not(.moving) * { pointer-events: none !important; }
.plan-wrapper.dim-others .zone-layer, .plan-wrapper.dim-others .zone-labels, .plan-wrapper.dim-others .zone-handles { opacity: .3; filter: grayscale(1); pointer-events: none; }
.icon-symbol.moving { box-shadow: 0 0 0 3px #2563eb, 0 0 14px 3px rgba(37, 99, 235, .75); z-index: 30; }
.sw-plate.moving { outline: 3px solid #2563eb; outline-offset: 2px; z-index: 30; }

/* verbanden tussen stopcontacten (blauw) */
.icon-symbol.rel-sock { box-shadow: 0 0 0 3px #2563eb, 0 0 12px 2px rgba(37, 99, 235, .8); }
.sw-plate.rel-sock { outline-color: #2563eb; }
