/* Modal dialogs + rich text editor.
   Self-contained so it works on both stylesheets. */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,.34);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 22px;
  opacity: 0; transition: opacity .18s ease;
}
.modal-backdrop.in { opacity: 1; }

.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 440px;
  box-shadow: 0 24px 60px rgba(0,0,0,.28);
  transform: translateY(12px) scale(.98);
  transition: transform .2s cubic-bezier(.2,.8,.3,1);
  max-height: 88vh; display: flex; flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  color: #1d1d1f;
}
.modal-wide { max-width: 760px; }
.modal-backdrop.in .modal { transform: translateY(0) scale(1); }

.modal-head { padding: 20px 24px 0; }
.modal-head h2 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.modal-body { padding: 16px 24px 4px; overflow-y: auto; }
.modal-text { margin: 0; font-size: 14.5px; line-height: 1.55; color: #3a3a3c; }

.modal-label {
  display: block; font-size: 12.5px; font-weight: 600;
  margin: 14px 0 5px; color: #1d1d1f;
}
.modal-body > .modal-label:first-child { margin-top: 0; }
.modal-input {
  width: 100%; padding: 9px 11px; font-size: 14px; font-family: inherit;
  border: 1px solid #8e8e93; border-radius: 9px; background: #fff; color: #1d1d1f;
  box-sizing: border-box;
}
.modal-input:focus {
  border-color: #0071e3; box-shadow: 0 0 0 3px rgba(0,113,227,.14);
}
.modal-input:focus-visible { outline: 2px solid #0071e3; outline-offset: 2px; }
textarea.modal-input { resize: vertical; min-height: 76px; }
select.modal-input[multiple] { padding: 5px; }
/* Greys in here are checked against the white dialog: hint text 4.5:1, a
 * control's border 3:1. Decorative rules (toolbar edge, separators) stay light. */
.modal-hint { font-size: 12px; color: #75757a; margin: 5px 0 0; line-height: 1.45; }
.modal-check {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; margin: 14px 0 2px; cursor: pointer;
}
.modal-check input { width: auto; margin: 0; }
/* One file chosen in a form (modalForm's file field): the label is the
   button, the input is hidden with .sr-only, the file's name beside it. */
.modal-file { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 6px 0 2px; }
/* A group of fields folded behind one line (modalForm's fold field): a long
   dialog opens on its essentials, and the rest is a click away. */
.modal-fold { margin: 16px 0 0; padding-top: 10px; border-top: 1px solid #e5e5ea; }
.modal-fold-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 4px 0; margin: 0;
  background: none; border: 0; box-shadow: none; text-align: left; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600; color: #1d1d1f;
}
.modal-fold-btn::before { content: '\25B8'; font-size: 11px; color: #75757a; }
.modal-fold-btn[aria-expanded="true"]::before { content: '\25BE'; }
.modal-fold-btn:hover { color: #0071e3; }
.modal-fold-btn:focus-visible { outline: 2px solid #0071e3; outline-offset: 2px; border-radius: 4px; }
.modal-fold-body { padding-bottom: 4px; }

.modal-actions {
  display: flex; justify-content: flex-end; gap: 9px;
  padding: 16px 24px 20px; border-top: 1px solid #f0f0f2; margin-top: 12px;
}
.modal-actions .btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 17px; border: 0; border-radius: 9px; cursor: pointer;
  font-size: 14px; font-weight: 500; font-family: inherit;
  background: #0071e3; color: #fff;
}
.modal-actions .btn:hover { background: #0062c4; }
.modal-actions .btn.secondary:hover { background: #dcdce2; }
.modal-actions .btn.danger:hover { background: #a82b24; }
.modal-actions .btn.secondary { background: #e8e8ed; color: #1d1d1f; }
.modal-actions .btn.danger { background: #c0332b; color: #fff; }

/* ---- A checklist field inside a form dialog ----
   Fluent styles .checklist everywhere and Broadsheet only inside .manage,
   which a dialog on the console is not. These are the fallback, kept at the
   lowest specificity so a theme sheet loaded after this one still wins. */
:where(.modal) .checklist { border: 1px solid #8e8e93; border-radius: 9px; overflow: hidden; background: #fff; }
:where(.modal) .checklist-search {
  width: 100%; box-sizing: border-box; padding: 8px 11px; font: inherit; font-size: 14px;
  border: 0; border-bottom: 1px solid #d2d2d7; border-radius: 0;
}
:where(.modal) .checklist-list { max-height: 190px; overflow-y: auto; padding: 4px 8px; }
:where(.modal) .checklist-item { display: flex; gap: 9px; align-items: flex-start; padding: 6px 2px; font-size: 14px; cursor: pointer; }
:where(.modal) .checklist-item input { width: auto; margin: 3px 0 0; }
:where(.modal) .checklist-item-hint { display: block; font-size: 12px; color: #75757a; }
:where(.modal) .checklist-empty { padding: 10px; margin: 0; }

/* ---- Rich text editor ---- */
.rt-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  padding: 7px 8px; border: 1px solid #d2d2d7; border-bottom: 0;
  border-radius: 10px 10px 0 0; background: #fbfbfd;
}
.rt-btn {
  min-width: 30px; height: 28px; padding: 0 7px;
  border: 1px solid transparent; border-radius: 7px; background: transparent;
  font-size: 13.5px; cursor: pointer; color: #1d1d1f; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center;
}
.rt-btn:hover { background: #ececf0; }
.rt-btn:active { background: #dfdfe4; }
.rt-select {
  height: 28px; padding: 0 6px; font-size: 12.5px; font-family: inherit;
  border: 1px solid #8e8e93; border-radius: 7px; background: #fff; color: #1d1d1f;
  max-width: 130px;
}
.rt-sep { width: 1px; height: 18px; background: #d2d2d7; margin: 0 3px; }

.rt-editor {
  border: 1px solid #8e8e93; border-radius: 0 0 10px 10px;
  padding: 16px 18px; min-height: 260px; max-height: 46vh; overflow-y: auto;
  font-size: 14.5px; line-height: 1.65; background: #fff; color: #1d1d1f;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.rt-editor:focus { border-color: #0071e3; box-shadow: 0 0 0 3px rgba(0,113,227,.14); }
.rt-editor:focus-visible { outline: 2px solid #0071e3; outline-offset: 2px; }
.rt-editor p { margin: 0 0 10px; }
.rt-editor ul, .rt-editor ol { margin: 0 0 10px; padding-left: 24px; }

/* Rendered letter content elsewhere in the app */
.letter-html {
  background: #fbfbfd; border: 1px solid #e8e8ed; border-radius: 10px;
  padding: 15px 17px; margin: 0 0 12px; font-size: 13.5px; line-height: 1.6;
  overflow-wrap: break-word;
}
.letter-html p { margin: 0 0 9px; }
.letter-html ul, .letter-html ol { margin: 0 0 9px; padding-left: 22px; }

@media (max-width: 560px) {
  .modal { max-width: 100%; }
  .rt-select { max-width: 96px; }
}

/* ---- File preview ---- */
.preview-frame {
  width: 100%; height: 60vh; border: 1px solid #d2d2d7; border-radius: 10px; background: #fff;
}
.preview-image-wrap {
  display: flex; align-items: center; justify-content: center;
  max-height: 60vh; overflow: auto; background: #f3f3f5; border-radius: 10px; padding: 12px;
}
.preview-image { max-width: 100%; max-height: 56vh; border-radius: 6px; }
@media (max-width: 560px) { .preview-frame { height: 44vh; } }

/* ---- Action chooser ---- */
.choice-list { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
/* A block, not the working pages’ inline-flex button, so a choice’s hint
   sits under its label rather than beside it. */
.choice-item {
  display: block; width: 100%; text-align: left; padding: 11px 14px; border-radius: 10px;
  border: 1px solid #8e8e93; background: #fff; font-size: 14px; cursor: pointer;
  box-shadow: none; color: inherit; font-weight: 500;
}
.choice-item:hover { background: #f2f5f4; transform: none; filter: none; }
.choice-item.danger { color: #b3261e; }
.choice-item.danger:hover { background: #fdeceb; }
[data-theme="dark"] .choice-item { background: #1c2b27; border-color: #2e423c; }
[data-theme="dark"] .choice-item:hover { background: #24352f; }
/* The line under a choice that says what comes of it. */
.choice-item .choice-hint { display: block; margin-top: 3px; font-size: 12.5px; font-weight: 400; line-height: 1.35; opacity: .82; }

/* ---- Submission confirmation ---- */
.confirm-block .k { font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: #6b7772; display: block; margin-bottom: 2px; }
.confirm-ref { background: #f2f5f4; border-radius: 10px; padding: 12px 14px; margin: 12px 0; }
.confirm-ref strong { font-size: 19px; letter-spacing: .5px; }
.confirm-steps { margin: 6px 0 12px; padding-left: 20px; }
.confirm-steps li { margin-bottom: 5px; font-size: 14px; }
[data-theme="dark"] .confirm-ref { background: #1c2b27; }
[data-theme="dark"] .confirm-block .k { color: #93a49e; }

/* A reduced motion preference. This sheet is loaded on the Broadsheet pages
   as well as the working ones, so it cannot lean on fluent.css: the dialog
   and the backdrop appear where they are going to be, rather than sliding
   and fading into it. */
@media (prefers-reduced-motion: reduce) {
  .modal-backdrop, .modal, .toast { transition: none; }
  .modal, .modal-backdrop.in .modal { transform: none; }
}

/* ---- The Product feedback tab (public/js/feedback.js), in the corner of
   every page of a demonstration site, and the menu, the pointing bar and
   the outline it draws. Here because both page designs load this sheet;
   the colours are fixed, as the dialog's are, so it reads the same on
   either design and in either theme. Every state the theme sheets give a
   plain button is set again on the class, so none of them shows through. */
.feedback-tab {
  position: fixed; right: 12px; bottom: 12px; z-index: 45;
  display: inline-block; width: auto; min-height: 0; margin: 0; padding: 6px 12px;
  border: 0; border-radius: 999px; background: #1d1d1f; color: #fff;
  font: 600 12.5px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0; text-transform: none; white-space: nowrap; opacity: .85; cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255,255,255,.28), 0 2px 10px rgba(0,0,0,.25); transform: none; filter: none;
}
.feedback-tab:hover, .feedback-tab:active, .feedback-tab:focus-visible, .feedback-tab[aria-expanded="true"] {
  opacity: 1; background: #1d1d1f; color: #fff; transform: none; filter: none; box-shadow: 0 0 0 1px rgba(255,255,255,.4), 0 2px 10px rgba(0,0,0,.3);
}
.feedback-tab:focus-visible { outline: 2px solid #0071e3; outline-offset: 2px; }
.feedback-tab.at-side { bottom: 45%; }
.feedback-menu {
  position: fixed; right: 12px; bottom: 52px; z-index: 45;
  display: flex; flex-direction: column; gap: 6px;
  width: min(280px, calc(100vw - 24px)); padding: 10px; box-sizing: border-box;
  background: #fff; color: #1d1d1f; border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.3);
}
.feedback-menu button {
  display: block; width: 100%; min-height: 0; margin: 0; padding: 9px 12px; text-align: left;
  border: 1px solid #8e8e93; border-radius: 9px; background: #fff; color: #1d1d1f;
  font: 500 14px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0; text-transform: none; cursor: pointer; box-shadow: none; transform: none; filter: none;
}
.feedback-menu button:hover, .feedback-menu button:active { background: #f2f5f4; color: #1d1d1f; box-shadow: none; transform: none; filter: none; }
.feedback-menu button:focus-visible { outline: 2px solid #0071e3; outline-offset: 2px; }
.feedback-menu[hidden], .feedback-pick[hidden], .feedback-spot[hidden] { display: none; }
.feedback-pick {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 960;
  max-width: calc(100vw - 24px); box-sizing: border-box; padding: 8px 14px;
  background: #1d1d1f; color: #fff; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.3);
  font: 13.5px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.feedback-pick .link-like, .feedback-pick button.link-like { color: #fff; text-decoration: underline; font: inherit; padding: 0; margin-left: 4px; background: none; box-shadow: none; }
.feedback-pick button.link-like:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.feedback-spot {
  position: fixed; z-index: 959; pointer-events: none;
  border: 2px solid #0071e3; border-radius: 6px; background: rgba(0,113,227,.12);
}
html.feedback-picking, html.feedback-picking * { cursor: crosshair !important; }
/* The word after a note is sent, on a page with no toast of its own (the
   Law Center's). */
.feedback-said {
  position: fixed; right: 12px; bottom: 52px; z-index: 961;
  max-width: calc(100vw - 24px); box-sizing: border-box; padding: 8px 14px;
  background: #1d1d1f; color: #fff; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.3);
  font: 13.5px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.feedback-said.is-error { background: #a82b24; }
@media print { .feedback-tab, .feedback-menu, .feedback-pick, .feedback-spot, .feedback-said { display: none; } }
