.hidden{display:none !important;}
* { box-sizing: border-box; }
:root{
  --bg:#eef2f7;
  --card:#ffffff;
  --muted:#6b7280;
  --border:rgba(0,0,0,0.12);
  --shadow: 0 12px 40px rgba(0,0,0,0.12);
  --shadow2: 0 8px 24px rgba(0,0,0,0.14);
}

body{
  margin:0;
  font-family:"Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color:#111827;
}

/* Topbar */
.topbar{
  height:56px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:0 14px;
  background:#1f2937;
  color:#fff;
}
.topbar-left{ display:flex; align-items:center; gap:10px; }
.topbar-right{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }

.iconBtn{
  width:38px; height:38px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,0.18);
  background:rgba(255,255,255,0.08);
  color:#fff;
  cursor:pointer;
  font-size:18px;
}
.iconBtn:hover{ filter:brightness(1.06); }

.brandName{
  font-size:18px;
  font-weight:800;
}

/* App layout */
.app{
  display:grid;
  grid-template-columns: 320px 1fr;
  gap:12px;
  padding:12px;
  height: calc(100vh - 56px - 46px);
}

/* Sidebar */
.sidebar{
  background: var(--card);
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow: var(--shadow);
  overflow:hidden;
}
.panel{
  height:100%;
  overflow:auto;
  padding:12px;
}
.panelSection{
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
  margin-bottom:12px;
  background:#fbfdff;
}
.sectionTitle{
  font-weight:800;
  margin-bottom:10px;
}
.field{ margin-bottom:10px; }
.field label{
  display:block;
  font-size:12px;
  color: var(--muted);
  margin-bottom:6px;
}
.field input[type="text"]{
  width:100%;
  padding:10px 10px;
  border-radius:12px;
  border:1px solid var(--border);
  outline:none;
  background:#fff;
}
.field input[type="number"]{
  width:100%;
  padding:10px 10px;
  border-radius:12px;
  border:1px solid var(--border);
  outline:none;
  background:#fff;
}
.field input[type="color"]{
  width:100%;
  height:40px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#fff;
  padding:4px;
}


.addCustomRoleBtn{
  margin-top:8px;
}

.row{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:14px;
  color:#111827;
  margin-bottom:8px;
}

.hint{
  font-size:12px;
  color:#374151;
  background:#fff;
  border:1px dashed rgba(0,0,0,0.18);
  border-radius:12px;
  padding:10px;
  line-height:1.35;
}

/* Buttons */
.btn{
  border:1px solid var(--border);
  background:#fff;
  border-radius:12px;
  padding:10px 12px;
  cursor:pointer;
  font-size:14px;
}
.btn:hover{ filter:brightness(0.98); }
.btn.primary{
  border-color: rgba(59,130,246,0.55);
  background: rgba(59,130,246,0.10);
}
.btn.danger{
  border-color: rgba(176,0,32,0.35);
  background: rgba(176,0,32,0.06);
}
.btn.ghost{ background: transparent; }
.btn.wide{ width:100%; }
.btn.small{ padding:8px 10px; border-radius:10px; font-size:13px; }

.pageActions{
  display:flex;
  gap:8px;
  margin-bottom:10px;
}

/* icon/tag pickers */
.iconRow, .tagRow{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.chipBtn, .tagBtn{
  border:1px solid var(--border);
  background:#fff;
  border-radius:999px;
  padding:7px 10px;
  cursor:pointer;
  font-size:13px;
}
.chipBtn.active, .tagBtn.active{
  border-color: rgba(59,130,246,0.55);
  background: rgba(59,130,246,0.10);
}
.chipBtn img{
  width:18px;
  height:18px;
  display:block;
}
.chipBtn.customIconActive{
  border-style:dashed;
}

/* stage size row */
.sizeRow{
  display:flex;
  gap:8px;
  align-items:center;
}
.sizeBox{
  display:flex;
  align-items:center;
  gap:6px;
  flex: 1 1 auto;
}
.sizeBox span{
  font-size:12px;
  color: var(--muted);
  min-width: 14px;
}
.sizeHint{
  font-size:12px;
  color:#6b7280;
  margin-top:6px;
}

/* page list */
.pageList{ display:flex; flex-direction:column; gap:10px; }
.page-item{
  border:1px solid var(--border);
  background:#fff;
  border-radius:14px;
  padding:10px;
  cursor:pointer;
}
.page-item.active{
  border-color: rgba(59,130,246,0.55);
  background: rgba(59,130,246,0.08);
}
.page-header{
  display:flex;
  gap:8px;
  align-items:center;
}
.page-item input{
  flex:1 1 auto;
  border:0;
  outline:none;
  background:transparent;
  font-weight:800;
}
.page-item button{
  border:1px solid var(--border);
  background:#fff;
  border-radius:10px;
  padding:6px 10px;
  cursor:pointer;
}
.page-preview{
  width:100%;
  height:120px;
  border-radius:12px;
  margin-top:10px;
  border:1px solid var(--border);
  background:#e5e7eb;
}

/* pills */
.pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  border:1px solid var(--border);
  background:#fff;
  border-radius:999px;
  padding:8px 10px;
  font-size:12px;
  color:#111827;
}
.pill.ok{ border-color: rgba(46,160,67,0.45); }
.statusRow{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:8px;
}

/* Main stage */
.main{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:10px;
}
.stageTitle{
  align-self:center;
  width:min(640px, 96%);
  padding:12px 12px;
  border-radius:14px;
  border:1px solid var(--border);
  background:#fff;
  font-size:16px;
  font-weight:800;
  text-align:center;
  outline:none;
}

.stage{
  flex:1 1 auto;
  position:relative;
  border-radius:18px;
  border:2px solid rgba(0,0,0,0.18);
  background:#d1d5db;
  overflow:hidden;
  box-shadow: var(--shadow2);
  min-height: 640px;
  touch-action: none;
  overscroll-behavior: contain;
}

.ownerLivePanel{
  position:absolute;
  top:12px;
  right:12px;
  width: min(320px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  overflow:auto;
  z-index:7;
  border:1px solid rgba(15,23,42,0.12);
  border-radius:14px;
  padding:12px;
  background: rgba(255,255,255,0.94);
  box-shadow: 0 8px 24px rgba(15,23,42,0.18);
  backdrop-filter: blur(2px);
}

.ownerKeyRow{
  display:flex;
  gap:8px;
  margin-bottom:8px;
}

.ownerKeyInput{
  flex:1;
  min-width:0;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid rgba(15,23,42,0.16);
  background:#fff;
}


.teamMemberRow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}

.teamMemberMeta{display:flex;flex-direction:column;min-width:0;}
.teamMemberEmail{font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.teamMemberRole{font-size:12px;color:#6b7280;}
.teamRoleToggleBtn{flex:0 0 auto; white-space:nowrap;}



/* IMPORTANT: world now has real size set by JS */
.stageViewport{
  position:absolute;
  left:0; top:0;
  transform-origin:0 0;
  will-change: transform;
  touch-action: none;
}

/* Background image layer */
.bgLayer{
  position:absolute;
  inset:0;
  background-position:center;
  background-size: cover;
  background-repeat:no-repeat;
  filter: saturate(1.02) contrast(1.02);
}

/* Grid */
.gridOverlay{
  position:absolute;
  inset:0;
  pointer-events:none;
  opacity:0.35;
}

/* Center line */
.centerLine{
  position:absolute;
  bottom:0;
  left:50%;
  width:10px;
  height:70px;
  transform:translateX(-50%);
  border-radius:10px;
  background: rgba(0,0,0,0.35);
}

/* Person bubble */
.person{
  width:64px;
  height:64px;
  border-radius:999px;
  position:absolute;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  user-select:none;
  cursor:grab;

  background: rgba(255,255,255,0.92);
  box-shadow: 0 10px 24px rgba(0,0,0,0.20);
  border: 3px solid rgba(59,130,246,0.9);
  color:#111827;
  touch-action: none;
  -webkit-user-select: none;
}
.person.dragging{ opacity:0.82; cursor:grabbing; }

/* selected */
.person.selected{
  box-shadow: 0 0 0 4px rgba(59,130,246,0.25), 0 10px 24px rgba(0,0,0,0.20);
  outline: 2px solid rgba(59,130,246,0.75);
  outline-offset: 2px;
}

.person .pIcon{
  font-size:18px;
  line-height:18px;
  margin-bottom:2px;
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:18px;
}
.person .pIcon img{
  width:18px;
  height:18px;
  object-fit:contain;
  background: transparent;
  mix-blend-mode: multiply;
}
.person .pName{
  font-size:10px;
  font-weight:800;
  text-align:center;
  padding:0 5px;
  line-height:1.1;
  max-width:54px;
  white-space:normal;
  overflow-wrap:anywhere;
}
.person .pTag{
  margin-top:3px;
  font-size:10px;
  color: #6b7280;
}

/* smart align guide lines */
.guideLine{
  position:absolute;
  background: rgba(59,130,246,0.85);
  pointer-events:none;
  z-index: 50;
}
.guideLine.hidden{ display:none; }
.guideLine.v{ width:2px; top:0; bottom:0; }
.guideLine.h{ height:2px; left:0; right:0; }

/* selection box */
.selectionBox{
  position:absolute;
  border: 2px dashed rgba(59,130,246,0.9);
  background: rgba(59,130,246,0.12);
  border-radius: 10px;
  pointer-events:none;
  z-index: 100;
}
.selectionBox.hidden{ display:none; }

/* Context menu */
.context-menu{
  position:absolute;
  z-index:999;
  min-width:190px;
  background:#fff;
  border:1px solid rgba(0,0,0,0.14);
  border-radius:14px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.22);
  padding:8px;
}
.context-menu.hidden{ display:none; }

.cm-item{
  width:100%;
  text-align:left;
  border:0;
  border-radius:12px;
  background:transparent;
  padding:10px 10px;
  cursor:pointer;
  font-size:14px;
}
.cm-item:hover{ background: rgba(0,0,0,0.06); }
.cm-item.danger{ color:#b00020; }
.cm-item.danger:hover{ background: rgba(176,0,32,0.10); }
.cm-sep{
  height:1px;
  background: rgba(0,0,0,0.10);
  margin:6px 6px;
}
.cm-color-input{
  position:absolute;
  opacity:0;
  pointer-events:none;
  width:0; height:0;
}

/* Sidebar toggle */
.sidebar.hidden { display:none; }
.app.sidebarHidden { grid-template-columns: 1fr; }

/* ===== Modal ===== */
.modal.hidden{ display:none; }
.modal{
  position: fixed;
  inset: 0;
  z-index: 99998;
}
.modalBackdrop{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,0.45);
}
.modalCard{
  position:absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 24px));
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.14);
  border-radius: 16px;
  box-shadow: 0 22px 70px rgba(0,0,0,0.35);
  overflow: hidden;
}
.modalHeader{
  padding: 14px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.10);
  background: #f9fafb;
}
.modalTitle{
  font-weight: 900;
  font-size: 16px;
}
.modalBody{
  padding: 14px;
}
.modalLabel{
  display:block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.modalInput{
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.18);
  outline: none;
  font-size: 14px;
}
.modalFooter{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  padding: 14px;
  border-top: 1px solid rgba(0,0,0,0.10);
  background: #f9fafb;
}
.modalHint{
  padding: 0 14px 12px 14px;
  font-size: 12px;
  color: #6b7280;
}

/* ===== Error Overlay ===== */
.errorOverlay{
  position: fixed;
  top: 12px;
  right: 12px;
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  z-index: 99999;

  background: #111827;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 16px;
  box-shadow: 0 22px 60px rgba(0,0,0,0.35);
}
.errorOverlay.hidden{ display:none; }

.errorHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 12px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  position: sticky;
  top: 0;
  background: #111827;
}
.errorTitle{
  font-weight: 900;
  font-size: 14px;
  color: #fca5a5;
}
.errorBtns{ display:flex; gap: 8px; }
.errBtn{
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  color: #fff;
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 13px;
}
.errBtn:hover{ filter: brightness(1.08); }

.errorText{
  padding: 12px;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.35;
}


/* ===== Footer (Impressum/Datenschutz) ===== */
.legalFooter{
  height:46px;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0 12px;
  background: rgba(255,255,255,0.65);
  border-top: 1px solid rgba(0,0,0,0.10);
  backdrop-filter: blur(8px);
}
.legalInner{
  width: min(1180px, 100%);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.legalLinks, .legalMeta{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.linkBtn{
  border:0;
  background:transparent;
  cursor:pointer;
  padding:6px 6px;
  border-radius:10px;
  font-size:13px;
  font-weight:800;
  color:#0f172a;
}
.linkBtn:hover{ background: rgba(0,0,0,0.06); }
.dot{ color: rgba(15,23,42,0.45); }
.muted{ color: rgba(15,23,42,0.60); font-size:12px; font-weight:700; }

/* Larger + scrollable modal for legal text */
.modalCard.large{
  width: min(860px, calc(100vw - 24px));
}
.modalBody.scroll{
  max-height: 70vh;
  overflow: auto;
}
.legalText{
  color:#111827;
  font-size:14px;
  line-height:1.55;
}
.legalText h3{
  margin: 14px 0 6px 0;
  font-size:14px;
  font-weight:900;
}
.legalText p{ margin: 8px 0; }
.legalText ul{ margin: 8px 0 8px 18px; }
.legalText hr{
  border:0;
  height:1px;
  background: rgba(0,0,0,0.10);
  margin: 14px 0;
}

/* ===== Share / Read-only ===== */
.readOnlyBanner{
  position: sticky;
  top: 56px;
  z-index: 20;
  display:flex;
  gap:12px;
  align-items:center;
  justify-content:space-between;
  padding:10px 14px;
  background: rgba(15,23,42,0.96);
  color:#fff;
  border-bottom:1px solid rgba(255,255,255,0.12);
}
.readOnlyBanner .robText{font-weight:700;}
.toast{
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 50;
  background: rgba(15,23,42,0.92);
  color:#fff;
  padding:10px 14px;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
  max-width: 92vw;
}

/* ===== Mobile / Tablet ===== */
@media (max-width: 980px){
  .topbar{height:auto;flex-wrap: wrap; gap:10px; padding:10px;}
  .topbar-left,
  .topbar-right{width:100%;}
  .topbar-right{
    overflow-x:auto;
    flex-wrap:nowrap;
    padding-bottom:2px;
  }
  .topbar-right .btn,
  .topbar-right .pill{flex:0 0 auto;}
  .topbar-right{gap:8px;}
  .btn{padding:10px 12px;}
  .sidebar{
    position: fixed;
    left: 0;
    top: 56px;
    bottom: 0;
    width: min(92vw, 360px);
    transform: translateX(-110%);
    transition: transform .18s ease;
    z-index: 40;
    border-right: 1px solid rgba(0,0,0,0.10);
  }
  .sidebar:not(.hidden){transform: translateX(0);}
  .app{grid-template-columns: 1fr;}
  .stageWrap{padding:10px;}
}

@media (max-width: 520px){
  .brandName{font-size: 14px;}
  .btn{font-size: 13px; padding:10px 10px;}
  .pill{font-size:12px;}
  .page-preview{width: 100%;}
  .sizeRow{flex-wrap:wrap;}
  .sizeBox{min-width:120px;}
  .sizeRow .btn.small{width:100%;}
}


/* Paket E1: SelfCheck Badge */
.selfcheck-badge{position:fixed;right:12px;bottom:12px;z-index:9999;padding:8px 10px;border-radius:999px;font-weight:700;font-size:12px;letter-spacing:.2px;box-shadow:0 8px 20px rgba(0,0,0,.18);user-select:none;cursor:pointer}
.selfcheck-badge.ok{background:rgba(16,185,129,.92);color:#062b22}
.selfcheck-badge.bad{background:rgba(239,68,68,.92);color:#2a0707}

/* SelfCheck detail panel */
.selfcheck-panel{position:fixed;right:12px;bottom:52px;z-index:10000;width:min(360px,calc(100vw - 24px));background:rgba(255,255,255,.97);backdrop-filter:blur(8px);border:1px solid rgba(15,23,42,.14);border-radius:14px;box-shadow:0 18px 50px rgba(0,0,0,.18);padding:10px 12px;color:#0f172a}
.selfcheck-panel.hidden{display:none !important;}
.selfcheck-panel .scp-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px}
.selfcheck-panel .scp-title{font-weight:900;font-size:13px;letter-spacing:.2px}
.selfcheck-panel .scp-close{border:none;background:transparent;font-size:18px;line-height:1;cursor:pointer;color:rgba(15,23,42,.7)}
.selfcheck-panel .scp-list{max-height:220px;overflow:auto;padding:0;margin:0;list-style:none}
.selfcheck-panel .scp-item{display:flex;gap:8px;align-items:flex-start;padding:6px 0;border-top:1px dashed rgba(15,23,42,.12)}
.selfcheck-panel .scp-item:first-child{border-top:none}
.selfcheck-panel .scp-item .scp-dot{width:18px;flex:0 0 18px;text-align:center}
.selfcheck-panel .scp-item .scp-key{font-weight:800;font-size:12px}
.selfcheck-panel .scp-item .scp-det{font-size:12px;color:rgba(15,23,42,.7)}
@media (max-width:640px){.selfcheck-badge{right:10px;bottom:10px}}


/* ===== Paket B/C UI ===== */
.hidden { display: none !important; }

.dropdown { position: relative; display: inline-block; }
.dropdownMenu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 160px;
  background: #fff;
  border: 1px solid rgba(15,23,42,0.12);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  padding: 8px;
  z-index: 50;
}
.dropdownMenu .menuItem{
  width: 100%;
  text-align: left;
  padding: 10px 10px;
  border: 0;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
}
.dropdownMenu .menuItem:hover{
  background: rgba(59,130,246,0.10);
}

.pillCheck{
  display:flex; align-items:center; gap:8px;
  padding: 8px 10px;
  border: 1px solid rgba(15,23,42,0.12);
  border-radius: 999px;
  background:#fff;
  cursor:pointer;
  user-select:none;
}
.pillCheck input{ accent-color:#3b82f6; }

.select{
  width:100%;
  padding:10px 12px;
  border-radius: 12px;
  border:1px solid rgba(15,23,42,0.16);
  background:#fff;
}

.legendPanel{ max-height: 220px; overflow:auto; border:1px solid rgba(15,23,42,0.10); border-radius:12px; padding:8px; background: rgba(255,255,255,0.6); }
.legendItem{ display:flex; align-items:center; gap:10px; padding:8px; border-radius:10px; cursor:pointer; }
.legendItem:hover{ background: rgba(15,23,42,0.06); }
.legendDot{ width:14px; height:14px; border-radius:50%; border:3px solid #3b82f6; background:#fff; flex:0 0 auto; }
.legendText{ display:flex; flex-direction:column; line-height:1.1; }
.legendName{ font-weight:800; font-size:13px; color:#0f172a; }
.legendMeta{ font-size:12px; color: rgba(15,23,42,0.65); }

.shareViewerList{
  max-height: 160px;
  overflow:auto;
  border:1px solid rgba(15,23,42,0.10);
  border-radius:12px;
  padding:6px;
  background: rgba(255,255,255,0.6);
}
.shareViewerItem{ 
  font-size:12px;
  color:#0f172a;
  padding:6px 8px;
  border-radius:8px;
}
.shareViewerItem + .shareViewerItem{
  margin-top:4px;
}
.shareViewerItem:nth-child(odd){
  background: rgba(15,23,42,0.04);
}
.shareViewerName{ font-weight:700; }
.shareViewerTime{ color: rgba(15,23,42,0.65); margin-left:6px; }

.person .lockBadge{
  position:absolute;
  right:-6px; top:-6px;
  width:22px; height:22px;
  border-radius:999px;
  background:#0f172a;
  color:#fff;
  display:flex; align-items:center; justify-content:center;
  font-size:12px;
  border:2px solid #fff;
}

.note{
  position:absolute;
  min-width: 120px;
  max-width: 220px;
  padding:10px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.95);
  border: 2px solid rgba(15,23,42,0.14);
  box-shadow: 0 10px 20px rgba(0,0,0,0.12);
  font-size: 12px;
  color:#0f172a;
}
.note::before{
  content:"";
  position:absolute;
  left: 14px;
  bottom:-8px;
  width: 14px;
  height: 14px;
  background: rgba(255,255,255,0.95);
  border-left:2px solid rgba(15,23,42,0.14);
  border-bottom:2px solid rgba(15,23,42,0.14);
  transform: rotate(45deg);
}


/* ===== StageMap Website-style header for Web App (non-invasive) ===== */
.sm-topbar{
  position:fixed;
  top:0; left:0; right:0;
  height:66px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 16px;
  background:#ffffff;
  border-bottom:1px solid #e5e7eb;
  z-index:9999;
}
.sm-brand{display:flex;align-items:center;gap:12px}
.sm-logo{
  width:42px;height:42px;
  border-radius:12px;
  background:linear-gradient(135deg,#2563eb,#38bdf8);
  color:#fff;
  display:flex;align-items:center;justify-content:center;
  font-weight:900;
  letter-spacing:.2px;
  user-select:none;
}
.sm-logoImg{
  width:42px;
  height:42px;
  border-radius:12px;
  display:block;
  object-fit:cover;
}
.sm-brandText strong{display:block;font-family:inherit;font-weight:800;color:#0f172a}
.sm-brandText span{display:block;font-size:12px;color:#64748b;font-weight:500}
.sm-nav{display:flex;gap:14px;align-items:center;flex-wrap:wrap;justify-content:flex-end}
.sm-nav a{
  text-decoration:none;
  font-weight:600;
  color:#334155;
  padding:9px 12px;
  border-radius:10px;
}
.sm-nav a:hover{background:#f1f5f9}
/* push app UI down so nothing is hidden under header */
body{padding-top:66px !important;}
/* legal footer */
.sm-legalFooter{
  position:fixed;
  right:14px;
  bottom:14px;
  display:flex;
  gap:10px;
  align-items:center;
  padding:10px 12px;
  border-radius:14px;
  background:rgba(255,255,255,0.92);
  border:1px solid rgba(15,23,42,0.10);
  box-shadow:0 8px 26px rgba(0,0,0,0.10);
  backdrop-filter: blur(10px);
  font-size:12px;
  color:#64748b;
  z-index:9999;
}
.sm-legalFooter a{color:#475569;text-decoration:none;font-weight:600}
.sm-legalFooter a:hover{text-decoration:underline}
@media (max-width: 720px){
  .sm-topbar{height:auto; padding:10px 12px; gap:10px; flex-wrap:wrap}
  .sm-nav{width:100%; justify-content:flex-start;}
  .sm-nav a{padding:8px 10px;}
  body{padding-top:112px !important;}
}

/* Portal */
.portalBody{
  min-height:100vh;
  background:#f8fafc;
}
.portalWrap{
  max-width:900px;
  margin:24px auto 60px;
  display:grid;
  gap:14px;
  padding:0 14px;
}
.portalCard{
  background:#fff;
  border:1px solid rgba(15,23,42,0.12);
  border-radius:16px;
  padding:16px;
  box-shadow:0 8px 30px rgba(15,23,42,0.08);
}
.portalCard h2{ margin:0 0 10px; font-size:20px; }
.portalStatus{
  display:inline-block;
  border:1px solid rgba(15,23,42,0.16);
  border-radius:999px;
  padding:8px 12px;
  font-size:13px;
  margin-bottom:10px;
}
.portalStatus.ok{ border-color:rgba(34,197,94,0.5); background:rgba(34,197,94,0.08); }
.portalStatus{line-height:1.4;max-width:100%;}
.portalActions .btn[disabled]{opacity:0.6;cursor:not-allowed;}
.portalActions{ display:flex; gap:8px; flex-wrap:wrap; }
.portalMuted{ color:#64748b; margin:6px 0 10px; }
.portalHint{ color:#64748b; font-size:12px; margin-top:10px; }
.portalEmailRow{ display:flex; gap:8px; flex-wrap:wrap; }
.portalEmailInput{
  flex:1 1 260px;
  border:1px solid rgba(15,23,42,0.2);
  border-radius:12px;
  padding:10px 12px;
  font-size:14px;
}
.portalCodeList{ list-style:none; margin:0; padding:0; display:grid; gap:8px; }
.portalCodeList li{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  border:1px solid rgba(15,23,42,0.12);
  border-radius:10px;
  padding:10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size:13px;
}
.portalCodeList small{
  font-family: "Segoe UI", Arial, sans-serif;
  color:#64748b;
  font-size:12px;
}
.portalCodeList li .btn.small{margin-left:auto;}

@media (max-width: 860px){
  .portalWrap{margin-top:16px;}
  .portalCard{padding:14px;}
}

@media (max-width: 640px){
  .portalCard h2{font-size:18px;}
  .portalActions .btn,
  .portalEmailRow .btn,
  .portalEmailInput,
  .portalEmailRow select{
    width:100%;
    max-width:100% !important;
    flex:1 1 100% !important;
  }
  .portalCodeList li{
    align-items:flex-start;
    flex-direction:column;
  }
  .portalCodeList li .btn.small{margin-left:0;}
}

/* Cookie Consent */
.cookieBanner{
  position:fixed;
  left:16px;
  right:16px;
  bottom:16px;
  background:#ffffff;
  border:1px solid rgba(15,23,42,0.16);
  border-radius:14px;
  box-shadow:0 12px 36px rgba(15,23,42,0.2);
  padding:14px;
  display:flex;
  gap:12px;
  align-items:flex-end;
  justify-content:space-between;
  z-index:10001;
}
.cookieBanner__text{max-width:760px;}
.cookieBanner__text strong{display:block;margin-bottom:4px;font-size:15px;color:#0f172a;}
.cookieBanner__text p{margin:0 0 8px;color:#334155;font-size:13px;line-height:1.4;}
.cookieBanner__text a{color:#1d4ed8;font-size:13px;font-weight:600;text-decoration:none;}
.cookieBanner__text a:hover{text-decoration:underline;}
.cookieBanner__actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end;}

.cookieSettingsFab{
  position:fixed;
  bottom:16px;
  left:16px;
  z-index:10000;
  border:1px solid rgba(15,23,42,0.16);
  background:#fff;
  color:#0f172a;
  border-radius:999px;
  padding:9px 12px;
  font-size:12px;
  font-weight:700;
  box-shadow:0 8px 22px rgba(15,23,42,0.15);
  cursor:pointer;
}

.cookieModal{
  position:fixed;
  inset:0;
  z-index:10002;
}
.cookieModal__backdrop{
  position:absolute;
  inset:0;
  background:rgba(15,23,42,0.5);
}
.cookieModal__card{
  position:relative;
  margin:80px auto;
  width:min(680px, calc(100% - 24px));
  background:#fff;
  border-radius:16px;
  border:1px solid rgba(15,23,42,0.12);
  box-shadow:0 20px 50px rgba(15,23,42,0.35);
  padding:16px;
}
.cookieModal__card h3{margin:0 0 8px;font-size:22px;color:#0f172a;}
.cookieModal__intro{margin:0 0 12px;color:#475569;font-size:14px;}
.cookieToggle{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  border:1px solid rgba(15,23,42,0.12);
  border-radius:12px;
  padding:10px;
  margin-bottom:8px;
}
.cookieToggle strong{display:block;color:#0f172a;font-size:14px;margin-bottom:3px;}
.cookieToggle small{color:#64748b;font-size:12px;line-height:1.4;display:block;}
.cookieToggle input{margin-top:4px;}
.cookieToggle.is-locked{background:#f8fafc;}
.cookieModal__actions{display:flex;gap:8px;justify-content:flex-end;flex-wrap:wrap;margin-top:12px;}

@media (max-width: 860px){
  .cookieBanner{flex-direction:column;align-items:stretch;}
  .cookieBanner__actions{justify-content:flex-start;}
}
@media (max-width: 720px){
  .cookieSettingsFab{bottom:84px;}
}

/* Dark mode */
body.dark{
  --bg:#0b1220;
  --card:#111827;
  --muted:#9ca3af;
  --border:rgba(148,163,184,0.30);
  color:#e5e7eb;
}

body.dark .sm-topbar,
body.dark .topbar{
  background:#030712;
}

body.dark .panelSection,
body.dark .stageTitle,
body.dark .btn,
body.dark .pill,
body.dark .chipBtn,
body.dark .tagBtn,
body.dark .select,
body.dark select,
body.dark .field input[type="text"],
body.dark .field input[type="number"],
body.dark .field input[type="color"],
body.dark .page-item,
body.dark .page-item button,
body.dark .hint,
body.dark .ownerLivePanel,
body.dark .ownerKeyInput,
body.dark .legendPanel{
  background:#0f172a;
  color:#e5e7eb;
}

body.dark .field label,
body.dark .sectionTitle,
body.dark .legendName,
body.dark .page-item input,
body.dark .sm-brandText strong,
body.dark .sm-brandText span,
body.dark .sm-nav a{
  color:#e5e7eb;
}

body.dark .sm-nav a:hover{
  background:rgba(148,163,184,0.16);
}

body.dark .chipBtn,
body.dark .tagBtn,
body.dark .pill,
body.dark .btn,
body.dark .page-item button,
body.dark select,
body.dark .select{
  border-color:rgba(148,163,184,0.45);
}

body.dark .chipBtn[data-icon^="builtin:"] img,
body.dark .person .pIcon img.builtinIcon{
  filter: brightness(0) invert(1);
  mix-blend-mode: screen;
}

body.dark .stage{
  background:#1f2937;
  border-color:rgba(148,163,184,0.4);
}

body.dark .sizeHint,
body.dark .row,
body.dark .legendMeta,
body.dark .teamMemberRole,
body.dark .person .pTag{
  color:#9ca3af;
}

body.dark .page-preview{
  background:#1f2937;
}
