/* ── DIALOGS ────────────────────────────────────────────────────────────
   One look for every window the app opens over the page, taken from the
   Design inspector's control kit (insp-controls.js, .ic-* in style.css):
   the interface face throughout, sentence-case semibold headings in the
   text colour, quiet grey labels, compact 28px fields with a soft focus
   ring, small switches, hairlines instead of tinted cards.

   It covers the families the app grew separately (2026-10-27):
     .modal          the 13 standard modals (.modal-ttl, .mform, .mbtn)
     #prefs-inner    Preferences window (windows.css makes it a window)
     #doc-settings-inner  Project settings window
     .share-modal    Share
     .setup-box      New project
     .confirm-box    confirm / rename / sign-in prompts
   Every theme gets it; colours come from the theme's own variables.

   The shape of a dialog: a title bar (title left, close × right, hairline
   under it), a body, and the buttons at the bottom right with the main
   action last. Form placeholders take the interface face here, as the
   inspector's fields do; empty-state lines keep the theme's script.

   Kept in its own file so it can be read, and removed, as one piece. */

:root{
  --dlg-r:12px;
  --dlg-shadow:0 24px 64px rgba(0,0,0,.16),0 4px 14px rgba(0,0,0,.08);
  --dlg-edge:color-mix(in srgb,var(--tx) 12%,transparent);
  --dlg-scrim:color-mix(in srgb,#0b0d12 38%,transparent);
  --dlg-field-h:1.875rem;
  --dlg-btn-h:2rem;
}

/* ── the layer under a dialog ── */
:root .modal-wrap,
:root .confirm-overlay,
:root #setup-overlay,
:root #share-panel{background:var(--dlg-scrim)!important;}
:root #doc-settings-panel#doc-settings-panel{background:var(--dlg-scrim);}

/* ── the window ── */
:root .modal,
:root .share-modal,
:root .setup-box,
:root .confirm-box{
  background:var(--sur);
  border:1px solid var(--dlg-edge);
  border-radius:var(--dlg-r);
  box-shadow:var(--dlg-shadow);
  font-family:var(--font-primary);
  color:var(--tx);
}
:root .modal{position:relative;max-height:88vh;}
:root .setup-box{max-height:90vh;}
:root .setup-overlay .setup-box{border-radius:var(--dlg-r);}

/* ── the title bar ── */
:root .modal-ttl,
:root .share-hdr,
:root .setup-hdr,
:root #prefs-inner > .prefs-hdr,
:root #doc-settings-inner > .prefs-hdr{
  display:flex;align-items:center;gap:8px;
  min-height:52px;box-sizing:border-box;
  padding:12px 52px 12px 20px;
  background:var(--sur);
  border-bottom:1px solid var(--br3);
  font-family:var(--font-primary);
  font-size:.9375rem;font-weight:600;
  letter-spacing:0;text-transform:none;
  color:var(--tx);
}
:root .share-hdr,
:root #prefs-inner > .prefs-hdr,
:root #doc-settings-inner > .prefs-hdr{padding-right:12px;}
:root #prefs-inner > .prefs-hdr .prefs-title,
:root #doc-settings-inner > .prefs-hdr .prefs-title,
:root .share-title{
  font-family:var(--font-primary);
  font-size:.9375rem;font-weight:600;
  letter-spacing:0;color:var(--tx);
}
:root #prefs-inner > .prefs-hdr #prefs-version{font-family:var(--font-primary)!important;font-size:.75rem!important;color:var(--txm)!important;margin-right:4px!important;}

/* the close ×: a quiet square icon button, as in the inspector's header */
:root .dlg-x,
:root .share-close,
:root #prefs-inner > .prefs-hdr .prefs-close{
  all:unset;box-sizing:border-box;
  display:inline-flex;align-items:center;justify-content:center;
  width:28px;height:28px;border-radius:7px;
  color:var(--txm);cursor:pointer;flex-shrink:0;
}
:root .dlg-x:hover,
:root .share-close:hover,
:root #prefs-inner > .prefs-hdr .prefs-close:hover{background:var(--bg3);color:var(--tx);}
:root .dlg-x:focus-visible,
:root .share-close:focus-visible,
:root .prefs-close:focus-visible{outline:2px solid var(--accent);outline-offset:-2px;}
:root .dlg-x{position:absolute;top:12px;right:12px;z-index:2;}
:root .dlg-x svg,:root .share-close svg,:root .prefs-close svg{width:14px;height:14px;}

/* ── the body ── */
:root .mform{padding:16px 20px 20px;}
:root .share-body{padding:16px 20px 20px;}
:root .setup-body{padding:18px 20px 20px;}
:root .confirm-box{padding:20px 20px 16px;max-width:400px;}

/* section headings: sentence case, the text colour, no tint */
:root .share-section-lbl,
:root .mopt-group-lbl,
:root .modal .prefs-section-lbl,
:root #prefs-inner .prefs-section-lbl,
:root #doc-settings-inner .prefs-section-lbl{
  font-family:var(--font-primary)!important;
  font-size:.8125rem!important;font-weight:600;
  letter-spacing:0!important;text-transform:none!important;font-style:normal;
  color:var(--tx);
}
:root .share-section-lbl{margin-bottom:8px;}
:root .mopt-group-lbl{padding:12px 20px 6px;border-bottom:none;}

/* field labels: grey, small, sentence case */
:root .mform label,
:root .setup-box .sf label,
:root .modal .di-row > label,
:root .mform-chk span{
  font-family:var(--font-primary);
  font-size:.75rem;font-weight:500;
  letter-spacing:0;text-transform:none;
  color:var(--txd);
  margin-bottom:5px;
}
:root .mform label{margin-top:12px;}
:root .mform label:first-child{margin-top:0;}
:root .setup-box .sf-hint,
:root .confirm-msg{
  font-family:var(--font-primary);
  font-size:.75rem;line-height:1.5;color:var(--txm);
}
:root .confirm-msg{font-size:.8125rem;color:var(--txd);margin-bottom:18px;}
:root .confirm-ttl{
  font-family:var(--font-primary);
  font-size:.9375rem;font-weight:600;
  letter-spacing:0;text-transform:none;
  color:var(--tx);margin-bottom:8px;
}

/* ── fields ── */
:root .mform input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]),
:root .mform select,
:root .mform textarea,
:root .setup-box .sf input,
:root .setup-box .sf select,
:root .setup-box .sf-select,
:root .rename-input,
:root .share-invite-input,
:root .share-invite-role-sel,
:root .img-add-row input,
:root :is(.modal,#prefs-inner,#doc-settings-inner) :is(.st-input,.st-select,.st-dd-btn,.cs-btn){
  box-sizing:border-box;
  min-height:var(--dlg-field-h);
  padding:4px 10px;
  background:var(--sur);
  border:1px solid var(--br);
  border-radius:6px;
  font-family:var(--font-primary)!important;
  font-size:.8125rem!important;font-weight:400;
  letter-spacing:0;text-transform:none;
  color:var(--tx);
  outline:none;
  transition:border-color .12s,box-shadow .12s;
}
:root .mform textarea{min-height:72px;padding:7px 10px;line-height:1.45;}
:root .mform input:hover,:root .mform select:hover,:root .setup-box .sf input:hover,:root .setup-box .sf-select:hover,
:root .share-invite-input:hover,:root .share-invite-role-sel:hover,:root .rename-input:hover,
:root :is(.modal,#prefs-inner,#doc-settings-inner) :is(.st-input,.st-select,.st-dd-btn,.cs-btn):hover{border-color:var(--br2);}
:root .mform :is(input,select,textarea):focus,
:root .setup-box .sf :is(input,select):focus,
:root .setup-box .sf-select:focus-visible,
:root .setup-box .sf-select.cs-open,
:root .rename-input:focus,
:root .share-invite-input:focus,
:root .share-invite-role-sel:focus,
:root :is(.modal,#prefs-inner,#doc-settings-inner) :is(.st-input,.st-select):focus{
  border-color:var(--accent);
  box-shadow:0 0 0 3px var(--accent-faint);
}
/* placeholders take the interface face inside a dialog, as the inspector's do */
:root :is(.modal,.share-modal,.setup-box,.confirm-box,#prefs-inner,#doc-settings-inner) :is(input,textarea)::placeholder{
  font-family:var(--font-primary)!important;
  font-size:1em;font-style:normal!important;
  letter-spacing:0;color:var(--txm);opacity:1;
}

/* steppers: the inspector's number field */
:root :is(.modal,#prefs-inner,#doc-settings-inner) .stp{
  height:var(--dlg-field-h);border-radius:6px;
  border-color:var(--br);background:var(--sur);
}
:root :is(.modal,#prefs-inner,#doc-settings-inner) .stp:hover{border-color:var(--br2);}
:root :is(.modal,#prefs-inner,#doc-settings-inner) .stp:focus-within{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-faint);}
:root :is(.modal,#prefs-inner,#doc-settings-inner) .stp button{width:24px;color:var(--txm);}
:root :is(.modal,#prefs-inner,#doc-settings-inner) .stp button:hover{color:var(--tx);background:var(--bg3);}
:root :is(.modal,#prefs-inner,#doc-settings-inner) .stp input{font-weight:400;font-size:.8125rem!important;font-variant-numeric:tabular-nums;}

/* switches: the inspector's small switch */
:root :is(.modal,.share-modal,#prefs-inner,#doc-settings-inner) .st-toggle-track{width:28px;height:16px;border-radius:8px;background:var(--br2);box-shadow:none;}
:root :is(.modal,.share-modal,#prefs-inner,#doc-settings-inner) .st-toggle-track::after{top:2px;left:2px;width:12px;height:12px;background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.25);}
:root :is(.modal,.share-modal,#prefs-inner,#doc-settings-inner) .st-toggle input:checked+.st-toggle-track::after{background:#fff;}
:root :is(.modal,.share-modal,#prefs-inner,#doc-settings-inner) .st-toggle input:checked+.st-toggle-track{background:var(--accent);}
:root :is(.modal,.share-modal,#prefs-inner,#doc-settings-inner) .st-toggle input:checked+.st-toggle-track::after{transform:translateX(12px);}
:root :is(.modal,.share-modal,#prefs-inner,#doc-settings-inner) .st-toggle input:focus-visible+.st-toggle-track{outline:2px solid var(--accent);outline-offset:2px;}

/* choice rows (Float / alignment): the inspector's segmented control */
:root .img-float-row{gap:2px;padding:2px;border-radius:7px;background:var(--bg3);margin:0 0 12px;}
:root .img-float-btn{
  height:1.625rem;padding:0 6px;border:none;border-radius:5px;background:transparent;
  font-family:var(--font-primary);font-size:.75rem;color:var(--txd);
}
:root .img-float-btn:hover:not(.active){background:transparent;color:var(--tx);}
:root .img-float-btn.active{background:var(--sur);color:var(--tx);border:none;box-shadow:0 1px 2px rgba(0,0,0,.14),0 0 0 1px var(--br3);}

/* ── buttons ── */
:root :is(.modal,#prefs-inner,#doc-settings-inner,.setup-box) .mbtn,
:root .confirm-cancel,
:root .confirm-ok,
:root .setup-btn,
:root .img-upload-btn,
:root .share-invite-send,
:root :is(.modal,#prefs-inner,#doc-settings-inner) .st-btn{
  box-sizing:border-box;
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
  min-height:var(--dlg-btn-h);height:auto;
  padding:0 14px;
  border:1px solid var(--br);
  border-radius:7px;
  background:var(--sur);
  font-family:var(--font-primary);
  font-size:.8125rem;font-weight:500;
  letter-spacing:0;text-transform:none;
  color:var(--tx);
  cursor:pointer;
  transition:background .12s,border-color .12s,color .12s;
}
:root :is(.modal,#prefs-inner,#doc-settings-inner,.setup-box) .mbtn:hover,
:root .confirm-cancel:hover,
:root .setup-btn.sec:hover,
:root .img-upload-btn:hover,
:root :is(.modal,#prefs-inner,#doc-settings-inner) .st-btn:hover{background:var(--bg2);border-color:var(--br2);color:var(--tx);}
/* the main action: filled */
:root :is(.modal,#prefs-inner,#doc-settings-inner,.setup-box) .mbtn.prim,
:root .confirm-ok.is-action,
:root .setup-btn:not(.sec),
:root .share-invite-send{
  background:var(--accent);border-color:var(--accent);color:#fff;
}
:root :is(.modal,#prefs-inner,#doc-settings-inner,.setup-box) .mbtn.prim:hover,
:root .confirm-ok.is-action:hover,
:root .setup-btn:not(.sec):hover,
:root .share-invite-send:hover{
  background:color-mix(in srgb,var(--accent) 86%,#000);
  border-color:color-mix(in srgb,var(--accent) 86%,#000);
  color:#fff;opacity:1;
}
/* destructive: filled red for a confirm, outlined red beside other buttons */
:root .confirm-ok.is-danger{background:var(--ember);border-color:var(--ember);color:#fff;}
:root .confirm-ok.is-danger:hover{background:color-mix(in srgb,var(--ember) 86%,#000);border-color:color-mix(in srgb,var(--ember) 86%,#000);color:#fff;}
:root :is(.modal,#prefs-inner,#doc-settings-inner) .mbtn.dng,
:root :is(.modal,#prefs-inner,#doc-settings-inner) .st-btn-dng{border-color:color-mix(in srgb,var(--ember) 40%,var(--br));color:var(--ember);}
:root :is(.modal,#prefs-inner,#doc-settings-inner) .mbtn.dng:hover,
:root :is(.modal,#prefs-inner,#doc-settings-inner) .st-btn-dng:hover{background:color-mix(in srgb,var(--ember) 8%,var(--sur));color:var(--ember);}
:root :is(.modal,.setup-box,.confirm-box) :is(.mbtn,.setup-btn,.confirm-ok,.confirm-cancel):focus-visible,
:root .share-invite-send:focus-visible{outline:2px solid var(--accent);outline-offset:2px;}
:root :is(.modal,.setup-box) :is(.mbtn,.setup-btn):disabled{opacity:.5;cursor:default;}

/* the footer: main action at the right, Cancel beside it, a destructive
   one apart at the left. The markup lists the main action first. */
:root .mbtnrow{flex-direction:row-reverse;justify-content:flex-start;gap:8px;margin-top:20px;}
:root .mbtnrow .mbtn.dng{margin-right:auto;}
:root .confirm-acts{gap:8px;}
:root .setup-actions{flex-direction:row-reverse;justify-content:flex-start;gap:8px;margin-top:18px;}

/* ── the Share window ── */
:root .share-modal{width:500px;}
:root .share-role-desc{
  background:none;padding:6px 0 0;margin:0 0 4px;border-radius:0;
  font-family:var(--font-primary);font-size:.75rem;line-height:1.5;color:var(--txm);
}
:root .share-invite-row-form{gap:6px;}
:root #share-panel .share-section-lbl[style*="margin-top"]{margin-top:22px!important;}
:root .share-limits-rows{gap:0;margin-top:2px;border-top:1px solid var(--br3);}
:root .share-limits-row,
:root .share-limits-row:hover{
  background:none;border-radius:0;padding:8px 2px;
  border-bottom:1px solid var(--br3);
  font-family:var(--font-primary);font-size:.8125rem;color:var(--txd);
}
:root .share-structural-label{font-family:var(--font-primary);font-size:.8125rem;color:var(--txd);}
:root .share-color-lbl{font-family:var(--font-primary);font-size:.8125rem;color:var(--txd);}
:root .share-modal .ps-team-card{background:var(--sur);border-color:var(--br3);border-radius:8px;}

/* ── the theme and target lists ── */
:root .mopt{padding:10px 20px;border-bottom:1px solid var(--br3);}
:root .mopt:hover{background:var(--bg2);}
:root .mopt.sel{background:var(--accent-faint);}
:root .mopt-name{font-family:var(--font-primary);font-size:.875rem;font-weight:500;color:var(--tx);}
:root .mopt-sub{font-family:var(--font-primary);font-size:.75rem;color:var(--txm);margin-top:1px;}

/* ── New project ── */
:root .setup-path{border-color:var(--br);border-radius:8px;}
:root .setup-path.active{border-color:var(--accent);background:var(--accent-faint);}
:root .setup-box .sf{margin-bottom:14px;}

/* ── Preferences and Project settings windows ──
   The sections were tinted cards with spaced capitals over a grey bar;
   they become plain groups under a semibold heading, divided by hairlines,
   as the inspector's sections are. */
:root #prefs-inner,
:root #doc-settings-inner{background:var(--sur);border-color:var(--dlg-edge);box-shadow:var(--dlg-shadow);}
:root #prefs-inner .prefs-section,
:root #doc-settings-inner .prefs-section{
  background:none;border:none;border-radius:0;overflow:visible;
  border-bottom:1px solid var(--br3);
  margin:0!important;padding:0 0 10px;
}
:root #prefs-inner .prefs-section:last-child,
:root #doc-settings-inner .prefs-section:last-child{border-bottom:none;}
:root #prefs-inner .prefs-section-lbl,
:root #doc-settings-inner .prefs-section-lbl{
  background:none;border:none;border-radius:0;
  padding:14px 0 6px;margin:0;
}
:root #prefs-inner .ps-card-body,
:root #doc-settings-inner .ps-card-body{padding:2px 0 4px;}
:root #prefs-inner :is(.ps-content,.ps-cat),
:root #doc-settings-inner :is(.ps-content,.ps-cat){gap:0;}
:root #doc-settings-inner .ps-cards{gap:0 28px;}
:root #prefs-inner .prefs-row,
:root #doc-settings-inner .prefs-row{min-height:2rem;margin-bottom:4px;gap:12px;}
:root #prefs-inner .prefs-row-label,
:root #doc-settings-inner .prefs-row-label{
  font-family:var(--font-primary);
  font-size:.8125rem;line-height:1.3;color:var(--txd);
}
:root #prefs-inner .prefs-sub .prefs-row-label,
:root #doc-settings-inner .prefs-sub .prefs-row-label{font-size:.8125rem;color:var(--txm);}
:root #prefs-inner .prefs-sub,
:root #doc-settings-inner .prefs-sub{border-left-color:var(--br3);}
:root #doc-settings-inner .ps-sub-lbl,
:root #prefs-inner .ps-sub-lbl{
  font-family:var(--font-primary);
  font-size:.75rem;font-weight:600;
  letter-spacing:0;text-transform:none;
  color:var(--txm);
  border-bottom:none;margin:12px 0 4px;padding:0;
}
/* the long notes under a row: plain grey text, no tinted box */
:root #doc-settings-inner #ps-format-note{
  font-family:var(--font-primary);font-size:.75rem;line-height:1.5;color:var(--txm);
}
/* the sidebar: the inspector's quiet list */
:root #prefs-inner .ps-nav-btn,
:root #doc-settings-inner .ps-nav-btn{
  font-family:var(--font-primary);font-size:.8125rem;
  padding:6px 10px;border-radius:6px;color:var(--txd);
}
:root #prefs-inner .ps-nav-btn:hover,
:root #doc-settings-inner .ps-nav-btn:hover{background:var(--bg2);color:var(--tx);}
:root #prefs-inner .ps-nav-btn.ps-nav-active,
:root #doc-settings-inner .ps-nav-btn.ps-nav-active{background:var(--bg3);color:var(--tx);font-weight:600;}
:root #prefs-inner .prefs-tab-btn{
  font-family:var(--font-primary);font-size:.8125rem;
  letter-spacing:0;text-transform:none;color:var(--txd);
}
:root #prefs-inner .prefs-tab-btn.active{color:var(--tx);font-weight:600;}
/* the pointer to the drawers (workspace only): a plain note, not a box */
html.ws #doc-settings-inner .ps-ws-elsewhere{background:none;border:none;border-top:1px solid var(--br3);border-radius:0;padding:14px 0 4px;margin:8px 0 0;}
html.ws #doc-settings-inner .ps-ws-elsewhere-t{font-family:var(--font-primary);font-size:.8125rem;font-weight:600;letter-spacing:0;text-transform:none;color:var(--tx);}
