:root {
  --brw-bg: #fff;
  --brw-fg: #0f172a;
  --brw-muted: #5b6678;
  --brw-line: #cbd5e1;
  --brw-control-border: #8a94a6;
  --brw-soft: #f1f5f9;
  --brw-accent: #1d4ed8;
  --brw-accent-fg: #fff;
  --brw-warn: #92400e;
  --brw-error: #b91c1c;
  --brw-ok: #166534;
  --brw-font: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --brw-z: 9500;
}

/* The inherited text properties a host's body rule sets are set here, so a host's light weight, line height or
   letter spacing reaches nothing in the window. The trigger and the pick hint are not inside the root, so they
   are named too. Their own rules below set their font.
   Direction is left to the page: an RTL page stays RTL. */
.brw-trigger,
.brw-modal,
.brw-pick-hint {
  font-family: var(--brw-font);
  font-size: 16px;
  font-weight: 400;
  font-style: normal;
  font-variant: normal;
  font-stretch: normal;
  font-feature-settings: normal;
  font-variation-settings: normal;
  font-kerning: auto;
  font-size-adjust: none;
  line-height: normal;
  letter-spacing: normal;
  word-spacing: normal;
  text-align: start;
  text-indent: 0;
  text-transform: none;
  text-shadow: none;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: manual;
  text-rendering: auto;
}

.brw-trigger {
  position: fixed;
  inset-inline-end: 16px;
  bottom: 16px;
  z-index: var(--brw-z);
  border: 0;
  border-radius: 9999px;
  padding: 9.6px 15.2px;
  background: #1e3a5f;
  color: #fff;
  font: 500 13.6px/1 var(--brw-font);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.brw-trigger:hover {
  background: #2c4f7c;
}

.brw-trigger[hidden],
.brw-modal[hidden],
.brw-strip[hidden],
.brw-editor[hidden],
.brw-field-error[hidden],
.brw-context[hidden],
.brw-diagnostics[hidden],
.brw-pick-hint[hidden] {
  display: none;
}

.brw-modal {
  position: fixed;
  inset: 0;
  z-index: var(--brw-z);
  color: var(--brw-fg);
}

.brw-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.brw-panel {
  position: relative;
  max-width: 672px;
  margin: 3vh auto;
  background: var(--brw-bg);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  max-height: 94vh;
  overflow: auto;
}

.brw-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14.4px 20px;
  border-bottom: 1px solid var(--brw-line);
  position: sticky;
  top: 0;
  /* above the positioned type choices and thumbnails, which would otherwise paint over the title on scroll */
  z-index: 1;
  background: var(--brw-bg);
}

/* A host's own h2 rule sets a family, a line height and a colour of its own; font: inherit takes the window's. */
.brw-head h2 {
  margin: 0;
  font: inherit;
  font-size: 17.6px;
  font-weight: 600;
  color: inherit;
}

.brw-spacer {
  flex: 1 1 auto;
}

.brw-close {
  background: none;
  border: 0;
  font: inherit;
  font-size: 17.6px;
  cursor: pointer;
  color: var(--brw-muted);
  padding: 6px;
}

/* The cross on the close and remove buttons is drawn in the button's colour; a host's own svg rule cannot size it. */
.brw-modal .brw-icon {
  display: block;
  width: 16px;
  height: 16px;
  margin: auto;
  fill: none;
  stroke: currentColor;
}

/* A host's icon kit may restyle every path (svg * { stroke: none }): the cross sets its own stroke. */
.brw-modal .brw-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75px;
  stroke-linecap: round;
}

.brw-modal .brw-thumb-remove .brw-icon {
  width: 12px;
  height: 12px;
}

/* A host's own icon (the icons mount option) sits before its control's text; its size and colour are the host's. */
.brw-modal .brw-host-icon {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-inline-end: 6px;
  line-height: 0;
}

.brw-modal .brw-close .brw-host-icon,
.brw-modal .brw-thumb-remove .brw-host-icon {
  margin: 0;
}

.brw-body {
  padding: 12px 20px 17.6px;
}

.brw-label {
  display: block;
  font-size: 13.6px;
  font-weight: 500;
  margin: 11.2px 0 4.8px;
}

.brw-types {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* margin and (on .brw-option) font-weight are set so a host's own label rule cannot reach these labels. */
.brw-type {
  flex: 1 1 128px;
  position: relative;
  border: 1px solid var(--brw-line);
  background: var(--brw-bg);
  border-radius: 8px;
  margin: 0;
  padding: 8.8px 9.6px;
  font: inherit;
  font-size: 14.4px;
  text-align: center;
  cursor: pointer;
  color: var(--brw-fg);
}

/* The native radio stays in the tab order (arrow keys, one stop) but is drawn by its label. */
.brw-type-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.brw-type:focus-within {
  outline: 2px solid var(--brw-accent);
  outline-offset: 1px;
}

.brw-type.is-on {
  border-color: var(--brw-accent);
  box-shadow: inset 0 0 0 1px var(--brw-accent);
  background: color-mix(in srgb, var(--brw-accent) 8%, var(--brw-bg));
  font-weight: 600;
}

.brw-body textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--brw-control-border);
  border-radius: 8px;
  padding: 8.8px 10.4px;
  font: inherit;
  font-size: 14.72px;
  resize: vertical;
  background: var(--brw-bg);
  color: var(--brw-fg);
}

.brw-body textarea:focus {
  outline: 2px solid var(--brw-accent);
  outline-offset: 1px;
}

.brw-attachment-count {
  color: var(--brw-muted);
  font-weight: 400;
}

.brw-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 4px 0 8px;
}

.brw-thumb-wrap {
  position: relative;
}

.brw-thumb {
  border: 1px solid var(--brw-line);
  border-radius: 6.4px;
  padding: 0;
  background: var(--brw-soft);
  cursor: pointer;
  overflow: hidden;
  display: block;
  font: inherit;
  font-size: 12px;
}

.brw-thumb-image {
  display: block;
  max-height: 72px;
  max-width: 128px;
}

.brw-thumb.is-file {
  padding: 8px 9.6px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
}

.brw-thumb-remove {
  position: absolute;
  top: -6.4px;
  inset-inline-end: -6.4px;
  border: 1px solid var(--brw-line);
  background: var(--brw-bg);
  border-radius: 9999px;
  width: 24px;
  height: 24px;
  padding: 0;
  font: inherit;
  font-size: 11.2px;
  cursor: pointer;
  line-height: 1;
  color: var(--brw-muted);
}

.brw-drop {
  border: 1px dashed var(--brw-control-border);
  border-radius: 9.6px;
  padding: 12.8px;
  text-align: center;
}

.brw-drop.is-over {
  border-color: var(--brw-accent);
  background: var(--brw-soft);
}

.brw-drop-hint {
  color: var(--brw-muted);
  font-size: 13.6px;
}

.brw-drop-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 9.6px 0;
  flex-wrap: wrap;
}

.brw-drop-warn {
  color: var(--brw-muted);
  font-size: 12px;
}

/* Two classes outrank a host's input[type="file"] { display: block } (Bootstrap 3) wherever its stylesheet loads. */
.brw-modal .brw-file-input {
  display: none;
}

.brw-btn {
  border: 1px solid var(--brw-line);
  background: var(--brw-bg);
  color: var(--brw-fg);
  border-radius: 8px;
  padding: 7.2px 12.8px;
  font: inherit;
  font-size: 13.6px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.brw-btn:hover {
  background: var(--brw-soft);
}

.brw-btn.is-primary {
  background: var(--brw-accent);
  color: var(--brw-accent-fg);
  border-color: var(--brw-accent);
}

.brw-btn.is-primary[aria-disabled="true"] {
  opacity: 0.6;
  cursor: default;
}

.brw-editor {
  margin: 8px 0;
  border: 1px solid var(--brw-line);
  border-radius: 9.6px;
  padding: 8px;
}

.brw-tools {
  display: flex;
  gap: 6.4px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 6.4px;
}

.brw-tools-hint {
  flex: 1 1 auto;
  font-size: 12px;
  color: var(--brw-muted);
}

.brw-tool {
  border: 1px solid var(--brw-line);
  background: var(--brw-bg);
  color: var(--brw-fg);
  border-radius: 6.4px;
  padding: 4.8px 8.8px;
  font: inherit;
  font-size: 12.8px;
  cursor: pointer;
}

.brw-tool.is-primary {
  background: var(--brw-accent);
  color: var(--brw-accent-fg);
  border-color: var(--brw-accent);
}

.brw-tool:disabled {
  opacity: 0.5;
  cursor: default;
}

.brw-canvas-wrap {
  max-height: 60vh;
  overflow: auto;
  background: var(--brw-soft);
  border-radius: 6.4px;
}

.brw-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  cursor: crosshair;
  touch-action: none;
}

.brw-context {
  margin: 14.4px 0 8px;
  padding: 11.2px 12.8px;
  background: var(--brw-soft);
  border-radius: 9.6px;
}

.brw-context-title {
  font-size: 13.6px;
  font-weight: 600;
  margin-bottom: 4px;
}

.brw-context-auto {
  font-size: 12.8px;
  color: var(--brw-muted);
  margin-bottom: 6.4px;
  word-break: break-word;
}

.brw-option {
  display: flex;
  gap: 6.4px;
  align-items: flex-start;
  font-size: 13.6px;
  font-weight: 400;
  margin: 4px 0;
  cursor: pointer;
}

/* All four sides, and one class more than a host's input[type="checkbox"] rule: its margin moves the text beside it. */
.brw-modal .brw-option input {
  margin: 3.2px 3px 3px 4px;
}

.brw-element {
  margin: 8px 0;
}

.brw-note {
  font-size: 12px;
  color: var(--brw-muted);
  margin: 4px 0 0;
  line-height: 1.4;
}

.brw-diagnostics {
  margin: 9.6px 0;
}

.brw-diagnostics-count {
  color: var(--brw-muted);
}

.brw-reporter {
  font-size: 12px;
  color: var(--brw-muted);
  margin: 6.4px 0;
}

.brw-status {
  font-size: 14.08px;
  margin: 8px 0;
  padding: 8px 10.4px;
  border-radius: 8px;
  background: var(--brw-soft);
}

/* Empty, the region stays in the page (and in the accessibility tree) but takes no room. */
.brw-status:empty {
  margin: 0;
  padding: 0;
}

.brw-field-error {
  font-size: 14.08px;
  margin: 4px 0 0;
  color: var(--brw-error);
}

.brw-body textarea[aria-invalid="true"] {
  border-color: var(--brw-error);
}

.brw-status.is-ok {
  color: var(--brw-ok);
}

.brw-status.is-warn {
  color: var(--brw-warn);
}

.brw-status.is-error {
  color: var(--brw-error);
}

.brw-status a {
  color: var(--brw-accent);
  font-weight: 600;
}

.brw-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 9.6px;
}

.brw-pick-hint {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: calc(var(--brw-z) + 1);
  background: #f59e0b;
  color: #1f2937;
  font: 600 13.6px var(--brw-font);
  padding: 8px 14.4px;
  border-radius: 9999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

/* !important: the crosshair must win over any cursor the host page sets on its own elements. */
.brw-picking,
.brw-picking * {
  cursor: crosshair !important;
}

@media (max-width: 640px) {
  .brw-panel {
    margin: 0;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .brw-type {
    flex-basis: 100%;
  }
}

.brw-list[hidden],
.brw-form[hidden],
.brw-back[hidden],
.brw-my-reports[hidden],
.brw-thread[hidden] {
  display: none;
}

.brw-back {
  padding: 4.8px 9.6px;
  font-size: 12.8px;
}

.brw-report {
  border: 1px solid var(--brw-line);
  border-radius: 9.6px;
  padding: 9.6px 12px;
  margin: 8px 0;
}

.brw-report-head {
  display: flex;
  gap: 8px;
  align-items: center;
}

.brw-report-title {
  flex: 1 1 auto;
  font-weight: 500;
  font-size: 14.4px;
  word-break: break-word;
}

.brw-chip {
  font-size: 12px;
  white-space: nowrap;
  background: var(--brw-soft);
  border-radius: 9999px;
  padding: 2.4px 8.8px;
}

.brw-report.is-fixed .brw-chip {
  color: var(--brw-ok);
}

.brw-report.is-rejected .brw-chip {
  color: var(--brw-error);
}

.brw-report.is-doing .brw-chip {
  color: var(--brw-warn);
}

.brw-report-meta {
  font-size: 12px;
  color: var(--brw-muted);
  margin: 3.2px 0 6.4px;
}

.brw-report-actions {
  display: flex;
  gap: 6.4px;
  flex-wrap: wrap;
}

.brw-btn-sm {
  padding: 4.8px 9.6px;
  font-size: 12.48px;
}

.brw-thread {
  margin-top: 8px;
  border-top: 1px solid var(--brw-line);
  padding-top: 8px;
  font-size: 13.6px;
}

.brw-comment {
  margin: 6.4px 0;
  padding: 7.2px 9.6px;
  background: var(--brw-soft);
  border-radius: 8px;
}

.brw-comment-meta {
  font-size: 11.52px;
  color: var(--brw-muted);
  margin-bottom: 3.2px;
}

.brw-comment-body {
  white-space: pre-wrap;
  word-break: break-word;
}

.brw-status .brw-btn {
  margin-left: 6.4px;
}

.brw-modal .brw-honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  pointer-events: none;
}
