:root{
  --red:#e11d2e;--red-dark:#8f101c;--ink:#151821;--muted:#6b7280;--line:#edf0f4;--panel:#ffffffee;--green:#047857;--orange:#c2410c;--discord:#5865f2;
}
*{box-sizing:border-box}
html,body{height:100%;margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;color:var(--ink);overflow:hidden;background:#f6f7fb}
.hidden{display:none!important}
.app-shell{height:100%;display:grid;grid-template-columns:320px 1fr}
.sidebar{z-index:500;background:linear-gradient(180deg,#fff 0%,#fff7f7 100%);border-right:1px solid var(--line);padding:18px;display:flex;flex-direction:column;gap:14px;box-shadow:12px 0 35px rgba(20,24,33,.08);overflow:auto}
.brand{display:flex;align-items:center;gap:12px}.brand img{width:64px;height:64px;object-fit:contain;border-radius:50%;box-shadow:0 10px 25px rgba(225,29,46,.22)}.brand-title{font-size:22px;font-weight:950;line-height:1}.brand-subtitle{font-size:12px;color:var(--muted);font-weight:700;text-transform:uppercase;letter-spacing:.05em;margin-top:4px}
.tabs{display:grid;grid-template-columns:1fr 1fr;gap:8px;background:#f1f3f7;border-radius:16px;padding:5px}.tab-btn{border:0;border-radius:12px;padding:11px 12px;font-weight:900;cursor:pointer;background:transparent;color:#626b7a}.tab-btn.active{background:#fff;color:var(--red);box-shadow:0 8px 20px rgba(0,0,0,.08)}
.panel{background:var(--panel);border:1px solid var(--line);border-radius:22px;padding:16px;box-shadow:0 10px 28px rgba(20,24,33,.07)}.panel h3{margin:0 0 12px;font-size:16px}.panel p{color:var(--muted);margin:0 0 12px;font-size:14px}.search-box span,.filter-group strong{display:block;font-size:12px;text-transform:uppercase;letter-spacing:.06em;color:#818898;font-weight:900;margin-bottom:7px}.search-box input,input:not([type="checkbox"]),select,textarea{width:100%;border:1px solid var(--line);border-radius:14px;padding:11px 12px;outline:none;font:inherit;background:#fff}.search-box input:focus,input:focus,select:focus,textarea:focus{border-color:#f19aa3;box-shadow:0 0 0 4px rgba(225,29,46,.09)}
.filter-group{margin-top:15px}.filter-group label{display:flex;align-items:center;gap:8px;margin:9px 0;font-size:14px;line-height:1.25}.filter-group input[type="checkbox"]{width:auto;flex:0 0 auto;margin:0}.filter-group label span{min-width:0}.filter-head{display:flex;align-items:center;justify-content:space-between;gap:8px}.owner-options{max-height:145px;overflow:auto;padding-right:4px}.mini-btn,.icon-btn{border:1px solid var(--line);background:#fff;border-radius:10px;padding:7px 10px;font-weight:800;cursor:pointer;color:var(--ink);text-decoration:none;display:inline-flex;align-items:center;justify-content:center;gap:6px}.mini-btn:hover,.icon-btn:hover{border-color:#f19aa3;color:var(--red)}.result-count{margin-top:14px;color:var(--muted);font-size:13px;font-weight:800}.discord-btn,.logout-btn,.save-btn,.danger-btn{display:inline-flex;justify-content:center;align-items:center;text-align:center;border:0;text-decoration:none;border-radius:14px;padding:12px 14px;font-weight:950;cursor:pointer}.discord-btn{width:100%;background:var(--discord);color:#fff;box-shadow:0 10px 20px rgba(88,101,242,.22)}.logout-btn{width:100%;background:#fff;color:var(--red);border:1px solid #fecdd3}.save-btn{background:var(--red);color:#fff;box-shadow:0 10px 20px rgba(225,29,46,.18)}.save-btn.small{padding:8px 10px;border-radius:10px;font-size:13px}.danger-btn{background:#fff1f2;color:#be123c;border:1px solid #fecdd3}.danger-btn:hover{background:#ffe4e6}
.main{position:relative;min-width:0}.topbar{position:absolute;top:16px;left:16px;right:16px;height:58px;z-index:450;background:rgba(255,255,255,.9);backdrop-filter:blur(10px);border:1px solid rgba(255,255,255,.8);border-radius:20px;box-shadow:0 12px 30px rgba(20,24,33,.12);display:flex;align-items:center;gap:12px;padding:0 16px}.topbar span{display:block;color:var(--muted);font-size:13px}.menu-toggle{display:none;border:0;background:#fff;border-radius:12px;width:38px;height:38px;font-size:20px;box-shadow:0 6px 16px rgba(0,0,0,.12)}
.view{position:absolute;inset:0;display:none}.view.active{display:block}#map{position:absolute;inset:0}.table-view{padding:92px 16px 16px;overflow:auto}.table-card{background:#fff;border-radius:24px;border:1px solid var(--line);box-shadow:0 18px 50px rgba(20,24,33,.1);overflow:hidden}.table-head{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:18px 20px;border-bottom:1px solid var(--line)}.table-head h2{margin:0}.table-head p{margin:4px 0 0;color:var(--muted);font-size:13px}.table-wrap{overflow:auto}table{width:100%;border-collapse:collapse;min-width:850px}th,td{text-align:left;padding:14px 16px;border-bottom:1px solid var(--line);font-size:14px;vertical-align:middle}th{font-size:12px;text-transform:uppercase;letter-spacing:.06em;color:#7b8494;background:#fafbfc}.actions-cell{display:flex;gap:8px;align-items:center}.badge{display:inline-flex;border-radius:999px;padding:7px 10px;font-size:12px;font-weight:950;white-space:nowrap}.badge-green{background:#ecfdf5;color:var(--green)}.badge-red{background:#fff1f2;color:#be123c}.badge-orange{background:#fff7ed;color:var(--orange)}
.leaflet-popup-content-wrapper{border-radius:22px;overflow:hidden;padding:0;background:#fff;box-shadow:0 22px 55px rgba(0,0,0,.42)}.leaflet-popup-content{margin:0;width:390px!important}.leaflet-popup-tip{background:#fff}.mansion-popup{overflow:hidden;background:linear-gradient(180deg,#fff 0%,#f8fafc 100%)}.mansion-video{width:100%;height:220px;background:#111}.mansion-video iframe{width:100%;height:100%;border:0;display:block}.mansion-popup-body{padding:18px}.mansion-popup-header{display:flex;justify-content:space-between;align-items:center;gap:14px;margin-bottom:16px}.mansion-kicker,.mansion-label{display:block;margin-bottom:5px;font-size:10px;font-weight:900;letter-spacing:.08em;text-transform:uppercase;color:#9ca3af}.mansion-popup-title{font-size:30px;font-weight:950;line-height:1;color:#111827}.mansion-status-badge{white-space:nowrap;border-radius:999px;padding:8px 13px;font-size:12px;font-weight:900;background:#111827;color:#fff;box-shadow:0 8px 20px rgba(17,24,39,.22)}.mansion-meta-strip{display:grid;grid-template-columns:1fr 1.25fr;gap:10px;margin-bottom:10px}.mansion-meta-strip>div,.mansion-detail-card{border:1px solid rgba(17,24,39,.08);background:rgba(255,255,255,.86);border-radius:16px;padding:12px 13px;box-shadow:0 4px 14px rgba(0,0,0,.05)}.mansion-meta-strip strong,.mansion-value{display:block;font-size:14px;font-weight:850;color:#111827;line-height:1.35}.mansion-detail-card.highlight{margin-top:10px;background:linear-gradient(135deg,#fff 0%,#fff7ed 100%);border-color:rgba(249,115,22,.22)}.leaflet-container a{color:#e11d48;font-weight:700;text-decoration:none}
.modal-backdrop{position:fixed;inset:0;z-index:1000;background:rgba(15,23,42,.38);backdrop-filter:blur(8px);display:flex;align-items:center;justify-content:center;padding:18px}.modal-card{width:min(760px,100%);max-height:92vh;overflow:auto;background:#fff;border-radius:26px;box-shadow:0 30px 80px rgba(0,0,0,.28);padding:20px}.modal-head{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;margin-bottom:16px}.modal-head h2{margin:0}.modal-head p{margin:4px 0 0;color:var(--muted)}.icon-btn{width:38px;height:38px;font-size:24px;padding:0}.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}.form-grid label{font-size:12px;text-transform:uppercase;letter-spacing:.06em;color:#818898;font-weight:900}.form-grid input,.form-grid select,.form-grid textarea{margin-top:7px;text-transform:none;color:var(--ink);font-weight:500;letter-spacing:0}.wide{grid-column:1/-1}.modal-actions{display:flex;justify-content:space-between;align-items:center;gap:14px;margin-top:18px}.modal-actions-right{display:flex;gap:10px}
@media(max-width:900px){.app-shell{grid-template-columns:1fr}.sidebar{position:absolute;top:0;bottom:0;left:0;width:min(88vw,340px);transform:translateX(-105%);transition:.25s ease}.sidebar.open{transform:none}.menu-toggle{display:block}.topbar{top:10px;left:10px;right:10px}.leaflet-popup-content{width:min(86vw,390px)!important}.mansion-video{height:190px}.form-grid{grid-template-columns:1fr}.table-head{align-items:flex-start;flex-direction:column}.modal-actions{align-items:stretch;flex-direction:column}.modal-actions-right{display:grid;grid-template-columns:1fr 1fr}.danger-btn{width:100%}}

/* ===== Admin upgrades + logs uitbreiding ===== */
.table-wrap table{min-width:1100px}.note-cell{max-width:240px;white-space:normal;color:#374151}.muted{color:var(--muted);font-style:normal}.icon-mini-btn{border:1px solid var(--line);background:#fff;border-radius:10px;width:36px;height:34px;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;text-decoration:none}.icon-mini-btn:hover{border-color:#f19aa3;background:#fff7f7}.upgrade-badges{display:flex;flex-wrap:wrap;gap:6px;max-width:330px}.upgrade-badges span{display:inline-flex;border-radius:999px;padding:5px 8px;font-size:12px;font-weight:850;background:#f3f4f6;color:#374151;border:1px solid #e5e7eb}.modal-card-wide{width:min(920px,100%)}.upgrade-section{margin-top:18px;border:1px solid var(--line);border-radius:20px;padding:16px;background:#fafbfc}.section-title{font-size:12px;text-transform:uppercase;letter-spacing:.06em;color:#818898;font-weight:950;margin-bottom:12px}.upgrade-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.upgrade-option{display:flex;align-items:center;gap:9px;padding:10px 11px;border:1px solid var(--line);border-radius:14px;background:#fff;font-weight:800;font-size:14px}.upgrade-option input{width:auto;flex:0 0 auto;margin:0}.logs-list{display:flex;flex-direction:column;gap:10px}.log-item{border:1px solid var(--line);border-radius:18px;padding:14px;background:#fff}.log-meta{display:flex;justify-content:space-between;gap:10px;color:var(--muted);font-size:13px}.log-meta strong{color:var(--ink)}.log-action{margin-top:8px;font-weight:950;color:var(--red)}.log-values{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:10px}.log-values>div{border:1px solid #eef0f4;border-radius:14px;padding:10px;background:#fafbfc;min-width:0}.log-values span{display:block;font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:#818898;font-weight:950;margin-bottom:5px}.log-values p{margin:0;white-space:pre-wrap;word-break:break-word}.empty-logs,.loading-row{border:1px dashed var(--line);border-radius:18px;padding:18px;color:var(--muted);text-align:center;background:#fafbfc}.filter-option{min-width:0}.filter-option span{word-break:normal;overflow-wrap:anywhere}
@media(max-width:900px){.upgrade-grid{grid-template-columns:1fr}.log-values{grid-template-columns:1fr}.log-meta{flex-direction:column}.table-wrap table{min-width:1000px}}


/* ===== UI patch: mobiel menu, kaart-topbar, popup close, compacte upgrades ===== */
.floating-menu-toggle,
.sidebar-close,
.sidebar-overlay{display:none}

body.view-map .topbar{display:none}
body.view-table .topbar{display:flex}
body.view-map .table-view{padding-top:16px}

.leaflet-popup-close-button{
  top:10px!important;
  right:10px!important;
  width:34px!important;
  height:34px!important;
  border-radius:999px!important;
  background:rgba(255,255,255,.96)!important;
  color:var(--red)!important;
  border:1px solid rgba(225,29,46,.18)!important;
  box-shadow:0 10px 24px rgba(15,23,42,.24)!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  font-size:24px!important;
  font-weight:950!important;
  line-height:1!important;
  text-decoration:none!important;
  z-index:10!important;
}
.leaflet-popup-close-button:hover{
  background:var(--red)!important;
  color:#fff!important;
  border-color:var(--red)!important;
}

.table-wrap table{min-width:980px;table-layout:fixed}
th,td{overflow:visible}
th:nth-child(1),td:nth-child(1){width:90px}
th:nth-child(2),td:nth-child(2){width:170px}
th:nth-child(3),td:nth-child(3){width:130px}
th:nth-child(4),td:nth-child(4){width:150px}
th:nth-child(5),td:nth-child(5){width:100px}
th:nth-child(6),td:nth-child(6){width:150px}
th:nth-child(7),td:nth-child(7){width:150px}
th:nth-child(8),td:nth-child(8){width:230px}

.upgrade-badges{display:none}
.upgrade-summary{
  position:relative;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:96px;
  border-radius:999px;
  padding:7px 11px;
  background:#f3f4f6;
  color:#374151;
  border:1px solid #e5e7eb;
  font-size:12px;
  font-weight:950;
  cursor:help;
  white-space:nowrap;
}
.upgrade-summary::after{
  content:attr(data-tooltip);
  position:absolute;
  left:50%;
  bottom:calc(100% + 10px);
  transform:translateX(-50%) translateY(4px);
  width:max-content;
  max-width:260px;
  white-space:pre-line;
  background:#111827;
  color:#fff;
  border-radius:14px;
  padding:10px 12px;
  box-shadow:0 16px 40px rgba(15,23,42,.24);
  font-size:12px;
  line-height:1.45;
  font-weight:750;
  opacity:0;
  pointer-events:none;
  transition:.16s ease;
  z-index:50;
}
.upgrade-summary::before{
  content:"";
  position:absolute;
  left:50%;
  bottom:calc(100% + 4px);
  transform:translateX(-50%);
  border:6px solid transparent;
  border-top-color:#111827;
  opacity:0;
  transition:.16s ease;
  z-index:51;
}
.upgrade-summary:hover::after,
.upgrade-summary:focus::after,
.upgrade-summary:hover::before,
.upgrade-summary:focus::before{
  opacity:1;
  transform:translateX(-50%) translateY(0);
}

@media(max-width:900px){
  .floating-menu-toggle{
    display:flex;
    position:fixed;
    top:12px;
    left:12px;
    z-index:650;
    width:44px;
    height:44px;
    border:0;
    border-radius:14px;
    background:#fff;
    color:var(--red);
    align-items:center;
    justify-content:center;
    font-size:24px;
    font-weight:950;
    box-shadow:0 12px 30px rgba(20,24,33,.18);
  }
  body.sidebar-is-open .floating-menu-toggle{display:none}
  body.view-table .floating-menu-toggle{display:none}
  body.view-map .topbar{display:none}
  body.view-table .topbar{display:flex}
  .sidebar{z-index:999999;padding-top:58px}
  .sidebar-close{
    display:flex;
    position:absolute;
    top:12px;
    right:12px;
    width:38px;
    height:38px;
    border:1px solid #fecdd3;
    border-radius:13px;
    background:#fff;
    color:var(--red);
    align-items:center;
    justify-content:center;
    font-size:26px;
    font-weight:950;
    cursor:pointer;
    box-shadow:0 8px 18px rgba(225,29,46,.13);
  }
  .sidebar-overlay.visible{
    display:block;
    position:fixed;
    inset:0;
    z-index:700;
    background:rgba(15,23,42,.32);
    backdrop-filter:blur(3px);
  }
  .menu-toggle{display:flex;align-items:center;justify-content:center;color:var(--red);font-weight:950}
  .table-wrap table{min-width:930px}
  th:nth-child(n),td:nth-child(n){width:auto}
  th:nth-child(8),td:nth-child(8){width:220px}
}

/* ===== Bugfix: perfect ronde Leaflet popup sluitknop ===== */
.leaflet-popup a.leaflet-popup-close-button,
.leaflet-popup-close-button{
  top:10px!important;
  right:10px!important;
  width:36px!important;
  height:36px!important;
  min-width:36px!important;
  max-width:36px!important;
  min-height:36px!important;
  max-height:36px!important;
  padding:0!important;
  margin:0!important;
  border-radius:50%!important;
  background:rgba(255,255,255,.98)!important;
  border:1px solid rgba(225,29,46,.22)!important;
  box-shadow:0 10px 24px rgba(15,23,42,.28)!important;
  display:grid!important;
  place-items:center!important;
  text-align:center!important;
  line-height:36px!important;
  font-size:0!important;
  font-weight:900!important;
  text-decoration:none!important;
  z-index:20!important;
  overflow:hidden!important;
}

.leaflet-popup a.leaflet-popup-close-button::before,
.leaflet-popup-close-button::before{
  content:'×';
  display:block;
  width:36px;
  height:36px;
  color:var(--red)!important;
  font-size:27px!important;
  font-weight:950!important;
  line-height:33px!important;
  text-align:center!important;
  transform:translateY(-1px);
}

.leaflet-popup a.leaflet-popup-close-button span,
.leaflet-popup-close-button span{
  display:none!important;
}

.leaflet-popup a.leaflet-popup-close-button:hover,
.leaflet-popup-close-button:hover{
  background:var(--red)!important;
  border-color:var(--red)!important;
}

.leaflet-popup a.leaflet-popup-close-button:hover::before,
.leaflet-popup-close-button:hover::before{
  color:#fff!important;
}

.field-attention input,
.field-attention select{
  border-color:rgba(225,29,46,.35)!important;
  box-shadow:0 0 0 4px rgba(225,29,46,.08)!important;
}

@media(max-width: 900px) {
.leaflet-top {
	top: unset !important;
	bottom: 20px !important;
	}
}
