/* Visual editor — manager-only no-code typography tuning */
.visual-editor-panel{
  position:fixed;
  z-index:260;
  top:18px;
  right:18px;
  width:min(360px,calc(100vw - 28px));
  max-height:calc(100dvh - 36px);
  overflow:auto;
  display:grid;
  gap:12px;
  padding:15px;
  border:1px solid var(--panel-border);
  border-radius:18px;
  background:color-mix(in srgb,var(--panel) 96%,#fff 4%);
  color:var(--text);
  box-shadow:0 24px 70px rgba(0,0,0,.32);
  backdrop-filter:blur(18px);
}
.visual-editor-panel[hidden]{display:none!important}
.visual-editor-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
.visual-editor-head>div{display:grid;gap:2px}
.visual-editor-head span{font-size:9px;font-weight:850;letter-spacing:.09em;color:var(--brand)}
.visual-editor-head strong{font-size:20px;line-height:1.05}
.visual-editor-close{
  width:34px;height:34px;border:1px solid var(--panel-border);border-radius:10px;
  background:var(--panel-2);color:var(--text);cursor:pointer;font-size:19px
}
.visual-editor-help{
  padding:10px 11px;border:1px dashed color-mix(in srgb,var(--brand) 45%,var(--panel-border));
  border-radius:11px;color:var(--muted);font-size:11px;line-height:1.35
}
.visual-editor-selected{
  display:grid;gap:3px;padding:9px 10px;border-radius:11px;
  background:color-mix(in srgb,var(--brand) 8%,var(--panel-2));
  border:1px solid color-mix(in srgb,var(--brand) 28%,var(--panel-border))
}
.visual-editor-selected[hidden]{display:none!important}
.visual-editor-selected span{font-size:9px;color:var(--brand);font-weight:850;text-transform:uppercase;letter-spacing:.06em}
.visual-editor-selected strong{font-size:12px;line-height:1.25;max-height:48px;overflow:hidden}
.visual-editor-field{display:grid;gap:5px}
.visual-editor-field>span{font-size:10px;color:var(--muted);font-weight:750}
.visual-editor-field select,.visual-editor-field input{
  width:100%;min-height:38px;padding:8px 9px;border:1px solid var(--panel-border);
  border-radius:10px;background:var(--panel-2);color:var(--text);font:inherit
}
.visual-stepper{display:grid;grid-template-columns:38px minmax(0,1fr) 38px auto;gap:5px;align-items:center}
.visual-stepper button{
  min-height:38px;border:1px solid var(--panel-border);border-radius:10px;
  background:var(--panel-2);color:var(--text);font-size:18px;cursor:pointer
}
.visual-stepper b{font-size:10px;color:var(--muted)}
.visual-editor-actions{display:grid;grid-template-columns:1fr;gap:6px;padding-top:3px}
.visual-editor-danger{color:var(--red)!important}
.visual-editor-status{min-height:16px;font-size:9px;line-height:1.3;color:var(--green)}
.visual-editor-status.is-error{color:var(--red)}

body.visual-editor-active{cursor:crosshair!important}
body.visual-editor-active .app-shell{user-select:none}
body.visual-editor-active [data-visual-editor-hover="1"]{
  outline:2px dashed color-mix(in srgb,var(--brand) 80%,#fff)!important;
  outline-offset:3px!important;
  cursor:crosshair!important
}
body.visual-editor-active [data-visual-editor-selected="1"]{
  outline:3px solid var(--orange)!important;
  outline-offset:4px!important;
  border-radius:4px
}
body.visual-editor-active #visualEditorPanel,
body.visual-editor-active #visualEditorPanel *{
  cursor:auto
}
.settings-page-choice.visual-editor-choice{
  border-color:color-mix(in srgb,var(--violet) 34%,var(--panel-border))
}
.settings-page-choice.visual-editor-choice .settings-page-choice-kicker{color:var(--violet)}

@media(max-width:920px){
  .visual-editor-panel{
    top:auto;right:8px;left:8px;bottom:8px;width:auto;max-height:56dvh;border-radius:16px
  }
}


/* Always-visible build marker at the bottom of Settings. */
.settings-modal{
  grid-template-rows:auto minmax(0,1fr) auto auto;
}
.settings-version-bar{
  min-height:26px;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:7px;
  padding:4px 18px 7px;
  border-top:1px solid color-mix(in srgb,var(--panel-border) 72%,transparent);
  color:var(--muted);
  font-size:9px;
  line-height:1;
  user-select:text;
}
.settings-version-bar strong{
  color:var(--text);
  font-size:10px;
  letter-spacing:.02em;
}
@media(max-width:920px){
  .settings-modal{
    grid-template-rows:auto minmax(0,1fr) auto auto !important;
  }
  .settings-version-bar{
    padding:6px max(12px,env(safe-area-inset-right)) max(7px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));
  }
}


/* Visual save confirmation states */
.visual-editor-actions [data-ve-save]{
  transition:background .18s ease,border-color .18s ease,color .18s ease,transform .18s ease;
}
.visual-editor-actions [data-ve-save].is-saving{
  opacity:.82;
  cursor:progress;
}
.visual-editor-actions [data-ve-save].is-saved{
  background:var(--green,#59d6a9)!important;
  border-color:var(--green,#59d6a9)!important;
  color:#06130e!important;
  transform:scale(1.015);
}
.visual-editor-actions [data-ve-save].is-save-error{
  background:color-mix(in srgb,var(--orange,#f5b14f) 22%,var(--panel-2))!important;
  border-color:var(--orange,#f5b14f)!important;
  color:var(--text)!important;
}
.visual-editor-status{
  min-height:30px;
  display:flex;
  align-items:center;
  padding:7px 9px;
  border-radius:9px;
  background:color-mix(in srgb,var(--green,#59d6a9) 9%,transparent);
  border:1px solid color-mix(in srgb,var(--green,#59d6a9) 22%,transparent);
  font-size:10px;
  font-weight:750;
}
.visual-editor-status.is-error{
  background:color-mix(in srgb,var(--orange,#f5b14f) 9%,transparent);
  border-color:color-mix(in srgb,var(--orange,#f5b14f) 24%,transparent);
}


/* Draggable visual editor panel */
@media(min-width:921px){
  .visual-editor-head[data-ve-drag-handle]{
    cursor:grab;
    user-select:none;
    touch-action:none;
    margin:-6px -6px 0;
    padding:6px;
    border-radius:12px;
  }
  .visual-editor-head[data-ve-drag-handle]:hover{
    background:color-mix(in srgb,var(--brand) 6%,transparent);
  }
  .visual-editor-panel.is-dragging .visual-editor-head[data-ve-drag-handle]{
    cursor:grabbing;
    background:color-mix(in srgb,var(--brand) 10%,transparent);
  }
  .visual-editor-head small{
    margin-top:1px;
    color:var(--muted);
    font-size:8px;
    font-weight:650;
    letter-spacing:0;
  }
}
@media(max-width:920px){
  .visual-editor-head small{display:none}
}


/* Visual editor alignment helpers */
body.visual-editor-active .team-table td[data-metric-key] .metric-value-wrap,
body.visual-editor-active .team-table td[data-metric-key] .deals-total-line{
  transition:none!important;
}
