/* Report a problem's button, form and thanks. Everything here is built from Huddle's tokens, so
   Nova and Classic, light and dark, and every --font-scale follow the rest of the app. */

.report-problem-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-island);
  background: var(--surface);
  color: var(--accent-ink);
  cursor: pointer;
  transition: background-color 150ms ease-out, border-color 150ms ease-out, color 150ms ease-out;
}

.report-problem-icon:hover,
.report-problem-icon:focus-visible {
  background: var(--surface-2);
}

.report-problem-icon .icon {
  width: 22px;
  height: 22px;
}

/* The conversation header's button sits at its right, after the name and tabs. */
.conversation-report {
  margin-left: auto;
}

/* You's own top bar: the office bar's frame with only the button in it. */
.report-problem-you-bar {
  justify-content: flex-end;
}

/* Computer: the rail's account area, above Sign out. It stays in view when the panel folds. */
.report-problem-row {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-nav);
  background: transparent;
  color: var(--side-muted);
  cursor: pointer;
  font: inherit;
  font-size: round(nearest, calc(13px * var(--font-scale)), 1px);
  font-weight: 400;
  text-align: left;
  transition: background-color 150ms ease-out, color 150ms ease-out;
}

.report-problem-row:hover,
.report-problem-row:focus-visible {
  background: var(--side-hover);
  color: var(--side-text);
}

.report-problem-row .icon {
  flex: none;
  width: 18px;
  height: 18px;
  opacity: 0.85;
}

/* ---- The link from an error note ---- */

.error .error-message {
  overflow-wrap: anywhere;
}

/* A block-level link so it sits on its own line under the message, never joined to its last
   word, and so a neighbouring control (the render card's Reload) starts below it. */
.report-problem-error-link {
  display: flex;
  width: max-content;
  max-width: 100%;
  align-items: center;
  min-height: 44px;
  margin: 2px 0 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  cursor: pointer;
}

.report-problem-error-link:hover,
.report-problem-error-link:focus-visible {
  background: none;
  text-decoration-thickness: 2px;
}

/* The render boundary's card has its own Reload button under the link; keep a visible gap. */
.screen-problem .report-problem-error-link {
  margin: 0 0 12px;
}

.report-error-attached {
  overflow-wrap: anywhere;
}

/* ---- The form ---- */

/* The form can be opened from an error note inside another dialog, sheet or raised pane (the
   sidebar's dialogs sit at 30; the remote-grant toast at 50). It has to sit above all of those
   and still below the idle screen cover. */
.overlay:has(.report-dialog) {
  z-index: 55;
}

.report-form .report-field {
  margin-bottom: 16px;
}

.report-field > span {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.report-req,
.report-opt {
  color: var(--muted);
  font-size: round(nearest, calc(13px * var(--font-scale)), 1px);
  font-weight: 400;
}

/* "What is this?": two checkmark choices, exactly one on, as a radio group is. Each is a native
   radio (hidden) in a 44px row, so the keyboard and screen readers treat it as one; the box shows
   a checkmark when it is on. Side by side, they wrap under each other when they don't fit. */
.report-type {
  min-width: 0;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}

.report-type legend {
  margin-bottom: 6px;
  padding: 0;
  color: var(--heading);
  font-weight: 600;
  font-size: round(nearest, calc(14px * var(--font-scale)), 1px);
}

.report-type-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.report-type-choice {
  display: inline-flex;
  flex: 1 1 160px;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--heading);
  cursor: pointer;
}

.report-type-choice:hover { background: var(--surface-2); }
.report-type-choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.report-type-choice:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.report-type-choice:has(input:disabled) { cursor: progress; }

.report-type-check {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: transparent;
}

.report-type-check .icon {
  width: 14px;
  height: 14px;
}

.report-type-choice:has(input:checked) .report-type-check {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

/* People type their words at 16px or more, on every width. */
.report-form textarea {
  min-height: 84px;
  font-size: max(16px, round(nearest, calc(15px * var(--font-scale)), 1px));
  line-height: 1.4;
}

.report-privacy {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 16px;
  color: var(--muted);
  font-size: round(nearest, calc(13.5px * var(--font-scale)), 1px);
  line-height: 1.45;
}

/* Screenshots: the button, a short hint, then a row of small thumbnails, each with its Remove.
   The row wraps, so three fit at 375 as well as at 1280. */
.report-shots {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 16px;
}

.report-shot-add {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.report-shot-add .icon {
  flex: none;
  width: 18px;
  height: 18px;
}

.report-shot-hint {
  color: var(--muted);
  font-size: round(nearest, calc(13px * var(--font-scale)), 1px);
}

.report-shot-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.report-shot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 88px;
}

.report-shot img,
.report-shot-blank {
  display: block;
  width: 88px;
  height: 66px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-nav);
  background: var(--surface-2);
  object-fit: cover;
}

.report-shot-uploading {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 66px;
  border-radius: var(--radius-nav);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  color: var(--muted);
  font-size: round(nearest, calc(12px * var(--font-scale)), 1px);
}

.report-shot .btn {
  min-height: 44px;
}

.report-shots .report-field-error {
  width: 100%;
  min-width: 0;
  margin: 0;
  /* A file name with no break point still wraps inside the form. */
  overflow-wrap: anywhere;
}

.report-attached {
  margin: 0 0 16px;
}

.report-attached summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent-ink);
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.report-attached summary::-webkit-details-marker {
  display: none;
}

.report-attached ul {
  margin: 6px 0 0;
  padding-left: 22px;
  color: var(--muted);
  font-size: round(nearest, calc(13.5px * var(--font-scale)), 1px);
  line-height: 1.5;
}

.report-attached li {
  margin: 4px 0;
}

/* The form's own refusal or send failure lives outside the scrolling fields, so it stays in
   view beside the fixed actions when a request settles. */
.report-error {
  margin: 0 0 12px;
  overflow-wrap: anywhere;
}

/* A box's own refusal sits under that box, not with the form-wide note at the foot. */
.report-field-error {
  margin: 6px 0 0;
}

.report-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* The form can be taller than its dialog, on a computer and in a phone's sheet alike. Scroll the
   fields and the attached list inside the form and keep Cancel and Send on the dialog's lower
   edge, so both are in view as it opens and stay in view while the list is read, at every text
   size. On a phone that means the list scrolls under the actions instead of pushing them below
   the sheet. */
.report-dialog:has(.report-form) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.report-dialog > h2 {
  flex: none;
}

.report-form {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.report-form-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.report-form > .report-error {
  flex: none;
}

.report-actions {
  flex: none;
}

/* ---- Saved on this device, and the note from a refused resend ---- */

.report-saved {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.report-saved-clock {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%; /* true circle */
  background: var(--warn-soft);
  color: var(--warn-ink);
}

.report-saved-clock .icon {
  width: 28px;
  height: 28px;
}

.report-saved p {
  margin: 4px 0 0;
  color: var(--text);
  font-size: round(nearest, calc(17px * var(--font-scale)), 1px);
  line-height: 1.45;
}

.report-queue-notice {
  overflow-wrap: anywhere;
}

/* ---- Thanks ---- */

.report-thanks {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.report-thanks-check {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%; /* true circle */
  background: var(--ok-soft);
  color: var(--ok);
}

.report-thanks-check .icon {
  width: 28px;
  height: 28px;
}

.report-thanks p {
  margin: 4px 0 0;
  color: var(--text);
  font-size: round(nearest, calc(17px * var(--font-scale)), 1px);
  line-height: 1.45;
}

.report-thanks strong {
  font-weight: 700;
}

@media (max-width: 860px) {
  .report-actions {
    margin-top: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .report-problem-icon,
  .report-problem-row {
    transition: none;
  }
}

/* ---- The Bugs page's type filter on a phone (web/js/screens/bugs.js) ---- */

/* The Bugs screen loads no stylesheet of its own, and its "Bug repairs or new feature requests"
   group has three buttons in the app's two-column phone grid (web/styles.css): "New feature
   requests" with its count is wider than the pill, so the count sticks out. A rule for that group
   only — the label is the Bugs page's own — makes every button hold its label and count: one row
   of three equal columns, the label wraps and the button grows taller, and every count stays
   inside. Budget's three-button rule (web/css/bots/budget.css) is the model. The pressed button
   keeps its shared brand look, and every other segmented group keeps the app's two a row.
   The wrap is the label's, not the count chip's: the chip is a 20px pill, so inheriting
   overflow-wrap: anywhere lets a number break across lines ("12" as "1" over "2"). The chip gets
   normal wrapping and no wrapping of its own; its shared rules (styles.css) set height, colour and
   size, never these, so this reaches it in every state, pressed, danger and zero included.
   Flat Panels has its own phone rules for every segmented group (styles.css ~10674, specificity
   0,5,0 and 0,5,1) that outrank the plain ones, so the same three rules are repeated under
   html:root[data-look="flat-panels"] at higher specificity. Only columns and padding: the look's
   tab rules (the line under each tab, the pressed one's underline, no pill) stay as they are, and
   every other segmented group in that look keeps the app's two a row. */
@media (max-width: 860px) {
  .segmented.scope[aria-label="Bug repairs or new feature requests"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .segmented.scope[aria-label="Bug repairs or new feature requests"] button {
    padding: 0 6px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .segmented.scope[aria-label="Bug repairs or new feature requests"] .seg-n {
    overflow-wrap: normal;
    white-space: nowrap;
  }
  html:root[data-look="flat-panels"] .segmented.scope[aria-label="Bug repairs or new feature requests"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  html:root[data-look="flat-panels"] .segmented.scope[aria-label="Bug repairs or new feature requests"] button {
    padding: 0 6px;
  }
  html:root[data-look="flat-panels"] .segmented.scope[aria-label="Bug repairs or new feature requests"] .seg-n {
    overflow-wrap: normal;
    white-space: nowrap;
  }
}
