:root {
  color-scheme: light;
  --bg: #f3f5f2;
  --panel: #ffffff;
  --ink: #19211f;
  --muted: #69716d;
  --line: #d9dfda;
  --accent: #0f766e;
  --accent-dark: #0b5751;
  --accent-warm: #8a5a2b;
  --warn: #b45309;
  --soft: #e7f3f0;
  --surface: #fbfcfa;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Barra de compartilhamento: vidro fosco legível sobre a lista, sem escurecer
   o restante da tela. A cor e a sombra mantêm a barra identificável, enquanto
   o desfoque fica restrito ao conteúdo imediatamente atrás dela. */
html body.preview-redesign .list-screen .bulk-context-actions:not([hidden]) {
  border: 1.5px solid rgba(44, 77, 71, 0.28) !important;
  border-radius: 999px !important;
  padding: 5px 8px !important;
  background: rgba(255, 255, 255, 0.16) !important;
  box-shadow:
    0 18px 42px rgba(31, 47, 44, 0.24),
    0 0 0 1px rgba(255, 255, 255, 0.92) inset,
    0 1px 0 rgba(255, 255, 255, 0.98) inset,
    0 0 0 2px rgba(195, 244, 234, 0.32) !important;
  -webkit-backdrop-filter: blur(20px) saturate(1.08) !important;
  backdrop-filter: blur(20px) saturate(1.08) !important;
  isolation: isolate;
  overflow: hidden;
}

/* Reflexo interno da cápsula: cria volume e uma leve sensação de lente sobre
   o conteúdo da lista que passa atrás, sem interferir nos cliques. */
html body.preview-redesign .list-screen .bulk-context-actions:not([hidden])::before {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(ellipse 72% 115% at 50% 0%, rgba(255, 255, 255, 0.44), transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), transparent 42%, rgba(31, 74, 68, 0.09));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.78) inset,
    0 -1px 0 rgba(25, 77, 68, 0.12) inset;
}

html body.preview-redesign .list-screen .bulk-context-actions:not([hidden]) .bulk-icon-action {
  position: relative;
  z-index: 1;
}

html body.preview-redesign .bulk-context-actions .bulk-icon-action {
  color: #263b38 !important;
  border-radius: 999px !important;
  background: transparent !important;
  transition: color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
  transform: none !important;
}

html body.preview-redesign .bulk-context-actions .bulk-icon-action svg {
  stroke-width: 3.6 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
}

html body.preview-redesign .bulk-context-actions .bulk-whatsapp-action {
  color: #087f6f !important;
}

html body.preview-redesign .bulk-context-actions .bulk-icon-action:not(.bulk-whatsapp-action):not(.bulk-danger-action) {
  color: #263b38 !important;
}

html body.preview-redesign .bulk-context-actions .bulk-icon-action:hover,
html body.preview-redesign .bulk-context-actions .bulk-icon-action:focus-visible {
  background: rgba(38, 59, 56, 0.09) !important;
  color: #142a27 !important;
  box-shadow: 0 0 0 2px rgba(38, 59, 56, 0.12) inset !important;
  transform: none !important;
}

html body.preview-redesign .bulk-context-actions .bulk-whatsapp-action:hover,
html body.preview-redesign .bulk-context-actions .bulk-whatsapp-action:focus-visible {
  background: rgba(8, 127, 111, 0.12) !important;
  color: #056457 !important;
  box-shadow: 0 0 0 2px rgba(8, 127, 111, 0.16) inset !important;
}

html body.preview-redesign .bulk-context-actions .bulk-danger-action,
html body.preview-redesign .bulk-context-actions .bulk-danger-action:hover,
html body.preview-redesign .bulk-context-actions .bulk-danger-action:focus-visible {
  color: #c62828 !important;
}

html body.preview-redesign .bulk-context-actions .bulk-danger-action:hover,
html body.preview-redesign .bulk-context-actions .bulk-danger-action:focus-visible {
  background: rgba(198, 40, 40, 0.12) !important;
  box-shadow: 0 0 0 2px rgba(198, 40, 40, 0.14) inset !important;
}

html body.dark-mode.preview-redesign .list-screen .bulk-context-actions:not([hidden]) {
  border-color: rgba(101, 207, 192, 0.86) !important;
  background: rgba(28, 34, 33, 0.3) !important;
  box-shadow:
    0 20px 46px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(166, 255, 242, 0.22) inset,
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 0 0 2px rgba(101, 207, 192, 0.16) !important;
}

html body.dark-mode.preview-redesign .list-screen .bulk-context-actions:not([hidden])::before {
  background:
    radial-gradient(ellipse 72% 115% at 50% 0%, rgba(255, 255, 255, 0.21), transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 42%, rgba(0, 0, 0, 0.16));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 -1px 0 rgba(101, 207, 192, 0.16) inset;
}

html body.dark-mode.preview-redesign .bulk-context-actions .bulk-icon-action {
  color: #f0fbf8 !important;
}

html body.dark-mode.preview-redesign .bulk-context-actions .bulk-whatsapp-action {
  color: #83e8d8 !important;
}

html body.dark-mode.preview-redesign .bulk-context-actions .bulk-icon-action:hover,
html body.dark-mode.preview-redesign .bulk-context-actions .bulk-icon-action:focus-visible {
  background: rgba(240, 251, 248, 0.12) !important;
  color: #d7fff9 !important;
}

html body.dark-mode.preview-redesign .bulk-context-actions .bulk-whatsapp-action:hover,
html body.dark-mode.preview-redesign .bulk-context-actions .bulk-whatsapp-action:focus-visible {
  background: rgba(131, 232, 216, 0.16) !important;
  color: #b8fff3 !important;
}

html body.dark-mode.preview-redesign .bulk-context-actions .bulk-danger-action,
html body.dark-mode.preview-redesign .bulk-context-actions .bulk-danger-action:hover,
html body.dark-mode.preview-redesign .bulk-context-actions .bulk-danger-action:focus-visible {
  color: #ff7777 !important;
}

html body.dark-mode.preview-redesign .bulk-context-actions .bulk-danger-action:hover,
html body.dark-mode.preview-redesign .bulk-context-actions .bulk-danger-action:focus-visible {
  background: rgba(255, 119, 119, 0.16) !important;
}

/* Filtros de data em cápsulas únicas: navegação e escopo de seleção ficam
   agrupados sem perder a separação visual entre cada ação. */
.list-screen .bulk-date-control {
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  gap: 0;
  overflow: hidden;
  border: 1px solid rgba(13, 127, 116, 0.24);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 90%, var(--soft));
  box-shadow: 0 6px 16px rgba(13, 127, 116, 0.07);
}

.list-screen .bulk-date-control .bulk-date-step,
.list-screen .bulk-date-control input {
  min-height: 46px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.list-screen .bulk-date-control .bulk-date-step {
  border-radius: 999px;
}

.list-screen .bulk-date-control .bulk-date-step:first-child {
  border-right: 1px solid rgba(13, 127, 116, 0.2);
}

.list-screen .bulk-date-control .bulk-date-step:last-child {
  border-left: 1px solid rgba(13, 127, 116, 0.2);
}

.list-screen .bulk-date-control .bulk-date-step:hover,
.list-screen .bulk-date-control .bulk-date-step:focus-visible {
  background: var(--soft);
  color: var(--accent);
}

.list-screen .bulk-selection-scope {
  gap: 0;
  overflow: hidden;
  padding: 4px;
  border: 1px solid rgba(13, 127, 116, 0.24);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 90%, var(--soft));
  box-shadow: 0 6px 16px rgba(13, 127, 116, 0.07);
}

.list-screen .bulk-selection-scope button,
.list-screen .bulk-selection-scope button:hover,
.list-screen .bulk-selection-scope button:focus-visible,
.list-screen .bulk-selection-scope button.active {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--accent-dark);
  box-shadow: none;
}

.list-screen .bulk-selection-scope button + button {
  border-left: 1px solid rgba(13, 127, 116, 0.2);
}

.list-screen .bulk-selection-scope button:hover,
.list-screen .bulk-selection-scope button:focus-visible,
.list-screen .bulk-selection-scope button.active {
  background: var(--soft);
  color: var(--accent);
}

body.dark-mode .list-screen .bulk-date-control,
body.dark-mode .list-screen .bulk-selection-scope {
  border-color: rgba(159, 243, 229, 0.22);
  background: #192321;
}

body.dark-mode .list-screen .bulk-date-control .bulk-date-step,
body.dark-mode .list-screen .bulk-date-control input,
body.dark-mode .list-screen .bulk-selection-scope button,
body.dark-mode .list-screen .bulk-selection-scope button.active {
  color: #b8fff3;
}

body.dark-mode .list-screen .bulk-date-control .bulk-date-step:first-child,
body.dark-mode .list-screen .bulk-date-control .bulk-date-step:last-child,
body.dark-mode .list-screen .bulk-selection-scope button + button {
  border-color: rgba(159, 243, 229, 0.22);
}

body.dark-mode .list-screen .bulk-date-control .bulk-date-step:hover,
body.dark-mode .list-screen .bulk-date-control .bulk-date-step:focus-visible,
body.dark-mode .list-screen .bulk-selection-scope button:hover,
body.dark-mode .list-screen .bulk-selection-scope button:focus-visible,
body.dark-mode .list-screen .bulk-selection-scope button.active {
  background: #24534d;
  color: #e5fffa;
}

/* Clínica, modalidade e exame seguem a mesma linguagem de cápsulas dos
   demais filtros, incluindo quando ações auxiliares estão desativadas. */
.list-screen .clinic-filter-control {
  grid-template-columns: minmax(0, 1fr) 44px 44px 44px;
  gap: 0;
  overflow: hidden;
  border: 1px solid rgba(13, 127, 116, 0.24);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 90%, var(--soft));
  box-shadow: 0 6px 16px rgba(13, 127, 116, 0.07);
}

.list-screen .clinic-filter-control:has(button:disabled) {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.list-screen .clinic-filter-control select,
.list-screen .clinic-filter-control button {
  min-height: 46px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.list-screen .clinic-filter-control select {
  padding-inline: 14px 30px;
}

.list-screen .clinic-filter-control button {
  border-left: 1px solid rgba(13, 127, 116, 0.2);
}

.list-screen .clinic-filter-control button:hover,
.list-screen .clinic-filter-control button:focus-visible {
  background: var(--soft);
}

.list-screen .bulk-modality-field select,
.list-screen .bulk-exam-field select {
  min-height: 46px;
  border-radius: 999px;
  border-color: rgba(13, 127, 116, 0.24);
  background: color-mix(in srgb, var(--surface) 90%, var(--soft));
  box-shadow: 0 6px 16px rgba(13, 127, 116, 0.07);
}

body.dark-mode .list-screen .clinic-filter-control,
body.dark-mode .list-screen .bulk-modality-field select,
body.dark-mode .list-screen .bulk-exam-field select {
  border-color: rgba(159, 243, 229, 0.22);
  background: #192321;
  color: #b8fff3;
}

body.dark-mode .list-screen .clinic-filter-control button {
  border-left-color: rgba(159, 243, 229, 0.22);
  color: #b8fff3;
}

body.dark-mode .list-screen .clinic-filter-control button:hover,
body.dark-mode .list-screen .clinic-filter-control button:focus-visible,
body.dark-mode .list-screen .bulk-modality-field select:focus,
body.dark-mode .list-screen .bulk-exam-field select:focus {
  background: #24534d;
  color: #e5fffa;
}

body.dark-mode .list-screen .clinic-filter-control .clinic-folder-delete:not(:disabled) {
  color: #ff7a8a;
}

/* A clínica usa uma cápsula larga para o seletor e círculos independentes
   para as ações auxiliares, evitando que o sinal de mais fique espremido. */
.list-screen .clinic-filter-control {
  grid-template-columns: minmax(0, 1fr) repeat(3, 44px);
  gap: 6px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.list-screen .clinic-filter-control:has(button:disabled) {
  grid-template-columns: minmax(0, 1fr) repeat(3, 44px);
}

.list-screen .clinic-filter-control select {
  min-height: 46px;
  border: 1px solid rgba(13, 127, 116, 0.24);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 90%, var(--soft));
  box-shadow: 0 6px 16px rgba(13, 127, 116, 0.07);
}

.list-screen .clinic-filter-control button {
  display: grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid rgba(13, 127, 116, 0.24);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 90%, var(--soft));
  box-shadow: 0 6px 16px rgba(13, 127, 116, 0.07);
}

.list-screen .clinic-filter-control button:hover,
.list-screen .clinic-filter-control button:focus-visible {
  border-color: var(--accent);
  background: var(--soft);
}

.list-screen .clinic-filter-control .clinic-folder-delete:not(:disabled) {
  color: #dc3b4b;
}

.list-screen .clinic-filter-control .clinic-folder-delete:disabled,
.list-screen .clinic-filter-control .clinic-pdf-profile-button:disabled {
  display: none;
}

body.dark-mode .list-screen .clinic-filter-control select,
body.dark-mode .list-screen .clinic-filter-control button {
  border-color: rgba(159, 243, 229, 0.22);
  background: #192321;
  color: #b8fff3;
}

body.dark-mode .list-screen .clinic-filter-control button:hover,
body.dark-mode .list-screen .clinic-filter-control button:focus-visible {
  border-color: #69dfce;
  background: #24534d;
  color: #e5fffa;
}

body.dark-mode .list-screen .clinic-filter-control .clinic-folder-delete:not(:disabled) {
  color: #ff7a8a;
}

/* Cápsulas do Editor PACS: voltar à lista e as três ações de cópia
   compartilham o mesmo acabamento, sem criar três cartões separados. */
body.preview-redesign.quick-editor-mode .topbar-actions #backToListButton,
body.preview-redesign.quick-editor-mode #backToListButton {
  min-height: 42px !important;
  padding: 0 20px !important;
  border: 1px solid rgba(13, 127, 116, 0.28) !important;
  border-radius: 999px !important;
  background: color-mix(in srgb, var(--surface) 88%, var(--soft)) !important;
  color: var(--accent-dark) !important;
  box-shadow: none !important;
}

body.preview-redesign.quick-editor-mode .topbar-actions #backToListButton:hover,
body.preview-redesign.quick-editor-mode .topbar-actions #backToListButton:focus-visible {
  border-color: var(--accent) !important;
  background: var(--soft) !important;
  color: var(--accent-dark) !important;
}

body.preview-redesign.quick-editor-mode .quick-editor-inline-actions {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 0 !important;
  margin: 10px 0 4px !important;
  padding: 4px !important;
  border: 1px solid rgba(13, 127, 116, 0.24) !important;
  border-radius: 999px !important;
  background: color-mix(in srgb, var(--surface) 90%, var(--soft)) !important;
  box-shadow: 0 7px 18px rgba(13, 127, 116, 0.08) !important;
}

body.preview-redesign.quick-editor-mode .quick-editor-inline-actions .quick-editor-copy-action,
body.preview-redesign.quick-editor-mode .quick-editor-inline-actions .quick-editor-copy-action:hover,
body.preview-redesign.quick-editor-mode .quick-editor-inline-actions .quick-editor-copy-action:focus-visible,
body.preview-redesign.quick-editor-mode .quick-editor-inline-actions .quick-editor-copy-action:active {
  min-height: 42px !important;
  min-width: 0 !important;
  padding: 0 10px !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: transparent !important;
  color: var(--accent-dark) !important;
  box-shadow: none !important;
  font-size: clamp(0.72rem, 2.9vw, 0.86rem) !important;
  line-height: 1.2 !important;
}

body.preview-redesign.quick-editor-mode .quick-editor-inline-actions .quick-editor-copy-action + .quick-editor-copy-action {
  border-left: 1px solid rgba(13, 127, 116, 0.2) !important;
}

body.preview-redesign.quick-editor-mode .quick-editor-inline-actions .quick-editor-copy-action:hover,
body.preview-redesign.quick-editor-mode .quick-editor-inline-actions .quick-editor-copy-action:focus-visible {
  background: var(--soft) !important;
  color: var(--accent) !important;
}

body.dark-mode.preview-redesign.quick-editor-mode .topbar-actions #backToListButton,
body.dark-mode.preview-redesign.quick-editor-mode #backToListButton,
body.dark-mode.preview-redesign.quick-editor-mode .quick-editor-inline-actions {
  border-color: rgba(159, 243, 229, 0.22) !important;
  background: #192321 !important;
  color: #b8fff3 !important;
}

body.dark-mode.preview-redesign.quick-editor-mode .topbar-actions #backToListButton:hover,
body.dark-mode.preview-redesign.quick-editor-mode .topbar-actions #backToListButton:focus-visible,
body.dark-mode.preview-redesign.quick-editor-mode .quick-editor-inline-actions .quick-editor-copy-action:hover,
body.dark-mode.preview-redesign.quick-editor-mode .quick-editor-inline-actions .quick-editor-copy-action:focus-visible {
  border-color: #69dfce !important;
  background: #24534d !important;
  color: #e5fffa !important;
}

body.dark-mode.preview-redesign.quick-editor-mode .quick-editor-inline-actions .quick-editor-copy-action {
  color: #b8fff3 !important;
}

body.dark-mode.preview-redesign.quick-editor-mode .quick-editor-inline-actions .quick-editor-copy-action + .quick-editor-copy-action {
  border-left-color: rgba(159, 243, 229, 0.22) !important;
}

/* Lista compacta: ano -> mês -> dia. */
.year-report-group,
.month-report-group { border-bottom: 1px solid #e3e7e4; background: #fff; }
.year-group-header,
.month-group-header { width: 100%; display: flex; align-items: center; gap: 12px; border: 0; color: inherit; text-align: left; cursor: pointer; }
.year-group-header { min-height: 68px; padding: 12px 18px; background: #eef8f5; }
.month-group-header { min-height: 58px; padding: 10px 18px 10px 28px; background: #f7fbf9; }
.year-group-copy,
.month-group-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.year-group-copy strong,
.month-group-copy strong { font-size: 1.08rem; }
.year-group-copy small,
.month-group-copy small { color: #62716d; font-size: .88rem; }
.year-group-count,
.month-group-count { min-width: 2.1rem; height: 2.1rem; border-radius: 999px; display: grid; place-items: center; background: #e6f5f1; color: #126a60; font-weight: 700; }
.year-group-chevron,
.month-group-chevron { color: #6e817c; font-size: 1.4rem; line-height: 1; }

/* Contraste do ano ativo no modo claro. */
body:not(.dark-mode) .list-screen .year-group-header { color: #123b35; }
body:not(.dark-mode) .list-screen .year-group-header:hover,
body:not(.dark-mode) .list-screen .year-group-header:focus-visible {
  background: #d8eee8;
  color: #123b35;
}
body:not(.dark-mode) .list-screen .year-report-group.partially-selected .year-group-header {
  background: #d9eee9;
  color: #123b35;
}
body:not(.dark-mode) .list-screen .year-report-group.fully-selected .year-group-header,
body:not(.dark-mode) .list-screen .year-group-header[aria-expanded="true"] {
  background: #0f766e;
  color: #ffffff;
}
body:not(.dark-mode) .list-screen .year-group-header[aria-expanded="true"] .year-group-copy strong {
  color: #ffffff;
}
body:not(.dark-mode) .list-screen .year-group-header[aria-expanded="true"] .year-group-copy small,
body:not(.dark-mode) .list-screen .year-group-header[aria-expanded="true"] .year-group-chevron {
  color: #e6fffa;
}
body:not(.dark-mode) .list-screen .year-group-header[aria-expanded="true"] .year-group-count {
  background: #f3fffb;
  color: #0b5751;
}
.year-group-list { border-top: 1px solid #dfe8e4; }
.month-group-list { border-top: 1px solid #e5ece9; }
body.dark-mode .list-screen .year-report-group,
body.dark-mode .list-screen .month-report-group { background: #192321; border-color: #3a514b; }
body.dark-mode .list-screen .year-group-header,
body.dark-mode .list-screen .month-group-header { background: #192321; color: #f4faf7; border-color: #3a514b !important; }
body.dark-mode .list-screen .year-group-header { background: #203a35; }
body.dark-mode .list-screen .month-group-header { background: #1d2d29; }
body.dark-mode .list-screen .year-group-copy small,
body.dark-mode .list-screen .month-group-copy small { color: #b7c9c4; }
body.dark-mode .list-screen .year-group-count,
body.dark-mode .list-screen .month-group-count { background: #dff6ef; color: #126a60; }
body.dark-mode .list-screen .year-group-chevron,
body.dark-mode .list-screen .month-group-chevron { color: #c7e8df; }
body.dark-mode .list-screen .year-group-list,
body.dark-mode .list-screen .month-group-list { border-color: #3a514b; }

/* Keep the mobile layout anchored to the device viewport after a browser
   restart.  Without an explicit inline-size/text-size policy, iOS may
   restore a wider layout viewport or enlarge text and make the page appear
   zoomed until the user pinches out manually. */
html {
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.dark-mode {
  --bg: #111918;
  --panel: #192321;
  --ink: #edf5f1;
  --muted: #a8b7b1;
  --line: #344540;
  --soft: #173e3a;
  --surface: #1d2926;
  color-scheme: dark;
  background: linear-gradient(180deg, #101716 0, #111918 240px);
}

body.dark-mode .list-screen,
body.dark-mode .editor-screen,
body.dark-mode .welcome-dialog,
body.dark-mode .privacy-card,
body.dark-mode .report-editor,
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea,
body.dark-mode .secondary,
body.dark-mode .action-share,
body.dark-mode .template-manager-item {
  background: #192321;
  color: var(--ink);
}

body.dark-mode .list-topbar,
body.dark-mode .topbar,
body.dark-mode .dictation-toolbar,
body.dark-mode .editor-bottom-bar,
body.dark-mode .template-manager-gate,
body.dark-mode .about-gate,
body.dark-mode .profile-gate,
body.dark-mode .account-gate,
body.dark-mode .privacy-gate,
body.dark-mode .delivery-confirmation-gate,
body.dark-mode .productivity-gate,
body.dark-mode .admin-gate,
body.dark-mode .patient-gate,
body.dark-mode .pdf-options-gate {
  background-color: #111918;
}

body.dark-mode .clinic-pdf-profile-gate {
  background-color: #111918;
}

body.dark-mode .about-brand-bar,
body.dark-mode button:not(.secondary):not(.theme-toggle):not(.list-settings-button):not(.list-privacy-button):not(.list-productivity-button):not(.list-account-button):not(.list-admin-button):not(.list-edit-button):not(.list-plus):not(.academy-lesson-button) {
  color: #ffffff;
}

/* Keep the signature image/canvas unchanged, while giving the controls
   beneath it a readable dark-mode surface and an obvious focus state. */
body.dark-mode .profile-actions .file-picker {
  background: #1f302c;
  border-color: #5d8077;
  color: #f2f7f5;
  box-shadow: none;
}

body.dark-mode .profile-actions .file-picker:hover,
body.dark-mode .profile-actions .file-picker:focus-within {
  background: #2a554c;
  border-color: #7ce6d8;
  color: #ffffff;
}

body.dark-mode .profile-signature-status {
  border-color: #3d6259;
  background: #172521;
  color: #d8e4e0;
}

body.dark-mode .profile-signature-status.is-image {
  border-color: #2e8074;
  background: #153a34;
  color: #baf5e9;
}

body.dark-mode .profile-remove-signature {
  color: #ffaaa2;
}

body.dark-mode .profile-remove-signature:hover,
body.dark-mode .profile-remove-signature:focus-visible {
  background: rgba(255, 170, 162, 0.12);
  color: #ffd0cc;
}

body.dark-mode .editor-screen .report-form,
body.dark-mode .doctor-profile-strip,
body.dark-mode .dictation-panel,
body.dark-mode .signature-panel,
body.dark-mode .bulk-panel,
body.dark-mode .queue-list,
body.dark-mode .report-row,
body.dark-mode .template-manager-list-section {
  background: #192321;
  color: var(--ink);
}

body.dark-mode .report-editor {
  caret-color: #f5d76e;
}

body.dark-mode .report-editor mark,
body.dark-mode .report-editor .ai-inserted,
body.dark-mode .report-editor [data-ai-inserted="true"] {
  background: rgba(244, 63, 94, 0.2);
}

body.dark-mode .template-manager-gate,
body.dark-mode .about-gate,
body.dark-mode .profile-gate,
body.dark-mode .account-gate,
body.dark-mode .productivity-gate,
body.dark-mode .admin-gate,
body.dark-mode .patient-gate,
body.dark-mode .pdf-options-gate {
  background: rgba(6, 12, 11, 0.92);
}

body.dark-mode .clinic-pdf-profile-gate {
  background: rgba(6, 12, 11, 0.92);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  width: 100%;
  min-width: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: linear-gradient(180deg, #ffffff 0, var(--bg) 240px);
  color: var(--ink);
}

body.welcome-open {
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

html.modal-scroll-locked,
body.modal-scroll-locked {
  overscroll-behavior: none !important;
}

body.welcome-open [role="dialog"] {
  overscroll-behavior: none;
  touch-action: none;
}

body.welcome-open [role="dialog"] > .welcome-dialog,
body.welcome-open [role="dialog"] > .academy-dialog,
body.welcome-open [role="dialog"] > .draft-notebook-dialog {
  touch-action: pan-y;
}

body.app-loading {
  overflow: hidden;
}

body.app-loading .app-shell {
  visibility: hidden;
  pointer-events: none;
}

.app-loading-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 50% 38%, rgba(15, 118, 110, 0.11), transparent 34%),
    linear-gradient(160deg, #fbfefd 0%, #edf7f4 100%);
  color: #0f766e;
  opacity: 1;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.app-loading-screen.is-leaving {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.app-loading-content {
  display: grid;
  justify-items: center;
  width: min(320px, 86vw);
  text-align: center;
}

.app-loading-mark {
  width: 146px;
  height: 146px;
  margin-bottom: 20px;
  color: #0f766e;
  filter: drop-shadow(0 14px 24px rgba(15, 118, 110, 0.13));
  overflow: visible;
}

.app-loading-mark use {
  fill: currentColor;
}

.app-loading-mark-track {
  opacity: 0.16;
}

.app-loading-mark-progress {
  clip-path: inset(100% 0 0 0);
  animation: app-loading-fill 0.72s ease-out forwards;
}

.app-loading-content strong {
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.app-loading-content p {
  min-height: 1.5em;
  margin: 8px 0 13px;
  color: #61736e;
  font-size: 0.9rem;
  line-height: 1.45;
}

.app-loading-dots {
  display: inline-flex;
  gap: 6px;
  min-height: 10px;
}

.app-loading-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: app-loading-dot 1.1s ease-in-out infinite;
}

.app-loading-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.app-loading-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes app-loading-fill {
  from { clip-path: inset(100% 0 0 0); opacity: 0.65; }
  to { clip-path: inset(0 0 0 0); opacity: 1; }
}

@keyframes app-loading-dot {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

@media (prefers-reduced-motion: reduce) {
  .app-loading-mark-progress,
  .app-loading-dots i {
    animation: none;
  }

  .app-loading-mark-progress {
    clip-path: inset(0);
  }
}

body.dark-mode .app-loading-screen {
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.08), transparent 34%),
    linear-gradient(160deg, #10221f 0%, #07110f 100%);
  color: #ffffff;
}

body.dark-mode .app-loading-mark {
  color: #ffffff;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.28));
}

body.dark-mode .app-loading-content p {
  color: #c1ceca;
}

@media (prefers-color-scheme: dark) {
  body.app-loading:not(.theme-ready) .app-loading-screen {
    background:
      radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.08), transparent 34%),
      linear-gradient(160deg, #10221f 0%, #07110f 100%);
    color: #ffffff;
  }

  body.app-loading:not(.theme-ready) .app-loading-mark {
    color: #ffffff;
  }

  body.app-loading:not(.theme-ready) .app-loading-content p {
    color: #c1ceca;
  }
}

button,
input,
textarea,
select {
  font: inherit;
}

/* O Safari do iPhone amplia a página quando um campo de texto tem menos de
   16px no momento do foco. Mantenha os campos do fluxo de identificação
   nessa medida para o teclado abrir sem deslocar as proporções da tela.
   Isso não desativa o zoom manual do usuário. */
@media (max-width: 700px) {
  #quickPatientName,
  #patientName,
  #quickPatientBirthDate,
  #patientBirthDate,
  #quickExamSearch,
  #examSearch {
    font-size: 16px !important;
  }
}

.auth-gate,
.reset-gate,
.welcome-gate,
.profile-gate,
.account-gate,
.privacy-gate,
.delivery-confirmation-gate,
.patient-gate,
.pdf-options-gate,
.clinic-pdf-profile-gate,
.productivity-gate,
.admin-gate,
.about-gate,
.academy-gate,
.template-manager-gate,
.previous-report-gate,
.draft-notebook-gate {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(243, 245, 242, 0.96);
}

.auth-gate {
  z-index: 80;
}

.welcome-dialog {
  position: relative;
  width: min(760px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 22px 54px rgba(25, 33, 31, 0.16);
  padding: 22px;
}

.dialog-app-icon {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 52px;
  height: 52px;
  border-radius: 13px;
  box-shadow: 0 10px 22px rgba(13, 95, 89, 0.16);
  object-fit: cover;
}

.welcome-header {
  display: grid;
  gap: 10px;
  padding-right: 72px;
}

.welcome-header h2 {
  font-size: clamp(1.4rem, 4vw, 2.05rem);
  line-height: 1.12;
}

.welcome-header p,
.welcome-terms,
.acceptance-check {
  line-height: 1.5;
}

.welcome-header p,
.welcome-terms {
  color: var(--muted);
}

.notice-band {
  margin-top: 18px;
  border: 1px solid #f1d29b;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff8eb;
  color: #72410a;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.45;
}

.welcome-terms {
  display: grid;
  gap: 10px;
  margin: 18px 0;
  padding-left: 20px;
}

.acceptance-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
}

.acceptance-check input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  min-height: 20px;
  margin-top: 2px;
  padding: 0;
  accent-color: var(--accent);
}

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

.profile-form-actions {
  position: sticky;
  bottom: -22px;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 10px;
  margin: 22px -22px -22px;
  padding: 14px 22px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -10px 24px rgba(25, 33, 31, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.profile-gate.is-required .profile-form-actions {
  grid-template-columns: 1fr;
}

.profile-cancel-action,
.profile-save-action {
  width: 100%;
  min-height: 50px;
}

.profile-save-action {
  font-weight: 750;
}

.profile-dialog-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.profile-dialog-nav .dialog-app-icon {
  position: static;
  flex: 0 0 auto;
}

.profile-dialog .welcome-header {
  padding-right: 0;
}

.profile-account-action {
  position: relative;
  z-index: 6;
  min-height: 42px;
  padding: 0 16px;
  pointer-events: auto;
  touch-action: manipulation;
}

body.dark-mode .profile-form-actions {
  border-color: #334c46;
  background: rgba(17, 25, 24, 0.96);
  box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.25);
}

.account-dialog {
  width: min(600px, 100%);
}

.privacy-dialog {
  width: min(680px, 100%);
  max-height: min(90dvh, 760px);
}

.privacy-insignia {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.privacy-insignia-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
}

.privacy-insignia-mark svg {
  width: 32px;
  height: 35px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-privacy-insignia {
  margin-top: 16px;
  border-color: color-mix(in srgb, var(--accent) 46%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 38%, transparent);
}

.app-privacy-insignia .privacy-insignia-mark {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 60%, transparent);
  color: var(--accent);
}

.app-privacy-insignia .privacy-insignia-copy .eyebrow {
  color: var(--accent-dark);
}

.app-privacy-insignia .privacy-insignia-copy h3 {
  margin-top: 4px;
  font-size: 1.05rem;
}

.app-privacy-insignia .privacy-insignia-copy p:not(.eyebrow) {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.app-privacy-insignia .privacy-insignia-copy small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.74rem;
}

.privacy-sections {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.privacy-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent-soft) 28%, transparent);
}

.privacy-card h3,
.privacy-card p {
  margin: 0;
}

.privacy-card label {
  display: grid;
  gap: 6px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.privacy-card textarea {
  min-height: 86px;
  resize: vertical;
}

.privacy-card a {
  color: var(--accent-dark);
}

.privacy-export-note,
.privacy-export-warning {
  font-size: 0.82rem;
  line-height: 1.4;
}

.privacy-export-warning {
  color: var(--muted);
}

.privacy-export-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.privacy-export-actions button {
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  font-size: 0.82rem;
  line-height: 1.25;
  white-space: normal;
}

@media (max-width: 520px) {
  .privacy-export-actions {
    grid-template-columns: 1fr;
  }
}

.privacy-policy-summary {
  padding-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.privacy-acceptance {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.privacy-acceptance-check {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: flex-start;
  gap: 8px !important;
  color: var(--text) !important;
}

.privacy-acceptance-check input {
  width: 18px;
  min-width: 18px;
  margin-top: 2px;
}

.privacy-acceptance-status {
  min-height: 1.2em;
  color: var(--muted);
  font-size: 0.82rem;
}

.privacy-request-status {
  min-height: 1.2em;
  color: var(--muted);
  font-size: 0.84rem;
}

.privacy-contact {
  color: var(--muted);
  font-size: 0.8rem;
}

.delivery-confirmation-dialog {
  width: min(560px, 100%);
}

.delivery-confirmation-dialog > label:not(.delivery-confirmation-check) {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  color: var(--muted);
}

.delivery-confirmation-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.delivery-confirmation-check input {
  width: 20px;
  min-width: 20px;
  min-height: 20px;
  padding: 0;
  flex: 0 0 auto;
  margin-top: 3px;
}

.delivery-confirmation-status {
  min-height: 1.2em;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.delivery-confirmation-code {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--accent-dark);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

body.dark-mode .delivery-confirmation-code {
  border-color: #42605a;
  background: #192321;
  color: #9ff3e5;
}

.account-status,
.account-footnote {
  color: var(--muted);
  font-size: 0.86rem;
}

.account-history {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.account-period-picker {
  display: grid;
  gap: 6px;
  margin: 12px 0;
  color: var(--muted-text, #6b7f7b);
  font-size: 0.86rem;
  font-weight: 700;
}

.account-period-picker select {
  width: 100%;
  min-height: 44px;
}

.account-history h3 {
  margin: 0;
  font-size: 0.95rem;
}

.account-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.account-history-row span {
  display: grid;
  gap: 2px;
}

.account-history-row small,
.account-history-row time,
.account-history-empty {
  color: var(--muted);
  font-size: 0.78rem;
}

.account-summary,
.admin-usage-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.usage-card {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent-soft) 42%, transparent);
}

.usage-card small {
  color: var(--muted);
}

.usage-card strong {
  overflow-wrap: anywhere;
  font-size: 1.05rem;
}

.usage-credit-breakdown {
  grid-column: 1 / -1;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent-soft) 28%, transparent);
}

.usage-credit-breakdown h3 {
  margin: 0 0 10px;
  font-size: 0.98rem;
}

.usage-credit-table-wrap {
  overflow-x: auto;
}

.usage-credit-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.usage-credit-table th,
.usage-credit-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.usage-credit-table thead th {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.usage-credit-table tbody th {
  font-weight: 700;
}

.usage-credit-table td:last-child,
.usage-credit-table th:last-child {
  text-align: right;
}

.usage-credit-table tfoot th,
.usage-credit-table tfoot td {
  border-bottom: 0;
  color: var(--accent-dark);
  font-weight: 800;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.auth-dialog {
  width: min(720px, 100%);
  background: linear-gradient(145deg, #ffffff 0%, #f8fbfa 100%);
}

.auth-promo {
  position: relative;
  min-height: 148px;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-top: 20px;
  padding: 22px 24px;
  border: 1px solid rgba(13, 95, 89, 0.22);
  border-radius: 22px;
  color: #f4fffc;
  background: radial-gradient(circle at 82% 12%, rgba(113, 239, 208, 0.26), transparent 32%), linear-gradient(128deg, #0c3c3b, #0c6e68 58%, #123b4a);
  box-shadow: 0 18px 34px rgba(8, 70, 67, 0.2), inset 0 1px 0 rgba(255,255,255,0.2);
  isolation: isolate;
}

.auth-promo::after {
  content: "";
  position: absolute;
  inset: auto -8% -58% 32%;
  height: 120px;
  border-radius: 50%;
  background: rgba(132, 242, 215, 0.13);
  transform: rotate(-10deg);
  z-index: -1;
}

.auth-promo-copy { display: grid; gap: 7px; max-width: 360px; }
.auth-promo-kicker { color: #9cf2dd; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.auth-promo-copy strong { font-size: clamp(1.1rem, 2vw, 1.45rem); line-height: 1.15; }
.auth-promo-copy p { margin: 0; color: rgba(244,255,252,0.78); font-size: 0.88rem; line-height: 1.4; }
.auth-promo-cards { display: grid; gap: 7px; min-width: 142px; transform: perspective(500px) rotateY(-12deg) rotateX(4deg); }
.auth-promo-cards span { display: block; padding: 8px 11px; border: 1px solid rgba(190,255,238,0.28); border-radius: 10px; background: rgba(6, 37, 42, 0.35); box-shadow: 0 7px 12px rgba(0,0,0,0.12); font-size: 0.76rem; }
.auth-promo-cards b { margin-right: 7px; color: #9cf2dd; font-size: 0.68rem; }
.auth-promo-orbit { position: absolute; top: -30px; right: 106px; width: 120px; height: 120px; border: 1px solid rgba(182,255,235,0.25); border-radius: 50%; transform: rotateX(64deg) rotateZ(-18deg); opacity: 0.8; }
.auth-promo-orbit::before, .auth-promo-orbit::after { content: ""; position: absolute; inset: 18px; border: 1px solid rgba(182,255,235,0.18); border-radius: 50%; }
.auth-promo-orbit span { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: #b5ffe9; box-shadow: 0 0 12px #b5ffe9; }
.auth-promo-orbit span:nth-child(1) { top: 8px; left: 54px; }.auth-promo-orbit span:nth-child(2) { right: 9px; bottom: 35px; }.auth-promo-orbit span:nth-child(3) { left: 19px; bottom: 12px; }

@media (max-width: 560px) {
  .auth-dialog { width: min(100%, 430px); max-height: calc(100svh - 24px); padding: 16px; border-radius: 18px; }
  .auth-dialog .dialog-app-icon { top: 13px; right: 13px; width: 42px; height: 42px; border-radius: 11px; }
  .auth-dialog .welcome-header { gap: 6px; padding-right: 52px; }
  .auth-dialog .welcome-header h2 { font-size: clamp(1.35rem, 6vw, 1.75rem); }
  .auth-dialog .welcome-header p:last-child { font-size: 0.82rem; line-height: 1.32; }
  .auth-promo { grid-template-columns: 1fr; min-height: 0; padding: 18px; }
  .auth-promo { gap: 10px; margin-top: 14px; padding: 14px; border-radius: 16px; }
  .auth-promo-copy { gap: 4px; }
  .auth-promo-copy strong { font-size: 1rem; }
  .auth-promo-copy p { font-size: 0.76rem; line-height: 1.28; }
  .auth-promo-kicker { font-size: 0.64rem; }
  .auth-promo-cards { grid-template-columns: repeat(3, 1fr); min-width: 0; transform: none; }
  .auth-promo-cards span { padding: 6px 4px; text-align: center; font-size: 0.64rem; }
  .auth-promo-cards b { display: block; margin: 0 0 2px; }
  .auth-promo-orbit { right: -18px; top: -56px; }
  .auth-dialog .auth-grid { gap: 8px; margin-top: 12px; }
  .auth-dialog .auth-grid label { font-size: 0.82rem; }
  .auth-dialog .auth-grid input { min-height: 44px; padding: 9px 11px; }
  .auth-dialog .auth-actions { gap: 8px; margin-top: 10px; }
  .auth-dialog .auth-actions button { min-height: 42px; padding: 8px 10px; font-size: 0.82rem; }
  .auth-request-button { margin-top: 8px; padding: 8px 10px; font-size: 0.78rem; }
}

.auth-grid {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

/* Safari amplia automaticamente a página quando um campo focado usa menos de
   16 px. Os inputs herdavam os 0.88rem do label e faziam o painel de acesso
   abrir no zoom da primeira captura. */
.auth-grid input {
  font-size: 1rem;
}

.auth-status {
  min-height: 22px;
  margin-top: 12px;
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
}

.auth-status.is-error {
  color: #b42318;
}

.auth-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.auth-actions.two-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.auth-request-button {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(13, 95, 89, 0.24);
  border-radius: 10px;
  color: var(--accent-dark);
  font-size: 0.86rem;
  font-weight: 750;
  text-decoration: none;
  background: rgba(13, 95, 89, 0.04);
}

.auth-request-button:hover { background: rgba(13, 95, 89, 0.09); }

.auth-request-button.is-disabled {
  cursor: default;
  opacity: 0.7;
}

.profile-signature-box {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.profile-signature-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-signature-header h3 {
  margin: 0;
  font-size: 1rem;
}

.profile-signature-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.profile-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.profile-actions .file-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
}

.profile-actions .file-picker svg,
.profile-remove-signature svg {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.profile-signature-status {
  margin: 0;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.35;
}

.profile-signature-status.is-image {
  border-color: #a7d9d1;
  background: #edf9f6;
  color: var(--accent-dark);
}

.profile-remove-signature {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  gap: 7px;
  min-height: 40px;
  padding: 6px 12px;
  border: 0;
  background: transparent;
  color: #b42318;
  box-shadow: none;
  font-size: 0.84rem;
  font-weight: 700;
}

.profile-remove-signature:hover,
.profile-remove-signature:focus-visible {
  background: #fff0ee;
  color: #8f1c13;
}

.profile-remove-signature:disabled {
  background: transparent;
  color: var(--muted);
  opacity: 0.45;
  cursor: default;
}

.profile-photo-adjust {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  background: #fbfcfa;
}

.profile-photo-adjust-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.profile-photo-adjust-actions {
  display: flex;
  gap: 8px;
}

.profile-photo-adjust-header h4 {
  margin: 0;
  font-size: 0.92rem;
}

.profile-photo-adjust-header button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.82rem;
}

.profile-photo-zoom-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 8px;
}

.profile-photo-zoom-row input[type="range"] {
  min-height: 30px;
  padding: 0;
  background: transparent;
}

#profileSignaturePhotoZoomValue {
  display: grid;
  place-items: center;
  min-height: 34px;
  min-width: 54px;
  color: var(--accent-dark);
  font-size: 0.84rem;
  font-weight: 700;
}

.profile-photo-gesture-hint {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

body.dark-mode .profile-photo-adjust {
  border-color: #3d6259;
  background: #172521;
  color: #f4faf7;
}

body.dark-mode .profile-photo-adjust-header h4,
body.dark-mode #profileSignaturePhotoZoomValue {
  color: #baf5e9;
}

.quick-patient-field {
  margin-top: 18px;
}

.quick-patient-name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.quick-patient-name-row .quick-patient-field {
  min-width: 0;
  margin-top: 18px;
}

.quick-patient-dictate-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  margin-bottom: 0;
  padding-inline: 13px;
  white-space: nowrap;
}

.quick-patient-dictate-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.admin-dialog {
  width: min(680px, 100%);
  max-height: calc(100dvh - 24px);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.admin-gate {
  overscroll-behavior: none;
  touch-action: none;
}

.admin-invite-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 0.35fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 20px;
}

.admin-invite-form label {
  min-width: 0;
}

.admin-invite-form input {
  width: 100%;
}

.admin-invite-form button {
  min-width: 132px;
}

.admin-status {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.admin-status.is-error {
  color: #be123c;
}

.admin-status.is-success {
  color: var(--accent-dark);
}

.admin-usage-summary {
  margin-top: 10px;
}

.admin-user-usage {
  display: block;
  color: var(--accent-dark);
  font-size: 0.76rem;
}

.admin-user-group {
  display: grid;
  gap: 0;
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.admin-user-group h4 {
  margin: 0;
  padding: 10px 14px;
  color: var(--accent-dark);
  background: color-mix(in srgb, var(--accent-soft) 55%, transparent);
  font-size: 0.86rem;
}

.admin-user-group .admin-user-row {
  border-radius: 0;
  border-inline: 0;
}

.account-credit-notice {
  grid-column: 1 / -1;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #d7a72f;
  border-radius: 12px;
  color: #7a4d00;
  background: #fff7d6;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.4;
}

body.dark-mode .account-credit-notice {
  color: #ffe39a;
  background: #392f17;
}

.admin-user-presence {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.admin-user-presence::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #94a3b8;
}

.admin-user-presence.is-online {
  color: #0f766e;
}

.admin-user-presence.is-online::before {
  background: #14b8a6;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.14);
}

.admin-user-presence.is-active::before {
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.admin-users-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.admin-users-heading h3 {
  margin: 0;
  font-size: 1rem;
}

.admin-retention-heading {
  align-items: flex-start;
}

.admin-retention-heading > div {
  min-width: 0;
}

.admin-retention-heading p {
  max-width: 560px;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.admin-retention-list {
  display: grid;
  max-height: min(38vh, 360px);
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-y: auto;
}

.admin-retention-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.admin-retention-row:last-child {
  border-bottom: 0;
}

.admin-retention-row.is-pending {
  background: #fff7df;
  border-inline-start: 4px solid #d97706;
}

.admin-retention-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.admin-retention-copy strong,
.admin-retention-copy small {
  overflow-wrap: anywhere;
}

.admin-retention-copy small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.admin-retention-pending {
  color: #a16207 !important;
  font-weight: 700;
}

.admin-retention-status {
  width: fit-content;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.7rem;
  font-weight: 800;
}

.admin-retention-status.is-scheduled {
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent-dark);
}

.admin-retention-status.is-processing {
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
}

.admin-retention-status.is-pending {
  background: rgba(217, 119, 6, 0.14);
  color: #a16207;
}

.admin-retention-status.is-restored {
  background: rgba(22, 163, 74, 0.12);
  color: #166534;
}

.admin-retention-status.is-purged {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
}

.admin-retention-status.is-failed {
  background: rgba(190, 18, 60, 0.12);
  color: #be123c;
}

.admin-retention-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.admin-retention-actions button {
  min-width: 0;
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.76rem;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
}

.admin-restore-access {
  border-color: #0f766e;
  background: #e6fffa;
  color: #115e59;
}

.admin-retention-audit {
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.admin-privacy-requests-heading {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.admin-privacy-requests-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.admin-privacy-request-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 170px);
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent-soft) 20%, transparent);
}

.admin-privacy-request-row.is-overdue {
  border-color: #e4a13a;
  background: #fff7df;
}

.admin-privacy-request-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.admin-privacy-request-copy strong,
.admin-privacy-request-copy small {
  overflow-wrap: anywhere;
}

.admin-privacy-request-copy small {
  color: var(--muted);
  font-size: 0.76rem;
}

.admin-privacy-request-due {
  color: var(--accent-dark) !important;
}

.admin-privacy-request-row.is-overdue .admin-privacy-request-due {
  color: #a15c00 !important;
  font-weight: 700;
}

.admin-privacy-request-status {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.74rem;
}

.admin-privacy-request-status select {
  width: 100%;
  min-height: 36px;
  padding: 6px 8px;
  font-size: 0.8rem;
}

body.dark-mode .admin-privacy-request-row.is-overdue {
  border-color: #d79b2c;
  background: #3a2d12;
}

body.dark-mode .admin-privacy-request-row.is-overdue .admin-privacy-request-due {
  color: #fbbf24 !important;
}

@media (max-width: 560px) {
  .admin-privacy-request-row {
    grid-template-columns: 1fr;
  }
}

.admin-retention-audit h4 {
  margin: 12px 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-retention-audit-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
}

.admin-retention-audit-row span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.admin-retention-audit-row span:last-child {
  text-align: right;
}

.admin-retention-audit-row small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

body.dark-mode .admin-retention-row.is-pending {
  background: #3a2d12;
  border-inline-start-color: #f59e0b;
}

body.dark-mode .admin-retention-pending,
body.dark-mode .admin-retention-status.is-pending {
  color: #fbbf24 !important;
}

body.dark-mode .admin-retention-status.is-restored {
  background: rgba(74, 222, 128, 0.16);
  color: #bbf7d0;
}

body.dark-mode .admin-restore-access {
  border-color: #5eead4;
  background: rgba(20, 184, 166, 0.18);
  color: #ccfbf1;
}

.admin-users-heading button {
  min-height: 36px;
  padding: 0 12px;
}

.admin-users-list {
  display: grid;
  max-height: min(46vh, 430px);
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-y: auto;
}

.admin-user-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.admin-user-row:last-child {
  border-bottom: 0;
}

.admin-user-state {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d97706;
}

.admin-user-state.is-confirmed {
  background: #0f766e;
}

.admin-user-state.is-blocked {
  background: #be123c;
}

.admin-user-row.is-blocked {
  background: rgba(190, 18, 60, 0.04);
}

.admin-user-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.admin-user-copy strong,
.admin-user-copy small {
  overflow-wrap: anywhere;
}

.admin-user-copy small,
.admin-empty {
  color: var(--muted);
  font-size: 0.8rem;
}

.admin-empty {
  margin: 0;
  padding: 18px 14px;
}

.admin-actions {
  grid-template-columns: 1fr;
}

.admin-user-actions {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.admin-user-actions button {
  min-width: 0;
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.76rem;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
}

.admin-delete-user {
  border-color: #e11d48;
  background: #fff1f2;
  color: #be123c;
  box-shadow: none;
}

.admin-delete-user:hover,
.admin-delete-user:focus-visible {
  border-color: #be123c;
  background: #be123c;
  color: #ffffff;
}

.admin-user-protected {
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent-dark);
  font-size: 0.7rem;
  font-weight: 800;
}

body.dark-mode .admin-users-list,
body.dark-mode .admin-user-row {
  border-color: #344540;
}

body.dark-mode .admin-user-row {
  background: #192321;
}

body.dark-mode .admin-user-row.is-blocked {
  background: rgba(190, 18, 60, 0.12);
}

body.dark-mode .admin-user-presence.is-online {
  color: #9ff3e5;
}

body.dark-mode .admin-delete-user {
  border-color: #fb7185;
  background: rgba(190, 18, 60, 0.15);
  color: #fecdd3;
}

#quickPatientDictateButton.is-listening,
#quickPatientDictateButton.is-listening:hover {
  border-color: #e11d48;
  background: #be123c;
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(225, 29, 72, 0.16);
  animation: quick-patient-listening-pulse 1.15s ease-in-out infinite;
}

#quickPatientDictateButton.is-processing,
#quickPatientDictateButton.is-processing:hover {
  position: relative;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  border-color: #d97706;
  background: #b45309;
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.14);
}

#quickPatientDictateButton.is-processing::before {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: quick-patient-processing-spin 0.8s linear infinite;
  content: "";
}

@keyframes quick-patient-processing-spin {
  to { transform: rotate(360deg); }
}

@keyframes quick-patient-listening-pulse {
  50% {
    box-shadow: 0 0 0 7px rgba(225, 29, 72, 0.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  #quickPatientDictateButton.is-listening {
    animation: none;
  }
}

/* Ditado do paciente: a mesma cápsula compacta da barra flutuante, com o
   texto mantido apenas para acessibilidade e para anunciar o estado. */
.quick-patient-dictate-button {
  width: 54px !important;
  min-width: 54px !important;
  height: 44px;
  min-height: 44px;
  padding: 0 !important;
  border: 1px solid var(--accent) !important;
  border-radius: 999px !important;
  background: color-mix(in srgb, var(--accent) 8%, var(--panel)) !important;
  color: var(--accent) !important;
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.14) !important;
}

.quick-patient-dictate-button > span:last-child {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.quick-patient-dictate-button .quick-patient-dictate-icon {
  width: 24px;
  height: 24px;
  stroke: currentColor;
}

.quick-patient-dictate-button.is-listening,
.quick-patient-dictate-button.is-listening:hover {
  border-color: #e11d48 !important;
  background: #e11d48 !important;
  color: #ffffff !important;
  animation: quick-patient-listening-pulse 1.15s ease-in-out infinite;
}

.quick-patient-dictate-button.is-processing,
.quick-patient-dictate-button.is-processing:hover {
  border-color: #d97706 !important;
  background: #d97706 !important;
  color: #ffffff !important;
}

.quick-patient-dictate-button.is-processing::before {
  display: none;
}

.patient-gate-actions {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 0 !important;
  margin-top: 16px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 92%, var(--soft));
  overflow: hidden;
}

.patient-gate-actions button {
  min-height: 42px;
  border: 0 !important;
  border-radius: 999px !important;
  background: transparent !important;
  color: var(--muted) !important;
  box-shadow: none !important;
}

.patient-gate-actions button + button {
  border-left: 1px solid var(--line) !important;
}

.patient-gate-actions #quickPatientContinueButton {
  background: var(--accent) !important;
  color: #ffffff !important;
}

.patient-gate-actions button:hover,
.patient-gate-actions button:focus-visible {
  color: var(--accent-dark) !important;
  background: color-mix(in srgb, var(--accent) 10%, transparent) !important;
}

.patient-gate-actions #quickPatientContinueButton:hover,
.patient-gate-actions #quickPatientContinueButton:focus-visible {
  background: var(--accent-dark) !important;
  color: #ffffff !important;
}

body.dark-mode .quick-patient-dictate-button {
  border-color: #70e3d3 !important;
  background: rgba(112, 227, 211, 0.1) !important;
  color: #70e3d3 !important;
}

body.dark-mode .patient-gate-actions {
  border-color: #3a514b;
  background: rgba(25, 35, 33, 0.94);
}

body.dark-mode .patient-gate-actions button {
  color: #b7c9c4 !important;
}

body.dark-mode .patient-gate-actions button + button {
  border-left-color: #3a514b !important;
}

body.dark-mode .patient-gate-actions #quickPatientContinueButton {
  background: #168f83 !important;
  color: #ffffff !important;
}

/* Override dos espaçamentos genéricos do modal no celular: os dois botões
   continuam formando uma única cápsula, sem intervalo entre eles. */
body .patient-dialog .patient-gate-actions {
  gap: 0 !important;
  padding: 4px !important;
  border-radius: 999px !important;
}

body .patient-dialog .patient-gate-actions button {
  border-radius: 999px !important;
}

.patient-dialog {
  width: min(560px, 100%);
}

.productivity-dialog {
  width: min(720px, 100%);
}

.productivity-filters {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) repeat(2, minmax(0, 0.8fr));
  gap: 10px;
  margin-top: 18px;
}

.productivity-exam-field {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.productivity-exam-field legend {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.productivity-exam-field legend small {
  font-weight: 500;
}

.productivity-exam-choices {
  display: grid;
  gap: 7px;
  max-height: 245px;
  overflow-y: auto;
  padding: 2px 3px 4px 0;
}

.productivity-exam-group {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  overflow: hidden;
}

.productivity-exam-group summary {
  cursor: pointer;
  padding: 9px 11px;
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 700;
  list-style: none;
}

.productivity-exam-group summary::-webkit-details-marker {
  display: none;
}

.productivity-exam-group summary::after {
  content: "▾";
  float: right;
  color: var(--muted);
}

.productivity-exam-group:not([open]) summary::after {
  content: "▸";
}

.productivity-exam-group-options {
  display: grid;
  gap: 6px;
  max-height: 190px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
  padding: 7px;
}

.productivity-exam-choice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 0.78rem;
}

.productivity-exam-choice input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.productivity-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.productivity-stat {
  display: grid;
  gap: 3px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.productivity-stat strong {
  color: var(--accent-dark);
  font-size: 1.35rem;
  line-height: 1;
}

.productivity-stat span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.productivity-list {
  display: grid;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.productivity-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(112px, 0.8fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  border-bottom: 1px solid #e3e7e4;
  padding: 9px 12px;
  background: #ffffff;
}

.productivity-row:last-child {
  border-bottom: 0;
}

.productivity-row strong {
  overflow: hidden;
  color: #111817;
  font-size: 0.98rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.productivity-row span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
}

.productivity-row b {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 30px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 0.9rem;
}

.about-dialog {
  width: min(680px, 100%);
  padding: 0;
}

.about-brand-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 84px;
  border-radius: 8px 8px 0 0;
  padding: 16px 20px;
  background: var(--accent);
  color: #ffffff;
}

.about-brand-bar img {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 12px;
  object-fit: cover;
}

.about-brand-bar strong {
  display: block;
  font-size: 1.45rem;
  line-height: 1;
}

.about-brand-bar span {
  display: block;
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.82rem;
  font-weight: 600;
}

.about-content {
  display: grid;
  gap: 14px;
  padding: 22px 22px 0;
}

.about-content h2 {
  font-size: clamp(1.45rem, 4vw, 2rem);
  line-height: 1.1;
}

.about-content p {
  color: var(--muted);
  line-height: 1.5;
}

.about-list {
  display: grid;
  gap: 9px;
  margin: 2px 0 0;
  padding-left: 18px;
  color: var(--ink);
  line-height: 1.45;
}

.about-list li::marker {
  color: var(--accent);
}

.about-owner {
  display: grid;
  gap: 4px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.about-owner span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.about-owner strong {
  color: var(--accent-dark);
  font-size: 1.05rem;
}

.about-owner-role {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.about-note {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  font-size: 0.9rem;
}

.about-dialog .welcome-actions {
  padding: 0 22px 22px;
}

.template-manager-dialog {
  width: min(820px, 100%);
  max-width: 820px;
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.template-manager-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.template-manager-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.template-manager-form textarea {
  min-height: 220px;
  resize: vertical;
  line-height: 1.5;
}

.template-manager-dictation-dock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: -4px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7fbfa;
  box-shadow: 0 8px 18px rgba(24, 58, 53, 0.08);
}

.template-manager-dictation-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  min-width: 92px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.template-manager-dictation-action:hover,
.template-manager-dictation-action:focus-visible {
  border-color: var(--line-strong);
  background: white;
}

.template-manager-dictation-action.is-mic {
  color: var(--accent-dark);
}

.template-manager-dictation-action svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.template-manager-dictation-action.is-recording {
  border-color: #d9435f;
  background: #d9435f;
  color: #fff;
  animation: template-manager-recording-pulse 1.25s ease-in-out infinite;
}

.template-manager-dictation-action.is-processing {
  border-color: #d98924;
  background: #d98924;
  color: #fff;
}

.template-manager-dictation-action.is-ready,
.template-manager-dictation-action.is-success {
  border-color: #168b7d;
  background: #168b7d;
  color: #fff;
}

.template-manager-dictation-action.is-error {
  border-color: #b94b4b;
  background: #fff3f3;
  color: #a33148;
}

@keyframes template-manager-recording-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 67, 95, .28); }
  50% { box-shadow: 0 0 0 7px rgba(217, 67, 95, 0); }
}

.template-manager-dictation-letter {
  color: var(--accent-dark);
  font-size: 1.05rem;
  font-weight: 800;
}

.template-manager-dictation-status {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.template-manager-dictation-hint {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
  text-align: center;
}

.template-manager-dictation-status {
  min-height: 18px;
  margin: -5px 0 0;
}

.template-manager-status {
  min-height: 20px;
  margin: 0;
  color: var(--accent-dark);
  font-size: 0.88rem;
  font-weight: 600;
}

.template-manager-form-actions,
.template-manager-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.template-manager-form-actions button,
.template-manager-item-actions button {
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.88rem;
}

.template-manager-list-section {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.template-manager-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.template-manager-list-heading h3 {
  margin: 0;
  font-size: 1.05rem;
}

.template-manager-list-heading span {
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-dark);
  font-weight: 700;
}

.template-manager-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.template-manager-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: var(--surface);
}

.template-manager-item strong,
.template-manager-item span {
  display: block;
  min-width: 0;
}

.template-manager-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  overflow-wrap: anywhere;
}

.template-manager-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.template-manager-item-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, auto));
  align-items: center;
  justify-content: end;
}

.template-manager-empty {
  margin: 0;
  color: var(--muted);
}

.danger-outline {
  border-color: rgba(185, 28, 28, 0.3);
  color: #b42318;
}

/* Contraste reforçado para uso em salas escuras. Estes seletores vêm após os
   estilos legados que usam branco/preto diretamente na lista de exames. */
body.dark-mode .list-screen .list-topbar,
body.dark-mode .list-screen .list-bottom-actions,
body.dark-mode .list-screen .date-report-group,
body.dark-mode .list-screen .date-group-header,
body.dark-mode .list-screen .report-row,
body.dark-mode .list-screen .report-row-main {
  background: #192321;
  color: #f4faf7;
}

body.dark-mode .list-screen .date-group-header:hover,
body.dark-mode .list-screen .report-row-main:hover {
  background: #243631;
}

body.dark-mode .list-screen .date-group-copy strong,
body.dark-mode .list-screen .report-row strong {
  color: #ffffff;
}

body.dark-mode .list-screen .date-group-copy small,
body.dark-mode .list-screen .report-row small,
body.dark-mode .list-screen .date-group-chevron {
  color: #b9c9c3;
}

body.dark-mode .list-screen .report-index,
body.dark-mode .list-screen .report-record-badge {
  color: #7ee1d2;
}

body.dark-mode .list-screen .report-record-badge {
  border-color: #3d766d;
  background: #173e3a;
}

body.dark-mode .list-screen .date-group-count {
  background: #eaf6f2;
  color: #0b5751;
}

body.dark-mode .list-screen .report-row.active {
  background: #263632;
}

body.dark-mode .list-screen.editing .report-row.selected,
body.dark-mode .list-screen.editing .date-report-group.partially-selected .date-group-header {
  background: #59282c;
  color: #ffffff;
}

body.dark-mode .list-screen .list-bottom-new-button {
  background: #192321;
  color: #7ee1d2;
}

body.dark-mode .list-screen .list-subtitle,
body.dark-mode .list-screen .list-creator {
  color: #a8b7b1;
}

body.dark-mode .list-screen .list-report-count #reportCount {
  background: #173e3a;
  color: #9de9df;
}

/* Contraste reforçado para a identidade e os filtros no modo noturno. */
body.dark-mode .list-screen .list-title h1 {
  color: #a8fff1;
  text-shadow: 0 0 14px rgba(126, 225, 210, .14);
}

body.dark-mode .list-screen .list-title .list-subtitle {
  color: #d8eee9;
}

body.dark-mode .list-screen .list-filter-details summary {
  color: #9de9df;
}

body.dark-mode .list-screen .list-filter-details summary:hover,
body.dark-mode .list-screen .list-filter-details summary:focus-visible {
  color: #c3fff5;
}

body.dark-mode .feedback-panel {
  background: #192321;
  color: #f4faf7;
  border-color: #344540;
}

body.dark-mode .feedback-panel .feedback-open-button,
body.dark-mode .feedback-panel .feedback-form button.secondary {
  background: #192321;
  color: #f4faf7;
  border-color: #4a5e58;
}

body.dark-mode .feedback-panel .feedback-form input,
body.dark-mode .feedback-panel .feedback-form textarea {
  background: #111918;
  color: #f4faf7;
  border-color: #465b55;
}

body.dark-mode .feedback-panel .feedback-form input::placeholder,
body.dark-mode .feedback-panel .feedback-form textarea::placeholder {
  color: #9aaea7;
}

.app-shell {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: calc(100vh - 54px);
  padding: 18px;
}

.list-screen {
  width: min(820px, 100%);
  min-height: calc(100vh - 90px);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(25, 33, 31, 0.08);
  overflow: hidden;
}

.list-topbar {
  display: grid;
  grid-template-columns: minmax(144px, 1fr) auto minmax(144px, 1fr);
  align-items: center;
  min-height: 64px;
  border-bottom: 1px solid #cfd5d1;
  gap: 10px;
  padding: 8px 14px;
  background: #eef0ee;
}

.list-title {
  display: inline-grid;
  grid-template-columns: auto minmax(0, auto);
  align-items: start;
  justify-content: center;
  gap: 8px;
  justify-self: center;
  min-height: 44px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  text-align: left;
}

.list-title:hover {
  background: transparent;
  color: var(--ink);
  box-shadow: none;
}

.list-app-icon {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: 8px;
  background: #ffffff;
  object-fit: cover;
}

.list-title h1 {
  font-size: 1.25rem;
  text-align: left;
  line-height: 1;
}

.list-title #reportCount {
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
}

.list-left-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-self: start;
  min-width: 0;
}

.list-more-details {
  position: relative;
  display: block;
}

.list-more-button {
  display: grid;
  place-items: center;
  width: 38px;
  min-height: 38px;
  border-radius: 8px;
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 2px;
  line-height: 1;
  list-style: none;
}

.list-more-button::-webkit-details-marker {
  display: none;
}

.list-more-button:hover,
.list-more-details[open] .list-more-button {
  background: color-mix(in srgb, var(--accent-soft) 72%, transparent);
  box-shadow: 0 5px 14px rgba(15, 118, 110, 0.2);
}

.list-more-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  display: grid;
  min-width: 220px;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 14px 30px rgba(10, 39, 34, 0.18);
}

.list-header-actions .list-more-menu > button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  border-radius: 8px;
  padding: 0 10px;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  text-align: left;
}

.list-header-actions .list-more-menu > button:hover,
.list-header-actions .list-more-menu > button:focus-visible {
  background: var(--soft);
  box-shadow: none;
}

.list-header-actions .list-more-menu > button svg {
  flex: 0 0 auto;
}

body.dark-mode .list-more-button {
  color: #8de2d5;
}

body.dark-mode .list-more-menu {
  background: #192321;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.42);
}

body.dark-mode .list-more-button:hover,
body.dark-mode .list-more-details[open] .list-more-button {
  background: rgba(126, 225, 210, 0.12);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.34);
}

.list-plus,
.list-settings-button,
.list-privacy-button,
.list-productivity-button,
.list-account-button,
.list-admin-button,
.list-edit-button,
.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  min-height: 38px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent-dark);
  box-shadow: none;
  font-weight: 600;
}

.theme-toggle {
  border-radius: 8px;
  font-size: 1.35rem;
  line-height: 1;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent);
  box-shadow: none;
}

.list-settings-button svg,
.list-privacy-button svg,
.list-productivity-button svg,
.list-account-button svg,
.list-admin-button svg,
.list-edit-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.list-edit-button.active {
  color: var(--accent);
}

.list-account-button svg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}

.list-plus {
  justify-self: end;
  border-radius: 8px;
  color: var(--accent-dark);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1;
}

.list-settings-button:hover,
.list-privacy-button:hover,
.list-productivity-button:hover,
.list-account-button:hover,
.list-edit-button:hover,
.theme-toggle:hover {
  background: transparent;
  color: #0369a1;
  box-shadow: none;
}

.list-plus:hover,
.list-plus:focus-visible {
  background: transparent;
  color: var(--accent);
  box-shadow: none;
}

.bulk-panel {
  display: grid;
  grid-template-columns: minmax(132px, 170px) minmax(0, 1fr);
  gap: 8px 10px;
  align-items: end;
  border-bottom: 1px solid #e3e7e4;
  padding: 10px 14px;
  background: #fbfcfa;
}

.bulk-folder-field,
.patient-search-field,
.bulk-date-field {
  gap: 4px;
  font-size: 0.78rem;
}

.bulk-folder-field,
.patient-search-field {
  grid-column: 1 / -1;
}

.bulk-folder-field select {
  min-height: 38px;
  padding: 0 9px;
  font-size: 0.9rem;
}

.folder-create-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(110px, auto);
  gap: 8px;
}

.folder-create-row input,
.folder-create-row button {
  min-height: 38px;
  font-size: 0.85rem;
}

.folder-create-row input {
  padding: 0 10px;
}

.bulk-date-field input {
  min-height: 38px;
  padding: 0 9px;
  font-size: 0.9rem;
}

.bulk-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.bulk-actions button {
  min-height: 38px;
  padding: 0 8px;
  font-size: 0.85rem;
}

.bulk-manage-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(74px, 1fr));
  gap: 8px;
}

.bulk-manage-actions button,
.bulk-manage-actions select {
  min-height: 34px;
  padding: 0 8px;
  font-size: 0.78rem;
}

.compact-button {
  min-height: 34px;
}

.danger-button {
  color: #991b1b;
}

.bulk-status {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.25;
}

.workspace {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(25, 33, 31, 0.08);
}

.workspace {
  width: min(1180px, 100%);
  margin: 0 auto;
  overflow: hidden;
  padding: 0;
}

.topbar,
.dictation-header,
.signature-panel > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfa;
}

.brand-lockup,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 8px;
  background: #ffffff;
  object-fit: cover;
}

.creator-line {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.creator-role {
  font-weight: 500;
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.35rem, 2.6vw, 2rem);
  line-height: 1.12;
}

h2 {
  font-size: 1rem;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-size: 1.7rem;
  line-height: 1;
}

.report-form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.doctor-profile-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.doctor-profile-strip strong {
  display: block;
  margin-top: 2px;
  line-height: 1.3;
}

.quick-editor-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid rgba(13, 127, 116, 0.32);
  border-radius: 12px;
  padding: 16px;
  background: #effaf6;
}

.quick-editor-banner[hidden] {
  display: none;
}

.quick-editor-banner h2,
.quick-editor-banner p {
  margin: 0;
}

.quick-editor-banner h2 {
  margin: 2px 0 4px;
  color: var(--accent-dark);
  font-size: 1.25rem;
}

.quick-editor-banner > div:first-child > p:last-child {
  max-width: 640px;
  color: var(--muted);
  line-height: 1.45;
}

.quick-editor-actions {
  display: grid;
  flex: 0 0 min(340px, 42%);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.quick-editor-actions button {
  min-height: 42px;
}

.quick-editor-actions .quick-editor-copy-action {
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 0.88rem;
  font-weight: 700;
}

.quick-editor-actions .quick-editor-copy-action:hover,
.quick-editor-actions .quick-editor-copy-action:focus-visible,
.quick-editor-actions .quick-editor-copy-action:active {
  background: var(--accent);
  color: #fff;
}

.quick-editor-actions .action-main {
  grid-column: 1 / -1;
}

.quick-editor-inline-actions {
  display: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 2px;
}

.quick-editor-inline-actions .quick-editor-copy-action {
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 0.84rem;
  font-weight: 700;
}

.quick-editor-inline-actions .quick-editor-copy-action:hover,
.quick-editor-inline-actions .quick-editor-copy-action:focus-visible,
.quick-editor-inline-actions .quick-editor-copy-action:active {
  background: var(--accent);
  color: #fff;
}

body.quick-editor-mode .quick-editor-inline-actions {
  display: grid;
}

body.quick-editor-mode .quick-editor-patient-field,
body.quick-editor-mode .quick-editor-patient-action,
body.quick-editor-mode .signature-panel,
body.quick-editor-mode .primary-actions {
  display: none !important;
}

.duty-mode-floating {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 45;
  display: grid;
  justify-items: end;
  gap: 10px;
}

.duty-mode-menu {
  display: grid;
  gap: 7px;
  justify-items: end;
  max-width: min( calc(100vw - 36px), 320px);
}

.duty-mode-view-toggle {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(10, 39, 34, 0.14);
}

.duty-mode-view-button {
  min-width: 42px;
  min-height: 34px;
  padding: 5px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .76rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.duty-mode-view-button.is-active,
.duty-mode-view-button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-contrast, #fff);
}

.duty-mode-view-button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.duty-mode-position {
  min-width: 86px;
  padding: 2px 8px;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.duty-mode-action,
.duty-mode-fab {
  border: 1px solid var(--line);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.duty-mode-action#dutyModeRecordButton,
.duty-mode-action#dutyModePreviousButton {
  touch-action: none;
}

.duty-mode-action {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(10, 39, 34, 0.14);
  font-weight: 700;
  font-size: 0;
}

.duty-mode-action-icon {
  width: 22px;
  height: 22px;
  margin: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.duty-mode-icon-accent {
  stroke: #d6a62a;
  stroke-width: 2.8;
}

.duty-mode-plus {
  stroke-width: 2.6;
}

.duty-mode-star {
  stroke-width: 2.2;
  fill: rgba(214, 166, 42, 0.08);
}

body.dark-mode .duty-mode-icon-accent {
  stroke: #f4c95d;
}

.duty-mode-action span {
  display: none;
}

/* Os controles do plantão são iconográficos e mantêm alvos confortáveis no celular. */
.duty-mode-action {
  min-height: 44px;
}

.duty-mode-action.is-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.duty-mode-action.is-primary span {
  color: #fff;
}

/* Se o botão estiver verde por foco, toque ou estado selecionado, mantenha
   texto e ícone brancos para preservar o contraste. */
.duty-mode-action:hover,
.duty-mode-action:focus-visible,
.duty-mode-action:active,
.duty-mode-action[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.duty-mode-action:hover span,
.duty-mode-action:focus-visible span,
.duty-mode-action:active span,
.duty-mode-action[aria-pressed="true"] span {
  color: #fff;
}

/* Estado de ação do modo plantão: o microfone permanece claramente ativo
   enquanto grava/transcreve e o avanço de parágrafo recebe um retorno breve. */
.duty-mode-action.is-recording,
.duty-mode-action.is-transcribing,
.duty-mode-action.is-active {
  color: #fff;
  box-shadow: 0 8px 22px rgba(225, 29, 72, 0.28);
}

.duty-mode-action.is-recording {
  border-color: #e11d48;
  background: #e11d48;
}

.duty-mode-action.is-transcribing {
  border-color: #c2410c;
  background: #c2410c;
}

.duty-mode-action.is-active {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 8px 22px rgba(15, 118, 110, 0.3);
}

.duty-mode-action.is-recording .duty-mode-action-icon,
.duty-mode-action.is-transcribing .duty-mode-action-icon,
.duty-mode-action.is-active .duty-mode-action-icon {
  stroke: currentColor;
}

body.dark-mode .duty-mode-action.is-recording {
  border-color: #fb7185;
  background: #be123c;
  box-shadow: 0 8px 24px rgba(251, 113, 133, 0.3);
}

body.dark-mode .duty-mode-action.is-transcribing {
  border-color: #fb923c;
  background: #9a3412;
  box-shadow: 0 8px 24px rgba(251, 146, 60, 0.28);
}

body.dark-mode .duty-mode-action.is-active {
  border-color: #65d8ca;
  background: #116b62;
}

/* O botão de microfone da barra flutuante segue a mesma leitura do ditado:
   vermelho quando disponível, vermelho pulsante ao gravar e laranja vivo ao
   interpretar. As regras ficam específicas para não afetar os demais ícones. */
html body #dutyModeMicButton:not(.is-recording):not(.is-transcribing),
html body #dutyModeMicButton:not(.is-recording):not(.is-transcribing):hover,
html body #dutyModeMicButton:not(.is-recording):not(.is-transcribing):focus-visible {
  border-color: #e11d48 !important;
  background: #e11d48 !important;
  color: #ffffff !important;
  box-shadow: 0 8px 22px rgba(225, 29, 72, 0.28) !important;
}

html body #dutyModeMicButton.is-recording,
html body #dutyModeMicButton.is-recording:hover,
html body #dutyModeMicButton.is-recording:focus-visible {
  border-color: #e11d48 !important;
  background: #e11d48 !important;
  color: #ffffff !important;
  animation: recording-button-pulse 1.15s ease-out infinite !important;
}

html body #dutyModeMicButton.is-transcribing,
html body #dutyModeMicButton.is-transcribing:hover,
html body #dutyModeMicButton.is-transcribing:focus-visible {
  border-color: #f97316 !important;
  background: #f97316 !important;
  color: #ffffff !important;
  box-shadow: 0 8px 22px rgba(249, 115, 22, 0.32) !important;
  animation: none !important;
}

.duty-mode-fab {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  padding: 0;
  border-radius: 50%;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.34);
  font-size: 1.55rem;
  font-weight: 800;
}

.duty-mode-fab[aria-pressed="false"] {
  background: var(--surface);
  color: var(--accent);
}

.duty-mode-fab-icon {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 700px) {
  .duty-mode-floating {
    bottom: max(82px, calc(env(safe-area-inset-bottom) + 72px));
  }

  /* O menu aberto não deve acompanhar o bottom do contêiner quando o
     teclado reduz o viewport. O raio permanece no canto inferior; somente
     os atalhos expandidos ficam ancorados em uma posição estável. */
  body.duty-mode .duty-mode-menu {
    position: fixed;
    top: max(72px, calc(env(safe-area-inset-top) + 48px));
    right: max(18px, env(safe-area-inset-right));
    bottom: auto;
    max-height: calc(100dvh - 96px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  /* No modo E, deixe as setas imediatamente abaixo do raio, formando um
     pequeno controle de navegação independente do menu superior. */
  body.duty-mode-spaces .duty-mode-fab {
    transform: translateY(-116px);
  }

  body.duty-mode-spaces #dutyModeRecordButton,
  body.duty-mode-spaces #dutyModePreviousButton {
    position: fixed;
    right: max(18px, env(safe-area-inset-right));
    z-index: 610;
  }

  body.duty-mode-spaces #dutyModeRecordButton {
    bottom: calc(max(70px, calc(env(safe-area-inset-bottom) + 70px)) + var(--duty-keyboard-inset, 0px));
  }

  body.duty-mode-spaces #dutyModePreviousButton {
    bottom: calc(max(16px, calc(env(safe-area-inset-bottom) + 16px)) + var(--duty-keyboard-inset, 0px));
  }

  body.duty-mode-spaces #dutyModeDeleteParagraphButton {
    display: none;
  }

  /* No modo E, o raio sobe e as setas ocupam a faixa inferior, formando um
     controle dedicado de navegação sem atravessar os demais atalhos. */
  body.duty-mode-spaces .duty-mode-fab {
    transform: translateY(-116px);
  }

  body.duty-mode-spaces #dutyModeRecordButton,
  body.duty-mode-spaces #dutyModePreviousButton {
    position: fixed;
    right: max(18px, env(safe-area-inset-right));
    z-index: 610;
  }

  body.duty-mode-spaces #dutyModeRecordButton {
    bottom: calc(max(70px, calc(env(safe-area-inset-bottom) + 70px)) + var(--duty-keyboard-inset, 0px));
  }

  body.duty-mode-spaces #dutyModePreviousButton {
    bottom: calc(max(16px, calc(env(safe-area-inset-bottom) + 16px)) + var(--duty-keyboard-inset, 0px));
  }

  body.duty-mode-spaces #dutyModeSaveNewButton,
  body.duty-mode-spaces #dutyModeNewButton {
    display: none;
  }

  /* Coordenadas independentes para impedir sobreposição no Safari/iOS: o
     raio fica acima e as setas formam uma coluna própria abaixo dele. */
  body.duty-mode-spaces .duty-mode-fab {
    position: fixed;
    right: max(18px, env(safe-area-inset-right));
    bottom: calc(max(150px, calc(env(safe-area-inset-bottom) + 150px)) + var(--duty-keyboard-inset, 0px));
    transform: none;
    z-index: 605;
  }

  body.duty-mode-spaces #dutyModeRecordButton {
    bottom: calc(max(86px, calc(env(safe-area-inset-bottom) + 86px)) + var(--duty-keyboard-inset, 0px));
  }

  body.duty-mode-spaces #dutyModePreviousButton {
    bottom: calc(max(28px, calc(env(safe-area-inset-bottom) + 28px)) + var(--duty-keyboard-inset, 0px));
  }

  /* No tela cheia, ancorar pelo topo evita que o menu suba quando o teclado
     reduz o viewport visual do Safari. O editor continua rolando por baixo. */
  html body.editor-focus-mode .duty-mode-floating {
    top: max(72px, calc(env(safe-area-inset-top) + 48px));
    bottom: auto;
    max-height: calc(100dvh - 96px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* O status fica no topo seguro do viewport; o Safari pode ocupar a parte
   inferior com sua própria barra de endereço. */
@media (max-width: 700px) {
  html body.editor-focus-mode .dictation-panel .editor-bottom-bar {
    position: fixed;
    z-index: 230;
    top: max(4px, env(safe-area-inset-top));
    right: 8px;
    bottom: auto;
    left: auto;
    width: auto;
    height: 28px;
    min-height: 28px !important;
    padding: 0;
    border: 0;
    background: transparent;
    pointer-events: none;
  }
  html body.editor-focus-mode .dictation-panel .record-control {
    display: block;
    pointer-events: none;
  }
  html body.editor-focus-mode .dictation-panel .record-activity-status {
    position: fixed;
    z-index: 231;
    top: max(11px, calc(env(safe-area-inset-top) + 7px));
    right: 88px;
    min-height: 16px;
    color: var(--muted);
    white-space: nowrap;
  }
  html body.editor-focus-mode .dictation-panel .record-control .editor-record-button,
  html body.editor-focus-mode .dictation-panel .record-control .editor-record-button:active {
    top: max(8px, calc(env(safe-area-inset-top) + 4px));
    right: 14px;
    bottom: auto;
    width: 58px;
    min-width: 58px;
    height: 58px;
    min-height: 58px;
    pointer-events: auto;
  }
}

body.duty-mode .doctor-profile-strip,
body.duty-mode .primary-actions,
body.duty-mode .report-writing-tools-hint {
  display: none !important;
}

body.quick-editor-mode .duty-mode-floating {
  display: none !important;
}

body.dark-mode .quick-editor-banner {
  border-color: #2e8074;
  background: #173e3a;
  color: #f4faf7;
}

body.dark-mode .quick-editor-banner h2 {
  color: #9ff3e5;
}

.details-panel,
.dictation-panel,
.signature-panel {
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

/* Nomes de exames podem ser longos (por exemplo, modalidades com modelo).
   No desktop, use a largura total para que o texto não desapareça antes da
   seta nativa do select; no celular a grade já é de uma coluna. */
.field-grid > .exam-type-field {
  grid-column: 1 / -1;
  min-width: 0;
}

/* Formulário progressivo: os dados essenciais ficam visíveis e os campos
   administrativos/avançados permanecem acessíveis sem ocupar a primeira tela. */
.progressive-report-details {
  grid-column: 1 / -1;
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.progressive-report-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 700;
  list-style: none;
}

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

.progressive-report-details summary::after {
  content: "⌄";
  font-size: 1.1rem;
  line-height: 1;
}

.progressive-report-details[open] summary::after {
  content: "⌃";
}

.progressive-report-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 12px 0 2px;
}

.progressive-report-fields .exam-search-field {
  grid-column: 1 / -1;
}

body.dark-mode .progressive-report-details summary {
  background: #192321;
  border-color: #465b55;
  color: #9ff3e5;
}

@media (max-width: 620px) {
  .progressive-report-fields {
    grid-template-columns: 1fr;
  }
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

label small {
  color: #8b958f;
  font-size: 0.78rem;
  font-weight: 600;
}

input[readonly] {
  background: #f3f8f6;
  color: var(--accent-dark);
  font-weight: 700;
}

.contact-suggestions {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(25, 33, 31, 0.1);
}

.contact-suggestion {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
  text-align: left;
  font-size: 0.9rem;
}

.contact-suggestion:hover {
  background: #eef8f6;
  box-shadow: none;
}

input,
select,
textarea,
.report-editor {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input,
select {
  min-height: 46px;
  padding: 0 12px;
}

.report-editor,
textarea {
  min-height: 310px;
  padding: 14px;
  line-height: 1.5;
  font-size: 1rem;
}

textarea {
  resize: vertical;
}

.report-editor {
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  cursor: text;
  /* Mantém a seleção e o menu nativos do iOS, incluindo Writing Tools. */
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
}

/* Indicador visual do ponto de inserção do ditado. O caret nativo permanece
   ativo para manter seleção, teclado e Writing Tools do iPhone. */
.dictation-caret-marker {
  position: fixed;
  z-index: 170;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  pointer-events: auto;
  cursor: pointer;
  color: var(--accent-dark);
  filter: drop-shadow(0 2px 4px rgba(15, 118, 110, 0.2));
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.dictation-caret-marker[hidden] {
  display: none;
}

.dictation-caret-marker-icon {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.dictation-caret-marker-icon rect {
  fill: currentColor;
  fill-opacity: 0.16;
}

.dictation-caret-marker.is-available {
  color: #16a34a;
  filter: drop-shadow(0 2px 4px rgba(22, 163, 74, 0.22));
}

.dictation-caret-marker.is-recording {
  color: #e11d48;
  animation: dictation-caret-pulse 0.9s ease-in-out infinite;
}

.dictation-caret-marker.is-transcribing {
  color: #d97706;
  animation: dictation-caret-pulse 0.9s ease-in-out infinite;
}

@keyframes dictation-caret-pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.08); }
}

body.dark-mode .dictation-caret-marker {
  color: #8de8dc;
  filter: drop-shadow(0 2px 5px rgba(141, 232, 220, 0.28));
}

body.dark-mode .dictation-caret-marker.is-recording,
body.dark-mode .dictation-caret-marker.is-transcribing {
  color: #ff6b91;
}

.report-writing-tools-hint {
  margin: 6px 2px 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.report-editor::selection,
.report-editor *::selection {
  background: rgba(15, 118, 110, 0.26);
}

.report-paragraph-selected {
  display: inline;
  padding: 0 2px;
  border-radius: 4px;
  background: rgba(15, 118, 110, 0.2);
  box-shadow: inset 3px 0 0 var(--accent);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.paragraph-record-button {
  position: fixed;
  z-index: 160;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(225, 29, 72, 0.28);
  border-radius: 50%;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(119, 25, 50, 0.2);
  cursor: pointer;
}

/* No modo plantão, o microfone fica no menu fixo do modo para não acompanhar
   o texto nem cobrir o parágrafo selecionado. */
body.duty-mode .paragraph-record-button {
  display: none !important;
}

/* No plantão, a gravação é comandada pelo microfone do próprio menu lateral.
   O botão flutuante geral não deve duplicar esse comando nem ficar sobre ele. */
html body.editor-focus-mode.duty-mode .dictation-panel .record-control .editor-record-button,
html body.editor-focus-mode.duty-mode .dictation-panel .record-control .editor-record-button:active,
html body.editor-focus-mode.duty-mode .dictation-panel .record-activity-status {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

html body.editor-focus-mode.duty-mode .duty-mode-floating {
  z-index: 600;
}

.paragraph-record-button:hover {
  background: #fff7f8;
}

.paragraph-record-button.available,
.paragraph-record-button:not(.recording):not(.transcribing) {
  border-color: #16a34a;
  background: #ecfdf3;
  color: #15803d;
  box-shadow: 0 8px 18px rgba(22, 163, 74, 0.18);
}

.paragraph-record-button .record-microphone {
  width: 23px;
  height: 23px;
}

.paragraph-record-button.recording,
.paragraph-record-button.transcribing {
  border-color: #e11d48;
  background: #e11d48;
}

.paragraph-record-button.transcribing {
  border-color: #d97706;
  background: #d97706;
}

.paragraph-record-button.recording .record-microphone {
  stroke: #ffffff;
  filter: none;
  animation: pulse 0.8s infinite;
}

.paragraph-record-button.transcribing .record-microphone {
  stroke: #ffffff;
  filter: none;
  animation: pulse 0.8s infinite;
}

.paragraph-record-button.recording .record-microphone rect,
.paragraph-record-button.transcribing .record-microphone rect {
  fill: rgba(255, 255, 255, 0.12);
}

/* Keep the idle/recording/transcribing colors explicit on the compact control. */
.paragraph-record-button.available .record-microphone,
.paragraph-record-button:not(.recording):not(.transcribing) .record-microphone {
  stroke: #16a34a;
  filter: drop-shadow(0 2px 3px rgba(22, 163, 74, 0.2));
}

.paragraph-record-button.available .record-microphone rect,
.paragraph-record-button:not(.recording):not(.transcribing) .record-microphone rect {
  fill: rgba(22, 163, 74, 0.1);
}

/* Preserve the original hover affordance without changing the state color. */
.paragraph-record-button.available:hover,
.paragraph-record-button:not(.recording):not(.transcribing):hover {
  background: #dcfce7;
}

/* recording is red; transcribing is orange */
.paragraph-record-button.recording {
  border-color: #e11d48;
  background: #e11d48;
}

.report-editor:empty::before {
  content: attr(data-placeholder);
  color: #9aa5a3;
}

.ai-inserted-transcript {
  color: #c71f37;
  background: rgba(199, 31, 55, 0.08);
  border-radius: 3px;
}

input:focus,
select:focus,
textarea:focus,
.report-editor:focus,
canvas:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.template-row,
.upload-signature,
.actions-line,
.primary-actions {
  display: grid;
  gap: 10px;
}

.template-row {
  grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
}

.upload-signature,
.actions-line {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.primary-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 10px;
  padding-top: 2px;
}

/* Ações essenciais sempre acessíveis no editor, sem retirar os botões
   detalhados da parte inferior do formulário. */
.editor-fixed-actions {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  width: min(calc(100% - 24px), 720px);
  padding: 8px;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: 0 10px 30px rgba(12, 45, 40, 0.18);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.editor-fixed-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--accent-dark);
  box-shadow: none;
  font-size: 0.78rem;
  font-weight: 700;
}

.editor-fixed-action:hover,
.editor-fixed-action:focus-visible,
.editor-fixed-action[aria-expanded="true"] {
  background: var(--soft);
  color: var(--accent);
  box-shadow: none;
}

.editor-fixed-action svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.editor-fixed-record {
  background: var(--accent);
  color: #fff;
}

.editor-fixed-record:hover,
.editor-fixed-record:focus-visible {
  background: var(--accent-dark);
  color: #fff;
}

body.quick-editor-mode .editor-fixed-actions,
body.duty-mode .editor-fixed-actions {
  display: none;
}

.editor-screen .report-form {
  padding-bottom: 92px;
}

body.dark-mode .editor-fixed-actions {
  background: rgba(25, 35, 33, 0.94);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

body.dark-mode .editor-fixed-action {
  color: #9ff3e5;
}

body.dark-mode .editor-fixed-action:hover,
body.dark-mode .editor-fixed-action:focus-visible,
body.dark-mode .editor-fixed-action[aria-expanded="true"] {
  background: #173e3a;
}

@media (max-width: 420px) {
  .editor-fixed-actions {
    width: calc(100% - 16px);
    gap: 2px;
    padding: 6px;
  }

  .editor-fixed-action {
    min-height: 42px;
    padding: 0 4px;
    font-size: 0.72rem;
  }

  .editor-fixed-action svg {
    width: 19px;
    height: 19px;
  }
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.16);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

button:hover {
  background: var(--accent-dark);
  box-shadow: 0 10px 22px rgba(15, 118, 110, 0.2);
}

button:active {
  transform: translateY(1px);
}

.template-row button,
.primary-actions button {
  min-height: 42px;
}

.primary-actions button {
  padding: 10px 16px;
  font-size: 0.92rem;
  box-shadow: 0 6px 14px rgba(15, 118, 110, 0.14);
}

.primary-actions .editor-action-button,
.pdf-option-actions .pdf-option-button {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  border-radius: 12px;
  text-align: center;
}

.primary-actions .editor-action-button::after,
.pdf-option-actions .pdf-option-button::after {
  content: "";
  display: block;
  width: 28px;
  height: 1px;
  grid-column: 3;
}

.primary-actions .editor-action-button > svg,
.pdf-option-actions .pdf-option-button > svg {
  grid-column: 1;
  grid-row: 1;
  justify-self: center;
  width: 24px;
  height: 24px;
  min-height: 24px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.primary-actions .editor-action-button > span,
.pdf-option-actions .pdf-option-button > span {
  grid-column: 2;
  grid-row: 1;
  justify-self: stretch;
  min-width: 0;
  text-align: center;
}

.primary-actions .editor-action-button svg text {
  fill: currentColor;
  stroke: none;
  font-family: system-ui, sans-serif;
  font-size: 5.4px;
  font-weight: 800;
  letter-spacing: -0.15px;
}

.primary-actions #whatsappButton svg {
  fill: currentColor;
  stroke: none;
}

.primary-actions .action-share {
  color: var(--accent);
  border-color: rgba(15, 118, 110, 0.28);
  background: #ffffff;
  box-shadow: none;
}

.primary-actions .action-share:hover {
  color: var(--accent-dark);
  background: rgba(15, 118, 110, 0.06);
}

.primary-actions .same-patient-exam-action {
  grid-column: 1 / -1;
  border: 1px solid rgba(15, 118, 110, 0.34);
  background: rgba(15, 118, 110, 0.07);
  color: var(--accent-dark);
  box-shadow: none;
}

.primary-actions .same-patient-exam-action:hover {
  background: rgba(15, 118, 110, 0.13);
}

.pdf-options-dialog {
  width: min(520px, 100%);
}

.pdf-option-actions {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.pdf-option-actions .pdf-option-button {
  min-height: 64px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--accent-dark);
  box-shadow: none;
}

.pdf-option-actions .pdf-option-button:hover,
.pdf-option-actions .pdf-option-button:focus-visible {
  border-color: rgba(13, 127, 116, 0.38);
  background: #f6faf8;
  color: var(--accent);
}

.pdf-option-copy {
  display: grid;
  gap: 3px;
}

.pdf-option-copy strong {
  font-size: 0.96rem;
}

.pdf-option-copy small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
}

.pdf-option-actions .pdf-option-close {
  min-height: 50px;
  color: var(--muted);
}

body.dark-mode .pdf-option-actions .pdf-option-button {
  border-color: #3a514b;
  background: #192321;
  color: #b8f3ea;
}

body.dark-mode .pdf-option-actions .pdf-option-button:hover,
body.dark-mode .pdf-option-actions .pdf-option-button:focus-visible {
  border-color: #5aa99c;
  background: #21332f;
}

.clinic-pdf-profile-dialog {
  width: min(560px, 100%);
}

.clinic-pdf-profile-intro,
.clinic-pdf-logo-status {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.clinic-pdf-profile-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.clinic-pdf-profile-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.clinic-pdf-profile-form input[type="color"] {
  width: 100%;
  min-height: 42px;
  padding: 4px;
}

.clinic-pdf-profile-form input[type="file"] {
  width: 100%;
  padding: 9px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--ink);
}

.clinic-pdf-profile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 4px;
}

body.dark-mode .clinic-pdf-profile-form input[type="file"] {
  border-color: #3a514b;
  background: #192321;
}

button:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.secondary {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  box-shadow: none;
}

.secondary:hover {
  background: var(--soft);
  box-shadow: none;
}

.file-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
}

.file-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dictation-panel,
.signature-panel {
  display: grid;
  gap: 12px;
}

.dictation-panel {
  position: relative;
  overflow: hidden;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding-bottom: 0;
  background: #ffffff;
}

.dictation-header {
  padding: 16px;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 6px 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f7f9f8;
}

.editor-toolbar button {
  min-height: 38px;
}

.context-ai-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--accent-dark);
  white-space: nowrap;
}

.context-ai-toggle input {
  width: 19px;
  height: 19px;
  accent-color: var(--accent);
}

.dictation-mode-field {
  display: flex;
  align-items: center;
  flex: 0 0 100%;
  order: 3;
  gap: 8px;
  margin-left: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.dictation-mode-field select {
  min-height: 34px;
  max-width: 270px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 28px 0 10px;
  background: #fff;
  color: var(--accent-dark);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
}

.contextual-generate-button {
  min-height: 34px;
  padding: 6px 12px;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  color: var(--accent-dark);
  white-space: nowrap;
}

/* O modo literal é o padrão do editor e não precisa de um seletor visível.
   O botão contextual ocupa sozinho a coluna reservada para essa ação. */
.dictation-context-field {
  align-items: stretch;
}

.dictation-context-field .contextual-generate-button {
  width: 100%;
}

.contextual-generate-button:disabled {
  opacity: 0.58;
  cursor: wait;
}

.contextual-preview-panel {
  margin: 12px 0 0;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}

.contextual-preview-heading,
.contextual-preview-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.contextual-preview-heading h3 {
  margin: 2px 0 0;
  font-size: 1rem;
}

.contextual-preview-heading > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: right;
}

.contextual-preview-text {
  max-height: 260px;
  margin: 12px 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  white-space: pre-wrap;
  line-height: 1.55;
}

.contextual-preview-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

@media (max-width: 680px) {
  .contextual-generate-button {
    width: 100%;
  }

  .contextual-preview-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .contextual-preview-heading > span {
    text-align: left;
  }

  .contextual-preview-actions > button {
    flex: 1 1 100%;
  }
}

.dictation-panel .report-editor {
  min-height: 420px;
  border: 0;
  border-radius: 0;
  padding: 22px 20px;
  font-size: 1.05rem;
  line-height: 1.65;
  box-shadow: none;
}

.transcription-pending-panel {
  border-top: 1px solid var(--line);
  background: #f8fbfa;
}

.transcription-pending-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  border: 0;
  border-radius: 0;
  padding: 9px 16px;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  text-align: left;
}

.transcription-pending-toggle:hover {
  background: #eef7f4;
  box-shadow: none;
}

.transcription-pending-indicator {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(15, 118, 110, 0.12);
}

.transcription-pending-panel.has-attention .transcription-pending-indicator {
  background: #b45309;
  box-shadow: 0 0 0 5px rgba(180, 83, 9, 0.12);
}

.transcription-pending-panel.has-ready .transcription-pending-indicator {
  background: #15803d;
  box-shadow: 0 0 0 5px rgba(21, 128, 61, 0.12);
}

.transcription-pending-summary {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.transcription-pending-summary strong,
.transcription-pending-summary small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transcription-pending-summary strong {
  font-size: 0.88rem;
}

.transcription-pending-summary small {
  color: var(--muted);
  font-size: 0.76rem;
}

.transcription-pending-count {
  display: grid;
  place-items: center;
  min-width: 29px;
  height: 29px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

.transcription-pending-chevron {
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  transition: transform 0.18s ease;
}

.transcription-pending-toggle[aria-expanded="true"] .transcription-pending-chevron {
  transform: rotate(180deg);
}

.transcription-pending-list {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.transcription-pending-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.transcription-pending-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.transcription-pending-copy strong,
.transcription-pending-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transcription-pending-copy strong {
  font-size: 0.84rem;
}

.transcription-pending-copy span {
  color: var(--muted);
  font-size: 0.76rem;
}

.transcription-pending-copy span.is-error {
  color: #b42318;
}

.transcription-pending-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.transcription-pending-actions button {
  min-height: 36px;
  padding: 0 10px;
  font-size: 0.76rem;
}

.transcription-pending-cancel {
  min-width: 36px;
  padding: 0 9px !important;
}

body.dark-mode .transcription-pending-panel {
  border-color: #344540;
  background: #16201e;
}

body.dark-mode .transcription-pending-toggle:hover,
body.dark-mode .transcription-pending-item {
  background: #1d2926;
}

body.dark-mode .transcription-pending-item {
  border-color: #344540;
}

.editor-bottom-bar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 82px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: #f2f4f3;
  overflow: visible;
}

.context-ai-hint {
  max-width: 560px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.orads-completion-panel {
  margin: 12px 18px 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius, 14px);
  background: var(--surface, #f3faf8);
  box-shadow: 0 6px 18px rgba(19, 86, 78, 0.06);
}

.orads-completion-panel h3 {
  margin: 2px 0 4px;
  color: var(--accent-dark, #0f766e);
  font-size: 1rem;
}

.orads-completion-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.tirads-completion-panel { border-color: rgba(14, 126, 117, 0.35); }
.tirads-explain { color: var(--ink-muted); font-size: 0.9rem; margin: 0; }

.orads-completion-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.orads-completion-form label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.orads-completion-form label.needs-input {
  color: #b42318;
}

.orads-completion-form label.needs-input input,
.orads-completion-form label.needs-input select {
  border-color: #dc2626;
  background: #fff7f7;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.1);
}

.orads-completion-form input,
.orads-completion-form select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.78rem;
}

.orads-completion-form button {
  grid-column: 1 / -1;
  min-height: 40px;
}

.tirads-cards {
  display: grid;
  gap: 12px;
}

.tirads-nodule-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.tirads-nodule-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.tirads-nodule-card h4 {
  margin: 2px 0 0;
  font-size: 0.95rem;
}

.tirads-card-status {
  color: var(--accent-dark);
  font-size: 0.78rem;
  text-align: right;
}

.tirads-card-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.tirads-nodule-card .tirads-explain {
  margin: 10px 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.tirads-nodule-card .action-main {
  width: 100%;
}

@media (max-width: 560px) {
  .tirads-card-fields { grid-template-columns: 1fr; }
  .tirads-nodule-card > header { display: block; }
  .tirads-card-status { display: block; margin-top: 6px; text-align: left; }
}

.classification-cancel-button {
  grid-column: 1 / -1;
  min-height: 34px;
  border: 1px solid #dc2626;
  border-radius: 8px;
  background: #fff;
  color: #b42318;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.classification-cancel-button:hover,
.classification-cancel-button:focus-visible {
  background: #fff1f2;
}

/* Keep the destructive/cancel action readable on the dark editor surface.
   The light-mode white background otherwise wins against the dark-mode
   inherited text color and makes the button appear empty (as on mobile). */
body.dark-mode .classification-cancel-button {
  border-color: #ff7180;
  background: #3b1d23;
  color: #ffd7dc;
  box-shadow: 0 0 0 1px rgba(255, 113, 128, 0.16);
}

body.dark-mode .classification-cancel-button:hover,
body.dark-mode .classification-cancel-button:focus-visible {
  background: #54242d;
  color: #ffffff;
}

@media (max-width: 560px) {
  .orads-completion-form { grid-template-columns: 1fr; }
}

.editor-record-button {
  flex: 0 0 auto;
  min-width: 132px;
  min-height: 56px;
  border: 1px solid rgba(225, 29, 72, 0.22);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 12px 26px rgba(119, 25, 50, 0.16);
}

.record-microphone {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: #e11d48;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(225, 29, 72, 0.18));
}

.record-microphone rect {
  fill: rgba(225, 29, 72, 0.06);
}

.microphone-wave {
  stroke-width: 2.2;
}

.editor-record-button:hover {
  border-color: rgba(225, 29, 72, 0.38);
  background: #fff7f8;
  color: var(--ink);
}

.recording .record-microphone,
.transcribing .record-microphone {
  stroke: #ffffff;
  filter: none;
  animation: pulse 0.8s infinite;
}

.recording.editor-record-button,
.transcribing.editor-record-button {
  border-color: #e11d48;
  background: #e11d48;
  color: #ffffff;
}

.recording .record-microphone rect,
.transcribing .record-microphone rect {
  fill: rgba(255, 255, 255, 0.12);
}

body.editor-focus-mode {
  overflow: hidden;
}

body.editor-focus-mode .editor-screen {
  position: fixed;
  z-index: 110;
  inset: 0;
  overflow: hidden;
  padding: 0;
  background: #eef2f1;
}

body.editor-focus-mode .editor-screen > .topbar,
body.editor-focus-mode .report-form > :not(.dictation-panel),
body.editor-focus-mode .app-footer {
  display: none !important;
}

body.editor-focus-mode .report-form,
body.editor-focus-mode .dictation-panel {
  width: 100%;
  height: 100%;
  margin: 0;
}

body.editor-focus-mode .dictation-panel {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  border: 0;
  border-radius: 0;
}

body.editor-focus-mode .dictation-panel .report-editor {
  min-height: 0;
  padding-bottom: 110px;
}

body.editor-focus-mode .editor-bottom-bar {
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

body.editor-focus-mode .editor-record-button {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  min-width: 150px;
  min-height: 64px;
}

body.editor-focus-mode .editor-record-button:active {
  transform: translateX(-50%) translateY(1px);
}

.dictation-header p,
.signature-panel p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.record-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 110px;
}

.undo-report-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 116px;
}

.undo-report-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.1;
}

.undo-report-button:disabled {
  background: #ffffff;
}

.dictation-header {
  flex-wrap: wrap;
}

.audio-source-field {
  flex: 1 1 210px;
  max-width: 320px;
  gap: 4px;
  font-size: 0.78rem;
}

.audio-source-field select {
  min-height: 38px;
  padding: 0 10px;
  font-size: 0.86rem;
}

.record-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #e11d48;
}

.recording .record-dot {
  animation: pulse 1s infinite;
}

.transcribing .record-dot {
  background: var(--warn);
  animation: pulse 0.7s infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.35;
    transform: scale(1.25);
  }
}

canvas {
  width: 100%;
  height: 180px;
  border: 1px dashed #a9b8b4;
  border-radius: 8px;
  background: #fff;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#signatureCanvas {
  justify-self: start;
  width: min(52%, 540px);
  min-width: 360px;
  height: 150px;
}

#signatureCanvas.adjusting-image {
  cursor: grab;
  touch-action: none;
}

#signatureCanvas.adjusting-image:active {
  cursor: grabbing;
}

#profileSignatureCanvas {
  height: 170px;
}

#profileSignatureCanvas.adjusting-image {
  cursor: default;
  touch-action: none;
}

#profileSignatureCanvas.adjusting-image:active {
  cursor: default;
}

body.signature-scroll-lock {
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

.signature-adjust {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(130px, auto);
  gap: 10px;
  align-items: end;
  justify-self: start;
  width: min(52%, 540px);
  min-width: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.signature-adjust[hidden] {
  display: none;
}

.signature-adjust label {
  gap: 8px;
}

.signature-adjust input[type="range"] {
  min-height: 32px;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

#signatureZoomValue {
  display: grid;
  place-items: center;
  min-height: 46px;
  min-width: 58px;
  color: var(--accent-dark);
  font-weight: 700;
}

.feedback-panel {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: #fbfcfa;
}

.feedback-panel h2 {
  margin-top: 2px;
}

.feedback-panel textarea {
  min-height: 108px;
  resize: vertical;
  padding: 12px;
  font-size: 0.92rem;
  line-height: 1.45;
}

.feedback-panel button {
  width: 100%;
}

.list-report-count #reportCount {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--accent-dark);
  font-weight: 700;
}

.queue-list {
  display: grid;
  gap: 0;
  overflow: auto;
}

.report-list {
  padding: 0;
}

.date-report-group {
  border-bottom: 1px solid #e3e7e4;
  background: #ffffff;
}

.date-report-group.active .date-group-header {
  background: #eef8f5;
}

.date-report-group.partially-selected .date-group-header {
  border-bottom-color: rgba(220, 38, 38, 0.32);
  background: #fee2e2;
  box-shadow: inset 4px 0 0 #dc2626;
}

.date-report-group.partially-selected .date-group-header {
  border-bottom-color: rgba(15, 118, 110, 0.32);
  background: #d9f0ea;
  box-shadow: inset 4px 0 0 var(--accent);
}

.list-screen.editing .date-report-group.partially-selected .date-group-header {
  border-bottom-color: rgba(220, 38, 38, 0.32);
  background: #fee2e2;
  box-shadow: inset 4px 0 0 #dc2626;
}

.date-report-group.fully-selected .date-group-header {
  border-bottom-color: #991b1b;
  background: #dc2626;
  color: #ffffff;
  box-shadow: inset 4px 0 0 var(--accent-dark);
}

.date-report-group.fully-selected .date-group-header {
  border-bottom-color: var(--accent-dark);
  background: var(--accent);
}

.list-screen.editing .date-report-group.fully-selected .date-group-header {
  border-bottom-color: #991b1b;
  background: #dc2626;
}

.date-group-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 24px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 66px;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid #e3e7e4;
  padding: 10px 14px;
  background: #fbfcfa;
  color: var(--ink);
  box-shadow: none;
  text-align: left;
}

.date-group-header:hover {
  background: #f3faf7;
  box-shadow: none;
}

.date-report-group.partially-selected .date-group-header:hover {
  background: #cce8df;
}

.date-report-group.fully-selected .date-group-header:hover {
  background: var(--accent-dark);
}

.date-group-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.date-group-copy strong {
  overflow: hidden;
  color: #111817;
  font-size: 1.08rem;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-report-group.fully-selected .date-group-copy strong {
  color: #ffffff;
}

.date-group-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-report-group.partially-selected .date-group-copy small {
  color: #315e58;
}

.date-report-group.fully-selected .date-group-copy small {
  color: rgba(255, 255, 255, 0.9);
}

.date-group-count {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 30px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--accent-dark);
  font-size: 0.88rem;
  font-weight: 700;
}

.date-report-group.partially-selected .date-group-count {
  background: #ffffff;
  color: var(--accent-dark);
}

.date-report-group.fully-selected .date-group-count {
  background: #ffffff;
  color: var(--accent-dark);
}

.date-group-chevron {
  color: #88938e;
  font-size: 1.65rem;
  font-weight: 400;
  line-height: 1;
  text-align: center;
}

.date-report-group.partially-selected .date-group-chevron {
  color: var(--accent-dark);
}

.date-report-group.fully-selected .date-group-chevron {
  color: #ffffff;
}

.date-group-list {
  display: grid;
}

.list-bottom-actions {
  padding: 12px 14px 14px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.list-bottom-actions {
  display: grid;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.list-bottom-actions button,
.quick-editor-inline-actions button,
.primary-actions button {
  position: relative;
  z-index: 2;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.list-bottom-draft-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--accent-dark);
  box-shadow: none;
  font-weight: 650;
}

.list-bottom-auto-draft-button {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  border: 1px solid rgba(13, 127, 116, 0.42);
  padding: 8px 14px;
  background: #e7f8f2;
  color: var(--accent-dark);
  box-shadow: none;
  text-align: left;
}

.list-bottom-auto-draft-button[hidden] {
  display: none;
}

.list-bottom-auto-draft-button svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.list-bottom-auto-draft-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.list-bottom-auto-draft-copy strong,
.list-bottom-auto-draft-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-bottom-auto-draft-copy small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
}

.list-bottom-auto-draft-button:hover,
.list-bottom-auto-draft-button:focus-visible {
  border-color: var(--accent);
  background: #d7f3e9;
  box-shadow: none;
}

.list-bottom-academy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(13, 127, 116, 0.3);
  background: #effaf6;
  color: var(--accent-dark);
  box-shadow: none;
  font-weight: 700;
}

.list-bottom-quick-editor-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(13, 127, 116, 0.3);
  background: #effaf6;
  color: var(--accent-dark);
  box-shadow: none;
  font-weight: 700;
}

.list-bottom-quick-editor-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.list-bottom-quick-editor-button:hover,
.list-bottom-quick-editor-button:focus-visible {
  background: #dff6ee;
  box-shadow: none;
}

.list-bottom-academy-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.list-bottom-academy-button:hover,
.list-bottom-academy-button:focus-visible {
  background: #dff6ee;
  box-shadow: none;
}

.academy-gate {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: hidden;
  overscroll-behavior: none;
  background: rgba(15, 33, 29, 0.48);
  backdrop-filter: blur(5px);
}

.academy-dialog {
  width: min(920px, 100%);
  max-height: calc(100vh - 36px);
  max-height: calc(100dvh - 36px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(13, 127, 116, 0.22);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(8, 30, 26, 0.26);
}

.academy-toolbar {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.academy-icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--accent-dark);
  box-shadow: none;
}

.academy-icon-button svg,
.academy-brand-icon svg,
.academy-lesson-number svg,
.academy-lesson-check svg,
.academy-action-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.academy-glyph,
.academy-brand-icon svg,
.academy-icon-button svg,
.academy-lesson-check svg,
.academy-action-button svg {
  overflow: visible;
  shape-rendering: geometricPrecision;
}

.academy-glyph path,
.academy-glyph rect,
.academy-glyph circle,
.academy-brand-icon svg path,
.academy-brand-icon svg circle,
.academy-icon-button svg path,
.academy-lesson-check svg path,
.academy-lesson-check svg circle,
.academy-action-button svg path,
.academy-action-button svg circle {
  vector-effect: non-scaling-stroke;
}

.academy-icon-button:disabled {
  opacity: 0.3;
  cursor: default;
}

.academy-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  min-width: 0;
  text-align: left;
}

.academy-brand-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(145deg, var(--accent), #0e6b63);
  color: #fff;
  box-shadow: 0 8px 18px rgba(13, 127, 116, 0.2);
}

.academy-brand .eyebrow {
  margin: 0 0 2px;
  font-size: 0.68rem;
}

.academy-brand h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.1;
}

.academy-intro,
.academy-safety,
.academy-lesson-copy {
  color: var(--muted);
}

.academy-intro {
  margin: 0 0 16px;
  text-align: center;
}

.academy-progress-row {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: space-between;
  gap: 7px 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.academy-progress {
  color: var(--accent-dark);
}

.academy-progress-track {
  grid-column: 1 / -1;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce8e4;
}

.academy-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #4ccfba);
  transition: width 180ms ease;
}

.academy-content {
  display: grid;
  grid-template-columns: minmax(210px, 0.7fr) minmax(0, 1.3fr);
  gap: 16px;
}

.academy-lessons {
  display: grid;
  align-content: start;
  gap: 8px;
}

.academy-lesson-button {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.academy-lesson-button.is-active {
  border-color: var(--accent);
  background: var(--soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.academy-lesson-number {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--soft) 78%, var(--panel));
  color: var(--accent-dark);
}

.academy-lesson-number .academy-glyph {
  width: 21px;
  height: 21px;
  stroke-width: 1.55;
}

.academy-lesson-name {
  display: grid;
  gap: 2px;
  font-weight: 750;
}

.academy-lesson-name small {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 650;
  text-transform: uppercase;
}

.academy-lesson-check {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: var(--accent-dark);
  font-weight: 850;
}

.academy-lesson-check svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.academy-lesson {
  min-height: 330px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  background: var(--surface);
}

.academy-lesson h3 {
  margin-top: 0;
  font-size: 1.42rem;
}

.academy-step-label {
  margin-bottom: 8px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.academy-demo {
  display: grid;
  gap: 12px;
  margin: 18px 0;
  border: 1px solid rgba(13, 127, 116, 0.28);
  border-radius: 14px;
  padding: 16px;
  background: color-mix(in srgb, var(--soft) 72%, var(--panel));
}

.academy-say {
  border-left: 4px solid var(--accent);
  padding: 10px 12px;
  border-radius: 0 10px 10px 0;
  background: var(--surface);
  font-size: 1.08rem;
  font-weight: 750;
}

.academy-command-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.academy-command-list code {
  display: block;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-weight: 700;
}

.academy-flow-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: academy-flow;
}

.academy-flow-list li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  color: var(--ink);
  font-weight: 680;
  line-height: 1.42;
  counter-increment: academy-flow;
}

.academy-flow-list li::before {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--soft) 88%, var(--panel));
  color: var(--accent-dark);
  content: counter(academy-flow);
  font-size: 0.76rem;
  font-weight: 850;
}

.academy-lesson-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.academy-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
}

.academy-action-button svg {
  width: 19px;
  height: 19px;
}

.academy-safety {
  margin: 16px 2px 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 0.86rem;
  text-align: center;
}

html.academy-open,
html.academy-open body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

.academy-target-highlight {
  position: relative;
  z-index: 2;
  outline: 4px solid #42d6c1 !important;
  outline-offset: 4px;
  animation: academyPulse 1.1s ease-in-out 3;
}

@keyframes academyPulse {
  50% { outline-color: rgba(66, 214, 193, 0.25); }
}

body.dark-mode .academy-gate { background: rgba(3, 16, 14, 0.64); }
body.dark-mode .academy-dialog,
body.dark-mode .academy-lesson,
body.dark-mode .academy-lesson-button,
body.dark-mode .academy-icon-button,
body.dark-mode .academy-say,
body.dark-mode .academy-command-list code { background: #192321; color: #f4faf7; }
body.dark-mode .academy-flow-list li { color: #f4faf7; }
body.dark-mode .academy-flow-list li::before { background: #24534d; color: #b8fff3; }
body.dark-mode .academy-demo,
body.dark-mode .academy-lesson-button.is-active,
body.dark-mode .list-screen .list-bottom-academy-button { background: #173e3a; color: #9ff3e5; }
body.dark-mode .list-screen .list-bottom-quick-editor-button { background: #173e3a; color: #9ff3e5; }
body.dark-mode .list-screen .list-bottom-auto-draft-button { background: #173e3a; color: #9ff3e5; }
body.dark-mode .academy-progress-track { background: #31423e; }

/* Refinamento visual da Academia: os controles seguem o mesmo vocabulário
   de cápsulas usado no cadastro, na lista e na barra flutuante. */
.academy-icon-button,
.academy-action-button,
.academy-lesson-button {
  border-radius: 999px;
}

.academy-icon-button {
  border-color: rgba(13, 127, 116, 0.28);
  background: color-mix(in srgb, var(--surface) 86%, var(--soft));
  color: var(--accent-dark);
  box-shadow: 0 5px 14px rgba(13, 127, 116, 0.08);
}

.academy-icon-button:not(:disabled):hover,
.academy-icon-button:not(:disabled):focus-visible {
  border-color: var(--accent);
  background: var(--soft);
  color: var(--accent-dark);
  box-shadow: 0 7px 18px rgba(13, 127, 116, 0.14);
}

.academy-lesson-button {
  grid-template-columns: 40px minmax(0, 1fr) 24px;
  min-height: 64px;
  padding: 10px 12px 10px 10px;
  border-color: rgba(13, 127, 116, 0.2);
  background: color-mix(in srgb, var(--surface) 92%, var(--soft));
  box-shadow: 0 4px 12px rgba(11, 47, 41, 0.045);
}

.academy-lesson-button:hover,
.academy-lesson-button:focus-visible {
  border-color: rgba(13, 127, 116, 0.46);
  background: var(--soft);
  box-shadow: 0 7px 18px rgba(11, 47, 41, 0.08);
}

.academy-lesson-button.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--soft) 88%, var(--surface));
  box-shadow: inset 3px 0 0 var(--accent), 0 7px 18px rgba(13, 127, 116, 0.1);
}

.academy-lesson-number {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(13, 127, 116, 0.16);
  border-radius: 999px;
  background: color-mix(in srgb, var(--soft) 82%, var(--panel));
}

.academy-lesson-check {
  border: 1px solid rgba(13, 127, 116, 0.2);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, var(--soft));
}

.academy-action-button {
  border: 1px solid rgba(13, 127, 116, 0.3);
  padding-inline: 16px;
  background: color-mix(in srgb, var(--surface) 88%, var(--soft));
  color: var(--accent-dark);
  box-shadow: none;
}

.academy-action-button:last-child {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.academy-action-button:hover,
.academy-action-button:focus-visible {
  border-color: var(--accent);
  background: var(--soft);
  color: var(--accent-dark);
  box-shadow: 0 6px 16px rgba(13, 127, 116, 0.12);
}

.academy-action-button:last-child:hover,
.academy-action-button:last-child:focus-visible {
  background: var(--accent-dark);
  color: #fff;
}

.academy-demo {
  border-radius: 20px;
}

.academy-say {
  border-left: 0;
  border: 1px solid rgba(13, 127, 116, 0.2);
  border-radius: 999px;
  padding: 11px 15px;
}

body.dark-mode .academy-icon-button,
body.dark-mode .academy-lesson-button,
body.dark-mode .academy-lesson-check,
body.dark-mode .academy-action-button {
  border-color: rgba(159, 243, 229, 0.22);
  background: color-mix(in srgb, #192321 86%, #24534d);
  color: #b8fff3;
}

body.dark-mode .academy-icon-button:not(:disabled):hover,
body.dark-mode .academy-icon-button:not(:disabled):focus-visible,
body.dark-mode .academy-lesson-button:hover,
body.dark-mode .academy-lesson-button:focus-visible,
body.dark-mode .academy-action-button:hover,
body.dark-mode .academy-action-button:focus-visible {
  border-color: #69dfce;
  background: #24534d;
  color: #e5fffa;
}

body.dark-mode .academy-lesson-button.is-active {
  border-color: #69dfce;
  background: #173e3a;
  box-shadow: inset 3px 0 0 #69dfce, 0 7px 18px rgba(0, 0, 0, 0.18);
}

body.dark-mode .academy-action-button:last-child,
body.dark-mode .academy-action-button:last-child:hover,
body.dark-mode .academy-action-button:last-child:focus-visible {
  border-color: #69dfce;
  background: #238f82;
  color: #fff;
}

/* A Academia acompanha o mesmo sistema de superfícies do aplicativo. Os
   ícones ficam em uma caixa fixa para não saltarem ou mudarem de escala ao
   passar o cursor/tocar em uma lição. */
.academy-lesson-number svg,
.academy-icon-button svg,
.academy-action-button svg {
  flex: 0 0 auto;
  transform: none !important;
  transition: none !important;
}
.academy-lesson-button,
.academy-lesson-button:hover,
.academy-lesson-button:active,
.academy-lesson-button:focus-visible,
.academy-icon-button,
.academy-icon-button:hover,
.academy-icon-button:active,
.academy-action-button,
.academy-action-button:hover,
.academy-action-button:active {
  transform: none !important;
}

.list-bottom-draft-button:hover,
.list-bottom-draft-button:focus-visible {
  border-color: rgba(13, 127, 116, 0.35);
  background: #f3faf7;
  color: var(--accent);
  box-shadow: none;
}

.draft-notebook-gate {
  z-index: 60;
  overflow: hidden;
  overscroll-behavior: none;
  background: rgba(15, 33, 29, 0.48);
  backdrop-filter: blur(4px);
}

.draft-notebook-dialog {
  width: min(760px, 100%);
  max-height: calc(100vh - 28px);
  max-height: calc(100dvh - 28px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
  border-radius: 20px;
  box-shadow: 0 28px 80px rgba(10, 39, 34, 0.22);
}

html.draft-notebook-open,
html.draft-notebook-open body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

.draft-notebook-header {
  gap: 6px;
  padding: 14px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(135deg, var(--surface), var(--soft));
}

.draft-notebook-header h2 {
  margin: 0;
}

.draft-notebook-intro {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.42;
}

.draft-notebook-note {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  margin-top: 5px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 650;
}

.draft-notebook-note span:first-child {
  color: var(--accent);
  font-size: 0.7rem;
}

.draft-notebook-title-field,
.draft-notebook-body-field {
  gap: 6px;
  margin-top: 14px;
}

.draft-notebook-title-field input {
  min-height: 42px;
}

.draft-notebook-body-field textarea {
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  caret-color: var(--accent);
  touch-action: manipulation;
}

.draft-notebook-text {
  min-height: 220px;
  resize: vertical;
  line-height: 1.55;
}

.draft-notebook-segments-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  padding: 0 2px;
  color: var(--accent-dark);
  font-size: 0.92rem;
  font-weight: 750;
}

.draft-notebook-segments-hint {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 500;
}

.draft-notebook-status {
  min-height: 1.4em;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.draft-notebook-segments {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.draft-notebook-segment {
  display: grid;
  gap: 7px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.draft-notebook-segment-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.draft-notebook-segment-number {
  display: grid;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
}

.draft-notebook-segment-title {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.draft-notebook-segment-heading strong {
  color: var(--accent-dark);
}

.draft-notebook-segment-heading span {
  color: var(--muted);
  font-size: 0.82rem;
}

.draft-notebook-segment p {
  margin: 0 0 2px 36px;
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.42;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.draft-notebook-segment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: 36px;
}

.draft-notebook-segment-actions button {
  flex: 1 1 150px;
}

/* Cartões compactos: o conteúdo completo só aparece quando o médico abre o bloco. */
.draft-notebook-segment {
  display: block;
  padding: 0;
  overflow: hidden;
}

.draft-notebook-segment-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: inherit;
  text-align: left;
  box-shadow: none;
  cursor: pointer;
}

.draft-notebook-segment-toggle:hover,
.draft-notebook-segment-toggle:focus-visible {
  background: color-mix(in srgb, var(--soft) 58%, transparent);
}

.draft-notebook-segment-toggle .draft-notebook-segment-title {
  flex: 1;
  min-width: 0;
}

.draft-notebook-segment-toggle .draft-notebook-segment-title strong,
.draft-notebook-segment-toggle .draft-notebook-segment-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.draft-notebook-segment-toggle .draft-notebook-segment-title strong {
  color: var(--accent-dark);
}

.draft-notebook-segment-toggle .draft-notebook-segment-title span {
  color: var(--muted);
  font-size: 0.82rem;
}

.draft-notebook-segment-chevron {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  transition: transform 0.15s ease;
}

.draft-measurement-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 8px;
  background: #e5f7f1;
  color: var(--accent-dark);
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
}

.draft-notebook-segment.is-expanded .draft-notebook-segment-chevron {
  transform: rotate(180deg);
}

.draft-notebook-segment-body {
  padding: 0 12px 12px 48px;
  border-top: 1px solid var(--line);
}

.draft-notebook-segment-body p {
  margin: 10px 0;
}

.draft-notebook-segment-body .draft-notebook-segment-actions {
  margin-left: 0;
}

.draft-measurements {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  border: 1px solid rgba(13, 127, 116, 0.26);
  border-radius: 12px;
  padding: 12px;
  background: #f1faf7;
}

.draft-measurements > strong {
  color: var(--accent-dark);
  font-size: 0.82rem;
}

.draft-measurements ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.draft-measurements li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 10px;
  border-radius: 9px;
  padding: 8px 10px;
  background: #fff;
}

.draft-measurements li span {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 650;
}

.draft-measurements li b {
  color: var(--accent-dark);
  font-size: 0.82rem;
  text-align: right;
}

.draft-measurements li small {
  grid-column: 1 / -1;
  color: #8a4f00;
  font-size: 0.74rem;
}

.draft-notebook-segment-body .draft-measurements > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

body.dark-mode .draft-notebook-segment-toggle:hover,
body.dark-mode .draft-notebook-segment-toggle:focus-visible {
  background: color-mix(in srgb, var(--soft) 72%, transparent);
}

body.dark-mode .draft-notebook-segment-body {
  border-top-color: var(--line);
}

body.dark-mode .draft-measurement-badge,
body.dark-mode .draft-measurements {
  background: #173e38;
  color: #b5fff0;
}

body.dark-mode .draft-measurements li {
  background: #1c2c28;
}

body.dark-mode .draft-measurements li span,
body.dark-mode .draft-measurements li b,
body.dark-mode .draft-measurements > strong {
  color: #c9fff4;
}

.draft-notebook-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.draft-notebook-action {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 48px;
  padding: 5px 4px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: none;
}

.draft-notebook-action:hover,
.draft-notebook-action:focus-visible {
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  color: var(--accent-dark);
  box-shadow: none;
}

.draft-notebook-action.is-primary {
  color: var(--accent);
}

.draft-notebook-action.is-primary:hover,
.draft-notebook-action.is-primary:focus-visible {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent-dark);
}

.draft-action-icon {
  display: inline-grid;
  width: 1.35rem;
  height: 1.35rem;
  place-items: center;
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1;
}

.draft-eraser-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.draft-action-label {
  position: static;
  width: auto;
  height: auto;
  padding: 0;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: nowrap;
  border: 0;
}

body.dark-mode .draft-notebook-actions {
  border-color: #3d6259;
}

body.dark-mode .draft-notebook-action:hover,
body.dark-mode .draft-notebook-action:focus-visible {
  background: #28473f;
  color: #b5fff0;
}

body.dark-mode .draft-notebook-action.is-primary {
  color: #8ff5df;
}

/* Ações do Caderno de Rascunhos em uma única cápsula, alinhadas ao padrão
   visual do Editor PACS e da Academia. */
.draft-notebook-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 4px;
  border: 1px solid rgba(13, 127, 116, 0.24);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 90%, var(--soft));
  box-shadow: 0 7px 18px rgba(13, 127, 116, 0.08);
}

.draft-notebook-action,
.draft-notebook-action:hover,
.draft-notebook-action:focus-visible,
.draft-notebook-action.is-primary,
.draft-notebook-action.is-primary:hover,
.draft-notebook-action.is-primary:focus-visible {
  min-height: 42px;
  border-radius: 999px;
  background: transparent;
  color: var(--accent-dark);
  box-shadow: none;
}

.draft-notebook-action + .draft-notebook-action {
  border-left: 1px solid rgba(13, 127, 116, 0.2);
}

.draft-notebook-action:hover,
.draft-notebook-action:focus-visible {
  background: var(--soft);
  color: var(--accent);
}

.draft-notebook-action.is-primary {
  color: var(--accent);
}

body.dark-mode .draft-notebook-actions {
  border-color: rgba(159, 243, 229, 0.22);
  background: #192321;
}

body.dark-mode .draft-notebook-action,
body.dark-mode .draft-notebook-action.is-primary {
  color: #b8fff3;
}

body.dark-mode .draft-notebook-action + .draft-notebook-action {
  border-left-color: rgba(159, 243, 229, 0.22);
}

body.dark-mode .draft-notebook-action:hover,
body.dark-mode .draft-notebook-action:focus-visible,
body.dark-mode .draft-notebook-action.is-primary:hover,
body.dark-mode .draft-notebook-action.is-primary:focus-visible {
  background: #24534d;
  color: #e5fffa;
}

.draft-notebook-empty {
  margin: 14px 0 0;
  color: var(--muted);
}

body.dark-mode .draft-notebook-gate {
  background: rgba(3, 16, 14, 0.78);
}

body.dark-mode .draft-notebook-segment {
  border-color: #3d6259;
  background: #172521;
  color: #f4faf7;
}

body.dark-mode .draft-notebook-header {
  border-color: #3d6259;
  background: linear-gradient(135deg, #1b302b, #163f39);
}

body.dark-mode .draft-notebook-note,
body.dark-mode .draft-notebook-segments-heading,
body.dark-mode .draft-notebook-segment-heading strong {
  color: #baf5e9;
}

body.dark-mode .draft-notebook-segment-number {
  background: #1b5c53;
  color: #d9fff7;
}

body.dark-mode .draft-notebook-segment-heading strong {
  color: #b8f3ea;
}

body.dark-mode .draft-notebook-status,
body.dark-mode .draft-notebook-segment-heading span,
body.dark-mode .draft-notebook-empty {
  color: #b9d4cc;
}

.list-bottom-new-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--accent-dark);
  box-shadow: none;
  font-weight: 650;
}

.list-bottom-new-button:hover,
.list-bottom-new-button:focus-visible {
  border-color: rgba(13, 127, 116, 0.35);
  background: #f3faf7;
  color: var(--accent);
  box-shadow: none;
}

.list-bottom-new-symbol {
  display: grid;
  place-items: center;
  width: 30px;
  min-height: 30px;
  border-radius: 8px;
  color: var(--accent-dark);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1;
  flex: 0 0 auto;
}

.list-bottom-new-button:hover .list-bottom-new-symbol,
.list-bottom-new-button:focus-visible .list-bottom-new-symbol {
  color: var(--accent);
}

/* Atalhos principais da lista: a terceira coluna vazia compensa o ícone e
   mantém o texto centralizado em relação ao botão inteiro. */
.list-bottom-actions .list-bottom-action-button {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--accent-dark);
  box-shadow: none;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.list-bottom-actions .list-bottom-action-button::after {
  content: "";
  display: block;
  width: 28px;
  height: 1px;
  grid-column: 3;
}

.list-bottom-actions .list-bottom-action-button > svg,
.list-bottom-actions .list-bottom-action-button > .list-bottom-new-symbol {
  grid-column: 1;
  grid-row: 1;
  justify-self: center;
  width: 24px;
  height: 24px;
  min-height: 24px;
  color: currentColor;
}

.list-bottom-actions .list-bottom-action-button > svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.list-bottom-actions .list-bottom-action-button > span:last-of-type {
  grid-column: 2;
  grid-row: 1;
  justify-self: stretch;
  min-width: 0;
  text-align: center;
}

.list-bottom-actions .list-bottom-action-button:hover,
.list-bottom-actions .list-bottom-action-button:focus-visible {
  border-color: rgba(13, 127, 116, 0.38);
  background: #f6faf8;
  color: var(--accent);
  box-shadow: none;
}

.list-bottom-actions .list-bottom-academy-button {
  border-color: rgba(13, 127, 116, 0.28);
  background: #eaf8f3;
}

.list-bottom-actions .list-bottom-academy-button:hover,
.list-bottom-actions .list-bottom-academy-button:focus-visible {
  background: #dcf3eb;
}

body.dark-mode .list-screen .list-bottom-actions .list-bottom-action-button {
  border-color: #3a514b;
  background: #192321;
  color: #b8f3ea;
}

body.dark-mode .list-screen .list-bottom-actions .list-bottom-action-button:hover,
body.dark-mode .list-screen .list-bottom-actions .list-bottom-action-button:focus-visible {
  border-color: #5aa99c;
  background: #21332f;
}

body.dark-mode .list-screen .list-bottom-actions .list-bottom-academy-button {
  border-color: #42786f;
  background: #23423c;
  color: #c7fff6;
}

.report-row {
  display: grid;
  grid-template-columns: 42px 0 minmax(0, 1fr) 44px 24px;
  align-items: center;
  min-height: 74px;
  border-bottom: 1px solid #e3e7e4;
  background: #ffffff;
}

.report-row.active {
  background: #e8ece9;
}

.report-row.selected {
  background: #eef8f5;
  box-shadow: inset 4px 0 0 var(--accent);
}

.list-screen.editing .report-row.selected {
  background: #fef2f2;
  box-shadow: inset 4px 0 0 #dc2626;
}

.list-screen.editing .report-row {
  grid-template-columns: 42px 44px minmax(0, 1fr) 44px 24px;
}

.report-row-main {
  display: grid;
  gap: 4px;
  min-height: 74px;
  border-radius: 0;
  padding: 9px 0 9px 16px;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  text-align: left;
}

.report-row-main:hover {
  background: #f7faf8;
  box-shadow: none;
}

.report-title-line {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  overflow: hidden;
}

.report-index {
  color: var(--accent-dark);
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1;
}

.report-record-badge {
  border: 1px solid #c5ddd8;
  border-radius: 8px;
  padding: 3px 6px;
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.report-row strong {
  overflow: hidden;
  color: #111817;
  font-size: 1.22rem;
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-row small {
  display: flex;
  gap: 14px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.report-row small span:first-child {
  overflow: hidden;
  color: #2530cf;
  text-overflow: ellipsis;
}

/* A data já é comunicada pelo agrupamento; a clínica fica como contexto discreto. */
.report-row small .report-row-date {
  display: none;
}

.report-row small .report-row-clinic {
  display: inline-block;
  max-width: 12ch;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78em;
  font-weight: 550;
  text-overflow: ellipsis;
  vertical-align: baseline;
}

.row-info {
  display: grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  border: 1.8px solid #d97706;
  border-radius: 999px;
  padding: 0;
  background: #ffffff;
  color: #b45309;
  box-shadow: none;
  font-size: 1.15rem;
  font-weight: 700;
  font-family: Georgia, serif;
}

.row-info svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.row-info:hover {
  background: #fff7ed;
  box-shadow: none;
}

.row-info.sent {
  border-color: #16a34a;
  color: #15803d;
}

.row-info.sent:hover {
  background: #ecfdf3;
}

.row-info.pending {
  border-color: #d97706;
  color: #b45309;
}

.row-select {
  justify-self: center;
  display: grid;
  place-items: center;
  width: 26px;
  min-height: 26px;
  border: 2px solid #a9b5af;
  border-radius: 7px;
  padding: 0;
  background: #ffffff;
  color: #ffffff;
  box-shadow: none;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.row-select:hover {
  background: #f3faf7;
  box-shadow: none;
}

.row-select.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.list-screen.editing .row-select.selected {
  border-color: #dc2626;
  background: #dc2626;
}

.row-chevron {
  color: #c3c9c5;
  font-size: 2rem;
  font-weight: 300;
  line-height: 1;
}

.row-delete {
  display: grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  color: #dc2626;
  box-shadow: none;
  opacity: 0;
  pointer-events: none;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1;
}

.list-screen.editing .row-delete {
  opacity: 1;
  pointer-events: auto;
}

.row-delete:hover,
.row-delete:focus-visible {
  background: #fef2f2;
  color: #991b1b;
  box-shadow: none;
}

.empty-state {
  color: var(--muted);
  line-height: 1.45;
  padding: 22px 16px;
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0 18px 18px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
}

.footer-link {
  min-height: auto;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: var(--accent-dark);
  box-shadow: none;
  font-size: inherit;
  text-decoration: underline;
}

.footer-link:hover {
  background: transparent;
  box-shadow: none;
  color: var(--accent);
}

.toast {
  position: fixed;
  top: 18px;
  right: 18px;
  left: auto;
  bottom: auto;
  transform: translateY(-120%);
  width: min(92vw, 420px);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
  color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line));
  box-shadow: 0 12px 30px rgba(25, 33, 31, 0.16);
  padding: 12px 14px;
  text-align: left;
  opacity: 0;
  transition: 0.22s ease;
  z-index: 3000;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 940px) {
  .app-shell {
    padding: 10px;
  }

  .topbar,
  .report-form {
    padding: 14px;
  }

  .template-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .auth-gate,
  .reset-gate,
  .welcome-gate,
  .profile-gate,
  .account-gate,
  .privacy-gate,
  .delivery-confirmation-gate,
  .patient-gate,
  .pdf-options-gate,
  .clinic-pdf-profile-gate,
  .productivity-gate,
  .admin-gate,
  .about-gate {
    padding: 12px;
  }

  .primary-actions {
    grid-template-columns: 1fr;
  }

  .primary-actions .editor-action-button {
    grid-column: 1;
  }

  .clinic-filter-control {
    grid-template-columns: minmax(0, 1fr) repeat(3, 38px);
    gap: 5px;
  }

  .clinic-filter-control:has(button:disabled) {
    grid-template-columns: minmax(0, 1fr) auto auto auto;
  }

  .clinic-folder-add,
  .clinic-folder-delete,
  .clinic-pdf-profile-button {
    min-height: 42px;
  }

  .clinic-pdf-profile-actions {
    grid-template-columns: 1fr;
  }

  .academy-gate {
    place-items: stretch;
    padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
  }

  .welcome-dialog.academy-dialog {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    padding: 14px;
    border-radius: 18px;
  }

  .academy-toolbar {
    position: sticky;
    top: 0;
    z-index: 3;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    gap: 8px;
    margin: 0 -14px 14px;
    padding: 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(247, 250, 248, 0.96);
    backdrop-filter: blur(10px);
  }

  body.dark-mode .academy-toolbar {
    background: rgba(25, 35, 33, 0.96);
  }

  .academy-icon-button {
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
  }

  .academy-brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
  }

  .academy-brand-icon svg {
    width: 20px;
    height: 20px;
  }

  .academy-brand h2 { font-size: 1.12rem; }
  .academy-brand .eyebrow { display: none; }
  .academy-intro { font-size: 0.88rem; }
  .academy-content { grid-template-columns: 1fr; }
  .academy-lessons {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 48px;
    gap: 6px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    padding: 3px 0 10px;
    scrollbar-width: none;
  }
  .academy-lessons::-webkit-scrollbar { display: none; }
  .academy-lesson-button {
    grid-template-columns: 1fr;
    justify-items: center;
    min-height: 48px;
    padding: 5px 3px;
    border-radius: 12px;
    scroll-snap-align: start;
  }
  .academy-lesson-button.is-active { box-shadow: inset 0 -3px 0 var(--accent); }
  .academy-lesson-button .academy-lesson-name,
  .academy-lesson-check { display: none; }
  .academy-lesson-number {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }
  .academy-lesson-number svg { width: 19px; height: 19px; }
  .academy-command-list { grid-template-columns: 1fr; }
  .academy-lesson { min-height: 0; padding: 17px; border-radius: 16px; }
  .academy-lesson h3 { font-size: 1.25rem; }
  .academy-lesson-actions {
    position: sticky;
    bottom: -14px;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 18px -17px -17px;
    padding: 12px 17px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
  }
  body.dark-mode .academy-lesson-actions { background: rgba(25, 35, 33, 0.96); }
  .academy-action-button { min-width: 0; padding-inline: 8px; }

  .welcome-dialog {
    padding: 18px;
  }

  .profile-dialog-nav .dialog-app-icon {
    width: 44px;
    height: 44px;
  }

  .profile-form-actions {
    bottom: -18px;
    margin: 20px -18px -18px;
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  }

  .profile-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .profile-actions .file-picker {
    gap: 6px;
    min-height: 46px;
    padding: 0 8px;
    font-size: 0.82rem;
  }

  .account-summary,
  .admin-usage-summary {
    grid-template-columns: 1fr;
  }

  .dialog-app-icon {
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: 11px;
  }

  .welcome-header {
    padding-right: 58px;
  }

  .auth-actions {
    grid-template-columns: 1fr;
  }

  .patient-dialog {
    padding: 16px;
  }

  .patient-dialog .welcome-header {
    gap: 7px;
  }

  .patient-dialog .welcome-header h2 {
    font-size: 1.45rem;
    line-height: 1.08;
  }

  .patient-dialog .welcome-header p {
    font-size: 0.95rem;
    line-height: 1.38;
  }

  .quick-patient-field {
    margin-top: 14px;
    font-size: 0.84rem;
  }

  .quick-patient-field input {
    min-height: 42px;
    padding: 0 10px;
    font-size: 0.95rem;
  }

  .patient-dialog .welcome-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-top: 14px;
  }

  .patient-dialog .welcome-actions button {
    min-height: 42px;
    min-width: 0;
    overflow: hidden;
    padding: 0 8px;
    font-size: 0.9rem;
    line-height: 1.12;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .quick-patient-name-row {
    gap: 7px;
  }

  .quick-patient-dictate-button {
    min-width: 96px;
    padding-inline: 9px;
    font-size: 0.84rem;
  }

  .account-dialog .welcome-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
  }

  .account-dialog .welcome-actions button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding-inline: 8px;
    font-size: 0.86rem;
  }

  .productivity-filters,
  .productivity-summary,
  .productivity-row {
    grid-template-columns: 1fr;
  }

  .productivity-row {
    gap: 4px;
    align-items: start;
  }

  .productivity-row b {
    justify-self: start;
    min-width: 72px;
  }

  .about-brand-bar {
    min-height: 72px;
    padding: 14px 16px;
  }

  .about-brand-bar img {
    width: 42px;
    height: 42px;
    border-radius: 10px;
  }

  .about-brand-bar strong {
    font-size: 1.28rem;
  }

  .about-content {
    gap: 12px;
    padding: 18px 18px 0;
  }

  .about-dialog .welcome-actions {
    padding: 0 18px 18px;
  }

  .list-topbar {
    grid-template-columns: minmax(104px, 1fr) auto minmax(104px, 1fr);
    min-height: 56px;
    gap: 8px;
    padding: 6px 10px;
  }

  .list-title h1 {
    font-size: 1.08rem;
  }

  .list-app-icon {
    width: 30px;
    height: 30px;
  }

  .list-title #reportCount {
    font-size: 0.68rem;
  }

  .list-left-actions {
    gap: 3px;
  }

  .list-settings-button,
  .list-productivity-button,
  .list-account-button,
  .list-edit-button,
  .list-plus {
    width: 32px;
    min-height: 38px;
  }

  .list-settings-button svg,
  .list-productivity-button svg,
  .list-account-button svg,
  .list-edit-button svg {
    width: 18px;
    height: 18px;
  }

  .list-account-button svg {
    width: 21px;
    height: 21px;
  }

  .list-plus {
    font-size: 1.3rem;
  }

  .list-bottom-new-symbol {
    width: 26px;
    min-height: 26px;
    font-size: 1.25rem;
  }

  .bulk-panel {
    grid-template-columns: 1fr;
    padding: 10px 12px;
  }

  .bulk-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bulk-manage-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bulk-manage-actions select {
    grid-column: 1 / -1;
  }

  .date-group-header {
    grid-template-columns: minmax(0, 1fr) auto 18px;
    min-height: 60px;
    gap: 8px;
    padding: 9px 12px;
  }

  .date-group-copy strong {
    font-size: 1rem;
  }

  .date-group-copy small {
    font-size: 0.78rem;
  }

  .date-group-count {
    min-width: 30px;
    height: 27px;
    font-size: 0.78rem;
  }

  .date-group-chevron {
    font-size: 1.45rem;
  }

  .report-row {
    grid-template-columns: 34px 0 minmax(0, 1fr) 38px 18px;
    min-height: 64px;
  }

  .list-screen.editing .report-row {
    grid-template-columns: 34px 38px minmax(0, 1fr) 38px 18px;
  }

  .report-row-main {
    min-height: 64px;
    padding: 8px 0 8px 14px;
  }

  .report-row strong {
    font-size: 1.05rem;
  }

  .report-record-badge {
    padding: 2px 5px;
    font-size: 0.66rem;
  }

  .report-row small {
    gap: 10px;
    font-size: 0.8rem;
  }

  .row-info {
    width: 30px;
    min-height: 30px;
    border-width: 2px;
    font-size: 1rem;
  }

  .row-select {
    width: 23px;
    min-height: 23px;
    border-radius: 6px;
    font-size: 0.88rem;
  }

  .row-chevron {
    font-size: 1.55rem;
  }

  .row-delete {
    width: 30px;
    min-height: 30px;
    font-size: 1.25rem;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
  }

  .brand-lockup {
    align-items: flex-start;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .topbar-actions {
    flex-direction: column-reverse;
    align-items: flex-end;
  }

  .primary-actions,
  .template-row,
  .upload-signature,
  .actions-line,
  .signature-adjust,
  .profile-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .doctor-profile-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .dictation-panel {
    border-radius: 12px;
  }

  .dictation-header {
    align-items: flex-start;
    padding: 12px;
  }

  .dictation-header h2 {
    font-size: 1.12rem;
  }

  .audio-source-field {
    flex-basis: 160px;
    max-width: 190px;
  }

  .editor-toolbar {
    gap: 6px;
    padding: 6px 8px;
  }

  .editor-toolbar .undo-report-button {
    min-width: 42px;
    width: 42px;
    padding: 0;
  }

  .editor-toolbar .undo-report-button span {
    display: none;
  }

  .editor-focus-button,
  .editor-close-button {
    padding: 0 10px;
    font-size: 0.82rem;
  }

  .context-ai-toggle {
    gap: 5px;
    font-size: 0.76rem;
  }

  .context-ai-toggle input {
    width: 17px;
    height: 17px;
  }

  .dictation-panel .report-editor {
    min-height: 390px;
    padding: 18px 14px;
    font-size: 1rem;
    line-height: 1.6;
  }

  .editor-bottom-bar {
    justify-content: center;
    min-height: 88px;
    padding: 12px;
  }

  .context-ai-hint {
    display: none;
  }

  .editor-record-button {
    min-width: 148px;
  }

  body.editor-focus-mode .dictation-header {
    padding-top: calc(12px + env(safe-area-inset-top));
  }

  textarea {
    min-height: 260px;
  }

  canvas {
    height: 150px;
  }

  #signatureCanvas,
  .signature-adjust,
  #profileSignatureCanvas {
    width: 100%;
    min-width: 0;
  }

  .app-footer {
    padding: 0 10px 14px;
  }
}

@media (max-width: 620px) {
  .delivery-confirmation-gate {
    place-items: center;
    padding: 12px;
  }

  .delivery-confirmation-dialog {
    width: 100%;
    max-height: 88dvh;
    border: 0;
    border-radius: 18px;
    padding: 20px 16px max(18px, env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  .delivery-confirmation-dialog .welcome-header {
    padding-right: 0;
  }

  .delivery-confirmation-dialog .welcome-actions {
    display: grid;
    grid-template-columns: 1fr 1.35fr;
    gap: 8px;
  }

  .delivery-confirmation-dialog .welcome-actions button {
    min-width: 0;
    padding: 0 10px;
    font-size: 0.9rem;
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  .dictation-panel .editor-record-button,
  body.editor-focus-mode .dictation-panel .editor-record-button {
    width: 72px;
    min-width: 72px;
    height: 72px;
    min-height: 72px;
  }

  .dictation-panel .editor-record-button .record-microphone {
    width: 34px;
    height: 34px;
  }

  .dictation-panel .editor-bottom-bar {
    min-height: 80px !important;
  }

  .dictation-panel .record-control .editor-record-button,
  body.editor-focus-mode .dictation-panel .record-control .editor-record-button {
    width: 60px;
    min-width: 60px;
    height: 60px;
    min-height: 60px;
  }

  .dictation-panel .record-control .editor-record-button .record-microphone {
    width: 30px;
    height: 30px;
  }
}

/* Limites finais contra estouro do cabeçalho em telas estreitas/zoom do
   navegador. Cada controle pode encolher, mas nunca empurra o editor para
   fora da viewport. */
body.preview-redesign .dictation-header > * { min-width: 0 !important; }
body.preview-redesign .dictation-header h2 {
  font-size: clamp(14px, 3.8vw, 20px) !important;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.preview-redesign .dictation-header .dictation-mode-field {
  max-width: 100% !important;
  overflow-x: auto !important;
  flex-wrap: nowrap !important;
}
body.preview-redesign .dictation-header .dictation-mode-field select,
body.preview-redesign .dictation-header .dictation-mode-field button {
  flex: 0 1 auto !important;
  max-width: min(46vw, 190px) !important;
  font-size: clamp(11px, 2.7vw, 14px) !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Composição própria do Editor rápido/PACS em telas estreitas. */
@media (max-width: 700px) {
  body.preview-redesign.quick-editor-mode .dictation-panel .dictation-header {
    display: grid !important;
    grid-template-columns: minmax(84px, .45fr) minmax(0, 1fr) !important;
    grid-template-areas: "title audio" "mode mode" !important;
    align-items: center !important;
    gap: 5px 8px !important;
    min-height: 92px !important;
    height: auto !important;
    padding: 8px 10px !important;
  }
  body.preview-redesign.quick-editor-mode .dictation-header > div:first-child { grid-area: title; }
  body.preview-redesign.quick-editor-mode .dictation-header .audio-source-field { grid-area: audio; }
  body.preview-redesign.quick-editor-mode .dictation-header .dictation-mode-field {
    grid-area: mode;
    width: 100% !important;
    margin: 0 !important;
  }
body.preview-redesign.quick-editor-mode .dictation-header .audio-source-field select { width: 100% !important; max-width: none !important; }
  body.preview-redesign.quick-editor-mode .editor-toolbar > * { flex: 0 0 auto !important; }
  body.preview-redesign.quick-editor-mode .editor-toolbar .editor-close-button,
  body.preview-redesign.quick-editor-mode .editor-toolbar .editor-focus-button { min-width: 82px !important; white-space: nowrap !important; }
}

/* A barra de edição nunca comprime os botões: rola horizontalmente em vez
   de produzir sobreposições como “ConcluirB”. */
body.preview-redesign .editor-toolbar {
  display: flex !important;
  flex-wrap: nowrap !important;
  justify-content: flex-start !important;
  overflow-x: scroll !important;
  overflow-y: hidden !important;
  min-width: 0 !important;
  scrollbar-width: none;
  touch-action: pan-x !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  width: 100% !important;
}
body.preview-redesign .editor-toolbar::-webkit-scrollbar { display: none; }
body.preview-redesign .editor-toolbar .text-format-tools {
  display: inline-flex !important;
  flex: 0 0 max-content !important;
  min-width: max-content !important;
  white-space: nowrap !important;
}
body.preview-redesign .editor-toolbar > button,
body.preview-redesign .editor-toolbar > .text-format-tools,
body.preview-redesign .editor-toolbar .format-button {
  flex: 0 0 auto !important;
  white-space: nowrap !important;
}
body.preview-redesign .editor-toolbar .undo-report-button { min-width: 44px !important; width: 44px !important; }
body.preview-redesign .editor-toolbar .editor-focus-button,
body.preview-redesign .editor-toolbar .editor-close-button { min-width: 96px !important; width: 96px !important; }
body.preview-redesign .editor-toolbar .format-button { min-width: 42px !important; width: 42px !important; }
body.preview-redesign .editor-toolbar > button,
body.preview-redesign .editor-toolbar .format-button,
body.preview-redesign .editor-toolbar select {
  touch-action: manipulation !important;
  pointer-events: auto !important;
}
body.preview-redesign.editor-focus-mode .duty-mode-floating {
  top: auto !important;
  bottom: var(--redesign-dock-bottom, 86px) !important;
}
body.preview-redesign .dictation-header {
  border-top: 0 !important;
  box-shadow: none !important;
}
/* Rodapé enxuto no editor: preserva apenas os links operacionais. */
body.preview-redesign:has(#editorScreen:not([hidden])) .app-footer {
  display: flex !important;
  min-height: 30px !important;
  height: 30px !important;
  padding: 3px 10px !important;
  gap: 12px !important;
  justify-content: center !important;
  font-size: .72rem !important;
  white-space: nowrap;
  overflow: hidden;
}
body.preview-redesign:has(#editorScreen:not([hidden])) .app-footer > span,
body.preview-redesign:has(#editorScreen:not([hidden])) #privacyFooterButton,
body.preview-redesign:has(#editorScreen:not([hidden])) #academyFooterButton {
  display: none !important;
}
body.preview-redesign:has(#editorScreen:not([hidden])) .duty-mode-floating {
  bottom: var(--redesign-dock-bottom, 48px) !important;
}
body.preview-redesign:has(#editorScreen:not([hidden])) #editorPrimaryActions #saveButton {
  display: none !important;
}
body.preview-redesign #saveButton {
  display: none !important;
}

/* No computador, o editor usa o mesmo rodapé completo da tela inicial. */
@media (min-width: 1100px) {
  body.preview-redesign:has(#editorScreen:not([hidden])) .app-footer {
    min-height: 42px !important;
    height: auto !important;
    padding: 10px 18px 18px !important;
    gap: 16px !important;
    font-size: 0.82rem !important;
    white-space: normal !important;
    overflow: visible !important;
  }

  body.preview-redesign:has(#editorScreen:not([hidden])) .app-footer > span,
  body.preview-redesign:has(#editorScreen:not([hidden])) #privacyFooterButton,
  body.preview-redesign:has(#editorScreen:not([hidden])) #academyFooterButton,
  body.preview-redesign:has(#editorScreen:not([hidden])) #logoutButton:not([hidden]) {
    display: inline !important;
  }

  body.preview-redesign:has(#editorScreen:not([hidden])) .duty-mode-floating {
    bottom: 66px !important;
  }
}
/* Ações secundárias compactas: ícones em cápsulas, sem ocupar a largura do
   editor nem esconder as opções seguintes. Os rótulos permanecem acessíveis
   por aria-label/title. */
body.preview-redesign #editorPrimaryActions {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: none;
  padding: 8px 12px !important;
}
body.preview-redesign #editorPrimaryActions::-webkit-scrollbar { display: none; }
body.preview-redesign #editorPrimaryActions .editor-action-button {
  flex: 0 0 46px !important;
  width: 46px !important;
  min-width: 46px !important;
  height: 46px !important;
  min-height: 46px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  font-size: 0 !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button svg {
  width: 22px !important;
  height: 22px !important;
  margin: 0 !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button span {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}
body.preview-redesign .patient-gate {
  z-index: 2147482000 !important;
  pointer-events: auto !important;
}
body.preview-redesign .patient-gate .welcome-dialog,
body.preview-redesign .patient-gate button,
body.preview-redesign .patient-gate input,
body.preview-redesign .patient-gate select {
  pointer-events: auto !important;
  touch-action: manipulation !important;
}
html:has(body.preview-redesign),
body.preview-redesign {
  overflow-x: hidden !important;
  max-width: 100vw !important;
}
body.preview-redesign .editor-screen,
body.preview-redesign .dictation-panel {
  max-width: 100vw !important;
  overflow-x: hidden !important;
}
body.preview-redesign:has(.duty-mode-floating:not([hidden])) .report-editor {
  padding-bottom: 180px !important;
  scroll-padding-bottom: 180px !important;
}

/* O cabeçalho do modo tela cheia precisa reservar espaço real para os
   controles de transcrição.  O estilo base do campo usa flex-basis:100%,
   o que empurra os controles para uma segunda linha e faz o editor cobri-los
   em telas estreitas. */
html body.editor-focus-mode .dictation-panel .dictation-header {
  position: relative;
  z-index: 250;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  flex: 0 0 48px !important;
  min-height: 48px !important;
  height: 48px !important;
  overflow: visible !important;
  gap: 6px;
  padding: 4px 8px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

html body.editor-focus-mode .dictation-panel .dictation-header > div:first-child {
  flex: 0 0 auto;
  min-width: 0;
}

html body.editor-focus-mode .dictation-panel .dictation-header h2 {
  margin: 0;
  font-size: .9rem;
  white-space: nowrap;
}

html body.editor-focus-mode .dictation-panel .dictation-mode-field {
  display: flex;
  align-items: center;
  flex: 0 1 auto !important;
  flex-basis: auto !important;
  order: initial !important;
  min-width: 0;
  margin-left: auto;
  gap: 5px;
  line-height: 1;
  font-size: 0;
}

html body.editor-focus-mode .dictation-panel .dictation-mode-field select,
html body.editor-focus-mode .dictation-panel .dictation-mode-field button {
  display: block;
  flex: 0 1 auto;
  min-width: 0;
  min-height: 32px;
  height: 32px;
  padding: 0 6px;
  font-size: .68rem;
  line-height: 1;
}

html body.editor-focus-mode .dictation-panel .dictation-mode-field select {
  width: 138px;
  max-width: 138px;
  overflow: hidden;
  text-overflow: ellipsis;
}

html body.editor-focus-mode .dictation-panel .dictation-mode-field .contextual-generate-button {
  width: 124px;
  max-width: 124px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html body.editor-focus-mode .dictation-panel .editor-toolbar {
  position: relative;
  z-index: 20;
}

@media (max-width: 700px) {
  html body.editor-focus-mode .dictation-panel .dictation-header {
    flex-basis: 46px !important;
    min-height: 46px !important;
    height: 46px !important;
  }

  html body.editor-focus-mode .dictation-panel .dictation-mode-field select {
    width: 124px;
    max-width: 124px;
  }

  html body.editor-focus-mode .dictation-panel .dictation-mode-field .contextual-generate-button {
    width: 116px;
    max-width: 116px;
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  html body.editor-focus-mode .dictation-panel .dictation-header {
    flex-basis: 40px !important;
    min-height: 40px !important;
    height: 40px !important;
    padding-top: 2px;
    padding-bottom: 2px;
  }

  html body.editor-focus-mode .dictation-panel .dictation-header h2 {
    font-size: .8rem;
  }

  html body.editor-focus-mode .dictation-panel .dictation-mode-field select,
  html body.editor-focus-mode .dictation-panel .dictation-mode-field button {
    min-height: 28px;
    height: 28px;
    font-size: .62rem;
  }

  html body.editor-focus-mode .dictation-panel .dictation-mode-field select {
    width: 116px;
    max-width: 116px;
  }

  html body.editor-focus-mode .dictation-panel .dictation-mode-field .contextual-generate-button {
    width: 108px;
    max-width: 108px;
  }
}

/* No modo Tela cheia móvel, há apenas um microfone: o controle flutuante.
   O marcador junto ao cursor é ocultado para não competir com ele nem ficar
   sob a barra de endereço do Safari. */
@media (max-width: 700px) {
  body.editor-focus-mode .dictation-caret-marker {
    display: none !important;
  }

  body.editor-focus-mode .dictation-panel .editor-bottom-bar {
    flex-basis: 30px;
    min-height: 30px !important;
    height: 30px;
    padding: 2px 8px max(4px, env(safe-area-inset-bottom));
  }

  body.editor-focus-mode .dictation-panel .record-control {
    position: static;
    width: auto;
  }

  body.editor-focus-mode .dictation-panel .record-activity-status {
    font-size: 0.62rem;
  }

  body.editor-focus-mode .dictation-panel .record-control .editor-record-button,
  body.editor-focus-mode .dictation-panel .record-control .editor-record-button:active {
    position: fixed;
    z-index: 240;
    right: 16px;
    bottom: max(86px, calc(env(safe-area-inset-bottom) + 70px));
    width: 64px;
    min-width: 64px;
    height: 64px;
    min-height: 64px;
    transform: none;
    border-width: 2px;
    box-shadow: 0 8px 20px rgba(15, 118, 110, 0.28);
  }

  body.editor-focus-mode .dictation-panel .record-control .editor-record-button .record-microphone {
    width: 34px;
    height: 34px;
  }
}

/* Tela cheia: preserve a maior área possível para o texto, especialmente no
   celular em paisagem. O microfone continua acessível, mas deixa de ocupar um
   painel alto separado do editor. */
body.editor-focus-mode .dictation-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 5px 10px;
}

body.editor-focus-mode .dictation-header h2 { margin: 0; font-size: 1rem; }
body.editor-focus-mode .dictation-header p,
body.editor-focus-mode .audio-source-field { display: none; }
body.editor-focus-mode .dictation-mode-field {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 0;
}
body.editor-focus-mode .dictation-mode-field select,
body.editor-focus-mode .dictation-mode-field button {
  min-height: 32px;
  padding: 0 8px;
  font-size: 0.74rem;
}
body.editor-focus-mode .editor-toolbar {
  min-height: 38px;
  gap: 4px;
  padding: 2px 7px;
}
body.editor-focus-mode .editor-toolbar button,
body.editor-focus-mode .editor-toolbar select { min-height: 30px; }
body.editor-focus-mode .dictation-panel .report-editor { padding-bottom: 64px; }
body.editor-focus-mode .dictation-panel .editor-bottom-bar {
  min-height: 56px !important;
  padding: 3px 8px max(3px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
}
body.editor-focus-mode .context-ai-hint { display: none; }
body.editor-focus-mode .record-control {
  position: static;
  flex-direction: row;
  gap: 7px;
  min-width: 0;
  transform: none;
}
body.editor-focus-mode .dictation-panel .record-control .editor-record-button,
body.editor-focus-mode .dictation-panel .record-control .editor-record-button:active {
  width: 50px;
  min-width: 50px;
  height: 50px;
  min-height: 50px;
  border-width: 1px;
}
body.editor-focus-mode .dictation-panel .record-control .editor-record-button .record-microphone {
  width: 27px;
  height: 27px;
}
body.editor-focus-mode .record-activity-status { min-height: 14px; font-size: 0.62rem; }

@media (orientation: landscape) and (max-height: 620px) {
  body.editor-focus-mode .dictation-header { min-height: 34px; padding: 2px 8px; }
  body.editor-focus-mode .dictation-header h2 { font-size: 0.88rem; }
  body.editor-focus-mode .dictation-mode-field select,
  body.editor-focus-mode .dictation-mode-field button {
    min-height: 26px;
    font-size: 0.68rem;
  }
  body.editor-focus-mode .dictation-panel .editor-bottom-bar {
    min-height: 42px !important;
    padding: 2px 7px;
  }
  body.editor-focus-mode .dictation-panel .report-editor { padding-bottom: 48px; }
  body.editor-focus-mode .dictation-panel .record-control .editor-record-button,
  body.editor-focus-mode .dictation-panel .record-control .editor-record-button:active {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
  }
  body.editor-focus-mode .dictation-panel .record-control .editor-record-button .record-microphone {
    width: 22px;
    height: 22px;
  }
  body.editor-focus-mode .record-activity-status { font-size: 0.56rem; }
}

/* Compact microphone states mirror the main recorder in dark mode too. */
body.dark-mode .dictation-caret-marker.is-available {
  color: #4ade80;
  filter: drop-shadow(0 2px 5px rgba(74, 222, 128, 0.3));
}

body.dark-mode .dictation-caret-marker.is-recording {
  color: #ff6b6b;
}

body.dark-mode .dictation-caret-marker.is-transcribing {
  color: #fbbf24;
}

body.dark-mode .paragraph-record-button.available,
body.dark-mode .paragraph-record-button:not(.recording):not(.transcribing) {
  background: #173b2a !important;
  border-color: #4ade80 !important;
  color: #bbf7d0 !important;
  box-shadow: 0 8px 20px rgba(74, 222, 128, 0.2);
}

body.dark-mode .paragraph-record-button.available .record-microphone,
body.dark-mode .paragraph-record-button:not(.recording):not(.transcribing) .record-microphone {
  stroke: #4ade80 !important;
  filter: drop-shadow(0 2px 4px rgba(74, 222, 128, 0.32)) !important;
}

body.dark-mode .paragraph-record-button.available .record-microphone rect,
body.dark-mode .paragraph-record-button:not(.recording):not(.transcribing) .record-microphone rect {
  fill: rgba(74, 222, 128, 0.16) !important;
}

body.dark-mode .paragraph-record-button.transcribing {
  border-color: #d97706 !important;
  background: #b45309 !important;
}

body.dark-mode .paragraph-record-button.transcribing .record-microphone {
  stroke: #fff7ed !important;
}

/* Exame anterior: a imagem/PDF existe somente enquanto o OCR é executado. */
.previous-report-dialog {
  width: min(720px, 100%);
  display: grid;
  gap: 16px;
}

.previous-report-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.previous-report-toolbar h2,
.previous-report-toolbar p,
.previous-report-intro,
.previous-report-safety {
  margin: 0;
}

.previous-report-intro,
.previous-report-safety,
.previous-report-processing-note {
  color: var(--muted);
  line-height: 1.5;
}

.previous-report-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: var(--soft);
}

.previous-report-tab {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.previous-report-tab.is-active {
  background: var(--surface);
  color: var(--accent-dark);
  box-shadow: 0 1px 4px rgba(10, 40, 35, 0.12);
}

.previous-report-current-panel {
  display: grid;
  gap: 8px;
}

.previous-report-comparison-panel {
  display: grid;
  gap: 12px;
}

.previous-report-comparison-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.previous-report-comparison-grid textarea {
  min-height: 190px;
}

.previous-report-current-panel textarea {
  background: var(--soft);
}

.previous-report-current-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.previous-report-processing-note {
  margin: -4px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: var(--soft);
  font-size: 0.86rem;
}

.previous-report-source-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.previous-report-source-button {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--accent-dark);
  font-weight: 700;
  cursor: pointer;
}

.previous-report-source-button svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.previous-report-source-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.previous-report-file-preview {
  grid-template-columns: 80px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}

.previous-report-file-preview:not([hidden]) {
  display: grid;
}

.previous-report-file-preview img {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  background: #fff;
}

.previous-report-file-preview strong,
.previous-report-file-preview small {
  display: block;
  overflow-wrap: anywhere;
}

.previous-report-file-preview small {
  margin-top: 5px;
  color: var(--muted);
}

.previous-report-text-field {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-weight: 700;
}

.previous-report-text-field textarea {
  min-height: 260px;
  resize: vertical;
  line-height: 1.5;
}

.previous-report-status {
  min-height: 20px;
  margin: 2px 0 0;
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 650;
}

.previous-report-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.previous-report-actions button {
  min-height: 46px;
}

.previous-report-actions .danger-outline {
  border: 1px solid rgba(185, 28, 28, 0.38);
  background: transparent;
  color: #b42318;
}

.previous-report-actions .danger-outline:hover {
  background: rgba(185, 28, 28, 0.07);
}

.template-action-button {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 8px;
  min-height: 56px !important;
  padding: 0 12px;
}

.template-action-icon {
  grid-column: 1;
  justify-self: center;
  width: 26px;
  height: 26px;
  overflow: visible;
  fill: none;
  stroke: var(--accent-dark);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.template-action-label {
  grid-column: 2;
  min-width: 0;
  text-align: center;
}

.template-action-danger .template-action-icon {
  color: #dc2626;
  stroke: currentColor;
}

body.dark-mode .template-action-icon {
  stroke: #8de2d5;
}

body.dark-mode .template-action-danger .template-action-icon {
  stroke: #ff6b6b;
}

.previous-report-open-button.has-reference {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--soft);
}

.previous-report-badge {
  grid-column: 3;
  justify-self: center;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 0.72rem;
}

body.dark-mode .previous-report-gate {
  background: rgba(5, 18, 16, 0.96);
}

body.dark-mode .previous-report-dialog,
body.dark-mode .previous-report-source-button,
body.dark-mode .previous-report-file-preview {
  background: var(--surface);
}

@media (max-width: 620px) {
  .previous-report-gate {
    place-items: end stretch;
    padding: 0;
  }

  .previous-report-dialog {
    width: 100%;
    max-height: 82dvh;
    min-height: 0;
    border: 0;
    border-radius: 18px 18px 0 0;
    padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .previous-report-source-actions,
  .previous-report-actions {
    grid-template-columns: 1fr;
  }

  .previous-report-comparison-grid {
    grid-template-columns: 1fr;
  }

  .previous-report-source-button {
    min-height: 64px;
  }

  .previous-report-text-field textarea {
    min-height: 300px;
  }
}

/* Painel compacto de filtros e ações contextuais da lista. */
.list-screen .bulk-panel {
  display: block;
  padding: 10px 14px 8px;
}

.list-quick-search {
  display: grid;
  gap: 5px;
  margin: 0 0 8px;
}

.list-quick-search span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.list-quick-search input {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid rgba(13, 127, 116, 0.22);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.list-quick-search input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(13, 127, 116, 0.13);
}

body.dark-mode .list-quick-search input {
  border-color: #42786f;
  background: #192724;
}

.list-screen .list-filter-details {
  border-bottom: 0;
}

.list-screen .list-filter-details summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 0 0 8px;
}

.list-screen .list-filter-details summary small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 550;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-screen .list-filter-details summary::after {
  float: none;
}

.list-screen .list-filter-details[open] summary small {
  display: none;
}

.list-screen .list-filter-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 10px;
  padding: 2px 0 10px;
}

.list-screen .bulk-folder-field,
.list-screen .bulk-modality-field {
  grid-column: auto;
}

.list-screen .bulk-modality-field,
.list-screen .bulk-exam-field {
  gap: 4px;
  font-size: 0.78rem;
}

.list-screen .bulk-exam-field {
  grid-column: 1 / -1;
}

.clinic-filter-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px 42px 42px;
  gap: 7px;
}

.clinic-filter-control:has(button:disabled) {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.clinic-filter-control button:disabled {
  display: none;
}

.clinic-filter-control select {
  min-width: 0;
}

.clinic-folder-add,
.clinic-folder-delete {
  min-height: 42px;
  padding: 0;
}

.clinic-folder-add {
  color: var(--accent-dark);
  font-size: 1.35rem;
  line-height: 1;
}

.clinic-folder-delete {
  display: grid;
  place-items: center;
  color: #c62828;
}

.clinic-folder-delete svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.clinic-folder-delete:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.42;
}

.clinic-pdf-profile-button {
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  padding: 0;
  color: var(--muted);
}

.clinic-pdf-profile-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.clinic-pdf-profile-button .clinic-pdf-profile-icon {
  display: block;
  justify-self: center;
  align-self: center;
  width: 25px;
  height: 25px;
  stroke-width: 2.7;
}

.clinic-pdf-profile-button:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.42;
}

.clinic-pdf-profile-button:not(:disabled):hover,
.clinic-pdf-profile-button:not(:disabled):focus-visible {
  color: var(--accent-dark);
}

.list-screen .folder-create-row,
.list-screen .patient-search-field,
.list-screen .bulk-date-field,
.list-screen .bulk-selection-scope,
.list-screen .bulk-date-range {
  grid-column: 1 / -1;
}

.list-screen .folder-create-row {
  padding: 2px 0;
}

.list-screen .patient-search-field input {
  min-height: 44px;
}

.bulk-date-field {
  display: grid;
  gap: 4px;
}

.bulk-date-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.bulk-date-control {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 7px;
}

.bulk-date-control .bulk-date-step,
.bulk-date-control input {
  min-height: 44px;
}

.bulk-date-control .bulk-date-step {
  padding: 0;
  color: var(--accent-dark);
  font-size: 1.45rem;
  line-height: 1;
}

.bulk-date-control input {
  width: 100%;
  min-width: 0;
  padding: 0 10px;
  text-align: center;
}

.bulk-selection-scope {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.bulk-selection-scope button {
  min-height: 42px;
  padding: 0 9px;
  font-size: 0.82rem;
}

.bulk-selection-scope button.active {
  border-color: rgba(13, 127, 116, 0.45);
  background: #eaf8f3;
  color: var(--accent-dark);
}

.bulk-date-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(13, 127, 116, 0.2);
  border-radius: 10px;
  background: #f4faf8;
}

.bulk-date-range[hidden] {
  display: none;
}

.bulk-date-range label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
}

.bulk-date-range input,
.bulk-date-range button {
  width: 100%;
  min-width: 0;
  min-height: 42px;
}

.bulk-date-range input {
  padding: 0 8px;
  text-align: center;
}

.bulk-date-range > button {
  grid-column: 1 / -1;
}

body.dark-mode .bulk-selection-scope button.active,
body.dark-mode .bulk-date-range {
  border-color: #42786f;
  background: #21332f;
  color: #c7fff6;
}

.bulk-selection-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 10px;
  min-height: 38px;
  border-top: 1px solid var(--line);
  padding-top: 7px;
}

.list-screen .bulk-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.bulk-context-actions {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line));
  border-radius: 12px;
  padding: 4px;
  background: color-mix(in srgb, var(--accent) 7%, var(--panel));
}

.bulk-icon-action {
  display: grid;
  min-width: 0;
  min-height: 48px;
  place-items: center;
  border: 0;
  border-radius: 9px;
  padding: 0;
  background: transparent;
  color: var(--accent-dark);
  box-shadow: none;
}

.bulk-icon-action svg {
  display: block;
  justify-self: center;
  align-self: center;
  width: 30px;
  height: 30px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bulk-icon-action svg .bulk-pdf-label {
  fill: currentColor;
  stroke: none;
  font-family: system-ui, sans-serif;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.bulk-icon-action .bulk-pdf-icon {
  width: 30px;
  height: 30px;
  stroke-width: 2.7;
}

.bulk-icon-action.bulk-whatsapp-action > svg { width: 31px; height: 31px; }
.bulk-icon-action#bulkEmailButton > svg { width: 29px; height: 29px; }
.bulk-icon-action#moveSelectedReportsButton > svg { width: 31px; height: 31px; }
.bulk-icon-action#deleteSelectedReportsButton > svg { width: 31px; height: 31px; }
.bulk-icon-action#clearReportSelectionButton > svg { width: 31px; height: 31px; }

.bulk-pdf-icon .bulk-pdf-acrobat {
  stroke-width: 2.4;
}

.bulk-icon-action svg .bulk-whatsapp-glyph {
  fill: currentColor;
  stroke: none;
}

.bulk-icon-action:hover,
.bulk-icon-action:focus-visible {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  box-shadow: none;
}

.bulk-icon-action:disabled {
  background: transparent;
  color: var(--muted);
  opacity: 0.45;
}

.bulk-danger-action {
  color: #dc2626;
}

.bulk-selection-utilities {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

.bulk-trash-link,
.bulk-empty-trash-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  border: 0;
  padding: 0 2px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-size: 0.73rem;
  font-weight: 700;
}

.bulk-trash-link svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bulk-trash-link .trash-link-back-icon {
  display: none;
}

.bulk-trash-link.active .trash-link-trash-icon {
  display: none;
}

.bulk-trash-link.active .trash-link-back-icon {
  display: block;
}

.bulk-trash-link:hover,
.bulk-trash-link:focus-visible {
  color: var(--accent-dark);
  background: transparent;
  box-shadow: none;
  text-decoration: underline;
}

.bulk-empty-trash-link {
  color: #b91c1c;
}

.bulk-empty-trash-link:hover,
.bulk-empty-trash-link:focus-visible {
  color: #dc2626;
  background: transparent;
  box-shadow: none;
  text-decoration: underline;
}

body.dark-mode .bulk-context-actions {
  border-color: #3f756c;
  background: rgba(25, 35, 33, 0.96);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

body.dark-mode .bulk-icon-action,
body.dark-mode .bulk-date-control .bulk-date-step,
body.dark-mode .clinic-folder-add {
  color: #9de9df;
}

body.dark-mode .clinic-folder-delete:not(:disabled) {
  color: #ff6b6b;
}

body.dark-mode .clinic-pdf-profile-button:not(:disabled) {
  color: #9de9df;
}

body.dark-mode .bulk-danger-action {
  color: #fbbf24 !important;
}

body.dark-mode .bulk-danger-action svg {
  color: #fbbf24 !important;
  stroke: currentColor !important;
}

/* Ações da seleção: a barra acompanha a seleção como uma superfície
   flutuante em qualquer tamanho de tela, inclusive no computador. */
.list-screen:has(#bulkContextActions:not([hidden])) {
  padding-bottom: 84px;
}

.bulk-context-actions:not([hidden]) {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 100;
  width: min(620px, calc(100vw - 32px));
  min-height: 58px;
  transform: translateX(-50%);
  box-shadow: 0 12px 30px rgba(7, 39, 33, 0.22);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

/* Quando a barra de ações está aberta, a lista fica em segundo plano para
   deixar claro que o foco está no compartilhamento/seleção. */
html body.preview-redesign .list-screen:has(#bulkContextActions:not([hidden]))::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  background: rgba(18, 65, 59, .035);
}

html body.preview-redesign .bulk-context-actions:not([hidden]) {
  bottom: max(28px, calc(env(safe-area-inset-bottom) + 20px)) !important;
  z-index: 120 !important;
  border: 1px solid color-mix(in srgb, var(--accent) 58%, var(--line)) !important;
  border-radius: 16px !important;
  background: color-mix(in srgb, var(--accent) 17%, var(--surface)) !important;
  box-shadow: 0 18px 42px rgba(7, 39, 33, .32), 0 0 0 4px color-mix(in srgb, var(--accent) 10%, transparent) !important;
  -webkit-backdrop-filter: blur(18px) saturate(1.1) !important;
  backdrop-filter: blur(18px) saturate(1.1) !important;
}

html body.dark-mode.preview-redesign .list-screen:has(#bulkContextActions:not([hidden]))::before {
  background: rgba(0, 0, 0, .08);
}

html body.dark-mode.preview-redesign .bulk-context-actions:not([hidden]) {
  border-color: #65cfc0 !important;
  background: #24534d !important;
  box-shadow: 0 20px 46px rgba(0, 0, 0, .46), 0 0 0 4px rgba(101, 207, 192, .14) !important;
}

@media (max-width: 620px) {
  .bulk-context-actions:not([hidden]) {
    right: 12px;
    left: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    width: auto;
    transform: none;
  }
}

/* Hierarquia compacta da lista: ano orienta, mês organiza e dia conduz. */
.list-screen .year-group-header {
  min-height: 54px;
  gap: 10px;
  padding: 8px 14px;
}

.list-screen .year-group-copy strong {
  font-size: 1rem;
  line-height: 1.1;
}

.list-screen .year-group-copy small,
.list-screen .month-group-copy small {
  font-size: 0.76rem;
  line-height: 1.1;
}

.list-screen .year-group-count,
.list-screen .month-group-count {
  min-width: 34px;
  height: 30px;
  font-size: 0.82rem;
}

.list-screen .month-group-header {
  min-height: 48px;
  gap: 10px;
  padding: 7px 14px 7px 22px;
}

.list-screen .month-group-copy strong {
  font-size: 0.96rem;
  line-height: 1.1;
}

.list-screen .date-group-header {
  min-height: 48px;
  gap: 8px;
  padding: 7px 12px;
}

.list-screen .date-group-copy {
  gap: 2px;
}

.list-screen .date-group-copy strong {
  font-size: 0.96rem;
  line-height: 1.1;
}

.list-screen .date-group-copy small {
  font-size: 0.74rem;
  line-height: 1.1;
}

.list-screen .date-report-group.partially-selected .date-group-header {
  background: #e5f3ef;
  box-shadow: inset 3px 0 0 var(--accent);
}

.list-screen .date-report-group.fully-selected .date-group-header {
  background: #d4eee7;
  color: #123b35;
  box-shadow: inset 3px 0 0 var(--accent-dark);
}

body.dark-mode .list-screen .year-group-header {
  background: #203a35;
}

body.dark-mode .list-screen .month-group-header {
  background: #1d2d29;
}

body.dark-mode .list-screen .date-report-group.partially-selected .date-group-header {
  background: #244842;
  color: #f4faf7;
  box-shadow: inset 3px 0 0 #6bd4c4;
}

body.dark-mode .list-screen .date-report-group.fully-selected .date-group-header {
  background: #2c665c;
  color: #ffffff;
  box-shadow: inset 3px 0 0 #9de9df;
}

@media (max-width: 620px) {
  .list-screen .bulk-panel {
    padding: 10px 12px 8px;
  }

  .list-screen .list-filter-grid {
    grid-template-columns: 1fr;
  }

  .list-screen .bulk-folder-field,
  .list-screen .bulk-modality-field,
  .list-screen .bulk-exam-field {
    grid-column: 1;
  }

  .list-screen .list-filter-details summary small {
    font-size: 0.66rem;
  }

  .list-screen .year-group-header {
    min-height: 50px;
    padding: 7px 12px;
  }

  .list-screen .month-group-header {
    min-height: 44px;
    padding: 6px 12px 6px 18px;
  }

  .list-screen .date-group-header {
    min-height: 44px;
    padding: 6px 10px;
  }

  .list-screen:has(#bulkContextActions:not([hidden])) {
    padding-bottom: 76px;
  }

  .bulk-context-actions {
    position: fixed;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 12px;
    z-index: 30;
    min-height: 54px;
    border-radius: 14px;
    box-shadow: 0 10px 28px rgba(7, 39, 33, 0.2);
  }

  .bulk-icon-action { min-height: 44px; }
  .bulk-icon-action svg { width: 26px; height: 26px; }
  .bulk-icon-action.bulk-whatsapp-action > svg,
  .bulk-icon-action#moveSelectedReportsButton > svg,
  .bulk-icon-action#deleteSelectedReportsButton > svg { width: 27px; height: 27px; }
  .bulk-icon-action#bulkEmailButton > svg { width: 25px; height: 25px; }
  .bulk-icon-action#clearReportSelectionButton > svg { width: 27px; height: 27px; }
}

/* Relatório de produtividade: manter cartões, grupos e controles legíveis
   no modo noturno. Estes componentes têm fundos explícitos no tema claro,
   portanto precisam de uma substituição própria (e tardia) no tema escuro. */
body.dark-mode .productivity-dialog {
  background: #192321 !important;
  color: #edf5f1 !important;
}

body.dark-mode .productivity-exam-field {
  color: #edf5f1;
}

body.dark-mode .productivity-exam-field legend {
  color: #c6d8d2 !important;
}

body.dark-mode .productivity-exam-group {
  background: #162521 !important;
  border-color: #3f5f57 !important;
}

body.dark-mode .productivity-exam-group summary {
  background: #1d332e !important;
  color: #a4f4e2 !important;
}

body.dark-mode .productivity-exam-group summary::after {
  color: #c6d8d2 !important;
}

body.dark-mode .productivity-exam-group-options {
  background: #14211f !important;
  border-top-color: #3f5f57 !important;
}

body.dark-mode .productivity-exam-choice {
  background: #1b2e2a !important;
  border-color: #466860 !important;
  color: #edf5f1 !important;
}

body.dark-mode .productivity-exam-choice:hover,
body.dark-mode .productivity-exam-choice:focus-within {
  background: #234139 !important;
  border-color: #8de2d5 !important;
}

body.dark-mode .productivity-exam-choice input {
  appearance: none;
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  min-height: 26px;
  flex: 0 0 26px;
  margin: 0;
  padding: 0;
  border: 2px solid #8de2d5;
  border-radius: 6px;
  background: #205249;
  box-shadow: 0 0 0 1px rgba(141, 226, 213, 0.16);
  cursor: pointer;
}

body.dark-mode .productivity-exam-choice input:hover,
body.dark-mode .productivity-exam-choice input:focus-visible {
  border-color: #b8f3ea;
  background: #2b665c;
  outline: none;
}

body.dark-mode .productivity-exam-choice input:checked {
  border-color: #a4f4e2;
  background-color: #0f766e;
  background-image: linear-gradient(135deg, transparent 46%, #ffffff 46%, #ffffff 58%, transparent 58%),
    linear-gradient(45deg, transparent 54%, #ffffff 54%, #ffffff 66%, transparent 66%);
  background-size: 60% 60%, 75% 75%;
  background-position: 28% 55%, 66% 34%;
  background-repeat: no-repeat;
}

body.dark-mode .productivity-summary,
body.dark-mode .productivity-stat,
body.dark-mode .productivity-list {
  border-color: #3f5f57 !important;
}

body.dark-mode .productivity-stat {
  border-top-color: #3f5f57 !important;
}

body.dark-mode .productivity-stat strong {
  color: #8de2d5 !important;
}

body.dark-mode .productivity-stat span {
  color: #c6d8d2 !important;
}

body.dark-mode .productivity-row {
  background: #182a26 !important;
  border-bottom-color: #3f5f57 !important;
  color: #edf5f1 !important;
}

body.dark-mode .productivity-row strong {
  color: #f4faf7 !important;
}

body.dark-mode .productivity-row span {
  color: #bfd1cb !important;
}

body.dark-mode .productivity-row b {
  background: #205249 !important;
  color: #a4f4e2 !important;
  border: 1px solid #6bc8b7;
}

/* Contraste acessível para o editor no modo noturno.  Mantemos as cores de
   estado (verde = seleção, vermelho = conteúdo retornado pela IA) distintas
   do fundo para que o médico consiga revisar o texto em ambientes escuros. */
body.dark-mode .report-editor::selection,
body.dark-mode .report-editor *::selection {
  background: #20b8a5 !important;
  color: #ffffff !important;
}

body.dark-mode .report-editor .report-paragraph-selected {
  background: #087f76 !important;
  color: #ffffff !important;
  box-shadow: inset 4px 0 0 #63f2dc, 0 0 0 1px rgba(99, 242, 220, 0.22);
}

body.dark-mode .report-editor .ai-inserted-transcript,
body.dark-mode .report-editor mark,
body.dark-mode .report-editor .ai-inserted,
body.dark-mode .report-editor [data-ai-inserted="true"] {
  background: #55202b !important;
  color: #ff9cac !important;
  text-decoration-color: #ff9cac !important;
  box-shadow: inset 0 0 0 1px rgba(255, 124, 145, 0.24);
}

/* Valores preenchidos pelas fórmulas ficam identificáveis durante a revisão,
   mas a marcação é removida antes de copiar, salvar ou gerar o PDF. */
.report-editor .auto-calculated-value,
.report-editor [data-auto-calculated="true"] {
  background: #fff0ad;
  color: #7a4300;
  border-radius: 0.25em;
  box-shadow: inset 0 0 0 1px rgba(197, 119, 0, 0.34);
  padding: 0 0.08em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

body.dark-mode .report-editor .auto-calculated-value,
body.dark-mode .report-editor [data-auto-calculated="true"] {
  background: #684900 !important;
  color: #ffe7a3 !important;
  box-shadow: inset 0 0 0 1px rgba(255, 211, 102, 0.56);
}

/* Botão parado: não parece um controle branco solto no tema escuro. O estado
   recording/transcribing continua sendo vermelho pulsante, definido acima. */
body.dark-mode .dictation-panel .editor-record-button:not(.recording):not(.transcribing),
body.dark-mode .editor-record-button:not(.recording):not(.transcribing),
body.dark-mode .paragraph-record-button:not(.recording):not(.transcribing) {
  background: #203a35 !important;
  border-color: #8de2d5 !important;
  color: #f4faf7 !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(141, 226, 213, 0.18);
}

body.dark-mode .dictation-panel .editor-record-button:not(.recording):not(.transcribing):hover,
body.dark-mode .editor-record-button:not(.recording):not(.transcribing):hover,
body.dark-mode .paragraph-record-button:not(.recording):not(.transcribing):hover {
  background: #2b4b44 !important;
  border-color: #b8f3ea !important;
}

body.dark-mode .dictation-panel .editor-record-button:not(.recording):not(.transcribing) .record-microphone,
body.dark-mode .editor-record-button:not(.recording):not(.transcribing) .record-microphone,
body.dark-mode .paragraph-record-button:not(.recording):not(.transcribing) .record-microphone {
  stroke: #ff6682 !important;
  filter: drop-shadow(0 2px 4px rgba(255, 82, 112, 0.34));
}

body.dark-mode .dictation-panel .editor-record-button:not(.recording):not(.transcribing) .record-microphone rect,
body.dark-mode .editor-record-button:not(.recording):not(.transcribing) .record-microphone rect,
body.dark-mode .paragraph-record-button:not(.recording):not(.transcribing) .record-microphone rect {
  fill: rgba(255, 102, 130, 0.14) !important;
}

/* A lista também precisa respeitar o contraste do tema: contadores e
   divisórias não devem parecer elementos brancos sobrepostos ao fundo. */
body.dark-mode .list-screen .date-report-group,
body.dark-mode .list-screen .date-group-header,
body.dark-mode .list-screen .report-row,
body.dark-mode .list-screen .list-bottom-actions {
  border-color: #3a514b !important;
}

body.dark-mode .list-screen .date-group-count {
  background: #23423c !important;
  border: 1px solid #5aa99c;
  color: #b8f3ea !important;
  box-shadow: 0 0 0 1px rgba(184, 243, 234, 0.08);
}

body.dark-mode .list-screen .date-group-chevron,
body.dark-mode .list-screen .row-chevron {
  color: #9ab8b0 !important;
}

body.dark-mode .list-screen .date-group-header,
body.dark-mode .list-screen .report-row {
  border-bottom-color: #3a514b !important;
}

/* Ajustes finais de contraste do editor no modo noturno. */
body.dark-mode .editor-screen > .topbar {
  background: #192321;
  color: #f4faf7;
  border-bottom-color: #344540;
}

body.dark-mode .editor-screen .brand-lockup .eyebrow,
body.dark-mode .editor-screen .brand-lockup h1 {
  color: #f4faf7;
}

body.dark-mode .editor-screen .editor-toolbar {
  background: #111918;
  color: #f4faf7;
  border-color: #344540;
}

body.dark-mode .editor-screen .editor-toolbar button,
body.dark-mode .editor-screen .editor-toolbar .secondary {
  background: #192321;
  color: #f4faf7;
  border-color: #465b55;
}

body.dark-mode .editor-screen .editor-toolbar button:hover,
body.dark-mode .editor-screen .editor-toolbar .secondary:hover {
  background: #243631;
}

body.dark-mode .editor-screen .editor-toolbar .text-format-tools button {
  color: #8de2d5;
}

body.dark-mode .editor-screen .editor-toolbar select,
body.dark-mode .editor-screen .dictation-mode-field select {
  background: #192321;
  color: #f4faf7;
  border-color: #465b55;
}

body.dark-mode .list-settings-button,
body.dark-mode .list-productivity-button,
body.dark-mode .list-account-button,
body.dark-mode .list-edit-button,
body.dark-mode .list-plus,
body.dark-mode .theme-toggle {
  color: #8de2d5;
}

body.dark-mode .list-settings-button:hover,
body.dark-mode .list-productivity-button:hover,
body.dark-mode .list-account-button:hover,
body.dark-mode .list-edit-button:hover,
body.dark-mode .list-plus:hover,
body.dark-mode .theme-toggle:hover,
body.dark-mode .theme-toggle:focus-visible {
  color: #b8f3ea;
}

body.dark-mode select {
  color-scheme: dark;
}

.theme-toggle {
  font-family: "Segoe UI Symbol", "Arial Unicode MS", sans-serif;
}

body.dark-mode .list-screen .row-select {
  border-color: #a8bbb4;
  background: #263632;
  color: #ffffff;
}

body.dark-mode .list-screen .row-select:hover {
  background: #344943;
}

body.dark-mode .list-screen.editing .row-select.selected {
  border-color: #ff667c;
  background: #dc2626;
  color: #ffffff;
}

body.dark-mode .list-screen .row-info {
  background: #192321;
  color: #fbbf74;
}

body.dark-mode .list-screen .row-info.sent {
  color: #8de2a8;
}

body.dark-mode .list-screen .row-info:hover {
  background: #263632;
}

body.dark-mode .list-screen .report-row small span:first-child {
  color: #8bb8ff;
}

/* Estado do ditado permanece junto ao microfone em qualquer orientação. */
.record-control {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 150px;
  position: relative;
  z-index: 21;
  margin-left: auto;
}

.dictation-panel .editor-bottom-bar .record-control,
.dictation-panel .editor-bottom-bar #recordButton {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.record-activity-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 17px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
}

.record-activity-status::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9ca3af;
  content: "";
}

.record-activity-status[data-state="recording"] {
  color: #be123c;
}

.record-activity-status[data-state="recording"]::before {
  background: #e11d48;
  animation: pulse 1s ease-in-out infinite;
}

.record-activity-status[data-state="processing"] {
  color: #9a6700;
}

.record-activity-status[data-state="processing"]::before {
  background: #d99a16;
  animation: pulse 0.8s ease-in-out infinite;
}

.record-activity-status[data-state="success"] {
  color: var(--accent-dark);
}

.record-activity-status[data-state="success"]::before {
  background: var(--accent);
}

.record-activity-status[data-state="attention"] {
  color: #9a6700;
}

.record-activity-status[data-state="attention"]::before {
  background: #d99a16;
}

.record-activity-status[data-state="error"] {
  color: #be123c;
}

.record-activity-status[data-state="error"]::before {
  background: #e11d48;
}

body.editor-focus-mode .record-control {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: calc(8px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
}

body.editor-focus-mode .dictation-panel .record-control .editor-record-button,
body.editor-focus-mode .dictation-panel .record-control .editor-record-button:active {
  position: static;
  transform: none;
}

@media (max-width: 620px) {
  .record-control {
    min-width: 140px;
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  .dictation-panel .editor-bottom-bar {
    min-height: 80px !important;
  }

  .record-control {
    gap: 3px;
    min-width: 126px;
  }

  .dictation-panel .record-control .editor-record-button,
  body.editor-focus-mode .dictation-panel .record-control .editor-record-button {
    width: 60px;
    min-width: 60px;
    height: 60px;
    min-height: 60px;
  }

  .dictation-panel .record-control .editor-record-button .record-microphone {
    width: 30px;
    height: 30px;
  }

  .record-activity-status {
    font-size: 0.64rem;
  }
}

/* Filtros e organização da lista: primeiro localizar, depois agir. */
.quick-exam-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quick-exam-row .exam-search-field,
.field-grid > .exam-search-field {
  grid-column: 1 / -1;
}

.exam-search-field input {
  padding-left: 38px;
  background-image: linear-gradient(45deg, transparent 48%, var(--muted) 49%, var(--muted) 54%, transparent 55%), radial-gradient(circle at 14px 17px, transparent 6px, var(--muted) 6.5px, var(--muted) 8px, transparent 8.5px);
  background-position: 20px 21px, 0 0;
  background-repeat: no-repeat;
  background-size: 9px 9px, 32px 34px;
}

.quick-patient-field select {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  font-size: 0.95rem;
}

.list-filter-details {
  grid-column: 1 / -1;
  border-bottom: 1px solid #e3e7e4;
}

.list-filter-details summary {
  cursor: pointer;
  list-style: none;
  padding: 3px 0 8px;
  color: var(--accent-dark);
  font-size: 0.86rem;
  font-weight: 700;
}

.list-filter-details summary::-webkit-details-marker {
  display: none;
}

.list-filter-details summary::after {
  content: "▾";
  float: right;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.list-filter-details[open] summary::after {
  transform: rotate(180deg);
}

.list-filter-grid {
  display: grid;
  grid-template-columns: minmax(132px, 170px) minmax(0, 1fr);
  gap: 8px 10px;
  padding: 2px 0 10px;
}

.bulk-exam-field {
  grid-column: 1 / -1;
}

.bulk-modality-field select,
.bulk-exam-field select,
.productivity-filters select {
  min-height: 38px;
  padding: 0 9px;
  font-size: 0.9rem;
}

.productivity-filters {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) repeat(2, minmax(0, 0.8fr));
}

.productivity-row {
  grid-template-columns: minmax(220px, 1.15fr) 128px minmax(300px, 1.55fr) 110px;
}

@media (max-width: 620px) {
  .template-manager-grid {
    grid-template-columns: 1fr;
  }

  .template-manager-item {
    align-items: stretch;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .template-manager-item-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .template-manager-item-actions button {
    width: 100%;
    min-width: 0;
    padding-inline: 8px;
  }

  .quick-exam-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .admin-invite-form {
    grid-template-columns: 1fr;
  }

  .admin-invite-form button {
    width: 100%;
  }

  .admin-retention-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .admin-retention-row {
    grid-template-columns: 1fr;
  }

  .admin-retention-actions {
    justify-content: stretch;
  }

  .admin-retention-actions button {
    flex: 1 1 150px;
    min-height: 40px;
  }

  .admin-user-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .admin-user-actions,
  .admin-user-protected {
    grid-column: 2;
  }

  .admin-user-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-user-actions button {
    width: 100%;
    min-height: 40px;
  }

  .admin-user-actions .admin-delete-user {
    grid-column: 1 / -1;
  }

  .list-filter-grid {
    grid-template-columns: 1fr;
  }

  .productivity-filters,
  .productivity-row {
    grid-template-columns: 1fr;
  }
}

/* Overrides finais: mantêm o novo cabeçalho acima das regras legadas. */
.list-title .list-subtitle,
.list-title .list-creator {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.25;
}

.list-title .list-creator {
  color: #8a918e;
  font-size: 0.74rem;
}

.list-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  flex: 0 0 auto;
}

.list-header-actions .list-admin-button {
  flex: 0 0 auto;
  width: 38px;
  min-height: 38px;
  border-radius: 8px;
  background: transparent;
  color: #c69214;
}

.list-header-actions .list-admin-button:hover,
.list-header-actions .list-admin-button:focus-visible {
  background: rgba(198, 146, 20, 0.1);
  color: #b27d08;
  box-shadow: 0 5px 14px rgba(138, 90, 43, 0.2);
}

.list-header-actions > button {
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.list-header-actions > button:hover,
.list-header-actions > button:focus,
.list-header-actions > button:focus-visible,
.list-header-actions > button:active {
  background: color-mix(in srgb, var(--accent-soft) 72%, transparent);
  box-shadow: 0 5px 14px rgba(15, 118, 110, 0.2);
  transform: translateY(-1px);
}

.list-header-actions .list-admin-button:hover,
.list-header-actions .list-admin-button:focus,
.list-header-actions .list-admin-button:focus-visible,
.list-header-actions .list-admin-button:active {
  background: rgba(198, 146, 20, 0.1);
  color: #b27d08;
  box-shadow: 0 5px 14px rgba(138, 90, 43, 0.2);
}

body.dark-mode .list-header-actions > button:hover,
body.dark-mode .list-header-actions > button:focus,
body.dark-mode .list-header-actions > button:focus-visible,
body.dark-mode .list-header-actions > button:active {
  background: rgba(126, 225, 210, 0.12);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.34);
}

body.dark-mode .list-header-actions .list-admin-button:hover,
body.dark-mode .list-header-actions .list-admin-button:focus,
body.dark-mode .list-header-actions .list-admin-button:focus-visible,
body.dark-mode .list-header-actions .list-admin-button:active {
  background: rgba(246, 196, 83, 0.12);
  color: #f6c453;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.34);
}

.list-report-count {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  margin-right: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.list-report-count b {
  color: var(--accent-dark);
  font-size: 0.95rem;
}

.list-total-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 68px;
  padding: 12px 18px;
  border-top: 1px solid #dfe8e4;
  border-bottom: 1px solid var(--line);
  background: #eef8f5;
  color: #123b35;
}

.list-total-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.list-total-copy strong {
  font-size: 1.08rem;
}

.list-total-copy small {
  color: #62716d;
  font-size: 0.88rem;
}

.list-total-count {
  display: grid;
  place-items: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 8px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--accent-dark);
  font-size: 1rem;
}

body.dark-mode .list-screen .list-header-actions .list-admin-button {
  background: transparent;
  color: #f6c453;
}

body.dark-mode .list-screen .list-header-actions .list-privacy-button {
  background: transparent;
  color: #9ff3e5;
}

body.dark-mode .list-screen .list-total-summary {
  border-color: #3a514b;
  background: #203a35;
  color: #f4faf7;
}

body.dark-mode .list-screen .list-total-copy small {
  color: #b7c9c4;
}

body.dark-mode .list-screen .list-total-count {
  background: #dff6ef;
  color: #126a60;
}

.list-edit-button.active,
.list-edit-button:hover,
.list-edit-button:focus-visible {
  color: #dc2626;
}

.feedback-open-button {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 16px;
  color: var(--accent-dark);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.feedback-open-button::after {
  content: "";
  display: block;
  width: 28px;
  height: 1px;
  grid-column: 3;
}

.feedback-open-button svg {
  grid-column: 1;
  grid-row: 1;
  justify-self: center;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.feedback-open-button > span {
  grid-column: 2;
  grid-row: 1;
  justify-self: stretch;
  min-width: 0;
  text-align: center;
}

.list-header-actions .list-plus {
  width: 38px;
  min-height: 38px;
  margin-left: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--accent-dark);
}

.text-format-tools {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.text-format-tools .format-button {
  display: grid;
  place-items: center;
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  color: var(--accent-dark);
  box-shadow: none;
  font-size: 1rem;
}

.text-format-tools .format-button:hover,
.text-format-tools .format-button:focus-visible {
  border-color: #c9ddd8;
  background: var(--soft);
  color: var(--accent-dark);
  box-shadow: none;
}

.font-size-control select {
  min-height: 38px;
  width: 94px;
  border-radius: 8px;
  padding: 0 26px 0 9px;
  font-size: 0.78rem;
}

.text-format-tools .align-format svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}

.sr-only,
.editor-record-button #recordLabel {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.list-screen .list-topbar {
  display: flex;
  grid-template-columns: none;
  justify-content: space-between;
  min-height: 112px;
  padding: 18px 22px;
  background: linear-gradient(135deg, #ffffff 0%, #f7fbf9 100%);
}

.list-screen .list-title {
  grid-template-columns: 62px minmax(0, 1fr);
  justify-content: start;
  justify-self: auto;
  gap: 15px;
  max-width: min(560px, calc(100% - 170px));
  text-align: left;
}

.list-screen .list-app-icon {
  width: 62px;
  height: 62px;
  border-radius: 15px;
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.16);
}

.list-screen .list-title h1 {
  margin: 0;
  color: var(--accent-dark);
  font-size: clamp(1.7rem, 4vw, 2.35rem);
  line-height: 1;
  text-align: left;
}

.editor-screen > .topbar {
  min-height: 124px;
  padding: 22px 28px;
  background: linear-gradient(135deg, #ffffff 0%, #f7fbf9 100%);
}

.editor-screen .brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 15px;
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.16);
}

.editor-screen .brand-lockup .eyebrow {
  color: var(--accent-dark);
  font-size: 1.75rem;
  letter-spacing: -0.03em;
  line-height: 1;
  text-transform: none;
}

.editor-screen .brand-lockup h1 {
  margin-top: 7px;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 500;
}

.dictation-panel .editor-record-button,
body.editor-focus-mode .dictation-panel .editor-record-button {
  width: 112px;
  min-width: 112px;
  height: 112px;
  min-height: 112px;
  border: 2px solid rgba(225, 29, 72, 0.25);
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 16px 32px rgba(119, 25, 50, 0.17);
}

.dictation-panel .editor-record-button .record-microphone {
  width: 50px;
  height: 50px;
  stroke-width: 2.8;
}

.dictation-panel .editor-record-button.recording,
.dictation-panel .editor-record-button.transcribing,
.dictation-panel .editor-record-button.recording:hover,
.dictation-panel .editor-record-button.transcribing:hover,
body.editor-focus-mode .dictation-panel .editor-record-button.recording,
body.editor-focus-mode .dictation-panel .editor-record-button.transcribing {
  border-color: #e11d48;
  background: #e11d48;
  color: #ffffff;
  box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.38);
  animation: none;
}

.dictation-panel .editor-record-button.recording,
.dictation-panel .editor-record-button.recording:hover,
body.editor-focus-mode .dictation-panel .editor-record-button.recording {
  animation: recording-button-pulse 1.15s ease-out infinite;
}

.dictation-panel .editor-record-button.recording .record-microphone,
.dictation-panel .editor-record-button.transcribing .record-microphone {
  stroke: #ffffff;
  filter: none;
}

.dictation-panel .editor-record-button.transcribing .record-microphone {
  animation: none;
}

.dictation-panel .editor-record-button.recording .record-microphone rect,
.dictation-panel .editor-record-button.transcribing .record-microphone rect {
  fill: rgba(255, 255, 255, 0.12);
}

@keyframes recording-button-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.42), 0 16px 32px rgba(119, 25, 50, 0.18);
  }
  70% {
    box-shadow: 0 0 0 14px rgba(225, 29, 72, 0), 0 16px 32px rgba(119, 25, 50, 0.18);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(225, 29, 72, 0), 0 16px 32px rgba(119, 25, 50, 0.18);
  }
}

.dictation-panel .editor-bottom-bar {
  min-height: 138px;
}

/* Em telas estreitas na horizontal, prioriza a área de edição. */
@media (orientation: landscape) and (max-height: 620px) {
  .dictation-panel {
    border-radius: 10px;
  }

  .dictation-header {
    padding: 8px 12px;
  }

  .dictation-header p {
    display: none;
  }

  .editor-toolbar {
    min-height: 38px;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(247, 249, 248, 0.72);
  }

  .editor-toolbar button,
  .editor-toolbar select {
    min-height: 30px;
    font-size: 0.78rem;
  }

  .dictation-panel .report-editor {
    min-height: 300px;
    padding: 12px 14px;
    font-size: 0.94rem;
    line-height: 1.45;
  }

  .dictation-panel .editor-bottom-bar {
    min-height: 64px;
    padding: 6px 10px;
    background: transparent;
    border: 0;
  }

  .dictation-panel .context-ai-hint {
    display: none;
  }

  .dictation-panel .editor-record-button,
  body.editor-focus-mode .dictation-panel .editor-record-button {
    width: 72px;
    min-width: 72px;
    height: 72px;
    min-height: 72px;
    border-width: 1px;
    box-shadow: 0 7px 16px rgba(119, 25, 50, 0.12);
  }

  .dictation-panel .editor-record-button .record-microphone {
    width: 34px;
    height: 34px;
  }
}

/* No modo tela cheia vertical, o gravador precisa permanecer acessível fora
   da barra inferior. A barra reserva apenas o status; o botão é flutuante e
   recebe toque mesmo quando o editor está rolando. */
@media (max-width: 700px) {
  html body.editor-focus-mode .dictation-panel .editor-bottom-bar {
    position: fixed !important;
    z-index: 230 !important;
    top: auto !important;
    right: 8px !important;
    bottom: max(48px, calc(env(safe-area-inset-bottom) + 8px)) !important;
    left: 8px !important;
    width: auto !important;
    height: 26px !important;
    min-height: 26px !important;
    flex: 0 0 26px !important;
    padding: 0 !important;
    overflow: visible !important;
    pointer-events: none !important;
    background: transparent !important;
    border: 0 !important;
  }

  html body.editor-focus-mode .dictation-panel .record-control {
    position: static !important;
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    pointer-events: none !important;
  }

  html body.editor-focus-mode .dictation-panel .record-control .editor-record-button,
  html body.editor-focus-mode .dictation-panel .record-control .editor-record-button:active {
    position: fixed !important;
    z-index: 500 !important;
    top: calc(50% - 32px) !important;
    right: 14px !important;
    bottom: auto !important;
    left: auto !important;
    display: grid !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 64px !important;
    min-width: 64px !important;
    height: 64px !important;
    min-height: 64px !important;
    margin: 0 !important;
    transform: none !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
  }

  html body.editor-focus-mode .dictation-panel .record-control .editor-record-button .record-microphone {
    width: 34px !important;
    height: 34px !important;
  }

  html body.editor-focus-mode .dictation-panel .record-activity-status {
    position: fixed !important;
    z-index: 501 !important;
    top: calc(50% + 40px) !important;
    right: 8px !important;
    bottom: auto !important;
    left: auto !important;
    min-height: 16px !important;
    max-width: 150px;
    padding: 0 3px;
    color: var(--muted);
    font-size: .62rem !important;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
  }
}

/* No modo Tela cheia móvel, há apenas um microfone: o controle flutuante. */
@media (max-width: 700px) {
  html body.editor-focus-mode .dictation-caret-marker { display: none !important; }
  html body.editor-focus-mode .dictation-panel .editor-bottom-bar {
    position: fixed;
    z-index: 230;
    top: max(4px, env(safe-area-inset-top));
    right: 8px;
    left: auto;
    bottom: auto;
    width: auto;
    flex-basis: 30px;
    min-height: 30px !important;
    height: 30px;
    padding: 0;
    border: 0;
    background: transparent;
    pointer-events: none;
  }
  html body.editor-focus-mode .dictation-panel .record-control {
    position: static;
    width: auto;
  }
  html body.editor-focus-mode .dictation-panel .record-activity-status {
    position: fixed;
    z-index: 241;
    top: calc(50% + 38px);
    right: 12px;
    min-height: 16px;
    color: var(--muted);
    font-size: 0.62rem;
    white-space: nowrap;
  }
  html body.editor-focus-mode .dictation-panel .record-control .editor-record-button,
  html body.editor-focus-mode .dictation-panel .record-control .editor-record-button:active {
    position: fixed;
    z-index: 240;
    right: 16px;
    top: 50%;
    bottom: auto;
    right: 14px;
    width: 64px;
    min-width: 64px;
    height: 64px;
    min-height: 64px;
    transform: translateY(-50%);
    border-width: 2px;
    box-shadow: 0 8px 20px rgba(15, 118, 110, 0.28);
  }
  html body.editor-focus-mode .dictation-panel .record-control .editor-record-button .record-microphone {
    width: 34px;
    height: 34px;
  }
}

/* Definitive fullscreen layout: the editor owns the scroll area and the
   compact recorder stays inside a reserved bottom row. */
body.editor-focus-mode .dictation-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100dvh;
  overflow: hidden;
}
body.editor-focus-mode .dictation-panel .dictation-header {
  flex: 0 0 38px;
  min-height: 38px;
  height: 38px;
  padding: 2px 8px;
  overflow: hidden;
}
body.editor-focus-mode .dictation-panel .dictation-header h2 { font-size: 0.9rem; }
body.editor-focus-mode .dictation-panel .editor-toolbar {
  flex: 0 0 34px;
  min-height: 34px;
  height: 34px;
  overflow-x: auto;
  overflow-y: hidden;
  touch-action: pan-x;
}
body.editor-focus-mode .dictation-panel .report-editor {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  pointer-events: auto;
  padding: 10px 14px 12px;
}
body.editor-focus-mode .dictation-panel .quick-editor-inline-actions,
body.editor-focus-mode .dictation-panel .report-writing-tools-hint,
body.editor-focus-mode .dictation-panel .transcription-pending-panel,
body.editor-focus-mode .dictation-panel .contextual-preview-panel,
body.editor-focus-mode .dictation-panel .paragraph-record-button {
  display: none !important;
}
body.editor-focus-mode .dictation-panel .editor-bottom-bar {
  position: relative;
  inset: auto;
  flex: 0 0 72px;
  min-height: 72px !important;
  height: 72px;
  padding: 8px 8px max(12px, env(safe-area-inset-bottom));
  overflow: hidden;
  pointer-events: auto;
}
body.editor-focus-mode .dictation-panel .record-control {
  position: static;
  display: flex;
  flex-direction: row;
  gap: 6px;
  min-width: 0;
  transform: none;
}
body.editor-focus-mode .dictation-panel .record-control .editor-record-button,
body.editor-focus-mode .dictation-panel .record-control .editor-record-button:active {
  position: static;
  width: 58px;
  min-width: 58px;
  height: 58px;
  min-height: 58px;
  transform: none;
  box-shadow: 0 4px 10px rgba(119, 25, 50, 0.12);
}
body.editor-focus-mode .dictation-panel .record-control .editor-record-button .record-microphone {
  width: 31px;
  height: 31px;
}
body.editor-focus-mode .dictation-panel .record-activity-status {
  min-height: 12px;
  font-size: 0.58rem;
}
@media (orientation: landscape) and (max-height: 620px) {
  body.editor-focus-mode .dictation-panel .dictation-header {
    flex-basis: 30px;
    min-height: 30px;
    height: 30px;
  }
  body.editor-focus-mode .dictation-panel .editor-toolbar {
    flex-basis: 30px;
    min-height: 30px;
    height: 30px;
  }
  body.editor-focus-mode .dictation-panel .editor-bottom-bar {
    flex-basis: 60px;
    min-height: 60px !important;
    height: 60px;
    padding: 5px 7px max(8px, env(safe-area-inset-bottom));
  }
  body.editor-focus-mode .dictation-panel .record-control .editor-record-button,
  body.editor-focus-mode .dictation-panel .record-control .editor-record-button:active {
    width: 48px;
    min-width: 48px;
    height: 48px;
    min-height: 48px;
  }
  body.editor-focus-mode .dictation-panel .record-control .editor-record-button .record-microphone {
    width: 26px;
    height: 26px;
  }
}

@media (max-width: 620px) {
  .quick-editor-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .quick-editor-actions {
    flex-basis: auto;
    grid-template-columns: 1fr;
  }

  .quick-editor-inline-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .quick-editor-actions .action-main {
    grid-column: auto;
  }

  .draft-notebook-gate {
    place-items: stretch;
    padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
  }

  .draft-notebook-dialog {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    padding: 16px;
    border-radius: 16px;
  }

  .draft-notebook-text {
    height: min(34dvh, 300px);
    min-height: 220px;
    overflow-y: auto;
    resize: none;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  .draft-measurements li {
    grid-template-columns: 1fr;
  }

  .draft-measurements li b {
    text-align: left;
  }

  .list-screen .list-topbar {
    min-height: 96px;
    padding: 13px 12px;
  }

  .list-screen .list-title {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 11px;
    max-width: calc(100% - 126px);
  }

  .list-screen .list-app-icon {
    width: 52px;
    height: 52px;
    border-radius: 13px;
  }

  .list-screen .list-title h1 {
    font-size: 1.55rem;
  }

  .list-title .list-subtitle {
    overflow: hidden;
    font-size: 0.68rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .list-title .list-creator {
    font-size: 0.61rem;
  }

  .list-header-actions {
    gap: 0;
  }

  .list-header-actions .list-settings-button,
  .list-header-actions .list-privacy-button,
  .list-header-actions .list-productivity-button,
  .list-header-actions .list-account-button,
  .list-header-actions .list-edit-button {
    width: 29px;
  }

  .list-header-actions .list-admin-button {
    width: 29px;
  }

  .list-header-actions .list-plus {
    width: 29px;
    min-height: 38px;
  }

  .editor-screen > .topbar {
    min-height: 104px;
    padding: 16px 14px;
  }

  .editor-screen .brand-mark {
    width: 52px;
    height: 52px;
  }

  .editor-screen .brand-lockup .eyebrow {
    font-size: 1.5rem;
  }

  .editor-screen .brand-lockup h1 {
    max-width: 220px;
    font-size: 0.78rem;
  }

  .editor-toolbar {
    overflow-x: auto;
    justify-content: flex-start;
    scrollbar-width: none;
  }

  .editor-toolbar::-webkit-scrollbar {
    display: none;
  }

  .text-format-tools,
  .context-ai-toggle {
    flex: 0 0 auto;
  }

  .font-size-control select {
    width: 84px;
  }

  .dictation-panel .editor-record-button,
  body.editor-focus-mode .dictation-panel .editor-record-button {
    width: 96px;
    min-width: 96px;
    height: 96px;
    min-height: 96px;
  }

  .dictation-panel .editor-record-button .record-microphone {
    width: 44px;
    height: 44px;
  }

  .dictation-panel .editor-bottom-bar {
    min-height: 124px;
  }

  .transcription-pending-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .transcription-pending-actions {
    justify-content: flex-end;
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  .dictation-panel .editor-record-button,
  body.editor-focus-mode .dictation-panel .editor-record-button {
    width: 72px;
    min-width: 72px;
    height: 72px;
    min-height: 72px;
  }

  .dictation-panel .editor-record-button .record-microphone {
    width: 34px;
    height: 34px;
  }
}
body.auth-locked .paragraph-record-button,
body.auth-locked .dictation-caret-marker,
body.auth-locked .editor-record-button,
body.auth-locked .editor-fixed-record-button {
  display: none !important;
  pointer-events: none !important;
}
/* Primeira etapa de simplificação: reduz as barras no celular sem remover
   ações; o editor permanece como foco principal e o microfone continua grande. */
@media (max-width: 700px) {
  .dictation-panel .dictation-header { padding: 10px 12px; }
  .dictation-panel .editor-toolbar {
    min-height: 42px;
    padding: 4px 8px;
    gap: 5px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .dictation-panel .editor-toolbar button,
  .dictation-panel .editor-toolbar select { min-height: 36px; }
  .dictation-panel .report-editor { min-height: 360px; padding: 16px 14px; }
  .dictation-panel .editor-bottom-bar { min-height: 92px; padding: 8px 12px; }
  .dictation-panel .record-control { min-width: 0; margin-left: auto; }
  .dictation-panel .editor-record-button {
    width: 82px;
    min-width: 82px;
    height: 82px;
    min-height: 82px;
  }
  .dictation-panel .editor-record-button .record-microphone { width: 38px; height: 38px; }
  .dictation-panel .record-activity-status { font-size: 0.68rem; }
}

/* Preview redesign: keep editing dominant and Plantão controls in one dock. */
body.preview-redesign{--pr-bg:#0d1d1b;--pr-panel:#122522;--pr-line:#2b5b53;--pr-teal:#35c4b0;--pr-text:#e7f5f1;--pr-muted:#9ebbb5;--pr-coral:#ff5f83;background:var(--pr-bg)!important;color:var(--pr-text)!important;overflow-x:hidden}
body.preview-redesign .preview-build-badge{position:fixed;top:6px;right:8px;z-index:9999;padding:4px 8px;border:1px solid var(--pr-teal);border-radius:999px;background:#123e38;color:#d8fff6;font:600 9px/1.2 system-ui;pointer-events:none}
body.preview-redesign .editor-screen,body.preview-redesign .editor-screen .report-form,body.preview-redesign .dictation-panel{background:var(--pr-bg)!important;color:var(--pr-text)!important;min-width:0;max-width:100vw}
body.preview-redesign .dictation-panel{border:1px solid var(--pr-line);border-radius:14px;overflow:visible}
body.preview-redesign .dictation-header,body.preview-redesign .editor-toolbar,body.preview-redesign .editor-bottom-bar{background:var(--pr-panel)!important;border-color:var(--pr-line)!important}
body.preview-redesign .dictation-header select,body.preview-redesign .dictation-mode-field select,body.preview-redesign .editor-toolbar button,body.preview-redesign .editor-toolbar select{background:transparent;border-color:var(--pr-line);color:var(--pr-text)}
body.preview-redesign .contextual-generate-button{border-color:var(--pr-teal);color:#b8fff2}
body.preview-redesign .report-editor{background:var(--pr-bg)!important;color:var(--pr-text)!important;min-width:0;max-width:100%;overflow-x:hidden;overflow-wrap:anywhere;word-break:break-word;caret-color:var(--pr-teal)}
body.preview-redesign .editor-record-button{border:2px solid #168b7d;background:#168b7d;color:#fff}
body.preview-redesign .editor-record-button:not(.recording):not(.transcribing){box-shadow:0 12px 26px rgba(22,139,125,.22)}
body.preview-redesign .editor-primary-actions{background:var(--pr-panel);border:1px solid var(--pr-line);border-radius:12px}
body.preview-redesign .duty-mode-floating{z-index:900;}
body.preview-redesign .duty-mode-menu{background:var(--pr-panel)!important;border-color:var(--pr-line)!important}
body.preview-redesign .duty-mode-action,body.preview-redesign .duty-mode-fab{background:#17322e;border-color:var(--pr-line);color:var(--pr-text)}
body.preview-redesign .duty-mode-action.is-primary,body.preview-redesign .duty-mode-fab[aria-pressed="true"]{background:#0f9587;border-color:var(--pr-teal);color:#fff}
body.preview-redesign .duty-mode-action#dutyModeMicButton{color:#fff;border-color:#e11d48;background:#e11d48}
body.preview-redesign .duty-mode-action#dutyModeMicButton.is-recording{color:#fff;border-color:#e11d48;background:#e11d48;animation:pulse .8s infinite}
body.preview-redesign .duty-mode-action#dutyModeMicButton.is-transcribing{color:#fff;border-color:#f97316;background:#f97316;animation:pulse 1s infinite}
@media(max-width:900px){
  body.preview-redesign .editor-screen{padding:0!important;overflow-x:hidden!important}
  body.preview-redesign .editor-screen .report-form> :not(.dictation-panel){display:none!important}
  body.preview-redesign .dictation-panel{display:flex;flex-direction:column;min-height:calc(100dvh - 48px);border-radius:0;border-left:0;border-right:0}
  body.preview-redesign .dictation-header{padding:8px 10px!important;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px;overflow:hidden}
  body.preview-redesign .dictation-header>div:first-child{grid-column:1/-1}
  body.preview-redesign .dictation-mode-field{min-width:0}
  body.preview-redesign .editor-toolbar{min-height:40px;padding:3px 6px!important;overflow-x:auto;position:sticky;top:0;z-index:20}
  body.preview-redesign .report-editor{flex:1 1 auto;min-height:0!important;height:auto;max-height:none!important;padding:14px 12px!important;overflow-y:auto}
  body.preview-redesign .editor-bottom-bar{min-height:48px!important;height:48px!important;padding:3px 8px!important;position:sticky;bottom:0;z-index:30}
  body.preview-redesign .editor-bottom-bar .context-ai-hint{display:none!important}
  body.preview-redesign .editor-record-button{width:58px!important;min-width:58px!important;height:58px!important;min-height:58px!important}
  body.preview-redesign .editor-primary-actions{display:grid;grid-template-columns:1fr 1fr;margin:8px;padding:8px;gap:6px}
  body.preview-redesign .editor-primary-actions .editor-action-button:nth-child(n+3){display:none}
  body.preview-redesign .duty-mode-floating{left:8px!important;right:8px!important;bottom:max(8px,env(safe-area-inset-bottom))!important;display:flex!important;flex-direction:row!important;justify-content:flex-end!important;align-items:center!important;gap:5px!important;max-width:calc(100vw - 16px)!important}
  body.preview-redesign .duty-mode-menu{position:static!important;display:flex!important;flex-direction:row!important;align-items:center!important;gap:4px!important;max-width:100%!important;padding:4px!important;overflow-x:auto!important;border-radius:14px!important}
  body.preview-redesign .duty-mode-position{display:none!important}
  body.preview-redesign .duty-mode-action{width:42px!important;height:42px!important;min-height:42px!important;flex:0 0 auto}
  body.preview-redesign .duty-mode-fab{width:50px!important;height:50px!important;flex:0 0 auto}
  body.preview-redesign:has(.duty-mode-floating:not([hidden])) .editor-bottom-bar,body.preview-redesign:has(.duty-mode-floating:not([hidden])) .paragraph-record-button,body.preview-redesign:has(.duty-mode-floating:not([hidden])) .dictation-caret-marker{display:none!important}
  body.preview-redesign:has(.duty-mode-floating:not([hidden])) .report-editor{padding-bottom:92px!important}
}

/* O dock é uma camada de interação própria. Mantê-lo acima do editor evita
   que a área rolável ou o teclado virtual capturem os toques dos controles. */
body.preview-redesign .duty-mode-floating,
body.preview-redesign .duty-mode-menu {
  pointer-events: auto !important;
  isolation: isolate;
  z-index: 2147483000 !important;
}
body.preview-redesign .duty-mode-floating button,
body.preview-redesign .duty-mode-floating [role="button"] {
  pointer-events: auto !important;
  touch-action: manipulation !important;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Garantia de prioridade sobre estilos legados carregados acima. */
body.preview-redesign #editorPrimaryActions {
  display:flex !important; flex-flow:row nowrap !important; align-items:center !important; justify-content:center !important;
  width:fit-content !important; max-width:calc(100% - 24px) !important; min-height:56px !important;
  margin:12px auto !important; padding:6px 10px !important; gap:6px !important; overflow:visible !important;
  border:1px solid var(--line) !important; border-radius:999px !important; background:var(--panel) !important;
  box-shadow:0 8px 22px rgba(0,0,0,.24) !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button,
body.preview-redesign #editorPrimaryActions .editor-action-button:hover,
body.preview-redesign #editorPrimaryActions .editor-action-button:active,
body.preview-redesign #editorPrimaryActions .editor-action-button:focus,
body.preview-redesign #editorPrimaryActions .editor-action-button:focus-visible {
  flex:0 0 44px !important; width:44px !important; min-width:44px !important; height:44px !important; min-height:44px !important;
  display:grid !important; place-items:center !important; padding:0 !important; border:0 !important; border-radius:0 !important;
  background:transparent !important; box-shadow:none !important; color:var(--accent-dark) !important; font-size:0 !important;
}
body.preview-redesign.dark-mode #editorPrimaryActions .editor-action-button { color:var(--accent) !important; }
body.preview-redesign #editorPrimaryActions .editor-action-button svg { width:23px !important; height:23px !important; stroke:currentColor !important; }
body.preview-redesign #editorPrimaryActions .editor-action-button span { position:absolute !important; width:1px !important; height:1px !important; overflow:hidden !important; clip:rect(0 0 0 0) !important; }
body.preview-redesign #editorPrimaryActions .editor-action-button:active::after,
body.preview-redesign #editorPrimaryActions .editor-action-button:focus-visible::after {
  content:attr(aria-label); position:absolute; left:50%; bottom:calc(100% + 8px); z-index:5; width:max-content; max-width:190px;
  padding:5px 8px; border:1px solid var(--line); border-radius:999px; background:var(--panel); color:var(--ink);
  font:600 .68rem/1.15 system-ui,sans-serif; white-space:normal; text-align:center; transform:translateX(-50%); pointer-events:none;
}

/* Barra compacta de microfone/contexto: os dois controles permanecem em uma
   única cápsula, sem sobrepor o título nem empurrar o editor para fora da tela. */
html body.preview-redesign .dictation-panel .dictation-header {
  display: flex !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
  min-height: 62px !important;
  height: auto !important;
  padding: 8px 10px !important;
  overflow: visible !important;
}

html body.preview-redesign .dictation-panel .dictation-header > div:first-child {
  flex: 0 0 auto !important;
  min-width: 0 !important;
}

html body.preview-redesign .dictation-panel .dictation-header h2 {
  margin: 0 !important;
  font-size: clamp(16px, 4.2vw, 20px) !important;
  line-height: 1.1 !important;
  white-space: nowrap !important;
}

html body.preview-redesign .dictation-panel .dictation-header > div:first-child p {
  display: none !important;
}

html body.preview-redesign .dictation-panel .dictation-header > .dictation-header-controls {
  display: flex !important;
  align-items: center !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  max-width: calc(100% - 52px) !important;
  margin-left: auto !important;
  gap: 6px !important;
  padding: 5px 7px !important;
  border: 1px solid var(--line) !important;
  border-radius: 999px !important;
  background: var(--panel) !important;
  overflow: hidden !important;
}

html body.preview-redesign .dictation-panel .dictation-header .audio-source-field {
  display: flex !important;
  align-items: center !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  max-width: none !important;
  gap: 4px !important;
  margin: 0 !important;
  font-size: clamp(10px, 2.5vw, 12px) !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

html body.preview-redesign .dictation-panel .dictation-header .audio-source-field select {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  width: auto !important;
  max-width: none !important;
  min-height: 30px !important;
  height: 30px !important;
  padding: 0 20px 0 5px !important;
  border: 0 !important;
  background: transparent !important;
  font-size: clamp(11px, 2.8vw, 13px) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

html body.preview-redesign .dictation-panel .dictation-header .dictation-context-field {
  display: flex !important;
  align-items: center !important;
  flex: 0 1 auto !important;
  min-width: 0 !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
}

html body.preview-redesign .dictation-panel .dictation-header .contextual-generate-button {
  flex: 0 1 auto !important;
  width: auto !important;
  min-width: 102px !important;
  max-width: 132px !important;
  min-height: 30px !important;
  height: 30px !important;
  padding: 0 9px !important;
  border-radius: 999px !important;
  font-size: clamp(11px, 2.8vw, 13px) !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Ajustes finais do espaço de trabalho no computador. Os filtros ficam em
   linhas próprias para que o menu de Clínica nunca fique atrás da seleção de
   modalidade; a lateral do editor usa a altura disponível da janela. */
@media (min-width: 1100px) {
  body.preview-redesign .list-screen > .bulk-panel,
  body.preview-redesign .list-screen .list-filter-details,
  body.preview-redesign .list-screen .list-filter-grid {
    position: relative !important;
    z-index: 40 !important;
    overflow: visible !important;
  }

  body.preview-redesign .list-screen .bulk-folder-field,
  body.preview-redesign .list-screen .bulk-modality-field,
  body.preview-redesign .list-screen .bulk-exam-field {
    grid-column: 1 / -1 !important;
    min-width: 0 !important;
  }

  body.preview-redesign .list-screen .clinic-filter-control {
    grid-template-columns: minmax(0, 1fr) minmax(210px, 0.4fr) !important;
    min-width: 0 !important;
  }

  body.preview-redesign .editor-recent-sidebar {
    height: calc(100vh - 104px) !important;
    max-height: calc(100vh - 104px) !important;
  }

  body.preview-redesign .editor-recent-sidebar-content,
  body.preview-redesign .editor-recent-list {
    flex: 1 1 auto !important;
  }

  body.preview-redesign .editor-recent-list {
    max-height: none !important;
  }

  body.preview-redesign.quick-editor-mode .template-tools-card {
    grid-template-columns: minmax(250px, 0.8fr) minmax(0, 1fr) auto !important;
  }

  /* No PACS, os dados do exame ocupam a largura inteira do editor. Antes os
     campos seguiam o fluxo de quatro colunas e deixavam metade do painel
     vazia ao lado do paciente e da data. */
  body.preview-redesign.quick-editor-mode .details-panel > .field-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    grid-template-areas:
      "patient patient date date"
      "folder folder category category"
      "exam exam exam exam"
      "more more more more" !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  body.preview-redesign.quick-editor-mode .details-panel .patient-name-field { grid-area: patient !important; }
  body.preview-redesign.quick-editor-mode .details-panel .exam-date-field { grid-area: date !important; }
  body.preview-redesign.quick-editor-mode .details-panel .exam-folder-field { grid-area: folder !important; }
  body.preview-redesign.quick-editor-mode .details-panel .exam-subcategory-field { grid-area: category !important; }
  body.preview-redesign.quick-editor-mode .details-panel .exam-type-field { grid-area: exam !important; }
  body.preview-redesign.quick-editor-mode .details-panel .progressive-report-details { grid-area: more !important; }

  body.preview-redesign.quick-editor-mode #openTemplateManagerButton {
    display: inline-flex !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  body.preview-redesign:has(#editorScreen:not([hidden])) .duty-mode-floating {
    left: calc(max(0px, (100vw - 1560px) / 2) + 338px) !important;
    right: calc(max(0px, (100vw - 1560px) / 2) + 28px) !important;
    width: auto !important;
    max-width: none !important;
    justify-content: center !important;
  }

  body.preview-redesign:has(#editorScreen.recent-sidebar-collapsed:not([hidden])) .duty-mode-floating {
    left: calc(max(0px, (100vw - 1560px) / 2) + 100px) !important;
  }
}

@media (min-width: 1100px) {
  body.preview-redesign .editor-recent-filters:has([data-editor-recent-filter="clinic"]:not([hidden])) {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

/* Filtros da lateral: a moldura externa define a curva. O estado ativo não
   deve criar uma cápsula menor dentro dela. */
@media (min-width: 1100px) {
  body.preview-redesign .editor-recent-filters {
    border-radius: 10px !important;
    overflow: hidden !important;
  }

  body.preview-redesign .editor-recent-filters button,
  body.preview-redesign .editor-recent-filters button.active {
    border-radius: 0 !important;
  }

  body.preview-redesign .editor-recent-filters button:first-child,
  body.preview-redesign .editor-recent-filters button:first-child.active {
    border-top-left-radius: 9px !important;
    border-bottom-left-radius: 9px !important;
  }

  body.preview-redesign .editor-recent-filters button:last-child,
  body.preview-redesign .editor-recent-filters button:last-child.active {
    border-top-right-radius: 9px !important;
    border-bottom-right-radius: 9px !important;
  }
}

@media (max-width: 380px) {
  html body.preview-redesign .dictation-panel .dictation-header {
    gap: 5px !important;
    padding-inline: 7px !important;
  }
  html body.preview-redesign .dictation-panel .dictation-header > .dictation-header-controls {
    gap: 3px !important;
    padding-inline: 5px !important;
    max-width: calc(100% - 48px) !important;
  }
  html body.preview-redesign .dictation-panel .dictation-header .audio-source-field {
    font-size: 0 !important;
  }
  html body.preview-redesign .dictation-panel .dictation-header .contextual-generate-button {
    min-width: 94px !important;
    padding-inline: 6px !important;
  }
}

/* Superfícies flutuantes com a mesma linguagem de vidro da barra de seleção. */
html body.preview-redesign .editor-screen .duty-mode-menu {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid rgba(44, 77, 71, 0.26) !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.22) !important;
  box-shadow: 0 18px 40px rgba(31, 47, 44, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.78) inset, 0 1px 0 rgba(255, 255, 255, 0.86) inset !important;
  -webkit-backdrop-filter: blur(20px) saturate(1.08) !important;
  backdrop-filter: blur(20px) saturate(1.08) !important;
}

html body.preview-redesign .editor-screen .duty-mode-menu::before {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(ellipse 70% 120% at 50% 0%, rgba(255, 255, 255, 0.44), transparent 62%), linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 46%, rgba(31, 74, 68, 0.08));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.76) inset;
}

html body.preview-redesign .editor-screen .duty-mode-menu > * {
  position: relative;
  z-index: 1;
}

html body.dark-mode.preview-redesign .editor-screen .duty-mode-menu {
  border-color: rgba(101, 207, 192, 0.68) !important;
  background: rgba(28, 34, 33, 0.38) !important;
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(166, 255, 242, 0.18) inset, 0 1px 0 rgba(255, 255, 255, 0.12) inset !important;
}

html body.dark-mode.preview-redesign .editor-screen .duty-mode-menu::before {
  background: radial-gradient(ellipse 70% 120% at 50% 0%, rgba(255, 255, 255, 0.2), transparent 62%), linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 46%, rgba(0, 0, 0, 0.15));
}

html body.preview-redesign div.toast {
  border: 1px solid rgba(44, 77, 71, 0.26) !important;
  border-radius: 999px !important;
  background: radial-gradient(ellipse 72% 120% at 50% 0%, rgba(255, 255, 255, 0.42), transparent 64%), rgba(255, 255, 255, 0.28) !important;
  box-shadow: 0 16px 36px rgba(31, 47, 44, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.78) inset !important;
  -webkit-backdrop-filter: blur(20px) saturate(1.08) !important;
  backdrop-filter: blur(20px) saturate(1.08) !important;
}

html body.dark-mode.preview-redesign div.toast {
  border-color: rgba(101, 207, 192, 0.68) !important;
  background: radial-gradient(ellipse 72% 120% at 50% 0%, rgba(255, 255, 255, 0.2), transparent 64%), rgba(28, 34, 33, 0.42) !important;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.44), 0 0 0 1px rgba(166, 255, 242, 0.16) inset !important;
}

/* A coluna lateral do editor acompanha a rolagem do laudo no computador.
   `overflow-x: hidden` no contêiner do grid transformava o próprio editor
   em uma área de rolagem e impedia que position: sticky chegasse ao topo da
   janela. O recorte horizontal não cria esse contêiner intermediário. */
@media (min-width: 1100px) {
  body.preview-redesign .editor-screen {
    position: relative !important;
    overflow-x: clip !important;
    overflow-y: visible !important;
  }

  body.preview-redesign .editor-recent-sidebar {
    position: sticky !important;
    top: 0 !important;
    align-self: start !important;
    height: 100vh !important;
    max-height: 100vh !important;
    overscroll-behavior: contain;
  }

  body.preview-redesign .editor-recent-sidebar.is-pinned {
    position: fixed !important;
    top: 0 !important;
    left: var(--editor-sidebar-left) !important;
    width: var(--editor-sidebar-width) !important;
    z-index: 40 !important;
  }

  body.preview-redesign .editor-recent-sidebar.is-at-end {
    position: absolute !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    width: var(--editor-sidebar-width) !important;
    z-index: 40 !important;
  }
}

/* O painel de sugestão é um item do mesmo grupo dos atalhos. No celular,
   ele não deve adicionar uma segunda moldura nem recuo interno. */
html body.preview-redesign .list-screen > .list-bottom-actions > .feedback-panel {
  display: grid !important;
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  gap: 10px !important;
}
html body.preview-redesign .list-screen > .list-bottom-actions > .feedback-panel > .feedback-open-button {
  display: grid !important;
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  border-radius: 14px !important;
}

/* Gravadores do Editor e dos Rascunhos compartilham o mesmo sinal visual:
   vermelho = pronto/capturando e laranja vibrante = interpretando. */
.dictation-panel .editor-record-button:not(.recording):not(.transcribing),
body.editor-focus-mode .dictation-panel .editor-record-button:not(.recording):not(.transcribing),
.draft-notebook-mic-button.is-ready,
.draft-notebook-mic-button.is-success {
  border-color: #e11d48;
  background: #e11d48;
  color: #ffffff;
  box-shadow: 0 12px 26px rgba(225, 29, 72, 0.24);
}

.dictation-panel .editor-record-button:not(.recording):not(.transcribing) .record-microphone,
.draft-notebook-mic-button.is-ready .record-microphone,
.draft-notebook-mic-button.is-success .record-microphone {
  stroke: #ffffff;
  filter: none;
}

.dictation-panel .editor-record-button:not(.recording):not(.transcribing) .record-microphone rect,
.draft-notebook-mic-button.is-ready .record-microphone rect,
.draft-notebook-mic-button.is-success .record-microphone rect {
  fill: rgba(255, 255, 255, 0.12);
}

.dictation-panel .editor-record-button.transcribing,
.dictation-panel .editor-record-button.transcribing:hover,
.draft-notebook-mic-button.is-transcribing,
.draft-notebook-mic-button.is-transcribing:hover {
  border-color: #f97316;
  background: #f97316;
  color: #ffffff;
  box-shadow: 0 12px 26px rgba(249, 115, 22, 0.28);
  animation: none;
}

.dictation-panel .editor-record-button.transcribing .record-microphone,
.draft-notebook-mic-button.is-transcribing .record-microphone {
  stroke: #ffffff;
  filter: none;
}

.dictation-panel .editor-record-button.transcribing .record-microphone rect,
.draft-notebook-mic-button.is-transcribing .record-microphone rect {
  fill: rgba(255, 255, 255, 0.12);
}

.draft-notebook-record-row {
  align-items: center;
  min-height: 58px;
}

.draft-notebook-mic-button,
.draft-notebook-mic-button:hover,
.draft-notebook-mic-button:focus-visible {
  position: relative;
  display: grid;
  flex: 0 0 58px;
  width: 58px;
  min-width: 58px;
  height: 58px;
  min-height: 58px;
  place-items: center;
  gap: 0;
  padding: 0;
  border: 2px solid #e11d48;
  border-radius: 50%;
  background: #e11d48;
  color: #ffffff;
  box-shadow: 0 12px 26px rgba(225, 29, 72, 0.24);
}

.draft-notebook-mic-button .record-microphone {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: none;
}

.draft-notebook-mic-button .record-microphone rect {
  fill: rgba(255, 255, 255, 0.12);
}

.draft-notebook-mic-button > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.draft-notebook-mic-button.is-recording,
.draft-notebook-mic-button.is-recording:hover,
.dictation-panel .editor-record-button.recording,
.dictation-panel .editor-record-button.recording:hover {
  border-color: #e11d48;
  background: #e11d48;
  color: #ffffff;
  animation: recording-button-pulse 1.15s ease-out infinite;
}

.draft-notebook-mic-button.is-recording .record-microphone {
  stroke: #ffffff;
  filter: none;
}

.draft-notebook-mic-button.is-recording .record-microphone rect {
  fill: rgba(255, 255, 255, 0.12);
}

.draft-notebook-mic-button:disabled {
  opacity: 1;
  cursor: wait;
}

/* Prioridade final: a folha legada ainda declara o mesmo botão mais abaixo.
   Estes seletores mantêm o controle circular mesmo quando essa folha é lida
   depois, sem alterar o layout do texto de apoio. */
html body .draft-notebook-mic-button,
html body .draft-notebook-mic-button:hover,
html body .draft-notebook-mic-button:focus-visible {
  display: grid !important;
  flex: 0 0 58px !important;
  width: 58px !important;
  min-width: 58px !important;
  height: 58px !important;
  min-height: 58px !important;
  place-items: center !important;
  gap: 0 !important;
  padding: 0 !important;
  border: 2px solid #e11d48 !important;
  border-radius: 50% !important;
  background: #e11d48 !important;
  color: #ffffff !important;
  box-shadow: 0 12px 26px rgba(225, 29, 72, 0.24) !important;
}

html body .draft-notebook-mic-button.is-recording,
html body .draft-notebook-mic-button.is-recording:hover,
html body .draft-notebook-mic-button.is-recording:focus-visible {
  border-color: #e11d48 !important;
  background: #e11d48 !important;
  color: #ffffff !important;
  animation: laude-dictation-recording-pulse 1.05s ease-in-out infinite !important;
}

html body .draft-notebook-mic-button.is-transcribing,
html body .draft-notebook-mic-button.is-transcribing:hover,
html body .draft-notebook-mic-button.is-transcribing:focus-visible {
  border-color: #f97316 !important;
  background: #f97316 !important;
  color: #ffffff !important;
  box-shadow: 0 12px 26px rgba(249, 115, 22, 0.28) !important;
  animation: none !important;
}

html body .draft-notebook-mic-button .record-microphone {
  width: 29px !important;
  height: 29px !important;
  margin: 0 !important;
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 2.6 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
  filter: none !important;
}

html body .draft-notebook-mic-button > span {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

html body .draft-notebook-mic-button:disabled {
  opacity: 1 !important;
  cursor: wait !important;
}

@keyframes laude-dictation-recording-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 8px 22px rgba(225, 29, 72, 0.34), 0 0 0 0 rgba(225, 29, 72, 0.66);
  }
  50% {
    transform: scale(1.12);
    box-shadow: 0 12px 30px rgba(225, 29, 72, 0.46), 0 0 0 18px rgba(225, 29, 72, 0);
  }
}

html body #dutyModeMicButton.is-recording,
html body #dutyModeMicButton.is-recording:hover,
html body #dutyModeMicButton.is-recording:focus-visible {
  animation: laude-dictation-recording-pulse 0.9s ease-in-out infinite !important;
}

html body .dictation-panel .editor-record-button.recording,
html body .dictation-panel .editor-record-button.recording:hover,
html body .draft-notebook-mic-button.is-recording,
html body .draft-notebook-mic-button.is-recording:hover,
html body .paragraph-record-button.recording,
html body .paragraph-record-button.recording:hover {
  animation: laude-dictation-recording-pulse 0.9s ease-in-out infinite !important;
}

@media (max-width: 620px) {
  html body .draft-notebook-record-row {
    align-items: center !important;
    flex-direction: column !important;
    gap: 8px !important;
  }
  html body .draft-notebook-mic-button {
    align-self: center !important;
    margin-inline: auto !important;
  }
}

/* Desktop clínico: lista lateral legível e formulário mais compacto para que
   o texto do laudo seja o elemento dominante da tela. */
@media (min-width: 1100px) {
  body.preview-redesign .workspace.editor-screen:not([hidden]) {
    grid-template-columns: clamp(330px, 24vw, 370px) minmax(0, 1fr) !important;
  }

  body.preview-redesign .editor-screen.recent-sidebar-collapsed {
    grid-template-columns: 72px minmax(0, 1fr) !important;
  }

  body.preview-redesign .editor-screen > .report-form {
    gap: 12px !important;
    padding: 16px 20px 28px !important;
  }

  body.preview-redesign .editor-recent-sidebar {
    top: 0 !important;
    height: 100vh !important;
    max-height: 100vh !important;
  }

  body.preview-redesign .editor-recent-sidebar-header {
    min-height: 64px !important;
    padding: 10px 12px 10px 16px !important;
  }

  body.preview-redesign .editor-recent-sidebar-heading strong {
    font-size: 1.05rem !important;
  }

  body.preview-redesign .editor-recent-sidebar-content {
    padding: 10px !important;
  }

  body.preview-redesign .editor-recent-search {
    min-height: 44px !important;
  }

  body.preview-redesign .editor-recent-filters {
    margin: 8px 0 !important;
  }

  body.preview-redesign .editor-recent-list {
    grid-auto-rows: minmax(62px, max-content) !important;
    border-radius: 8px !important;
  }

  body.preview-redesign .editor-recent-sidebar .editor-recent-item,
  body.preview-redesign .editor-recent-sidebar .editor-template-item {
    width: 100% !important;
    min-height: 62px !important;
    margin: 0 !important;
    padding: 9px 11px !important;
    border: 0 !important;
    border-bottom: 1px solid var(--line) !important;
    border-radius: 0 !important;
  }

  body.preview-redesign .editor-recent-sidebar .editor-recent-item:last-child,
  body.preview-redesign .editor-recent-sidebar .editor-template-item:last-child {
    border-bottom: 0 !important;
  }

  body.preview-redesign .editor-recent-item-main {
    gap: 4px !important;
  }

  body.preview-redesign .editor-recent-item-main strong {
    display: -webkit-box !important;
    overflow: hidden !important;
    font-size: 0.9rem !important;
    line-height: 1.18 !important;
    white-space: normal !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
  }

  body.preview-redesign .editor-recent-item-main small {
    font-size: 0.74rem !important;
  }

  body.preview-redesign .editor-recent-item-meta {
    min-width: 72px !important;
    font-size: 0.72rem !important;
  }

  body.preview-redesign .editor-recent-item:hover,
  body.preview-redesign .editor-recent-item:focus-visible {
    border-bottom-color: var(--line) !important;
  }

  body.preview-redesign .editor-recent-item.active {
    border-bottom-color: var(--line) !important;
    box-shadow: inset 4px 0 0 var(--accent) !important;
  }

  body.preview-redesign:not(.quick-editor-mode) .editor-screen .report-form > .details-panel {
    padding: 12px !important;
    border-radius: 14px !important;
  }

  body.preview-redesign:not(.quick-editor-mode) .editor-screen .details-panel > .field-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
    grid-template-areas:
      "patient patient patient patient patient date date folder folder category category category"
      "exam exam exam exam exam exam exam exam side side more more"
      "obstetric obstetric obstetric obstetric obstetric obstetric obstetric obstetric obstetric obstetric obstetric obstetric" !important;
    gap: 9px 10px !important;
  }

  body.preview-redesign:not(.quick-editor-mode) .editor-screen .details-panel > .field-grid:has(#examSideField[hidden]) {
    grid-template-areas:
      "patient patient patient patient patient date date folder folder category category category"
      "exam exam exam exam exam exam exam exam exam exam more more"
      "obstetric obstetric obstetric obstetric obstetric obstetric obstetric obstetric obstetric obstetric obstetric obstetric" !important;
  }

  body.preview-redesign:not(.quick-editor-mode) .details-panel label {
    grid-template-rows: auto 42px !important;
    gap: 4px !important;
    font-size: 0.76rem !important;
  }

  body.preview-redesign:not(.quick-editor-mode) .details-panel label > input,
  body.preview-redesign:not(.quick-editor-mode) .details-panel label > select,
  body.preview-redesign:not(.quick-editor-mode) .details-panel .date-field-shell,
  body.preview-redesign:not(.quick-editor-mode) .details-panel .date-field-display {
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
  }

  body.preview-redesign:not(.quick-editor-mode) .details-panel label > input,
  body.preview-redesign:not(.quick-editor-mode) .details-panel label > select {
    padding-inline: 11px !important;
    border-radius: 10px !important;
    font-size: 0.9rem !important;
  }

  body.preview-redesign:not(.quick-editor-mode) .details-panel .progressive-report-details {
    align-self: end !important;
    margin: 0 !important;
    padding: 0 !important;
    border-top: 0 !important;
  }

  body.preview-redesign:not(.quick-editor-mode) .details-panel .progressive-report-details > summary {
    min-height: 42px !important;
    height: 42px !important;
    padding: 0 11px !important;
    border-radius: 10px !important;
    font-size: 0.82rem !important;
  }

  body.preview-redesign:not(.quick-editor-mode) .details-panel .progressive-report-details[open] {
    grid-column: 1 / -1 !important;
  }

  body.preview-redesign:not(.quick-editor-mode) .editor-screen .progressive-report-fields {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 9px 10px !important;
    padding-top: 10px !important;
  }

  body.preview-redesign .editor-screen .template-tools-card {
    display: grid !important;
    grid-template-columns: minmax(220px, 0.8fr) minmax(0, 2fr) auto !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 8px 10px !important;
    border-radius: 12px !important;
  }

  body.preview-redesign .editor-screen .template-tools-current {
    min-width: 0 !important;
    padding: 0 !important;
    border-bottom: 0 !important;
  }

  body.preview-redesign .editor-screen .template-row-primary {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  body.preview-redesign .editor-screen .template-action-button {
    min-height: 38px !important;
    padding: 6px 9px !important;
    border-radius: 10px !important;
    font-size: 0.75rem !important;
  }

  body.preview-redesign .editor-screen .template-more-actions {
    padding-top: 0 !important;
    border-top: 0 !important;
  }

  body.preview-redesign .editor-screen .template-more-actions summary {
    min-height: 38px !important;
    padding-inline: 10px !important;
    border-radius: 10px !important;
    white-space: nowrap !important;
  }

  body.preview-redesign .editor-screen .template-more-actions[open] {
    grid-column: 1 / -1 !important;
  }

  body.preview-redesign .editor-screen .dictation-panel {
    min-height: 560px !important;
  }

  html body.preview-redesign .editor-screen .dictation-panel .dictation-header {
    min-height: 52px !important;
    padding: 6px 10px !important;
  }

  body.preview-redesign .editor-screen .dictation-panel > .editor-toolbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 8 !important;
    margin-top: 0 !important;
    background: var(--panel) !important;
  }

  body.preview-redesign .editor-screen .dictation-panel .report-editor {
    min-height: clamp(440px, 56vh, 720px) !important;
  }
}

/* Overrides finais do layout desktop: filtros, máscaras e barra do editor. */
@media (min-width: 1100px) {
  body.preview-redesign .list-screen > .bulk-panel,
  body.preview-redesign .list-screen .list-filter-details,
  body.preview-redesign .list-screen .list-filter-grid { position: relative !important; z-index: 40 !important; overflow: visible !important; }
  body.preview-redesign .list-screen .bulk-folder-field,
  body.preview-redesign .list-screen .bulk-modality-field,
  body.preview-redesign .list-screen .bulk-exam-field { grid-column: 1 / -1 !important; min-width: 0 !important; }
  body.preview-redesign .list-screen .clinic-filter-control { grid-template-columns: minmax(0, 1fr) minmax(210px, 0.4fr) !important; min-width: 0 !important; }
  body.preview-redesign .editor-recent-sidebar { height: calc(100vh - 104px) !important; max-height: calc(100vh - 104px) !important; }
  body.preview-redesign .editor-recent-sidebar-content,
  body.preview-redesign .editor-recent-list { flex: 1 1 auto !important; }
  body.preview-redesign .editor-recent-list { max-height: none !important; }
  body.preview-redesign.quick-editor-mode .template-tools-card { grid-template-columns: minmax(250px, 0.8fr) minmax(0, 1fr) auto !important; }
  body.preview-redesign.quick-editor-mode #openTemplateManagerButton { display: inline-flex !important; visibility: visible !important; pointer-events: auto !important; }
  body.preview-redesign:has(#editorScreen:not([hidden])) .duty-mode-floating { left: calc(max(0px, (100vw - 1560px) / 2) + 338px) !important; right: calc(max(0px, (100vw - 1560px) / 2) + 28px) !important; width: auto !important; max-width: none !important; justify-content: center !important; }
  body.preview-redesign:has(#editorScreen.recent-sidebar-collapsed:not([hidden])) .duty-mode-floating { left: calc(max(0px, (100vw - 1560px) / 2) + 100px) !important; }
  body.preview-redesign .editor-recent-filters:has([data-editor-recent-filter="clinic"]:not([hidden])) { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
}

/* Overrides finais do layout desktop. */
@media (min-width: 1100px) {
  body.preview-redesign .list-screen > .bulk-panel,
  body.preview-redesign .list-screen .list-filter-details,
  body.preview-redesign .list-screen .list-filter-grid { position: relative !important; z-index: 40 !important; overflow: visible !important; }
  body.preview-redesign .list-screen .bulk-folder-field,
  body.preview-redesign .list-screen .bulk-modality-field,
  body.preview-redesign .list-screen .bulk-exam-field { grid-column: 1 / -1 !important; min-width: 0 !important; }
  body.preview-redesign .list-screen .clinic-filter-control { grid-template-columns: minmax(0, 1fr) minmax(210px, 0.4fr) !important; min-width: 0 !important; }
  body.preview-redesign .editor-recent-sidebar { height: calc(100vh - 104px) !important; max-height: calc(100vh - 104px) !important; }
  body.preview-redesign .editor-recent-sidebar-content,
  body.preview-redesign .editor-recent-list { flex: 1 1 auto !important; }
  body.preview-redesign .editor-recent-list { max-height: none !important; }
  body.preview-redesign.quick-editor-mode .template-tools-card { grid-template-columns: minmax(250px, 0.8fr) minmax(0, 1fr) auto !important; }
  body.preview-redesign.quick-editor-mode #openTemplateManagerButton { display: inline-flex !important; visibility: visible !important; pointer-events: auto !important; }
  body.preview-redesign:has(#editorScreen:not([hidden])) .duty-mode-floating { left: calc(max(0px, (100vw - 1560px) / 2) + 338px) !important; right: calc(max(0px, (100vw - 1560px) / 2) + 28px) !important; width: auto !important; max-width: none !important; justify-content: center !important; }
  body.preview-redesign:has(#editorScreen.recent-sidebar-collapsed:not([hidden])) .duty-mode-floating { left: calc(max(0px, (100vw - 1560px) / 2) + 100px) !important; }
  body.preview-redesign .editor-recent-filters:has([data-editor-recent-filter="clinic"]:not([hidden])) { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
}

/* Fechamentos isolados usam um único controle circular. Botões "Fechar"
   inseridos em conjuntos textuais preservam a cápsula e o rótulo. */
.standalone-close-button,
button.standalone-close-button {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line));
  border-radius: 50%;
  background: transparent;
  color: var(--accent-dark);
  box-shadow: 0 5px 14px rgba(13, 127, 116, 0.09);
}

.standalone-close-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.standalone-close-button:hover,
.standalone-close-button:focus-visible {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--soft) 62%, transparent);
  color: var(--accent-dark);
  box-shadow: 0 7px 18px rgba(13, 127, 116, 0.15);
}

body.dark-mode button.standalone-close-button,
body.dark-mode button.standalone-close-button:hover,
body.dark-mode button.standalone-close-button:focus-visible {
  border-color: rgba(159, 243, 229, 0.28);
  background: transparent;
  color: #9ff3e5;
}

body.dark-mode button.standalone-close-button:hover,
body.dark-mode button.standalone-close-button:focus-visible {
  border-color: #69dfce;
  background: rgba(36, 83, 77, 0.52);
  color: #e5fffa;
}

/* Em telas de toque, o microfone contextual não é exibido: a barra flutuante
   continua sendo o ponto único de gravação, sem ocupar espaço junto ao texto.
   Em computadores com mouse/trackpad ele permanece disponível ao lado do
   parágrafo selecionado. A especificidade reforçada impede que estilos
   responsivos posteriores reexibam o controle após a seleção. */
@media (pointer: coarse), (max-width: 900px) {
  html body.preview-redesign.editor-focus-mode .dictation-panel > .paragraph-record-button:not([hidden]),
  html body.preview-redesign.quick-editor-mode .dictation-panel > .paragraph-record-button:not([hidden]),
  html body .dictation-panel > .paragraph-record-button:not([hidden]),
  html body .paragraph-record-button:not([hidden]) {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

/* Overrides finais: ocultar a faixa inferior também em tela cheia e manter o
   microfone contextual disponível após a seleção do parágrafo no PACS. */
html body .dictation-panel > .editor-bottom-bar,
html body.preview-redesign.editor-focus-mode .dictation-panel > .editor-bottom-bar,
html body.preview-redesign.quick-editor-mode.editor-focus-mode .dictation-panel > .editor-bottom-bar {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
html body .dictation-panel > .paragraph-record-button:not([hidden]),
html body.preview-redesign.quick-editor-mode .dictation-panel > .paragraph-record-button:not([hidden]) {
  display: grid !important;
  visibility: visible !important;
  pointer-events: auto !important;
}
html body.duty-mode .dictation-panel > .paragraph-record-button,
html body.template-manager-open .dictation-panel > .paragraph-record-button {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Estado final do editor: a faixa de status/microfone fica fora da tela e o
   microfone contextual volta a aparecer junto ao parágrafo selecionado, em
   ambos os editores, inclusive no modo PACS. */
html body .dictation-panel > .editor-bottom-bar {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
html body .dictation-panel > .paragraph-record-button:not([hidden]) {
  display: grid !important;
  visibility: visible !important;
  pointer-events: auto !important;
}
html body.template-manager-open .dictation-panel > .paragraph-record-button,
html body.preview-redesign.template-manager-open .dictation-panel > .paragraph-record-button {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
html body.duty-mode .dictation-panel > .paragraph-record-button {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Padrao visual: acoes em capsula, mantendo barras de icones compactas. */
html body.preview-redesign button:not(.editor-fixed-action):not(.format-button):not(.year-group-header):not(.month-group-header):not(.date-group-header):not(.editor-recent-item):not(.editor-template-item):not(.editor-clinic-option):not(.list-bottom-action-button):not(.list-bottom-auto-draft-button):not(.feedback-open-button) {
  border-radius: 999px !important;
}

/* Fechar deve desaparecer no plano de fundo e responder claramente ao toque. */
html body.preview-redesign button[id$="CloseButton"],
html body.preview-redesign button#academyCloseButton,
html body.preview-redesign button.pdf-option-close {
  border: 1px solid var(--line) !important;
  border-radius: 999px !important;
  background: transparent !important;
  color: var(--muted) !important;
  box-shadow: none !important;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 100ms ease !important;
}

html body.preview-redesign button[id$="CloseButton"]:hover,
html body.preview-redesign button[id$="CloseButton"]:focus-visible,
html body.preview-redesign button[id$="CloseButton"]:active,
html body.preview-redesign button#academyCloseButton:hover,
html body.preview-redesign button#academyCloseButton:focus-visible,
html body.preview-redesign button#academyCloseButton:active,
html body.preview-redesign button.pdf-option-close:hover,
html body.preview-redesign button.pdf-option-close:focus-visible,
html body.preview-redesign button.pdf-option-close:active {
  border-color: color-mix(in srgb, var(--accent) 42%, transparent) !important;
  background: color-mix(in srgb, var(--accent) 14%, transparent) !important;
  color: var(--accent-dark) !important;
}

html body.preview-redesign button[id$="CloseButton"]:active,
html body.preview-redesign button#academyCloseButton:active,
html body.preview-redesign button.pdf-option-close:active {
  transform: scale(0.96) !important;
}

html body.dark-mode.preview-redesign button[id$="CloseButton"],
html body.dark-mode.preview-redesign button#academyCloseButton,
html body.dark-mode.preview-redesign button.pdf-option-close {
  color: #b9c8c5 !important;
  border-color: #49645f !important;
}

html body.dark-mode.preview-redesign button[id$="CloseButton"]:hover,
html body.dark-mode.preview-redesign button[id$="CloseButton"]:focus-visible,
html body.dark-mode.preview-redesign button[id$="CloseButton"]:active,
html body.dark-mode.preview-redesign button#academyCloseButton:hover,
html body.dark-mode.preview-redesign button#academyCloseButton:focus-visible,
html body.dark-mode.preview-redesign button#academyCloseButton:active,
html body.dark-mode.preview-redesign button.pdf-option-close:hover,
html body.dark-mode.preview-redesign button.pdf-option-close:focus-visible,
html body.dark-mode.preview-redesign button.pdf-option-close:active {
  border-color: #69dfce !important;
  background: #24534d !important;
  color: #e5fffa !important;
}

/* Última camada visual dos controles de clínica, após as regras responsivas. */
body.preview-redesign .list-screen .clinic-filter-control {
  grid-template-columns: minmax(0, 1fr) repeat(3, 44px) !important;
  gap: 6px !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
body.preview-redesign .list-screen .clinic-filter-control select {
  min-height: 46px !important;
  border: 1px solid rgba(13, 127, 116, 0.24) !important;
  border-radius: 999px !important;
  background: color-mix(in srgb, var(--surface) 90%, var(--soft)) !important;
  box-shadow: 0 6px 16px rgba(13, 127, 116, 0.07) !important;
}
body.preview-redesign .list-screen .clinic-filter-control button {
  display: grid !important;
  place-items: center !important;
  width: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  padding: 0 !important;
  border: 1px solid rgba(13, 127, 116, 0.24) !important;
  border-radius: 999px !important;
  background: color-mix(in srgb, var(--surface) 90%, var(--soft)) !important;
  box-shadow: 0 6px 16px rgba(13, 127, 116, 0.07) !important;
}
body.preview-redesign .list-screen .clinic-filter-control button:hover,
body.preview-redesign .list-screen .clinic-filter-control button:focus-visible {
  border-color: var(--accent) !important;
  background: var(--soft) !important;
}
body.preview-redesign .list-screen .clinic-filter-control .clinic-folder-delete:not(:disabled) {
  color: #dc3b4b !important;
}
body.preview-redesign .list-screen .clinic-filter-control .clinic-folder-delete:disabled,
body.preview-redesign .list-screen .clinic-filter-control .clinic-pdf-profile-button:disabled {
  display: none !important;
}
body.dark-mode.preview-redesign .list-screen .clinic-filter-control select,
body.dark-mode.preview-redesign .list-screen .clinic-filter-control button {
  border-color: rgba(159, 243, 229, 0.22) !important;
  background: #192321 !important;
  color: #b8fff3 !important;
}
body.dark-mode.preview-redesign .list-screen .clinic-filter-control button:hover,
body.dark-mode.preview-redesign .list-screen .clinic-filter-control button:focus-visible {
  border-color: #69dfce !important;
  background: #24534d !important;
  color: #e5fffa !important;
}
body.dark-mode.preview-redesign .list-screen .clinic-filter-control .clinic-folder-delete:not(:disabled) {
  color: #ff7a8a !important;
}

/* Os três comandos ficam juntos numa cápsula contínua, sem linhas entre
   eles. O seletor de clínica permanece separado e largo. */
body.preview-redesign .list-screen .clinic-filter-control {
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 8px !important;
}
body.preview-redesign .list-screen .clinic-filter-actions {
  display: inline-grid !important;
  grid-template-columns: repeat(3, 44px) !important;
  align-items: center !important;
  gap: 0 !important;
  padding: 3px !important;
  border: 1px solid rgba(13, 127, 116, 0.24) !important;
  border-radius: 999px !important;
  background: color-mix(in srgb, var(--surface) 90%, var(--soft)) !important;
  box-shadow: 0 6px 16px rgba(13, 127, 116, 0.07) !important;
}
body.preview-redesign .list-screen .clinic-filter-actions button,
body.preview-redesign .list-screen .clinic-filter-actions button:hover,
body.preview-redesign .list-screen .clinic-filter-actions button:focus-visible,
body.preview-redesign .list-screen .clinic-filter-actions button:active {
  display: grid !important;
  place-items: center !important;
  width: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease !important;
}
body.preview-redesign .list-screen .clinic-filter-actions button:hover,
body.preview-redesign .list-screen .clinic-filter-actions button:focus-visible {
  background: var(--soft) !important;
}
body.preview-redesign .list-screen .clinic-filter-actions .clinic-folder-delete:not(:disabled) {
  color: #dc3b4b !important;
}
body.preview-redesign .list-screen .clinic-filter-actions .clinic-folder-delete:disabled,
body.preview-redesign .list-screen .clinic-filter-actions .clinic-pdf-profile-button:disabled {
  display: grid !important;
  color: #9aa5a3 !important;
  opacity: 0.42 !important;
  cursor: not-allowed !important;
}
body.dark-mode.preview-redesign .list-screen .clinic-filter-actions {
  border-color: rgba(159, 243, 229, 0.22) !important;
  background: #192321 !important;
}
body.dark-mode.preview-redesign .list-screen .clinic-filter-actions button {
  color: #b8fff3 !important;
}
body.dark-mode.preview-redesign .list-screen .clinic-filter-actions button:hover,
body.dark-mode.preview-redesign .list-screen .clinic-filter-actions button:focus-visible {
  background: #24534d !important;
  color: #e5fffa !important;
}
body.dark-mode.preview-redesign .list-screen .clinic-filter-actions .clinic-folder-delete:not(:disabled) {
  color: #ff7a8a !important;
}
body.dark-mode.preview-redesign .list-screen .clinic-filter-actions .clinic-folder-delete:disabled,
body.dark-mode.preview-redesign .list-screen .clinic-filter-actions .clinic-pdf-profile-button:disabled {
  color: #71827d !important;
}

/* Equaliza as duas cápsulas do bloco Clínica. */
body.preview-redesign .list-screen .clinic-filter-control {
  grid-template-columns: minmax(0, 1.38fr) minmax(210px, 0.62fr) !important;
}
body.preview-redesign .list-screen .clinic-filter-actions {
  width: 100% !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  box-sizing: border-box !important;
}
body.preview-redesign .list-screen .clinic-filter-actions button {
  width: 100% !important;
  min-width: 0 !important;
}
@media (max-width: 520px) {
  body.preview-redesign .list-screen .clinic-filter-control {
    grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr) !important;
  }
}

/* Mesma altura visual para as duas cápsulas, com os ícones compactos dentro
   da segunda. */
body.preview-redesign .list-screen .clinic-filter-control select,
body.preview-redesign .list-screen .clinic-filter-actions {
  height: 52px !important;
  min-height: 52px !important;
  box-sizing: border-box !important;
}
body.preview-redesign .list-screen .clinic-filter-actions button {
  height: 44px !important;
  min-height: 44px !important;
}

/* Mantém o acabamento em cápsula também na navegação compacta do celular. */
@media (max-width: 720px) {
  .academy-icon-button {
    border-radius: 999px;
  }

  .academy-lesson-button {
    width: 48px;
    min-width: 48px;
    height: 48px;
    min-height: 48px;
    padding: 0;
    border: 1px solid rgba(13, 127, 116, 0.24);
    border-radius: 50%;
    background: var(--surface);
    color: #08766d;
    box-shadow: 0 5px 14px rgba(13, 95, 89, 0.12);
  }

  .academy-lesson-button.is-active {
    border-color: var(--accent);
    background: var(--surface);
    color: var(--accent-dark);
    box-shadow: 0 0 0 2px rgba(13, 127, 116, 0.14), 0 7px 18px rgba(13, 95, 89, 0.2);
  }

  .academy-lesson-number {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: inherit;
    background: transparent;
    color: inherit;
  }

  .academy-lesson-number .academy-glyph {
    width: 21px;
    height: 21px;
    stroke-width: 1.45;
  }

  .academy-action-button {
    border-radius: 999px;
  }

  body.dark-mode .academy-lesson-button {
    border-color: rgba(159, 243, 229, 0.3);
    background: #192321;
    color: #9ff3e5;
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.3);
  }

  body.dark-mode .academy-lesson-button.is-active {
    border-color: #69dfce;
    background: #192321;
    color: #b8fff3;
    box-shadow: 0 0 0 2px rgba(105, 223, 206, 0.16), 0 7px 18px rgba(0, 0, 0, 0.38);
  }
}

/* Relatório de produtividade agrupado por tipo de exame. */
.productivity-summary {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.productivity-stat-primary strong {
  color: var(--accent) !important;
}

/* Mais contraste para os pictogramas das lições no tema escuro. */
body.dark-mode .academy-lesson-button .academy-lesson-number {
  background: #24534d;
  color: #c8fff5;
}

body.dark-mode .academy-lesson-button .academy-lesson-number .academy-glyph {
  stroke: currentColor;
  stroke-width: 2.15;
  opacity: 1;
  filter: drop-shadow(0 0 1px rgba(200, 255, 245, 0.45));
}

body.dark-mode .academy-lesson-button.is-active .academy-lesson-number {
  background: #b8fff3;
  color: #124b44;
}

.productivity-row {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 16px;
}

.productivity-row-main {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.productivity-row-main span {
  color: var(--accent-dark);
  font-size: 0.92rem;
  font-weight: 700;
}

.productivity-row-count {
  display: grid;
  justify-items: end;
  gap: 3px;
}

.productivity-row-count b {
  min-width: 0;
  height: auto;
  padding: 5px 10px;
}

.productivity-row-count small,
.productivity-row-dates {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.3;
}

.productivity-row-dates {
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
}

body.dark-mode .productivity-row-main span {
  color: #9de9df;
}

@media (max-width: 700px) {
  .productivity-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .productivity-row {
    grid-template-columns: 1fr;
  }

  .productivity-row-count {
    justify-items: start;
  }
}

/* O dock pertence exclusivamente ao laudo em edição; não pode atravessar o
   gerenciador de máscaras quando ele é aberto a partir do Editor rápido. */
html body.preview-redesign.template-manager-open .duty-mode-floating,
html body.template-manager-open .duty-mode-floating {
  display:none !important;
  visibility:hidden !important;
  pointer-events:none !important;
}

@media (max-width: 560px) {
  .template-manager-dictation-dock {
    gap: 3px;
    padding: 5px;
  }
  .template-manager-dictation-action {
    min-width: 0;
    flex: 1 1 0;
    gap: 4px;
    padding-inline: 6px;
    font-size: 0.78rem;
  }
  .template-manager-dictation-action svg {
    width: 17px;
    height: 17px;
  }
}

/* O controle nativo de data do iOS pode conservar uma largura intrínseca
   maior que a coluna do modal. No formulário de novo laudo, mantenha-o
   limitado à caixa mesmo em telas estreitas e no modo escuro. */
.patient-dialog .quick-patient-field,
.patient-dialog .quick-patient-field input[type="date"] {
  min-width: 0;
  max-width: 100%;
  inline-size: 100%;
  box-sizing: border-box;
}

.patient-dialog .quick-patient-field input[type="date"] {
  display: block;
  overflow: hidden;
  padding-inline: 10px;
  padding-block: 0;
  text-align: left;
  text-align-last: left;
  line-height: 42px;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 44px;
  min-height: 44px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 13px;
}

.patient-dialog .quick-patient-field input[type="date"]::-webkit-datetime-edit {
  min-width: 0;
  max-width: 100%;
  padding: 0;
}

.patient-dialog .quick-patient-field input[type="date"]::-webkit-date-and-time-value {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  overflow: hidden;
  text-align: left;
  line-height: 42px;
}

/* Cabeçalho definitivo e compartilhado pelos editores normal e PACS.
   O agrupador não desenha caixa: somente os dois controles são cápsulas. */
html body.preview-redesign .dictation-panel .dictation-header {
  display: grid !important;
  grid-template-columns: max-content minmax(0, 1fr) minmax(0, 1fr) !important;
  align-items: center !important;
  column-gap: 8px !important;
  min-height: 58px !important;
  height: auto !important;
  padding: 8px 10px !important;
  overflow: visible !important;
}
html body.preview-redesign .dictation-panel .dictation-header > div:first-child {
  grid-column: 1 !important;
  display: block !important;
  width: auto !important;
  min-width: 0 !important;
  margin: 0 !important;
}
html body.preview-redesign .dictation-panel .dictation-header h2 {
  margin: 0 !important;
  font-size: clamp(16px, 4.2vw, 20px) !important;
  line-height: 1.1 !important;
  white-space: nowrap !important;
}
html body.preview-redesign .dictation-panel .dictation-header > div:first-child p {
  display: none !important;
}
html body.preview-redesign .dictation-panel .dictation-header > .dictation-header-controls {
  display: contents !important;
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 0 !important;
}
html body.preview-redesign .dictation-panel .dictation-header .audio-source-field {
  grid-column: 2 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  max-width: 150px !important;
  min-width: 0 !important;
  height: 38px !important;
  margin: 0 !important;
  padding: 0 8px !important;
  justify-self: end !important;
  box-sizing: border-box !important;
  border: 1px solid var(--line) !important;
  border-radius: 999px !important;
  background: var(--surface) !important;
  color: var(--muted) !important;
  font-size: 0 !important;
  overflow: hidden !important;
}
html body.preview-redesign .dictation-panel .dictation-header .audio-source-field select {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  min-height: 30px !important;
  height: 30px !important;
  margin: 0 !important;
  padding: 0 20px 0 8px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background-color: transparent !important;
  color: var(--ink) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  text-align: center !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
html body.preview-redesign .dictation-panel .dictation-header .dictation-context-field {
  grid-column: 3 !important;
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  max-width: 150px !important;
  min-width: 0 !important;
  height: 38px !important;
  margin: 0 !important;
  padding: 0 !important;
  justify-self: start !important;
  border: 0 !important;
  background: transparent !important;
  overflow: visible !important;
}
html body.preview-redesign .dictation-panel .dictation-header .contextual-generate-button {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  height: 38px !important;
  min-height: 38px !important;
  margin: 0 !important;
  padding: 0 8px !important;
  box-sizing: border-box !important;
  border: 1px solid var(--accent) !important;
  border-radius: 999px !important;
  background: var(--surface) !important;
  color: var(--accent-dark) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  text-align: center !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
body.dark-mode.preview-redesign .dictation-panel .dictation-header .contextual-generate-button {
  color: var(--accent) !important;
}
@media (max-width: 380px) {
  html body.preview-redesign .dictation-panel .dictation-header {
    grid-template-columns: max-content minmax(96px, 1fr) minmax(104px, 1fr) !important;
    column-gap: 5px !important;
    padding-inline: 7px !important;
  }
  html body.preview-redesign .dictation-panel .dictation-header .audio-source-field,
  html body.preview-redesign .dictation-panel .dictation-header .dictation-context-field {
    max-width: none !important;
  }
  html body.preview-redesign .dictation-panel .dictation-header .audio-source-field select,
  html body.preview-redesign .dictation-panel .dictation-header .contextual-generate-button {
    font-size: 11px !important;
  }
}

/* Prioridade máxima para o layout final: duas cápsulas, sem cápsula externa. */
html body.preview-redesign .dictation-panel .dictation-header .dictation-header-controls {
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  border-radius: 0 !important;
  padding: 0 !important;
  gap: 8px !important;
}
html body.preview-redesign .dictation-panel .dictation-header .dictation-context-field,
html body.preview-redesign .dictation-panel .dictation-header .contextual-generate-button {
  flex: 0 0 126px !important;
  width: 126px !important;
  min-width: 126px !important;
  max-width: 126px !important;
}
html body.preview-redesign .dictation-panel .dictation-header .contextual-generate-button {
  padding-inline: 7px !important;
  font-size: 12px !important;
}
@media (max-width: 480px) {
  html body.preview-redesign .dictation-panel .dictation-header .dictation-context-field,
  html body.preview-redesign .dictation-panel .dictation-header .contextual-generate-button {
    flex-basis: 116px !important;
    width: 116px !important;
    min-width: 116px !important;
    max-width: 116px !important;
  }
}

/* Última prioridade: duas cápsulas independentes no cabeçalho. */
html body.preview-redesign .dictation-panel .dictation-header > .dictation-header-controls {
  flex: 0 1 auto !important;
  width: auto !important;
  max-width: calc(100% - 58px) !important;
  gap: 8px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  overflow: visible !important;
}
html body.preview-redesign .dictation-panel .dictation-header .audio-source-field {
  flex: 0 1 142px !important;
  width: 142px !important;
  max-width: 142px !important;
  min-width: 112px !important;
  height: 38px !important;
  box-sizing: border-box !important;
  padding: 0 8px 0 10px !important;
  border: 1px solid var(--line) !important;
  border-radius: 999px !important;
  background: var(--surface) !important;
  overflow: hidden !important;
  font-size: 11px !important;
}
html body.preview-redesign .dictation-panel .dictation-header .audio-source-field select {
  flex: 1 1 auto !important;
  width: auto !important;
  max-width: 88px !important;
  min-width: 0 !important;
  min-height: 30px !important;
  height: 30px !important;
  padding: 0 15px 0 0 !important;
  border: 0 !important;
  background: transparent !important;
  font-size: 11px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
html body.preview-redesign .dictation-panel .dictation-header .dictation-context-field,
html body.preview-redesign .dictation-panel .dictation-header .contextual-generate-button {
  flex: 0 0 120px !important;
  width: 120px !important;
  min-width: 120px !important;
  max-width: 120px !important;
}
html body.preview-redesign .dictation-panel .dictation-header .dictation-context-field {
  height: 38px !important;
}
html body.preview-redesign .dictation-panel .dictation-header .contextual-generate-button {
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 8px !important;
  border: 1px solid var(--accent) !important;
  border-radius: 999px !important;
  background: var(--surface) !important;
  font-size: 12px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
@media (max-width: 480px) {
  html body.preview-redesign .dictation-panel .dictation-header > .dictation-header-controls {
    gap: 5px !important;
    max-width: calc(100% - 50px) !important;
  }
  html body.preview-redesign .dictation-panel .dictation-header .audio-source-field {
    flex-basis: 116px !important;
    width: 116px !important;
    min-width: 100px !important;
    padding-inline: 7px !important;
    font-size: 10px !important;
  }
  html body.preview-redesign .dictation-panel .dictation-header .audio-source-field select {
    max-width: 72px !important;
    font-size: 10px !important;
  }
  html body.preview-redesign .dictation-panel .dictation-header .dictation-context-field,
  html body.preview-redesign .dictation-panel .dictation-header .contextual-generate-button {
    flex-basis: 108px !important;
    width: 108px !important;
    min-width: 108px !important;
    max-width: 108px !important;
  }
  html body.preview-redesign .dictation-panel .dictation-header .contextual-generate-button {
    font-size: 11px !important;
    padding-inline: 5px !important;
  }
}

/* Remove qualquer moldura herdada do agrupador: somente as duas ações devem
   aparecer como cápsulas individuais. */
html body.preview-redesign .dictation-panel .dictation-header .dictation-header-controls,
html body.preview-redesign .dictation-panel .dictation-header > .dictation-header-controls {
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  border-radius: 0 !important;
  padding: 0 !important;
}
html body.preview-redesign .dictation-panel .dictation-header .dictation-context-field,
html body.preview-redesign .dictation-panel .dictation-header .contextual-generate-button {
  flex-basis: 126px !important;
  width: 126px !important;
  min-width: 126px !important;
  max-width: 126px !important;
}
html body.preview-redesign .dictation-panel .dictation-header .contextual-generate-button {
  padding-inline: 7px !important;
  font-size: 12px !important;
}
@media (max-width: 480px) {
  html body.preview-redesign .dictation-panel .dictation-header .dictation-context-field,
  html body.preview-redesign .dictation-panel .dictation-header .contextual-generate-button {
    flex-basis: 116px !important;
    width: 116px !important;
    min-width: 116px !important;
    max-width: 116px !important;
  }
}

/* Cada ação do cabeçalho é uma cápsula independente. */
html body.preview-redesign .dictation-panel .dictation-header > .dictation-header-controls {
  flex: 0 1 auto !important;
  width: auto !important;
  max-width: calc(100% - 58px) !important;
  gap: 8px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  overflow: visible !important;
}
html body.preview-redesign .dictation-panel .dictation-header .audio-source-field {
  display: flex !important;
  align-items: center !important;
  flex: 0 1 142px !important;
  width: 142px !important;
  max-width: 142px !important;
  min-width: 112px !important;
  height: 38px !important;
  box-sizing: border-box !important;
  padding: 0 8px 0 10px !important;
  gap: 3px !important;
  border: 1px solid var(--line) !important;
  border-radius: 999px !important;
  background: var(--surface) !important;
  overflow: hidden !important;
  font-size: 11px !important;
  white-space: nowrap !important;
}
html body.preview-redesign .dictation-panel .dictation-header .audio-source-field select {
  flex: 1 1 auto !important;
  width: auto !important;
  max-width: 88px !important;
  min-width: 0 !important;
  min-height: 30px !important;
  height: 30px !important;
  padding: 0 15px 0 0 !important;
  border: 0 !important;
  background: transparent !important;
  font-size: 11px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
html body.preview-redesign .dictation-panel .dictation-header .dictation-context-field {
  flex: 0 0 120px !important;
  width: 120px !important;
  min-width: 120px !important;
  max-width: 120px !important;
  height: 38px !important;
}
html body.preview-redesign .dictation-panel .dictation-header .contextual-generate-button {
  width: 120px !important;
  min-width: 120px !important;
  max-width: 120px !important;
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 8px !important;
  border: 1px solid var(--accent) !important;
  border-radius: 999px !important;
  background: var(--surface) !important;
  font-size: 12px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
@media (max-width: 480px) {
  html body.preview-redesign .dictation-panel .dictation-header > .dictation-header-controls {
    gap: 5px !important;
    max-width: calc(100% - 50px) !important;
  }
  html body.preview-redesign .dictation-panel .dictation-header .audio-source-field {
    flex-basis: 116px !important;
    width: 116px !important;
    min-width: 100px !important;
    padding-inline: 7px !important;
    font-size: 10px !important;
  }
  html body.preview-redesign .dictation-panel .dictation-header .audio-source-field select {
    max-width: 72px !important;
    font-size: 10px !important;
  }
  html body.preview-redesign .dictation-panel .dictation-header .dictation-context-field,
  html body.preview-redesign .dictation-panel .dictation-header .contextual-generate-button {
    flex-basis: 108px !important;
    width: 108px !important;
    min-width: 108px !important;
    max-width: 108px !important;
  }
  html body.preview-redesign .dictation-panel .dictation-header .contextual-generate-button {
    font-size: 11px !important;
    padding-inline: 5px !important;
  }
}

/* Proporções finais: o botão contextual mantém uma largura própria e o
   seletor ocupa apenas o espaço restante da cápsula. */
html body.preview-redesign .dictation-panel .dictation-header > .dictation-header-controls {
  width: min(100%, 340px) !important;
  max-width: min(100%, 340px) !important;
  flex: 0 1 340px !important;
  overflow: visible !important;
}
html body.preview-redesign .dictation-panel .dictation-header .audio-source-field {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  max-width: calc(100% - 112px) !important;
  overflow: hidden !important;
}
html body.preview-redesign .dictation-panel .dictation-header .audio-source-field select {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
html body.preview-redesign .dictation-panel .dictation-header .dictation-context-field,
html body.preview-redesign .dictation-panel .dictation-header .contextual-generate-button {
  flex: 0 0 106px !important;
  width: 106px !important;
  min-width: 106px !important;
  max-width: 106px !important;
}
html body.preview-redesign .dictation-panel .dictation-header .contextual-generate-button {
  padding-inline: 5px !important;
  font-size: 12px !important;
}
@media (max-width: 380px) {
  html body.preview-redesign .dictation-panel .dictation-header > .dictation-header-controls {
    flex: 1 1 auto !important;
    width: auto !important;
    max-width: calc(100% - 48px) !important;
  }
  html body.preview-redesign .dictation-panel .dictation-header .dictation-context-field,
  html body.preview-redesign .dictation-panel .dictation-header .contextual-generate-button {
    flex-basis: 100px !important;
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
  }
  html body.preview-redesign .dictation-panel .dictation-header .audio-source-field {
    max-width: calc(100% - 106px) !important;
  }
}

/* Override final dos botões de exportação: cápsula única e ícones limpos. */
body.preview-redesign #editorPrimaryActions {
  display: flex !important;
  flex-flow: row nowrap !important;
  align-items: center !important;
  justify-content: center !important;
  width: fit-content !important;
  max-width: calc(100% - 24px) !important;
  min-height: 56px !important;
  margin: 12px auto !important;
  padding: 6px 10px !important;
  gap: 6px !important;
  overflow: visible !important;
  border: 1px solid var(--line) !important;
  border-radius: 999px !important;
  background: var(--panel) !important;
  box-shadow: 0 8px 22px rgba(0,0,0,.24) !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button,
body.preview-redesign #editorPrimaryActions .editor-action-button:hover,
body.preview-redesign #editorPrimaryActions .editor-action-button:active,
body.preview-redesign #editorPrimaryActions .editor-action-button:focus,
body.preview-redesign #editorPrimaryActions .editor-action-button:focus-visible {
  flex: 0 0 44px !important;
  width: 44px !important;
  min-width: 44px !important;
  height: 44px !important;
  min-height: 44px !important;
  display: grid !important;
  place-items: center !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--accent-dark) !important;
  font-size: 0 !important;
}
body.preview-redesign.dark-mode #editorPrimaryActions .editor-action-button { color: var(--accent) !important; }
body.preview-redesign #editorPrimaryActions .editor-action-button svg { width: 23px !important; height: 23px !important; stroke: currentColor !important; }
body.preview-redesign #editorPrimaryActions .editor-action-button span { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; }
body.preview-redesign #editorPrimaryActions .editor-action-button:active::after,
body.preview-redesign #editorPrimaryActions .editor-action-button:focus-visible::after {
  content: attr(aria-label);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 5;
  width: max-content;
  max-width: 190px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font: 600 .68rem/1.15 system-ui, sans-serif;
  white-space: normal;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
}

/* Ações finais do editor: a mesma linguagem visual da barra flutuante.
   Os rótulos continuam disponíveis por acessibilidade e aparecem somente
   durante o toque/foco, evitando uma segunda faixa de botões com texto. */
body.preview-redesign #editorPrimaryActions {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-wrap: nowrap !important;
  width: fit-content !important;
  max-width: calc(100% - 24px) !important;
  min-height: 56px !important;
  margin: 12px auto !important;
  padding: 6px 8px !important;
  gap: 6px !important;
  overflow: visible !important;
  border: 1px solid var(--line, #2b5b53) !important;
  border-radius: 18px !important;
  background: var(--panel, #122522) !important;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .24) !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button {
  position: relative !important;
  flex: 0 0 44px !important;
  width: 44px !important;
  min-width: 44px !important;
  height: 44px !important;
  min-height: 44px !important;
  margin: 0 !important;
  padding: 0 !important;
  display: inline-grid !important;
  place-items: center !important;
  border: 0 !important;
  border-radius: 999px !important;
  outline: 0 !important;
  background: transparent !important;
  color: var(--ink, #e7f5f1) !important;
  box-shadow: none !important;
  font-size: 0 !important;
  touch-action: manipulation !important;
  -webkit-tap-highlight-color: transparent !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button:hover,
body.preview-redesign #editorPrimaryActions .editor-action-button:active,
body.preview-redesign #editorPrimaryActions .editor-action-button:focus-visible {
  background: color-mix(in srgb, var(--accent, #0f9587) 22%, transparent) !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button svg {
  width: 23px !important;
  height: 23px !important;
  margin: 0 !important;
  stroke: currentColor !important;
}
body.preview-redesign #editorPrimaryActions #pdfButton,
body.preview-redesign #editorPrimaryActions #samePatientExamButton {
  color: var(--ink, #e7f5f1) !important;
}
body.preview-redesign #editorPrimaryActions #whatsappButton { color: #25d366 !important; }
body.preview-redesign #editorPrimaryActions #emailButton { color: #9ff3e5 !important; }
body.preview-redesign #editorPrimaryActions #driveButton { color: #9ff3e5 !important; }
body.preview-redesign #editorPrimaryActions .editor-action-button span {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button:active::after,
body.preview-redesign #editorPrimaryActions .editor-action-button:focus-visible::after {
  content: attr(aria-label);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 5;
  width: max-content;
  max-width: 190px;
  padding: 5px 8px;
  border: 1px solid var(--line, #2b5b53);
  border-radius: 999px;
  background: var(--panel, #122522);
  color: var(--ink, #e7f5f1);
  box-shadow: 0 5px 14px rgba(0, 0, 0, .25);
  font: 600 .68rem/1.15 system-ui, sans-serif;
  text-align: center;
  white-space: normal;
  transform: translateX(-50%);
  pointer-events: none;
}
@media (max-width: 380px) {
  body.preview-redesign #editorPrimaryActions { gap: 3px !important; padding-inline: 5px !important; }
  body.preview-redesign #editorPrimaryActions .editor-action-button {
    flex-basis: 40px !important; width: 40px !important; min-width: 40px !important;
    height: 40px !important; min-height: 40px !important;
  }
}

/* Última camada de normalização: não permitir que o tema legado devolva
   círculos ou molduras individuais à faixa de ações. */
#editorPrimaryActions {
  box-sizing: border-box !important;
  align-items: center !important;
  justify-content: center !important;
}
#editorPrimaryActions .editor-action-button,
#editorPrimaryActions .editor-action-button:hover,
#editorPrimaryActions .editor-action-button:active,
#editorPrimaryActions .editor-action-button:focus,
#editorPrimaryActions .editor-action-button:focus-visible {
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  color: var(--accent-dark, #0f766e) !important;
}
body.dark-mode #editorPrimaryActions .editor-action-button,
body.preview-redesign.dark-mode #editorPrimaryActions .editor-action-button {
  color: var(--accent, #35c4b0) !important;
}
body.preview-redesign #editorPrimaryActions #pdfButton,
body.preview-redesign #editorPrimaryActions #samePatientExamButton,
body.preview-redesign #editorPrimaryActions #whatsappButton,
body.preview-redesign #editorPrimaryActions #emailButton,
body.preview-redesign #editorPrimaryActions #driveButton,
body.preview-redesign #editorPrimaryActions #copyReportFormattedButton {
  color: var(--accent-dark, #0f766e) !important;
}
body.preview-redesign.dark-mode #editorPrimaryActions #pdfButton,
body.preview-redesign.dark-mode #editorPrimaryActions #samePatientExamButton,
body.preview-redesign.dark-mode #editorPrimaryActions #whatsappButton,
body.preview-redesign.dark-mode #editorPrimaryActions #emailButton,
body.preview-redesign.dark-mode #editorPrimaryActions #driveButton,
body.preview-redesign.dark-mode #editorPrimaryActions #copyReportFormattedButton {
  color: var(--accent, #35c4b0) !important;
}
#editorPrimaryActions .editor-action-button svg { stroke: currentColor !important; }

/* O atributo hidden deve prevalecer na tela de lista e durante o carregamento. */
body.preview-redesign .duty-mode-floating[hidden],
body.preview-redesign .duty-mode-menu[hidden] {
  display: none !important;
  pointer-events: none !important;
}

/* Barra flutuante em formato de cápsula, inspirada nas barras compactas do
   Instagram, sem caixas individuais ao redor dos comandos. */
body.preview-redesign .duty-mode-floating {
  left: 16px !important;
  right: 16px !important;
  width: auto !important;
  justify-content: center !important;
}
body.preview-redesign .duty-mode-menu {
  gap: 2px !important;
  padding: 5px 8px !important;
  width: max-content !important;
  max-width: calc(100vw - 24px) !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  justify-content: flex-start !important;
  flex-wrap: nowrap !important;
  scrollbar-width: none;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent) !important;
  border-radius: 999px !important;
  background: rgba(17, 35, 32, .82) !important;
  background: color-mix(in srgb, var(--panel) 78%, transparent) !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .26), inset 0 1px 0 rgba(255,255,255,.08) !important;
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  backdrop-filter: blur(18px) saturate(1.25);
}
body.preview-redesign .duty-mode-menu::-webkit-scrollbar { display: none; }
body.preview-redesign .duty-mode-menu > * { flex: 0 0 auto !important; }
body.preview-redesign .duty-mode-view-toggle {
  gap: 0 !important;
  padding: 2px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
body.preview-redesign .duty-mode-view-button,
body.preview-redesign .duty-mode-action {
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}
body.preview-redesign .duty-mode-view-button {
  min-width: 42px !important;
  min-height: 40px !important;
  border-radius: 999px !important;
  color: var(--muted) !important;
}
body.preview-redesign .duty-mode-view-button.is-active {
  background: var(--accent) !important;
  color: #fff !important;
}
body.preview-redesign .duty-mode-action {
  width: 42px !important;
  height: 42px !important;
  min-height: 42px !important;
  color: var(--ink) !important;
  border-radius: 999px !important;
}
body.preview-redesign .duty-mode-action:hover,
body.preview-redesign .duty-mode-action:focus-visible {
  background: color-mix(in srgb, var(--accent) 20%, transparent) !important;
}
body.preview-redesign .duty-mode-action#dutyModeMicButton {
  color: #ec4f86 !important;
}
body.preview-redesign .duty-mode-action.is-primary {
  background: var(--accent) !important;
  color: #fff !important;
}
body.preview-redesign .duty-mode-position { display: none !important; }

/* No redesign, as setas do modo E permanecem dentro da mesma cápsula.
   Sobrescreve o posicionamento legado que as destacava em uma coluna fixa. */
body.preview-redesign.duty-mode-spaces #dutyModeRecordButton,
body.preview-redesign.duty-mode-spaces #dutyModePreviousButton {
  position: static !important;
  right: auto !important;
  bottom: auto !important;
  top: auto !important;
  transform: none !important;
  z-index: auto !important;
  display: grid !important;
}
body.preview-redesign.duty-mode-spaces .duty-mode-fab { display: none !important; }
body.preview-redesign .paragraph-record-button[hidden] {
  display: none !important;
  pointer-events: none !important;
}
/* Modais de exame anterior/modelos ocupam a tela inteira; o dock não deve
   ficar sobre os campos de importação ou captura. */
body.preview-redesign.welcome-open .duty-mode-floating {
  display: none !important;
  pointer-events: none !important;
}
/* O microfone contextual do editor fica atrás do gerenciador de máscaras;
   somente o botão de geração da máscara deve permanecer disponível. */
body.template-manager-open .paragraph-record-button,
body.template-manager-open .dictation-caret-marker,
body.template-manager-open .editor-bottom-bar {
  display: none !important;
  pointer-events: none !important;
}
body.preview-redesign.welcome-open:has(#previousReportCurrentPanel:not([hidden])) .duty-mode-floating,
body.preview-redesign.welcome-open:has(#previousReportComparisonPanel:not([hidden])) .duty-mode-floating {
  display: flex !important;
  pointer-events: auto !important;
}
body.preview-redesign.welcome-open.previous-report-text-mode .duty-mode-floating {
  display: flex !important;
  pointer-events: auto !important;
}

/* Estados explícitos da gravação no dock redesignado. */
body.preview-redesign .duty-mode-action#dutyModeMicButton.is-recording {
  background: #e11d48 !important;
  border-color: #e11d48 !important;
  color: #fff !important;
  animation: pulse 0.8s infinite;
}
body.preview-redesign .duty-mode-action#dutyModeMicButton.is-transcribing {
  background: #d97706 !important;
  border-color: #d97706 !important;
  color: #fff !important;
  animation: pulse 1s infinite;
}
body.preview-redesign:has(.duty-mode-floating:not([hidden])) .paragraph-record-button {
  display: grid !important;
  width: 38px !important;
  height: 38px !important;
  z-index: 950 !important;
}
@media(orientation:landscape) and (max-height:620px){body.preview-redesign .dictation-header{padding:4px 8px!important}body.preview-redesign .dictation-header p{display:none}body.preview-redesign .editor-bottom-bar{height:42px!important;min-height:42px!important}body.preview-redesign .duty-mode-action{width:36px!important;height:36px!important}body.preview-redesign .duty-mode-fab{width:44px!important;height:44px!important}}

/* Ajuste aprovado para teste: dock enxuto sem o raio e sem criar novo exame. */
body.preview-redesign {
  background: var(--bg) !important;
  color: var(--ink) !important;
}
body.preview-redesign .editor-screen,
body.preview-redesign .editor-screen .report-form,
body.preview-redesign .dictation-panel,
body.preview-redesign .report-editor { background: var(--bg) !important; color: var(--ink) !important; }
body.preview-redesign .dictation-header,
body.preview-redesign .editor-toolbar,
body.preview-redesign .editor-bottom-bar { background: var(--panel) !important; border-color: var(--line) !important; }
body.preview-redesign .dictation-header > div:first-child p {
  display: none !important;
}
body.preview-redesign .editor-toolbar button,
body.preview-redesign .editor-toolbar select { background: transparent !important; color: var(--ink) !important; border-color: var(--line) !important; }
body.preview-redesign .dictation-header { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; align-items: end; }
body.preview-redesign .dictation-header > div:first-child { grid-column: 1 / -1; }
body.preview-redesign .audio-source-field,
body.preview-redesign .dictation-mode-field { min-width: 0; }
body.preview-redesign .audio-source-field select,
body.preview-redesign .dictation-mode-field select { width: 100%; min-height: 38px; background: var(--surface); color: var(--ink); border-color: var(--line); }
body.preview-redesign .contextual-generate-button { width: 100%; min-height: 38px; margin-top: 6px; border-color: var(--accent); color: var(--accent-dark); background: transparent; }
body.preview-redesign .duty-mode-fab { display: none !important; }
body.preview-redesign #dutyModeSaveNewButton,
body.preview-redesign #dutyModeNewButton { display: none !important; }
body.preview-redesign .duty-mode-floating { left: 12px !important; right: 12px !important; bottom: max(10px, env(safe-area-inset-bottom)) !important; display: flex !important; justify-content: center !important; }
body.preview-redesign .duty-mode-floating { position: sticky !important; left: auto !important; right: auto !important; bottom: 8px !important; width: calc(100% - 24px) !important; margin: 8px 12px 12px !important; }
body.preview-redesign .duty-mode-menu { display: flex !important; flex-direction: row !important; align-items: center !important; justify-content: center !important; gap: 6px !important; width: auto !important; max-width: 100% !important; padding: 6px 8px !important; border-radius: 16px !important; background: var(--panel) !important; border: 1px solid var(--line) !important; box-shadow: 0 8px 22px rgba(0,0,0,.24); }
body.preview-redesign .duty-mode-floating { position: fixed !important; }
body.preview-redesign .duty-mode-position { display: none !important; }
body.preview-redesign.quick-editor-mode .duty-mode-floating { display: flex !important; }
body.preview-redesign.quick-editor-mode .duty-mode-menu { display: flex !important; }
body.preview-redesign .duty-mode-menu,
body.preview-redesign .duty-mode-action,
body.preview-redesign .duty-mode-view-button { pointer-events: auto !important; }
body.preview-redesign .duty-mode-action { width: 44px !important; height: 44px !important; min-height: 44px !important; flex: 0 0 auto; background: var(--panel) !important; border-color: var(--line) !important; color: var(--ink) !important; }
body.preview-redesign .duty-mode-action#dutyModeMicButton:not(.is-recording):not(.is-transcribing) { color: #ffffff !important; border-color: #e11d48 !important; background: #e11d48 !important; box-shadow: 0 8px 22px rgba(225, 29, 72, 0.28) !important; }
body.preview-redesign .duty-mode-action.is-primary { background: var(--accent) !important; border-color: var(--accent) !important; color: #ffffff !important; }
body.preview-redesign .editor-bottom-bar { min-height: 44px !important; height: 44px !important; padding: 3px 10px !important; }
body.preview-redesign .editor-bottom-bar .record-control { display: none !important; }
body.preview-redesign .report-editor { padding-bottom: 20px !important; }
body.preview-redesign:has(.duty-mode-floating:not([hidden])) .report-editor { padding-bottom: 20px !important; }
/* Barra realmente flutuante: afastada do rodapé e da área de navegação do iOS. */
body.preview-redesign .duty-mode-floating {
  position: fixed !important;
  left: 12px !important;
  right: 12px !important;
  bottom: var(--redesign-dock-bottom, max(86px, env(safe-area-inset-bottom) + 64px)) !important;
  width: auto !important;
  margin: 0 !important;
  z-index: 900 !important;
}
body.preview-redesign:has(.duty-mode-floating:not([hidden])) .report-editor { padding-bottom: 92px !important; }
@media (max-width: 900px) {
  body.preview-redesign .duty-mode-floating { bottom: var(--redesign-dock-bottom, max(72px, calc(env(safe-area-inset-bottom) + 56px))) !important; }
  body.preview-redesign .editor-screen > .topbar { align-items: center !important; }
  body.preview-redesign .editor-screen .topbar-actions { flex-direction: row !important; align-items: center !important; gap: 6px !important; flex-wrap: nowrap !important; }
  body.preview-redesign .editor-screen .topbar-actions .theme-toggle { order: 1; width: 36px; min-width: 36px; min-height: 36px; }
  body.preview-redesign .editor-screen .topbar-actions #backToListButton { order: 2; min-height: 36px; white-space: nowrap; }
  body.preview-redesign.quick-editor-mode .editor-screen .report-form > .quick-editor-banner { display: flex !important; flex-direction: column; align-items: stretch; gap: 8px; margin: 6px 10px; padding: 10px 12px; }
  body.preview-redesign.quick-editor-mode .quick-editor-banner h2 { font-size: 1rem; }
  body.preview-redesign.quick-editor-mode .quick-editor-banner > div:first-child > p:last-child { font-size: .78rem; }
}
@media(max-width:900px){
  body.preview-redesign .dictation-header { grid-template-columns: 1fr; gap: 5px; padding: 8px 10px !important; }
  body.preview-redesign .dictation-header > div:first-child { grid-column: auto; }
  body.preview-redesign .audio-source-field { display: block; }
  body.preview-redesign .contextual-generate-button { margin-top: 0; }
  /* Ações do laudo continuam acessíveis na prévia, em faixas compactas. */
  body.preview-redesign .editor-screen .report-form > .template-row { display: flex !important; gap: 6px; padding: 6px 10px; overflow-x: auto; border-bottom: 1px solid var(--line); background: var(--panel); }
  body.preview-redesign .template-row .template-action-button { flex: 0 0 auto; min-height: 38px; padding: 6px 10px; }
  body.preview-redesign .template-row .template-action-label { white-space: nowrap; }
  body.preview-redesign .editor-screen .report-form > #editorPrimaryActions { display: flex !important; gap: 6px; padding: 8px 10px; overflow-x: auto; background: var(--panel); border-top: 1px solid var(--line); }
  body.preview-redesign #editorPrimaryActions .editor-action-button { flex: 0 0 auto; min-height: 40px; padding: 7px 12px; }
  body.preview-redesign #editorPrimaryActions .editor-action-button span { white-space: nowrap; }
  body.preview-redesign #editorPrimaryActions .editor-action-button:nth-child(n+1) { display: inline-flex !important; }
  body.preview-redesign .editor-toolbar { gap: 3px !important; padding: 3px 6px !important; }
  body.preview-redesign .editor-toolbar button,
  body.preview-redesign .editor-toolbar select { min-height: 32px !important; height: 32px !important; min-width: 32px; padding: 3px 7px !important; font-size: .82rem; }
  body.preview-redesign .editor-toolbar .undo-report-button,
  body.preview-redesign .editor-toolbar .editor-focus-button { min-width: auto; }
  body.preview-redesign .editor-toolbar .editor-focus-button { white-space: nowrap !important; min-width: 76px !important; font-size: .78rem !important; }
}

body.preview-redesign .paragraph-record-button { white-space: nowrap; }
@media (max-width: 900px) {
  body.preview-redesign .toast {
    top: calc(env(safe-area-inset-top, 0px) + 72px);
    right: auto;
    left: 50%;
    width: min(88vw, 420px);
    text-align: center;
    transform: translateX(-50%) translateY(-120%);
  }
  body.preview-redesign .toast.visible {
    transform: translateX(-50%) translateY(0);
  }
}

/* O gravador contextual só existe quando há seleção dentro do editor. */
body.preview-redesign .paragraph-record-button[hidden] {
  display: none !important;
  visibility: hidden !important;
}
body.preview-redesign .paragraph-record-button {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  padding: 0 !important;
  border: 2px solid var(--accent) !important;
  border-radius: 50% !important;
  background: var(--panel) !important;
  color: var(--accent) !important;
  box-shadow: 0 6px 16px rgba(0,0,0,.2) !important;
}
body.preview-redesign .paragraph-record-button .record-microphone {
  width: 25px !important;
  height: 25px !important;
}

/* O seletor do dock tem uma regra posterior que pode reexibir o microfone
   contextual. Durante o gerenciador de máscaras, ele deve permanecer oculto. */
body.preview-redesign.template-manager-open .paragraph-record-button,
body.template-manager-open .paragraph-record-button {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* O microfone principal e a mensagem de classificação não ocupam mais a
   parte inferior do editor. O controle contextual reaparece ao lado do
   parágrafo selecionado e continua usando o mesmo fluxo de gravação. */
html body .dictation-panel > .editor-bottom-bar {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

html body .paragraph-record-button:not([hidden]) {
  display: grid !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

html body.template-manager-open .paragraph-record-button,
html body.preview-redesign.template-manager-open .paragraph-record-button {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Cabeçalho estável da tela cheia em ambos os sentidos do aparelho. */
body.preview-redesign.editor-focus-mode .dictation-panel .dictation-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 300 !important;
  padding-top: max(4px, env(safe-area-inset-top)) !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 700px) and (orientation: portrait) {
  body.preview-redesign.editor-focus-mode .dictation-panel .dictation-header {
    flex-wrap: wrap !important;
    align-content: center !important;
    min-height: 70px !important;
    height: auto !important;
    row-gap: 4px !important;
  }
  body.preview-redesign.editor-focus-mode .dictation-panel .dictation-mode-field {
    flex: 1 1 100% !important;
    margin-left: 0 !important;
    overflow-x: auto !important;
    justify-content: flex-start !important;
  }
}
@media (orientation: landscape) and (max-height: 620px) {
  body.preview-redesign.editor-focus-mode .dictation-panel .dictation-header {
    min-height: 42px !important;
    height: 42px !important;
    padding-top: 2px !important;
  }
}
body.preview-redesign.dark-mode .paragraph-record-button,
body.dark-mode.preview-redesign .paragraph-record-button {
  background: var(--panel) !important;
  color: #9ff3e5 !important;
  border-color: #9ff3e5 !important;
}

/* O microfone contextual espelha o controle flutuante: círculo compacto,
   ícone rosa em repouso e pulso durante gravação/transcrição. */
html body.preview-redesign .paragraph-record-button,
html body.preview-redesign .paragraph-record-button:hover,
html body.preview-redesign .paragraph-record-button:focus-visible {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  min-height: 42px !important;
  border: 2px solid rgba(225, 29, 72, 0.42) !important;
  border-radius: 50% !important;
  background: var(--panel) !important;
  color: #e11d48 !important;
  box-shadow: 0 8px 20px rgba(119, 25, 50, 0.2) !important;
}
html body.preview-redesign .paragraph-record-button .record-microphone {
  width: 25px !important;
  height: 25px !important;
  stroke: #e11d48 !important;
  fill: none !important;
  filter: drop-shadow(0 2px 3px rgba(225, 29, 72, 0.18)) !important;
}
html body.preview-redesign .paragraph-record-button .record-microphone rect {
  fill: rgba(225, 29, 72, 0.06) !important;
}
html body.preview-redesign .paragraph-record-button.recording,
html body.preview-redesign .paragraph-record-button.transcribing {
  border-color: #e11d48 !important;
  background: #e11d48 !important;
  color: #fff !important;
  animation: pulse 0.8s infinite;
}
html body.preview-redesign .paragraph-record-button.transcribing {
  border-color: #d97706 !important;
  background: #d97706 !important;
  animation-duration: 1s;
}
html body.preview-redesign .paragraph-record-button.recording .record-microphone,
html body.preview-redesign .paragraph-record-button.transcribing .record-microphone {
  stroke: #fff !important;
  filter: none !important;
}
html body.preview-redesign .paragraph-record-button.recording .record-microphone rect,
html body.preview-redesign .paragraph-record-button.transcribing .record-microphone rect {
  fill: rgba(255, 255, 255, 0.12) !important;
}
html body.dark-mode.preview-redesign .paragraph-record-button:not(.recording):not(.transcribing) {
  border-color: rgba(255, 122, 138, 0.72) !important;
  background: var(--panel) !important;
}

/* Camada de interação do editor: nenhum painel rolável deve capturar os toques. */
body.preview-redesign .duty-mode-floating,
body.preview-redesign .duty-mode-menu {
  pointer-events: auto !important;
  isolation: isolate;
  z-index: 2147483000 !important;
}
body.preview-redesign .duty-mode-floating button,
body.preview-redesign .duty-mode-floating [role="button"] {
  pointer-events: auto !important;
  touch-action: manipulation !important;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Overrides finais da faixa de ações do editor. */
body.preview-redesign #editorPrimaryActions { display:flex !important; flex-flow:row nowrap !important; align-items:center !important; justify-content:center !important; width:fit-content !important; max-width:calc(100% - 24px) !important; min-height:56px !important; margin:12px auto !important; padding:6px 10px !important; gap:6px !important; overflow:visible !important; border:1px solid var(--line) !important; border-radius:999px !important; background:var(--panel) !important; box-shadow:0 8px 22px rgba(0,0,0,.24) !important; }
body.preview-redesign #editorPrimaryActions .editor-action-button,
body.preview-redesign #editorPrimaryActions .editor-action-button:hover,
body.preview-redesign #editorPrimaryActions .editor-action-button:active,
body.preview-redesign #editorPrimaryActions .editor-action-button:focus,
body.preview-redesign #editorPrimaryActions .editor-action-button:focus-visible { flex:0 0 44px !important; width:44px !important; min-width:44px !important; height:44px !important; min-height:44px !important; display:grid !important; place-items:center !important; padding:0 !important; border:0 !important; border-radius:0 !important; background:transparent !important; box-shadow:none !important; color:var(--accent-dark) !important; font-size:0 !important; }
body.preview-redesign.dark-mode #editorPrimaryActions .editor-action-button { color:var(--accent) !important; }
body.preview-redesign #editorPrimaryActions .editor-action-button svg { width:23px !important; height:23px !important; stroke:currentColor !important; }
body.preview-redesign #editorPrimaryActions .editor-action-button span { position:absolute !important; width:1px !important; height:1px !important; overflow:hidden !important; clip:rect(0 0 0 0) !important; }
body.preview-redesign #editorPrimaryActions .editor-action-button:active::after,
body.preview-redesign #editorPrimaryActions .editor-action-button:focus-visible::after { content:attr(aria-label); position:absolute; left:50%; bottom:calc(100% + 8px); z-index:5; width:max-content; max-width:190px; padding:5px 8px; border:1px solid var(--line); border-radius:999px; background:var(--panel); color:var(--ink); font:600 .68rem/1.15 system-ui,sans-serif; white-space:normal; text-align:center; transform:translateX(-50%); pointer-events:none; }

/* Barra de ações logo acima do dock P/E, conforme a referência enviada. */
body.preview-redesign #editorPrimaryActions {
  display:flex !important; align-items:center !important; justify-content:center !important;
  width:fit-content !important; max-width:calc(100% - 56px) !important; min-height:74px !important;
  margin:14px auto !important; padding:8px 10px !important; gap:0 !important; overflow:visible !important;
  border:0 !important; border-radius:999px !important; background:#fff !important;
  box-shadow:0 8px 20px rgba(27,55,50,.14) !important;
}
body.preview-redesign.dark-mode #editorPrimaryActions { background:var(--panel) !important; box-shadow:0 8px 20px rgba(0,0,0,.26) !important; }
body.preview-redesign #editorPrimaryActions .editor-action-button,
body.preview-redesign #editorPrimaryActions .editor-action-button:hover,
body.preview-redesign #editorPrimaryActions .editor-action-button:active,
body.preview-redesign #editorPrimaryActions .editor-action-button:focus,
body.preview-redesign #editorPrimaryActions .editor-action-button:focus-visible {
  position:relative !important; flex:0 0 58px !important; width:58px !important; min-width:58px !important;
  height:56px !important; min-height:56px !important; display:grid !important; place-items:center !important;
  padding:0 !important; border:0 !important; border-left:1px solid #dbe5e2 !important; border-radius:0 !important;
  background:transparent !important; box-shadow:none !important; color:#176e66 !important; font-size:0 !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button:first-child { border-left:0 !important; }
body.preview-redesign.dark-mode #editorPrimaryActions .editor-action-button { color:#8de8db !important; border-left-color:var(--line) !important; }
body.preview-redesign #editorPrimaryActions .editor-action-button svg { width:25px !important; height:25px !important; stroke:currentColor !important; }
body.preview-redesign #editorPrimaryActions .editor-action-button span { position:absolute !important; width:1px !important; height:1px !important; overflow:hidden !important; clip:rect(0 0 0 0) !important; }
body.preview-redesign #editorPrimaryActions .editor-action-button:active::after,
body.preview-redesign #editorPrimaryActions .editor-action-button:focus-visible::after {
  content:attr(aria-label); position:absolute; left:50%; bottom:calc(100% + 8px); z-index:5; width:max-content; max-width:180px;
  padding:5px 8px; border:1px solid #c8d9d5; border-radius:999px; background:#fff; color:#176e66;
  font:600 .68rem/1.15 system-ui,sans-serif; white-space:normal; text-align:center; transform:translateX(-50%); pointer-events:none;
}
body.preview-redesign.dark-mode #editorPrimaryActions .editor-action-button:active::after,
body.preview-redesign.dark-mode #editorPrimaryActions .editor-action-button:focus-visible::after { border-color:var(--line); background:var(--panel); color:var(--ink); }
@media (max-width:500px) {
  body.preview-redesign #editorPrimaryActions { max-width:calc(100% - 28px) !important; min-height:64px !important; padding:6px 7px !important; }
  body.preview-redesign #editorPrimaryActions .editor-action-button { flex-basis:50px !important; width:50px !important; min-width:50px !important; height:50px !important; min-height:50px !important; }
  body.preview-redesign #editorPrimaryActions .editor-action-button svg { width:22px !important; height:22px !important; }
}

/* Correção final de alinhamento e do glifo WhatsApp. */
body.preview-redesign #editorPrimaryActions {
  width:calc(100% - 32px) !important;
  max-width:none !important;
  margin-left:16px !important;
  margin-right:16px !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button svg {
  width:28px !important;
  height:28px !important;
  fill:none !important;
}
body.preview-redesign #editorPrimaryActions #whatsappButton svg {
  width:39px !important;
  height:39px !important;
  fill:currentColor !important;
  stroke:none !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button:not(:first-child)::before {
  top:10px !important;
  height:36px !important;
}

/* Barra de formatação no mesmo padrão da referência: cápsula, divisórias
   sutis e controles centrados, sem caixas soltas. */
body.preview-redesign .editor-toolbar {
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  flex-wrap:nowrap !important;
  width:fit-content !important;
  max-width:calc(100% - 24px) !important;
  min-height:56px !important;
  margin:10px auto !important;
  padding:5px 8px !important;
  gap:0 !important;
  overflow:visible !important;
  border:1px solid var(--line) !important;
  border-radius:999px !important;
  background:var(--panel) !important;
  box-shadow:0 8px 22px rgba(0,0,0,.18) !important;
}
body.preview-redesign .editor-toolbar > button,
body.preview-redesign .editor-toolbar .text-format-tools > button,
body.preview-redesign .editor-toolbar .font-size-control {
  flex:0 0 52px !important;
  width:52px !important;
  min-width:52px !important;
  height:44px !important;
  min-height:44px !important;
  display:grid !important;
  place-items:center !important;
  margin:0 !important;
  padding:0 !important;
  border:0 !important;
  border-left:1px solid color-mix(in srgb, var(--line) 58%, transparent) !important;
  border-radius:0 !important;
  background:transparent !important;
  color:var(--accent-dark) !important;
  box-shadow:none !important;
  font-size:1.2rem !important;
}
body.preview-redesign .editor-toolbar > button:first-child { border-left:0 !important; }
body.preview-redesign .editor-toolbar .text-format-tools { display:flex !important; align-items:center !important; gap:0 !important; }
body.preview-redesign .editor-toolbar .text-format-tools > button:first-child { border-left:1px solid color-mix(in srgb, var(--line) 58%, transparent) !important; }
body.preview-redesign .editor-toolbar .editor-focus-button { font-size:0 !important; }
body.preview-redesign .editor-toolbar .editor-focus-button::before { content:"Tₜ"; font-size:1.15rem; font-weight:600; }
body.preview-redesign .editor-toolbar .editor-close-button { font-size:0 !important; }
body.preview-redesign .editor-toolbar .editor-close-button::before { content:"✓"; font-size:1.25rem; }
body.preview-redesign .editor-toolbar .format-button strong,
body.preview-redesign .editor-toolbar .format-button em,
body.preview-redesign .editor-toolbar .format-button u { font-size:1.15rem !important; color:inherit !important; }
body.preview-redesign .editor-toolbar .format-button svg { width:22px !important; height:22px !important; stroke:currentColor !important; }
body.preview-redesign .editor-toolbar .font-size-control { display:none !important; }
body.preview-redesign.dark-mode .editor-toolbar > button,
body.preview-redesign.dark-mode .editor-toolbar .text-format-tools > button { color:var(--accent) !important; }

/* Proporção final da referência: a cápsula de ações fica menor que o dock
   P/E, sempre centralizada no mesmo eixo. */
body.preview-redesign #editorPrimaryActions {
  width:min(472px, 82vw) !important;
  max-width:none !important;
  margin-left:auto !important;
  margin-right:auto !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button {
  flex:1 1 0 !important;
  min-width:0 !important;
}

/* Réplica fiel da cápsula de ações da referência enviada. */
body.preview-redesign #editorPrimaryActions {
  width:min(472px, 82vw) !important;
  max-width:none !important;
  height:74px !important;
  min-height:74px !important;
  padding:9px 8px !important;
  border-radius:37px !important;
  gap:0 !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button {
  flex:1 1 0 !important;
  width:auto !important;
  min-width:0 !important;
  height:56px !important;
  min-height:56px !important;
  border-left:0 !important;
  color:#176e66 !important;
}
body.preview-redesign.dark-mode #editorPrimaryActions .editor-action-button { color:#8de8db !important; }
body.preview-redesign #editorPrimaryActions .editor-action-button:not(:first-child)::before {
  content:"";
  position:absolute;
  left:0;
  top:9px;
  width:1px;
  height:38px;
  background:#dbe5e2;
}
body.preview-redesign.dark-mode #editorPrimaryActions .editor-action-button:not(:first-child)::before { background:var(--line); }
body.preview-redesign #editorPrimaryActions .editor-action-button svg { width:25px !important; height:25px !important; }
@media (max-width:500px) {
  body.preview-redesign #editorPrimaryActions { width:82vw !important; max-width:none !important; height:66px !important; min-height:66px !important; border-radius:33px !important; padding:7px 6px !important; }
  body.preview-redesign #editorPrimaryActions .editor-action-button { height:52px !important; min-height:52px !important; }
  body.preview-redesign #editorPrimaryActions .editor-action-button:not(:first-child)::before { top:8px; height:36px; }
}

/* Normalização móvel definitiva: nenhuma barra pode ampliar ou deslocar a
   largura da página. A rolagem dos controles extras acontece dentro da
   própria cápsula, mantendo os comandos clicáveis. */
body.preview-redesign .dictation-panel,
body.preview-redesign .report-form,
body.preview-redesign .report-editor {
  min-width:0 !important;
  max-width:100% !important;
  overflow-x:hidden !important;
}
body.preview-redesign .editor-toolbar {
  box-sizing:border-box !important;
  width:calc(100% - 32px) !important;
  max-width:calc(100% - 32px) !important;
  margin:10px 16px !important;
  justify-content:flex-start !important;
  overflow-x:auto !important;
  overflow-y:hidden !important;
  overscroll-behavior-x:contain;
  -webkit-overflow-scrolling:touch;
  touch-action:pan-x !important;
  scrollbar-width:none;
}
body.preview-redesign .editor-toolbar::-webkit-scrollbar { display:none; }
body.preview-redesign .editor-toolbar button,
body.preview-redesign .editor-toolbar select,
body.preview-redesign .editor-toolbar .text-format-tools {
  pointer-events:auto !important;
  touch-action:manipulation !important;
}
body.preview-redesign #editorPrimaryActions {
  box-sizing:border-box !important;
  width:calc(100% - 32px) !important;
  max-width:calc(100% - 32px) !important;
  margin:14px 16px !important;
  overflow:visible !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button {
  flex:1 1 0 !important;
  width:auto !important;
  min-width:0 !important;
  pointer-events:auto !important;
  touch-action:manipulation !important;
}
body.preview-redesign #editorPrimaryActions #whatsappButton svg {
  width:34px !important;
  height:34px !important;
  fill:currentColor !important;
  stroke:none !important;
}
body.preview-redesign #editorPrimaryActions #whatsappButton svg path {
  fill:currentColor !important;
  stroke:none !important;
}

/* Composição final da barra de referência: seis colunas idênticas dentro de
   uma cápsula de 470 px, com divisórias finas e ícones sem moldura. */
body.preview-redesign #editorPrimaryActions {
  box-sizing:border-box !important;
  width:min(470px, calc(100vw - 48px)) !important;
  max-width:calc(100vw - 48px) !important;
  height:74px !important;
  min-height:74px !important;
  margin:14px auto !important;
  padding:9px 6px !important;
  gap:0 !important;
  border:0 !important;
  border-radius:37px !important;
  background:#fff !important;
  box-shadow:0 8px 20px rgba(27,55,50,.14) !important;
}
body.preview-redesign.dark-mode #editorPrimaryActions {
  background:var(--panel) !important;
  box-shadow:0 8px 20px rgba(0,0,0,.26) !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button {
  flex:1 1 0 !important;
  width:auto !important;
  min-width:0 !important;
  height:56px !important;
  min-height:56px !important;
  border:0 !important;
  border-radius:0 !important;
  background:transparent !important;
  color:#176e66 !important;
}
body.preview-redesign.dark-mode #editorPrimaryActions .editor-action-button { color:#8de8db !important; }
body.preview-redesign #editorPrimaryActions .editor-action-button:not(:first-child)::before {
  top:10px !important;
  height:36px !important;
  background:#d9e4e1 !important;
}
body.preview-redesign.dark-mode #editorPrimaryActions .editor-action-button:not(:first-child)::before { background:var(--line) !important; }
body.preview-redesign #editorPrimaryActions .editor-action-button svg { width:29px !important; height:29px !important; }
body.preview-redesign #editorPrimaryActions #whatsappButton svg { width:38px !important; height:38px !important; fill:currentColor !important; stroke:none !important; }
body.preview-redesign #editorPrimaryActions .editor-action-button:hover,
body.preview-redesign #editorPrimaryActions .editor-action-button:active,
body.preview-redesign #editorPrimaryActions .editor-action-button:focus-visible { background:transparent !important; }
@media (max-width:500px) {
  body.preview-redesign #editorPrimaryActions { width:calc(100vw - 48px) !important; max-width:calc(100vw - 48px) !important; }
}

/* Tela cheia: mantenha cabeçalho, formatação, editor e gravação em faixas
   independentes. O cabeçalho do redesign pode ocupar duas linhas; nunca o
   comprima a 38px, pois isso fazia os campos de microfone invadirem a barra. */
body.preview-redesign.editor-focus-mode .dictation-panel {
  display: flex !important;
  flex-direction: column !important;
  height: 100dvh !important;
  min-height: 0 !important;
  overflow: hidden !important;
}
body.preview-redesign.editor-focus-mode .dictation-panel .dictation-header {
  flex: 0 0 auto !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  align-items: end !important;
  height: auto !important;
  min-height: 76px !important;
  max-height: 150px !important;
  padding: 8px 12px !important;
  gap: 6px 10px !important;
  overflow: visible !important;
}
body.preview-redesign.editor-focus-mode .dictation-panel .editor-toolbar {
  flex: 0 0 56px !important;
  width: calc(100% - 32px) !important;
  height: 56px !important;
  min-height: 56px !important;
  margin: 8px 16px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
}
body.preview-redesign.editor-focus-mode .dictation-panel .report-editor {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  padding: 12px 14px 18px !important;
}
body.preview-redesign.editor-focus-mode .dictation-panel .editor-bottom-bar {
  position: relative !important;
  inset: auto !important;
  flex: 0 0 66px !important;
  height: 66px !important;
  min-height: 66px !important;
  padding: 6px 10px max(8px, env(safe-area-inset-bottom)) !important;
  overflow: visible !important;
}
@media (max-width: 700px) {
  body.preview-redesign.editor-focus-mode .dictation-panel .dictation-header {
    grid-template-columns: 1fr !important;
    min-height: 116px !important;
    max-height: 180px !important;
    align-items: stretch !important;
    gap: 4px !important;
  }
  body.preview-redesign.editor-focus-mode .dictation-panel .dictation-header > div:first-child {
    grid-column: auto !important;
  }
  body.preview-redesign.editor-focus-mode .dictation-panel .editor-toolbar {
    flex-basis: 52px !important;
    height: 52px !important;
    min-height: 52px !important;
    margin-top: 6px !important;
    margin-bottom: 6px !important;
  }
}

/* Ajuste proporcional final da cápsula de exportação. */
body.preview-redesign #editorPrimaryActions {
  width:min(990px, 80vw) !important;
  max-width:min(990px, 80vw) !important;
  height:50px !important;
  min-height:50px !important;
  padding:5px 6px !important;
  border-radius:25px !important;
  margin:14px auto !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button {
  height:40px !important;
  min-height:40px !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button:not(:first-child)::before {
  top:6px !important;
  height:28px !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button svg { width:22px !important; height:22px !important; }
body.preview-redesign #editorPrimaryActions #whatsappButton svg { width:30px !important; height:30px !important; }
@media (max-width:500px) {
  body.preview-redesign #editorPrimaryActions { width:80vw !important; max-width:80vw !important; height:50px !important; min-height:50px !important; border-radius:25px !important; }
}

/* Todos os glifos ocupam a mesma caixa e o mesmo centro óptico. */
body.preview-redesign #editorPrimaryActions .editor-action-button {
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button svg,
body.preview-redesign #editorPrimaryActions #whatsappButton svg {
  width:22px !important;
  height:22px !important;
  margin:0 auto !important;
}

/* Recorte rígido da cápsula para manter divisórias e ícones dentro da
   moldura em qualquer nível de zoom. */
body.preview-redesign #editorPrimaryActions {
  overflow:hidden !important;
  contain:paint !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button svg {
  position:relative !important;
  z-index:2 !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button:not(:first-child)::before {
  z-index:1 !important;
  pointer-events:none !important;
}

/* O documento continua navegável com pinça e arrasto; os limites ficam
   restritos aos componentes internos. */
html:has(body.preview-redesign),
body.preview-redesign {
  overflow-x:auto !important;
  max-width:none !important;
  touch-action:pan-x pan-y pinch-zoom !important;
}
body.preview-redesign #editorPrimaryActions {
  contain:none !important;
  overflow:visible !important;
}
body.preview-redesign .editor-toolbar { touch-action:pan-x pan-y pinch-zoom !important; }

/* OVERRIDE DEFINITIVO — deve permanecer por último para vencer as regras
   históricas do redesign. Escopo restrito às faixas superiores/editor. */
body.preview-redesign #editorPrimaryActions {
  display:grid !important;
  grid-template-columns:repeat(6, minmax(0, 1fr)) !important;
  grid-template-rows:1fr !important;
  grid-auto-flow:column !important;
  flex-wrap:nowrap !important;
  width:min(620px, calc(100% - 24px)) !important;
  max-width:calc(100% - 24px) !important;
  height:64px !important;
  min-height:64px !important;
  margin:12px auto !important;
  padding:6px 8px !important;
  gap:0 !important;
  overflow:hidden !important;
  box-sizing:border-box !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button {
  grid-row:1 !important;
  display:grid !important;
  place-items:center !important;
  width:100% !important;
  min-width:0 !important;
  height:52px !important;
  min-height:52px !important;
  padding:0 !important;
  border:0 !important;
  border-radius:0 !important;
  background:transparent !important;
  box-shadow:none !important;
  transform:none !important;
  transition:none !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button:not(:first-child)::before {
  content:"" !important;
  position:absolute !important;
  left:0 !important;
  top:9px !important;
  width:1px !important;
  height:34px !important;
  background:var(--line) !important;
}
body.preview-redesign #editorPrimaryActions #copyReportFormattedButton::before,
body.preview-redesign #editorPrimaryActions #copyReportFormattedButton::after {
  display:none !important;
  content:none !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button > svg {
  position:static !important;
  display:block !important;
  width:24px !important;
  height:24px !important;
  margin:0 !important;
  transform:none !important;
  stroke:currentColor !important;
}
body.preview-redesign #editorPrimaryActions #whatsappButton > svg {
  width:24px !important;
  height:24px !important;
  fill:currentColor !important;
  stroke:none !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button > span {
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  overflow:hidden !important;
  clip:rect(0 0 0 0) !important;
  white-space:nowrap !important;
}

body.preview-redesign .editor-screen .report-form > .template-row {
  display:grid !important;
  grid-template-columns:repeat(auto-fit, minmax(180px, 1fr)) !important;
  grid-auto-flow:row !important;
  width:100% !important;
  max-width:100% !important;
  box-sizing:border-box !important;
  overflow:hidden !important;
}
body.preview-redesign .editor-screen .report-form > .template-row .template-action-button {
  width:100% !important;
  min-width:0 !important;
  max-width:100% !important;
  box-sizing:border-box !important;
  white-space:normal !important;
  word-break:normal !important;
  overflow-wrap:normal !important;
  hyphens:none !important;
  line-height:1.15 !important;
  text-align:center !important;
}

body.preview-redesign .dictation-header .audio-source-field {
  justify-self:end !important;
  width:min(360px, 100%) !important;
  max-width:100% !important;
  min-width:0 !important;
}
body.preview-redesign .dictation-header .audio-source-field select {
  width:100% !important;
  max-width:100% !important;
  min-width:0 !important;
  box-sizing:border-box !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
  white-space:nowrap !important;
}
body.preview-redesign .editor-toolbar .undo-report-button {
  flex:0 0 44px !important;
  width:44px !important;
  min-width:44px !important;
  height:38px !important;
  min-height:38px !important;
  display:grid !important;
  place-items:center !important;
  padding:0 !important;
  overflow:hidden !important;
}
body.preview-redesign .editor-toolbar .undo-report-button > span {
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  overflow:hidden !important;
  clip:rect(0 0 0 0) !important;
}
body.preview-redesign .report-editor {
  width:100% !important;
  max-width:100% !important;
  min-width:0 !important;
  box-sizing:border-box !important;
  white-space:pre-wrap !important;
  overflow-wrap:break-word !important;
  word-break:normal !important;
  overflow-x:hidden !important;
}
@media (max-width:700px) {
  body.preview-redesign .dictation-header .audio-source-field {
    justify-self:stretch !important;
    width:100% !important;
  }
  body.preview-redesign .editor-screen .report-form > .template-row {
    grid-template-columns:repeat(2, minmax(0, 1fr)) !important;
  }
}

/* No Editor rápido, o aviso ocupa a largura do cabeçalho para não quebrar
   palavra por palavra ao lado do seletor de microfone. */
@media (max-width: 700px) {
  body.preview-redesign.quick-editor-mode .dictation-header {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas: "title" "audio" "mode" !important;
    gap: 6px !important;
    min-height: 0 !important;
    padding: 8px 10px !important;
  }
  body.preview-redesign.quick-editor-mode .dictation-header > div:first-child {
    grid-area: title !important;
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) !important;
    align-items: baseline !important;
    gap: 4px 10px !important;
    min-width: 0 !important;
  }
  body.preview-redesign.quick-editor-mode .dictation-header > div:first-child h2 {
    grid-column: 1 !important;
    margin: 0 !important;
    white-space: nowrap !important;
  }
  body.preview-redesign.quick-editor-mode .dictation-header > div:first-child p {
    grid-column: 2 !important;
    min-width: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: .78rem !important;
  }
  body.preview-redesign.quick-editor-mode .dictation-header .audio-source-field { grid-area: audio !important; }
  body.preview-redesign.quick-editor-mode .dictation-header .dictation-mode-field { grid-area: mode !important; }
}

/* Barra compacta de captura: microfone e contexto compartilham uma única
   cápsula, sem deixar o botão contextual ocupar metade do cabeçalho. */
body.preview-redesign .dictation-header {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 10px !important;
}
body.preview-redesign .dictation-header > div:first-child {
  display: block !important;
  width: auto !important;
}
body.preview-redesign .dictation-header > div:first-child p {
  display: none !important;
}
body.preview-redesign .dictation-header-controls {
  display: flex !important;
  align-items: stretch !important;
  gap: 0 !important;
  width: min(100%, 720px) !important;
  margin: 0 auto !important;
  padding: 5px !important;
  border: 1px solid var(--line) !important;
  border-radius: 999px !important;
  background: var(--surface) !important;
  box-sizing: border-box !important;
}
body.preview-redesign .dictation-header-controls .audio-source-field {
  flex: 1 1 auto !important;
  width: auto !important;
  max-width: none !important;
  min-width: 0 !important;
  padding: 0 12px !important;
  justify-content: center !important;
  border: 0 !important;
  color: var(--muted) !important;
}
body.preview-redesign .dictation-header-controls .audio-source-field select {
  width: 100% !important;
  min-height: 38px !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--ink) !important;
}
body.preview-redesign .dictation-header-controls .dictation-mode-field {
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}
body.preview-redesign .dictation-header-controls .contextual-generate-button {
  width: auto !important;
  min-height: 38px !important;
  padding: 6px 18px !important;
  border-radius: 999px !important;
  white-space: nowrap !important;
}
@media (max-width: 700px) {
  body.preview-redesign .dictation-header { padding: 8px 10px !important; }
  body.preview-redesign .dictation-header-controls { width: 100% !important; }
  body.preview-redesign .dictation-header-controls .audio-source-field { padding: 0 6px !important; }
  body.preview-redesign .dictation-header-controls .audio-source-field > select { font-size: .86rem !important; }
  body.preview-redesign .dictation-header-controls .contextual-generate-button { padding: 6px 12px !important; font-size: .82rem !important; }
}

/* Atalhos inferiores da lista: cartões contornados com ícone, descrição e
   chevron em uma coluna própria, como no fluxo móvel de referência. */
.list-bottom-actions .list-bottom-action-button,
.list-bottom-actions .list-bottom-auto-draft-button,
.feedback-panel .feedback-open-button {
  display: grid !important;
  grid-template-columns: 40px minmax(0, 1fr) 24px !important;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 72px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
  text-align: left;
}
.list-bottom-actions .list-bottom-action-button::after { content: none; }
.list-bottom-actions .list-bottom-action-button > svg:first-child,
.list-bottom-actions .list-bottom-auto-draft-button > svg:first-child,
.feedback-panel .feedback-open-button > svg:first-child {
  grid-column: 1;
  grid-row: 1;
  justify-self: center;
  width: 30px;
  height: 30px;
  min-height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.list-bottom-actions .list-bottom-new-symbol {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-height: 36px;
  border-radius: 50%;
  background: #dff6ef;
  color: var(--accent-dark);
}
.list-bottom-actions .list-bottom-new-symbol svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}
.list-bottom-actions .list-bottom-action-copy,
.feedback-panel .list-bottom-action-copy {
  display: grid;
  grid-column: 2;
  grid-row: 1;
  gap: 2px;
  min-width: 0;
  text-align: left;
}
.list-bottom-actions .list-bottom-action-copy strong,
.feedback-panel .list-bottom-action-copy strong {
  color: currentColor;
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.2;
}
.list-bottom-actions .list-bottom-action-copy small,
.feedback-panel .list-bottom-action-copy small {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 500;
  line-height: 1.2;
}
.list-bottom-actions .list-bottom-action-chevron,
.feedback-panel .list-bottom-action-chevron {
  grid-column: 3 !important;
  grid-row: 1 !important;
  justify-self: end !important;
  width: 24px !important;
  height: 24px !important;
  min-height: 24px !important;
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 1.8 !important;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .8;
}
.list-bottom-actions .list-bottom-action-button:hover,
.list-bottom-actions .list-bottom-action-button:focus-visible,
.feedback-panel .feedback-open-button:hover,
.feedback-panel .feedback-open-button:focus-visible {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  color: var(--accent-dark);
}
.list-bottom-actions .list-bottom-auto-draft-button {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: #e7f8f2;
  color: var(--accent-dark);
}
.list-bottom-actions .list-bottom-auto-draft-button > svg:first-child {
  width: 30px;
  height: 30px;
}
.list-bottom-actions .list-bottom-auto-draft-button .list-bottom-auto-draft-copy {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  gap: 2px;
  min-width: 0;
}
.list-bottom-actions .list-bottom-auto-draft-button .list-bottom-action-chevron { grid-column: 3; }
.feedback-panel .feedback-open-button { min-height: 72px; }
body.dark-mode .list-bottom-actions .list-bottom-action-button,
body.dark-mode .list-bottom-actions .list-bottom-auto-draft-button,
body.dark-mode .feedback-panel .feedback-open-button {
  border-color: #3a514b;
  background: #192321;
  color: #f4faf7;
}
body.dark-mode .list-bottom-actions .list-bottom-action-button:hover,
body.dark-mode .list-bottom-actions .list-bottom-action-button:focus-visible,
body.dark-mode .feedback-panel .feedback-open-button:hover,
body.dark-mode .feedback-panel .feedback-open-button:focus-visible {
  border-color: #65cfc0;
  background: #21332f;
  color: #c7fff6;
}
body.dark-mode .list-bottom-actions .list-bottom-action-copy small,
body.dark-mode .feedback-panel .list-bottom-action-copy small { color: #b7c9c4; }
body.dark-mode .list-bottom-actions .list-bottom-new-symbol { background: #24534d; color: #a9f4e6; }
body.dark-mode .list-bottom-actions .list-bottom-auto-draft-button { border-color: #42786f; background: #173e3a; color: #c7fff6; }

/* Último override do dock: garante que o conjunto completo caiba no celular. */
@media (max-width: 900px) {
  body.preview-redesign .duty-mode-menu {
    gap: 2px !important;
    padding: 4px 6px !important;
  }
  body.preview-redesign .duty-mode-action {
    width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
  }
  body.preview-redesign .duty-mode-action .duty-mode-action-icon {
    width: 20px !important;
    height: 20px !important;
  }
  body.preview-redesign .duty-mode-action .duty-mode-new-paragraph-icon {
    width: 18px !important;
    height: 18px !important;
  }
}

/* Correção final das duas faixas superiores do editor (compartilhamento e
   ferramentas de texto). Nenhuma regra abaixo deste bloco alcança a barra
   fixa P/E, setas ou salvar. */
body.preview-redesign #editorPrimaryActions {
  display:grid !important;
  grid-template-columns:repeat(6, minmax(0, 1fr)) !important;
  align-items:center !important;
  width:min(620px, calc(100% - 24px)) !important;
  max-width:calc(100% - 24px) !important;
  min-height:64px !important;
  height:64px !important;
  margin:12px auto !important;
  padding:6px 8px !important;
  gap:0 !important;
  overflow:hidden !important;
  box-sizing:border-box !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button {
  position:relative !important;
  display:grid !important;
  place-items:center !important;
  width:100% !important;
  min-width:0 !important;
  height:52px !important;
  min-height:52px !important;
  padding:0 !important;
  border:0 !important;
  border-radius:0 !important;
  background:transparent !important;
  box-shadow:none !important;
  overflow:visible !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button:not(:first-child)::before {
  content:"" !important;
  position:absolute !important;
  left:0 !important;
  top:9px !important;
  width:1px !important;
  height:34px !important;
  background:var(--line) !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button > svg {
  position:static !important;
  width:24px !important;
  height:24px !important;
  margin:0 !important;
  transform:none !important;
  stroke:currentColor !important;
}
body.preview-redesign #editorPrimaryActions #whatsappButton > svg {
  width:25px !important;
  height:25px !important;
  fill:currentColor !important;
  stroke:none !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button > span {
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  overflow:hidden !important;
  clip:rect(0 0 0 0) !important;
  white-space:nowrap !important;
}

body.preview-redesign .editor-toolbar .undo-report-button {
  flex:0 0 44px !important;
  width:44px !important;
  min-width:44px !important;
  height:38px !important;
  min-height:38px !important;
  display:grid !important;
  place-items:center !important;
  padding:0 !important;
  overflow:hidden !important;
}
body.preview-redesign .editor-toolbar .undo-report-button svg {
  width:21px !important;
  height:21px !important;
  margin:0 !important;
}
body.preview-redesign .editor-toolbar .undo-report-button > span {
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  overflow:hidden !important;
  clip:rect(0 0 0 0) !important;
}
body.preview-redesign .editor-bottom-bar .editor-record-button {
  display:grid !important;
  place-items:center !important;
  width:48px !important;
  min-width:48px !important;
  height:48px !important;
  min-height:48px !important;
  padding:0 !important;
  border-radius:999px !important;
  overflow:hidden !important;
}
body.preview-redesign .editor-bottom-bar .editor-record-button > #recordLabel,
body.preview-redesign .editor-bottom-bar .record-activity-status {
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  overflow:hidden !important;
  clip:rect(0 0 0 0) !important;
}
body.preview-redesign .editor-bottom-bar .editor-record-button .record-microphone {
  width:25px !important;
  height:25px !important;
  margin:0 !important;
}

/* Lateralidade é um dado essencial e fica logo depois do exame/modelo,
   antes da seção recolhível de informações administrativas. */
body.preview-redesign:not(.quick-editor-mode) .details-panel > .field-grid > #examSideField {
  order:6 !important;
  grid-column:1 / -1 !important;
  width:100% !important;
  max-width:100% !important;
  min-width:0 !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel > .field-grid > .progressive-report-details {
  order:7 !important;
}

/* Estabilidade em zoom: as ações superiores permanecem em uma única linha
   e os rótulos das ações do cabeçalho quebram por palavra, nunca por letra. */
body.preview-redesign #editorPrimaryActions {
  display:grid !important;
  grid-template-columns:repeat(6, minmax(0, 1fr)) !important;
  grid-template-rows:1fr !important;
  grid-auto-flow:column !important;
  flex-wrap:nowrap !important;
  white-space:nowrap !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button {
  grid-row:1 !important;
  min-width:0 !important;
  max-width:100% !important;
  white-space:nowrap !important;
}
body.preview-redesign .editor-screen .report-form > .template-row {
  display:grid !important;
  grid-template-columns:repeat(auto-fit, minmax(170px, 1fr)) !important;
  grid-auto-flow:row !important;
  align-items:stretch !important;
  width:100% !important;
  max-width:100% !important;
  box-sizing:border-box !important;
  overflow:hidden !important;
}
body.preview-redesign .template-row .template-action-button {
  min-width:0 !important;
  max-width:100% !important;
  white-space:normal !important;
  word-break:normal !important;
  overflow-wrap:normal !important;
  hyphens:none !important;
  line-height:1.15 !important;
}
body.preview-redesign .report-editor {
  width:100% !important;
  max-width:100% !important;
  min-width:0 !important;
  box-sizing:border-box !important;
  white-space:pre-wrap !important;
  overflow-wrap:break-word !important;
  word-break:normal !important;
  overflow-x:hidden !important;
}

/* Compartilhamento: glifos estáticos, sem deslocamento ao passar/tocar, e
   sem a divisória artificial antes do primeiro item visível (Copiar). */
body.preview-redesign #editorPrimaryActions .editor-action-button,
body.preview-redesign #editorPrimaryActions .editor-action-button:hover,
body.preview-redesign #editorPrimaryActions .editor-action-button:active,
body.preview-redesign #editorPrimaryActions .editor-action-button:focus {
  transform:none !important;
  transition:none !important;
}
body.preview-redesign #editorPrimaryActions #copyReportFormattedButton,
body.preview-redesign #editorPrimaryActions #copyReportFormattedButton::before {
  border-left:0 !important;
  box-shadow:none !important;
}
body.preview-redesign #editorPrimaryActions #copyReportFormattedButton::before {
  display:none !important;
  content:none !important;
}

/* Ações de modelo: cartões responsivos, com quebra por palavra e sem
   compressão que transforme “anterior” em várias linhas de letras. */
body.preview-redesign .editor-screen .report-form > .template-row {
  display:grid !important;
  grid-template-columns:repeat(auto-fit, minmax(170px, 1fr)) !important;
  grid-auto-flow:row !important;
  width:100% !important;
  max-width:100% !important;
  box-sizing:border-box !important;
  overflow:hidden !important;
}
body.preview-redesign .editor-screen .report-form > .template-row .template-action-button {
  width:100% !important;
  min-width:0 !important;
  max-width:100% !important;
  box-sizing:border-box !important;
  white-space:normal !important;
  word-break:keep-all !important;
  overflow-wrap:normal !important;
  hyphens:none !important;
  line-height:1.15 !important;
  text-align:center !important;
}

/* O seletor de microfone fica alinhado à direita do cabeçalho e não força
   uma largura maior que a moldura do editor. */
body.preview-redesign .dictation-header .audio-source-field {
  justify-self:end !important;
  width:min(360px, 100%) !important;
  max-width:100% !important;
  min-width:0 !important;
}
body.preview-redesign .dictation-header .audio-source-field select {
  width:100% !important;
  max-width:100% !important;
  min-width:0 !important;
  box-sizing:border-box !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
  white-space:nowrap !important;
}
@media (max-width:700px) {
  body.preview-redesign .dictation-header .audio-source-field {
    justify-self:stretch !important;
    width:100% !important;
  }
}

/* Campos superiores com dimensões estáveis em zoom e telas largas. */
body.preview-redesign:not(.quick-editor-mode) .details-panel > .field-grid {
  grid-template-columns:minmax(0, 1fr) minmax(0, 1fr) !important;
  width:100% !important;
  max-width:100% !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel > .field-grid > label {
  width:100% !important;
  max-width:100% !important;
  min-width:0 !important;
  box-sizing:border-box !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel > .field-grid > label > input,
body.preview-redesign:not(.quick-editor-mode) .details-panel > .field-grid > label > select {
  width:100% !important;
  max-width:100% !important;
  min-width:0 !important;
  box-sizing:border-box !important;
  height:48px !important;
  min-height:48px !important;
  max-height:48px !important;
  padding:0 12px !important;
  font-size:clamp(.82rem, 1.8vw, 1rem) !important;
  line-height:1.2 !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel #examDate {
  text-align:center !important;
  padding-inline:8px !important;
}

/* Campos de data: o Safari aplica uma largura intrínseca maior que a coluna
   quando o calendário nativo está ativo. Confinamos somente esses dois
   controles ao marcador do formulário, sem tocar nas barras de ação. */
body.preview-redesign:not(.quick-editor-mode) #examDate,
body.preview-redesign:not(.quick-editor-mode) #patientBirthDate {
  display:block !important;
  width:100% !important;
  max-width:100% !important;
  min-width:0 !important;
  min-inline-size:0 !important;
  inline-size:100% !important;
  box-sizing:border-box !important;
  overflow:hidden !important;
  padding-inline:10px 6px !important;
  font-size:clamp(.72rem, 3.2vw, .88rem) !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel label:has(#examDate),
body.preview-redesign:not(.quick-editor-mode) .progressive-report-fields label:has(#patientBirthDate) {
  width:100% !important;
  max-width:100% !important;
  min-width:0 !important;
  overflow:hidden !important;
}

/* Ações do exame pertencem ao cabeçalho do formulário. Em zoom/telas
   estreitas elas devem se adaptar à moldura, sem criar uma faixa horizontal
   que esconda os últimos botões. */
@media (min-width: 701px) {
  body.preview-redesign .editor-screen .report-form > .template-row {
    display:grid !important;
    grid-template-columns:repeat(auto-fit, minmax(150px, 1fr)) !important;
    gap:8px !important;
    width:100% !important;
    max-width:100% !important;
    box-sizing:border-box !important;
    overflow:visible !important;
    padding:8px 10px !important;
  }
  body.preview-redesign .editor-screen .report-form > .template-row .template-action-button {
    width:100% !important;
    min-width:0 !important;
    min-height:58px !important;
    box-sizing:border-box !important;
    white-space:normal !important;
    overflow-wrap:anywhere !important;
  }
}

/* Correções finais para telas estreitas: a cápsula de compartilhamento não
   deve crescer nem deslocar os glifos; os botões de exame precisam acomodar
   seus rótulos sem cortar palavras. */
body.preview-redesign .editor-screen .report-form > .template-row .template-action-label {
  display:block !important;
  max-width:100% !important;
  white-space:normal !important;
  word-break:normal !important;
  overflow-wrap:break-word !important;
  hyphens:none !important;
}
@media (max-width:700px) {
  body.preview-redesign #editorPrimaryActions {
    width:calc(100% - 40px) !important;
    max-width:calc(100% - 40px) !important;
    height:58px !important;
    min-height:58px !important;
    padding:4px 6px !important;
  }
  body.preview-redesign #editorPrimaryActions .editor-action-button {
    height:48px !important;
    min-height:48px !important;
  }
  body.preview-redesign #editorPrimaryActions .editor-action-button > svg,
  body.preview-redesign #editorPrimaryActions #whatsappButton > svg {
    width:21px !important;
    height:21px !important;
  }
  body.preview-redesign #editorPrimaryActions .editor-action-button:not(:first-child)::before {
    top:8px !important;
    height:32px !important;
  }
}

.draft-notebook-record-row { display:flex; align-items:center; gap:12px; margin:10px 0 4px; }
.draft-notebook-mic-button { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:42px; padding:8px 16px; border:1px solid var(--accent); border-radius:999px; background:transparent; color:var(--accent); font:inherit; font-weight:700; cursor:pointer; }
.draft-notebook-mic-button svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.draft-notebook-mic-button.is-recording { background:var(--accent); color:var(--surface, #fff); }
.draft-notebook-mic-button:disabled { opacity:.65; cursor:wait; }
.draft-notebook-record-hint { color:var(--muted); font-size:.85rem; }
@media (max-width:600px) {
  .draft-notebook-record-row { align-items:flex-start; flex-direction:column; gap:6px; }
  .draft-notebook-mic-button { width:100%; }
}

/* O rascunho também precisa iniciar uma gravação sem depender de texto ou
   de um parágrafo selecionado. A regra compacta antiga escondia o controle
   original; reabrimos a mesma ação de Gravar IA apenas enquanto o editor
   estiver criando/retomando um rascunho (inclusive Editor rápido). */
body.preview-redesign.draft-editor-mode .editor-bottom-bar {
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  min-height:58px !important;
  height:58px !important;
  padding:6px 10px !important;
  position:relative !important;
  z-index:40 !important;
}
body.preview-redesign.draft-editor-mode .editor-bottom-bar .record-control {
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  width:100% !important;
  min-width:0 !important;
}
body.preview-redesign.draft-editor-mode .editor-bottom-bar .editor-record-button {
  display:grid !important;
  place-items:center !important;
  width:46px !important;
  min-width:46px !important;
  height:46px !important;
  min-height:46px !important;
  padding:0 !important;
  border-radius:999px !important;
  cursor:pointer !important;
  pointer-events:auto !important;
}
body.preview-redesign.draft-editor-mode .editor-bottom-bar .editor-record-button #recordLabel,
body.preview-redesign.draft-editor-mode .editor-bottom-bar .record-activity-status {
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  padding:0 !important;
  margin:-1px !important;
  overflow:hidden !important;
  clip:rect(0,0,0,0) !important;
  white-space:nowrap !important;
  border:0 !important;
}
body.preview-redesign.draft-editor-mode .editor-bottom-bar .editor-record-button .record-microphone {
  width:25px !important;
  height:25px !important;
  margin:0 !important;
}
body.preview-redesign.draft-editor-mode .report-editor {
  padding-bottom:76px !important;
}

/* Organização do cadastro superior. Mantemos as barras inferiores fora deste
   bloco: apenas os campos clínicos recebem uma ordem visual mais curta e
   previsível no celular. */
@media (max-width: 700px) {
  body.preview-redesign:not(.quick-editor-mode) .details-panel > .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px 8px !important;
    align-items: start !important;
  }
  body.preview-redesign:not(.quick-editor-mode) .details-panel > .field-grid > label,
  body.preview-redesign:not(.quick-editor-mode) .details-panel > .field-grid > details,
  body.preview-redesign:not(.quick-editor-mode) .details-panel > .field-grid > section {
    min-width: 0 !important;
    margin: 0 !important;
  }
  body.preview-redesign:not(.quick-editor-mode) .details-panel > .field-grid > label:nth-child(1) { order: 1; grid-column: 1; }
  body.preview-redesign:not(.quick-editor-mode) .details-panel > .field-grid > label:nth-child(5) { order: 2; grid-column: 2; }
  body.preview-redesign:not(.quick-editor-mode) .details-panel > .field-grid > label:nth-child(2) { order: 3; grid-column: 1; }
  body.preview-redesign:not(.quick-editor-mode) .details-panel > .field-grid > label:nth-child(3) { order: 4; grid-column: 2; }
  body.preview-redesign:not(.quick-editor-mode) .details-panel > .field-grid > label:nth-child(4) { order: 5; grid-column: 1 / -1; }
  body.preview-redesign:not(.quick-editor-mode) .details-panel > .field-grid > label:nth-child(7) { order: 6; grid-column: 1 / -1; }
  body.preview-redesign:not(.quick-editor-mode) .details-panel > .field-grid > details { order: 7; grid-column: 1 / -1; }
  body.preview-redesign:not(.quick-editor-mode) .details-panel > .field-grid > section { order: 8; grid-column: 1 / -1; }
  body.preview-redesign:not(.quick-editor-mode) .details-panel label {
    display: grid !important;
    gap: 4px !important;
    line-height: 1.15 !important;
  }
  body.preview-redesign:not(.quick-editor-mode) .details-panel input,
  body.preview-redesign:not(.quick-editor-mode) .details-panel select {
    min-height: 42px !important;
    padding: 0 11px !important;
    border-radius: 10px !important;
  }
  body.preview-redesign:not(.quick-editor-mode) .details-panel .progressive-report-details {
    margin-top: 2px !important;
    padding-top: 8px !important;
  }
}

/* Como Salvar está oculto, Copiar é o primeiro item visível e não recebe
   divisória na borda esquerda. */
body.preview-redesign #editorPrimaryActions #copyReportFormattedButton::before {
  display:none !important;
}

/* Proteção contra zoom do navegador: o texto não participa do layout dos
   botões e nenhuma cápsula consegue aumentar a largura da página. */
html:has(body.preview-redesign),
body.preview-redesign { overflow-x:hidden !important; max-width:100vw !important; }
body.preview-redesign #editorPrimaryActions { box-sizing:border-box !important; width:min(80vw, 470px) !important; max-width:calc(100vw - 24px) !important; overflow:hidden !important; }
body.preview-redesign #editorPrimaryActions .editor-action-button span { display:none !important; }
body.preview-redesign #editorPrimaryActions .editor-action-button { overflow:visible !important; }
body.preview-redesign .editor-toolbar { box-sizing:border-box !important; max-width:calc(100vw - 24px) !important; overflow-x:auto !important; touch-action:pan-x !important; }

/* Grade fixa: cada ação ocupa exatamente 1/6 da cápsula e o glifo é
   centralizado no centro geométrico da sua coluna. */
body.preview-redesign #editorPrimaryActions {
  display:grid !important;
  grid-template-columns:repeat(6, minmax(0, 1fr)) !important;
  align-items:center !important;
  justify-items:stretch !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button {
  width:100% !important;
  min-width:0 !important;
  display:grid !important;
  place-items:center !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button svg {
  display:block !important;
  margin:auto !important;
}
body.preview-redesign #editorPrimaryActions #whatsappButton svg {
  width:18px !important;
  height:18px !important;
}

/* Dados clínicos essenciais não podem ser ocultados pelo modo compacto:
   exame, data, nascimento e lateralidade são necessários antes da máscara. */
body.preview-redesign:not(.quick-editor-mode) .editor-screen .report-form > .details-panel {
  display:block !important;
  visibility:visible !important;
  width:100% !important;
  box-sizing:border-box !important;
  padding:10px 12px !important;
  margin:0 !important;
  background:var(--panel) !important;
  border-bottom:1px solid var(--line) !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel > .field-grid {
  display:grid !important;
  grid-template-columns:repeat(2, minmax(0, 1fr)) !important;
  gap:8px !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel label {
  min-width:0 !important;
  font-size:.72rem !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel input,
body.preview-redesign:not(.quick-editor-mode) .details-panel select {
  width:100% !important;
  min-width:0 !important;
  min-height:38px !important;
  box-sizing:border-box !important;
  font-size:.88rem !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel .exam-type-field,
body.preview-redesign:not(.quick-editor-mode) .details-panel .progressive-report-details {
  grid-column:1 / -1 !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel #examSideField:not([hidden]) { display:block !important; }
@media (max-width:500px) {
  body.preview-redesign:not(.quick-editor-mode) .details-panel > .field-grid { grid-template-columns:1fr 1fr !important; }
}

/* Centro matemático independente de heranças de flex/alinhamento. */
body.preview-redesign #editorPrimaryActions .editor-action-button {
  position:relative !important;
  justify-self:stretch !important;
  align-self:stretch !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button > svg {
  position:absolute !important;
  left:50% !important;
  top:50% !important;
  transform:translate(-50%, -50%) !important;
  margin:0 !important;
}
body.preview-redesign #editorPrimaryActions #whatsappButton > svg {
  width:22px !important;
  height:22px !important;
}

/* Override final: permitir pinça/arrasto no documento sem deixar a barra
   criar um viewport preso. */
html:has(body.preview-redesign),
body.preview-redesign { overflow-x:auto !important; max-width:none !important; touch-action:pan-x pan-y pinch-zoom !important; }
body.preview-redesign #editorPrimaryActions { contain:none !important; overflow:visible !important; }
body.preview-redesign .editor-toolbar { touch-action:pan-x pan-y pinch-zoom !important; }

/* Última camada: estes seletores ficam deliberadamente no EOF para impedir
   que estilos legados do redesign desfaçam o layout em zoom. */
body.preview-redesign #editorPrimaryActions {
  display:grid !important; grid-template-columns:repeat(6,minmax(0,1fr)) !important;
  grid-template-rows:1fr !important; grid-auto-flow:column !important;
  flex-wrap:nowrap !important; width:min(620px,calc(100% - 24px)) !important;
  max-width:calc(100% - 24px) !important; height:64px !important; min-height:64px !important;
  margin:12px auto !important; padding:6px 8px !important; gap:0 !important;
  overflow:hidden !important; box-sizing:border-box !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button {
  grid-row:1 !important; display:grid !important; place-items:center !important;
  width:100% !important; min-width:0 !important; height:52px !important; min-height:52px !important;
  padding:0 !important; border:0 !important; border-radius:0 !important;
  background:transparent !important; box-shadow:none !important; transform:none !important; transition:none !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button:not(:first-child)::before {
  content:"" !important; position:absolute !important; left:0 !important; top:9px !important;
  width:1px !important; height:34px !important; background:var(--line) !important;
}
body.preview-redesign #editorPrimaryActions #copyReportFormattedButton::before,
body.preview-redesign #editorPrimaryActions #copyReportFormattedButton::after { display:none !important; content:none !important; }
body.preview-redesign #editorPrimaryActions .editor-action-button > svg {
  position:static !important; display:block !important; width:24px !important; height:24px !important;
  margin:0 !important; transform:none !important; stroke:currentColor !important;
}
body.preview-redesign #editorPrimaryActions #whatsappButton > svg { width:24px !important; height:24px !important; fill:currentColor !important; stroke:none !important; }
body.preview-redesign #editorPrimaryActions .editor-action-button > span { position:absolute !important; width:1px !important; height:1px !important; overflow:hidden !important; clip:rect(0 0 0 0) !important; }
body.preview-redesign .editor-screen .report-form > .template-row {
  display:grid !important; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)) !important;
  grid-auto-flow:row !important; width:100% !important; max-width:100% !important;
  box-sizing:border-box !important; overflow:hidden !important;
}
body.preview-redesign .editor-screen .report-form > .template-row .template-action-button {
  width:100% !important; min-width:0 !important; max-width:100% !important; box-sizing:border-box !important;
  white-space:normal !important; word-break:normal !important; overflow-wrap:normal !important;
  hyphens:none !important; line-height:1.15 !important; text-align:center !important;
}
body.preview-redesign .dictation-header .audio-source-field { justify-self:end !important; width:min(360px,100%) !important; max-width:100% !important; min-width:0 !important; }
body.preview-redesign .dictation-header .audio-source-field select { width:100% !important; max-width:100% !important; min-width:0 !important; box-sizing:border-box !important; overflow:hidden !important; text-overflow:ellipsis !important; white-space:nowrap !important; }
body.preview-redesign .editor-toolbar .undo-report-button { flex:0 0 44px !important; width:44px !important; min-width:44px !important; height:38px !important; min-height:38px !important; display:grid !important; place-items:center !important; padding:0 !important; overflow:hidden !important; }
body.preview-redesign .editor-toolbar .undo-report-button > span { position:absolute !important; width:1px !important; height:1px !important; overflow:hidden !important; clip:rect(0 0 0 0) !important; }
body.preview-redesign .report-editor { width:100% !important; max-width:100% !important; min-width:0 !important; box-sizing:border-box !important; white-space:pre-wrap !important; overflow-wrap:break-word !important; word-break:normal !important; overflow-x:hidden !important; }
@media (max-width:700px) { body.preview-redesign .dictation-header .audio-source-field { justify-self:stretch !important; width:100% !important; } body.preview-redesign .editor-screen .report-form > .template-row { grid-template-columns:repeat(2,minmax(0,1fr)) !important; } }

/* O botão de salvar pertence exclusivamente ao dock inferior. Retirá-lo do
   fluxo da grade evita uma coluna fantasma antes do primeiro compartilhamento. */
body.preview-redesign #editorPrimaryActions #saveButton,
body.preview-redesign #editorPrimaryActions .editor-action-button[hidden] {
  display:none !important;
  visibility:hidden !important;
  pointer-events:none !important;
}

/* Proporção final da cápsula de compartilhamento: mais área horizontal e
   glifos legíveis, sem alterar o dock inferior de navegação. */
body.preview-redesign #editorPrimaryActions {
  width:min(560px, calc(100% - 32px)) !important;
  max-width:calc(100% - 32px) !important;
  height:72px !important;
  min-height:72px !important;
  padding:8px 10px !important;
  border-radius:999px !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button {
  height:56px !important;
  min-height:56px !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button > svg {
  width:29px !important;
  height:29px !important;
}
body.preview-redesign #editorPrimaryActions #whatsappButton > svg {
  width:29px !important;
  height:29px !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button:not(:first-child)::before {
  top:10px !important;
  height:36px !important;
}
body.preview-redesign #editorPrimaryActions #copyReportFormattedButton::before,
body.preview-redesign #editorPrimaryActions #copyReportFormattedButton::after {
  display:none !important;
}

/* Cabeçalho do ditado: título/status à esquerda e os dois seletores em
   colunas próprias, evitando que o texto do microfone invada o modo do
   ditado em telas grandes ou com zoom. */
@media (min-width: 701px) {
  body.preview-redesign .dictation-header {
    display:grid !important;
    grid-template-columns:minmax(180px, 1fr) minmax(220px, 320px) minmax(220px, 320px) !important;
    align-items:end !important;
    column-gap:16px !important;
  }
  body.preview-redesign .dictation-header > div:first-child {
    grid-column:1 !important;
    grid-row:1 !important;
    min-width:0 !important;
  }
  body.preview-redesign .dictation-header .audio-source-field {
    grid-column:2 !important;
    grid-row:1 !important;
    justify-self:stretch !important;
  }
  body.preview-redesign .dictation-header .dictation-mode-field {
    grid-column:3 !important;
    grid-row:1 !important;
    min-width:0 !important;
  }
}

/* Mobile final override (must remain last so legacy redesign rules cannot
   enlarge the sharing capsule or force clipped labels). */
@media (max-width:700px) {
  body.preview-redesign #editorPrimaryActions { width:calc(100% - 40px) !important; max-width:calc(100% - 40px) !important; height:58px !important; min-height:58px !important; padding:4px 6px !important; }
  body.preview-redesign #editorPrimaryActions .editor-action-button { height:48px !important; min-height:48px !important; }
  body.preview-redesign #editorPrimaryActions .editor-action-button > svg,
  body.preview-redesign #editorPrimaryActions #whatsappButton > svg { width:21px !important; height:21px !important; }
  body.preview-redesign #editorPrimaryActions .editor-action-button:not(:first-child)::before { top:8px !important; height:32px !important; }
}
body.preview-redesign .editor-screen .report-form > .template-row .template-action-label { display:block !important; max-width:100% !important; white-space:normal !important; word-break:normal !important; overflow-wrap:break-word !important; hyphens:none !important; }

/* Icon-only buttons must not inherit the three-column icon/label/spacer
   grid used by labelled actions. Reset both the outer placement and children. */
body.preview-redesign #editorPrimaryActions > .editor-action-button {
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  grid-column:auto !important;
  grid-row:1 !important;
  order:0 !important;
  gap:0 !important;
}
body.preview-redesign #editorPrimaryActions > .editor-action-button::after {
  display:none !important;
  content:none !important;
}
body.preview-redesign #editorPrimaryActions > .editor-action-button > svg {
  flex:0 0 auto !important;
  grid-area:auto !important;
  min-height:0 !important;
  left:auto !important;
  top:auto !important;
  align-self:center !important;
}
/* The explanatory text participates in normal flow; it never shares the
   recorder's absolute positioning or a fixed-height clipping box. */
body.preview-redesign .dictation-panel .editor-bottom-bar .context-ai-hint {
  flex:1 1 0 !important;
  position:static !important;
  width:auto !important;
  max-width:none !important;
  min-width:0 !important;
  height:auto !important;
  margin:0 !important;
  padding:0 !important;
  transform:none !important;
  white-space:normal !important;
  word-break:normal !important;
  overflow-wrap:break-word !important;
  font-size:12px !important;
  line-height:1.5 !important;
}
body.preview-redesign .dictation-panel .editor-bottom-bar {
  grid-template-columns:minmax(0,1fr) auto !important;
  height:auto !important;
  min-height:56px !important;
  padding:10px 16px !important;
  gap:12px !important;
  align-items:center !important;
}
body.preview-redesign .dictation-panel .editor-bottom-bar .record-control {
  flex:0 0 auto !important;
  width:auto !important;
  min-width:46px !important;
  margin-left:auto !important;
  position:relative !important;
}

/* A barra de compartilhamento usa a mesma escala da referência em qualquer
   viewport. O dock inferior não é afetado por estes seletores. */
body.preview-redesign #editorPrimaryActions {
  width:min(470px, calc(100% - 32px)) !important;
  max-width:min(470px, calc(100% - 32px)) !important;
  height:74px !important;
  min-height:74px !important;
  padding:8px 10px !important;
  margin:16px auto !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button {
  height:56px !important;
  min-height:56px !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button > svg,
body.preview-redesign #editorPrimaryActions #whatsappButton > svg {
  width:24px !important;
  height:24px !important;
}
body.preview-redesign #editorPrimaryActions .editor-action-button:not(:first-child)::before {
  top:10px !important;
  height:36px !important;
}
@media (max-width:500px) {
  body.preview-redesign #editorPrimaryActions { width:calc(100% - 32px) !important; max-width:calc(100% - 32px) !important; }
}

/* Compact sharing controls keep the same geometry during hover and touch. */
body.preview-redesign #editorPrimaryActions {
  height:58px !important;
  min-height:58px !important;
  padding:6px 10px !important;
}
body.preview-redesign #editorPrimaryActions > .editor-action-button {
  height:46px !important;
  min-height:46px !important;
}
body.preview-redesign #editorPrimaryActions > .editor-action-button:not(:first-child)::before {
  top:9px !important;
  height:28px !important;
}
body.preview-redesign #editorPrimaryActions,
body.preview-redesign #editorPrimaryActions > .editor-action-button,
body.preview-redesign #editorPrimaryActions > .editor-action-button:is(:hover,:active,:focus) > svg,
body.preview-redesign #editorPrimaryActions > .editor-action-button > svg {
  animation:none !important;
  transition:none !important;
  transform:none !important;
  translate:none !important;
  scale:none !important;
  rotate:none !important;
}

/* Two real columns, without the legacy empty spacer column that squeezed
   labels into fragments. Whole words wrap within a comfortable tap target. */
body.preview-redesign .editor-screen .report-form > .template-row {
  gap:8px !important;
  padding:10px !important;
  grid-template-columns:repeat(auto-fit,minmax(160px,1fr)) !important;
}
body.preview-redesign .editor-screen .report-form > .template-row .template-action-button {
  display:grid !important;
  grid-template-columns:22px minmax(0,1fr) !important;
  gap:8px !important;
  padding:10px 12px !important;
  min-height:56px !important;
  height:auto !important;
  border-radius:16px !important;
  font-size:14px !important;
  font-weight:600 !important;
  line-height:1.35 !important;
  text-align:left !important;
}
body.preview-redesign .editor-screen .report-form > .template-row .template-action-button::after { content:none !important; display:none !important; }
body.preview-redesign .editor-screen .report-form > .template-row .template-action-icon {
  width:22px !important; height:22px !important; min-width:0 !important;
  grid-column:1 !important; grid-row:1 !important;
}
body.preview-redesign .editor-screen .report-form > .template-row .template-action-label {
  grid-column:2 !important; grid-row:1 !important;
  text-align:left !important; width:auto !important;
  word-break:normal !important; overflow-wrap:normal !important;
}
@media (max-width:700px) {
  body.preview-redesign .editor-screen .report-form > .template-row { grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
  body.preview-redesign:not(.quick-editor-mode) .details-panel label { font-size:13px !important; line-height:1.4 !important; }
  body.preview-redesign:not(.quick-editor-mode) .details-panel input,
  body.preview-redesign:not(.quick-editor-mode) .details-panel select {
    display:block !important; width:100% !important; max-width:100% !important;
    min-width:0 !important; height:44px !important; min-height:44px !important;
    padding:8px 10px !important; border-radius:12px !important;
    font-size:16px !important; line-height:1.25 !important; text-align:left !important;
    box-sizing:border-box !important;
  }
  body.preview-redesign .details-panel input[type="date"] { appearance:none; -webkit-appearance:none; }
  body.preview-redesign .details-panel input[type="date"]::-webkit-date-and-time-value { text-align:left; margin:0; min-height:1.25em; }
  body.preview-redesign .details-panel input[type="date"]::-webkit-datetime-edit { padding:0; }
}
@media (max-width:340px) {
  body.preview-redesign .editor-screen .report-form > .template-row { grid-template-columns:1fr !important; }
}

/* Ferramentas de máscaras: ação atual clara, três atalhos principais e
   operações menos frequentes recolhidas em Mais ações. */
body.preview-redesign .template-tools-card {
  display:grid;
  gap:10px;
  width:100%;
  padding:12px;
  border:1px solid var(--line);
  border-radius:18px;
  background:var(--panel);
  box-sizing:border-box;
}
@media (max-width:900px) {
  body.preview-redesign .editor-screen .report-form > .template-tools-card {
    display:grid !important;
  }
}
body.preview-redesign .template-tools-current {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:2px 2px 10px;
  border-bottom:1px solid var(--line);
}
body.preview-redesign .template-tools-current > div {
  display:grid;
  gap:2px;
  min-width:0;
}
body.preview-redesign .template-tools-current span {
  color:var(--muted);
  font-size:12px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.04em;
}
body.preview-redesign .template-tools-current strong {
  overflow:hidden;
  color:var(--ink);
  font-size:15px;
  line-height:1.25;
  text-overflow:ellipsis;
  white-space:nowrap;
}
body.preview-redesign .template-tools-insert {
  flex:0 0 auto;
  min-height:36px;
  padding:7px 14px;
  border-radius:999px;
  color:var(--accent-dark);
  font-weight:700;
}
body.preview-redesign .template-tools-card .template-row {
  display:grid !important;
  grid-template-columns:repeat(3,minmax(0,1fr)) !important;
  gap:8px !important;
  width:100% !important;
  padding:0 !important;
  overflow:visible !important;
  background:transparent !important;
  border:0 !important;
}
body.preview-redesign .template-tools-card .template-action-button {
  display:grid !important;
  grid-template-columns:22px minmax(0,1fr) !important;
  align-items:center !important;
  gap:8px !important;
  width:100% !important;
  min-width:0 !important;
  min-height:52px !important;
  height:auto !important;
  padding:9px 10px !important;
  border-radius:14px !important;
  font-size:13px !important;
  line-height:1.25 !important;
  text-align:left !important;
  box-sizing:border-box !important;
}
body.preview-redesign .template-tools-card .template-action-icon {
  grid-column:1 !important;
  width:21px !important;
  height:21px !important;
}
body.preview-redesign .template-tools-card .template-action-label {
  grid-column:2 !important;
  width:auto !important;
  text-align:left !important;
  white-space:normal !important;
}
body.preview-redesign .template-more-actions {
  border-top:1px solid var(--line);
  padding-top:8px;
}
body.preview-redesign .template-more-actions summary {
  cursor:pointer;
  color:var(--accent-dark);
  font-size:13px;
  font-weight:700;
  list-style:none;
  text-align:center;
}
body.preview-redesign .template-more-actions summary::-webkit-details-marker { display:none; }
body.preview-redesign .template-more-actions summary::after { content:" ▾"; }
body.preview-redesign .template-more-actions[open] summary::after { content:" ▴"; }
body.preview-redesign .template-more-actions[open] .template-row-secondary { margin-top:9px; }
body.preview-redesign .template-tools-card .template-action-button[hidden] { display:none !important; }
@media (max-width:700px) {
  body.preview-redesign .template-tools-card .template-row-primary { grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
  body.preview-redesign .template-tools-card .template-row-primary .template-action-button:last-child { grid-column:1 / -1 !important; }
  body.preview-redesign .template-tools-card .template-row-secondary { grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
}
@media (max-width:360px) {
  body.preview-redesign .template-tools-card .template-row,
  body.preview-redesign .template-tools-card .template-row-primary,
  body.preview-redesign .template-tools-card .template-row-secondary { grid-template-columns:1fr !important; }
  body.preview-redesign .template-tools-card .template-row-primary .template-action-button:last-child { grid-column:auto !important; }
}

/* Ações de máscara no editor seguem o mesmo desenho dos controles da
   Academia e do cadastro: cápsulas claras, com ícones estáveis e leitura
   rápida no celular. */
body.preview-redesign .template-tools-card .template-action-button {
  border-radius: 999px !important;
  border-color: rgba(13, 127, 116, 0.24) !important;
  background: color-mix(in srgb, var(--surface) 90%, var(--soft)) !important;
  color: var(--accent-dark) !important;
  box-shadow: none !important;
}

body.preview-redesign .template-tools-card .template-action-button:hover,
body.preview-redesign .template-tools-card .template-action-button:focus-visible {
  border-color: var(--accent) !important;
  background: var(--soft) !important;
  color: var(--accent-dark) !important;
}

body.preview-redesign .template-tools-card .template-action-icon {
  border-radius: 999px;
  color: currentColor;
  stroke: currentColor;
}

body.preview-redesign .template-more-actions summary {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid rgba(13, 127, 116, 0.2);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, var(--soft));
  color: var(--accent-dark);
}

body.preview-redesign .template-more-actions summary::after {
  margin-left: 3px;
}

body.dark-mode.preview-redesign .template-tools-card .template-action-button,
body.dark-mode.preview-redesign .template-more-actions summary {
  border-color: rgba(159, 243, 229, 0.22) !important;
  background: #192321 !important;
  color: #b8fff3 !important;
}

body.dark-mode.preview-redesign .template-tools-insert {
  border-color: rgba(159, 243, 229, 0.42) !important;
  background: #192321 !important;
  color: #b8fff3 !important;
}

body.dark-mode.preview-redesign .template-tools-insert:hover,
body.dark-mode.preview-redesign .template-tools-insert:focus-visible,
body.dark-mode.preview-redesign .template-tools-insert:active {
  border-color: #69dfce !important;
  background: #24534d !important;
  color: #e5fffa !important;
}

body.dark-mode.preview-redesign .template-tools-card .template-action-button:hover,
body.dark-mode.preview-redesign .template-tools-card .template-action-button:focus-visible,
body.dark-mode.preview-redesign .template-more-actions summary:hover {
  border-color: #69dfce !important;
  background: #24534d !important;
  color: #e5fffa !important;
}

/* Compacta o formulário sem alterar as barras de ação. */
body.preview-redesign:not(.quick-editor-mode) .details-panel > .field-grid {
  gap:9px 10px !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel label {
  grid-template-rows:auto 44px !important;
  gap:4px !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel label > input,
body.preview-redesign:not(.quick-editor-mode) .details-panel label > select {
  height:44px !important;
  min-height:44px !important;
  max-height:44px !important;
  border-radius:13px !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel #examDate {
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  text-align:center !important;
  line-height:1.2 !important;
  padding:0 10px !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel #examDate::-webkit-datetime-edit,
body.preview-redesign:not(.quick-editor-mode) .details-panel #examDate::-webkit-date-and-time-value {
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  height:100% !important;
  min-height:0 !important;
  margin:0 !important;
  padding:0 !important;
  line-height:1.2 !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel #patientBirthDate::-webkit-datetime-edit,
body.preview-redesign:not(.quick-editor-mode) .details-panel #patientBirthDate::-webkit-date-and-time-value {
  display:flex !important;
  align-items:center !important;
  height:100% !important;
  min-height:0 !important;
  margin:0 !important;
  padding:0 !important;
  line-height:1.2 !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel .progressive-report-details > summary {
  min-height:46px !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel .progressive-report-fields {
  gap:9px 10px !important;
  padding-top:11px !important;
}
@media (max-width:430px) {
  body.preview-redesign:not(.quick-editor-mode) .details-panel label > input,
  body.preview-redesign:not(.quick-editor-mode) .details-panel label > select { font-size:15px !important; }
}
/* Safari sometimes paints the native date control over its right edge. Keep
   the field itself visible and reinforce all four sides inside the box. */
body.preview-redesign:not(.quick-editor-mode) .details-panel label:has(#examDate) {
  overflow:visible !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel #examDate {
  overflow:visible !important;
  width:100% !important;
  min-width:0 !important;
  max-width:100% !important;
  inline-size:100% !important;
  min-inline-size:0 !important;
  max-inline-size:100% !important;
  justify-self:stretch !important;
  appearance:none !important;
  -webkit-appearance:none !important;
  border:1px solid var(--line) !important;
  border-right:1px solid var(--line) !important;
  box-shadow:inset -1px 0 0 var(--line), inset 0 1px 0 rgba(255,255,255,.06) !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel #patientBirthDate {
  width:100% !important;
  min-width:0 !important;
  max-width:100% !important;
  inline-size:100% !important;
  min-inline-size:0 !important;
  max-inline-size:100% !important;
  appearance:none !important;
  -webkit-appearance:none !important;
}
/* O shell impede que o controle nativo de data imponha sua largura
   intrínseca à coluna da grade. O input continua cobrindo toda a área e
   mantém o acionamento do calendário. */
body.preview-redesign:not(.quick-editor-mode) .details-panel .date-field-shell {
  position:relative !important;
  display:block !important;
  width:100% !important;
  min-width:0 !important;
  max-width:100% !important;
  height:44px !important;
  min-height:44px !important;
  max-height:44px !important;
  overflow:visible !important;
  grid-row:2 !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel .date-field-shell > input[type="date"] {
  position:absolute !important;
  inset:0 !important;
  display:flex !important;
  width:100% !important;
  min-width:0 !important;
  max-width:100% !important;
  inline-size:100% !important;
  min-inline-size:0 !important;
  max-inline-size:100% !important;
  height:44px !important;
  min-height:44px !important;
  max-height:44px !important;
  box-sizing:border-box !important;
  overflow:hidden !important;
  padding:0 14px !important;
  border:1px solid var(--line) !important;
  border-radius:13px !important;
  background:var(--surface) !important;
  color:var(--ink) !important;
  font-size:16px !important;
  font-weight:600 !important;
  line-height:1.2 !important;
  text-align:center !important;
  appearance:none !important;
  -webkit-appearance:none !important;
  box-shadow:inset -1px 0 0 var(--line), inset 0 1px 0 rgba(255,255,255,.06) !important;
}
body.preview-redesign #editorPrimaryActions > .editor-action-button,
body.preview-redesign #editorPrimaryActions > .editor-action-button:is(:hover,:active,:focus,:focus-visible) {
  flex:1 1 0 !important;
  display:flex !important;
  width:100% !important; min-width:0 !important;
  height:46px !important; min-height:46px !important;
  padding:0 !important; border:0 !important;
  align-items:center !important; justify-content:center !important;
  grid-column:auto !important; grid-row:1 !important;
  transform:none !important; transition:none !important; animation:none !important;
}

/* Dados do exame: uma grade semântica e estável. Cada campo ocupa sempre a
   mesma região, inclusive quando a lateralidade aparece dinamicamente. */
body.preview-redesign:not(.quick-editor-mode) .editor-screen .report-form > .details-panel {
  padding:16px !important;
  border:1px solid var(--line) !important;
  border-radius:18px !important;
  background:var(--panel) !important;
  box-shadow:0 8px 24px rgba(26, 62, 56, .06) !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel > .field-grid {
  display:grid !important;
  grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  grid-template-areas:
    "patient date"
    "folder category"
    "exam exam"
    "side side"
    "more more"
    "obstetric obstetric" !important;
  gap:12px !important;
  align-items:start !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel .patient-name-field { grid-area:patient !important; }
body.preview-redesign:not(.quick-editor-mode) .details-panel .exam-date-field { grid-area:date !important; }
body.preview-redesign:not(.quick-editor-mode) .details-panel .exam-folder-field { grid-area:folder !important; }
body.preview-redesign:not(.quick-editor-mode) .details-panel .exam-subcategory-field { grid-area:category !important; }
body.preview-redesign:not(.quick-editor-mode) .details-panel .exam-type-field { grid-area:exam !important; }
body.preview-redesign:not(.quick-editor-mode) .details-panel #examSideField { grid-area:side !important; }
body.preview-redesign:not(.quick-editor-mode) .details-panel .progressive-report-details { grid-area:more !important; }
body.preview-redesign:not(.quick-editor-mode) .details-panel .obstetric-configuration { grid-area:obstetric !important; }
body.preview-redesign:not(.quick-editor-mode) .details-panel #examSideField[hidden],
body.preview-redesign:not(.quick-editor-mode) .details-panel .obstetric-configuration[hidden] {
  display:none !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel label {
  display:grid !important;
  grid-template-rows:auto 48px !important;
  gap:6px !important;
  width:100% !important;
  min-width:0 !important;
  margin:0 !important;
  color:var(--muted) !important;
  font-size:13px !important;
  font-weight:650 !important;
  line-height:1.25 !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel label > input,
body.preview-redesign:not(.quick-editor-mode) .details-panel label > select {
  display:block !important;
  width:100% !important;
  min-width:0 !important;
  height:48px !important;
  min-height:48px !important;
  max-height:48px !important;
  padding:0 14px !important;
  border:1px solid var(--line) !important;
  border-radius:14px !important;
  background:var(--surface) !important;
  color:var(--ink) !important;
  box-sizing:border-box !important;
  font-size:16px !important;
  font-weight:600 !important;
  line-height:1.25 !important;
  text-align:left !important;
  text-overflow:ellipsis !important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.06) !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel label > input:focus,
body.preview-redesign:not(.quick-editor-mode) .details-panel label > select:focus {
  border-color:var(--accent) !important;
  outline:2px solid color-mix(in srgb,var(--accent) 22%,transparent) !important;
  outline-offset:1px !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel #examSideField:not([hidden]) select:required:invalid {
  border-color:color-mix(in srgb,var(--accent) 48%,var(--line)) !important;
  color:var(--muted) !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel .progressive-report-details {
  width:100% !important;
  min-width:0 !important;
  margin:2px 0 0 !important;
  padding:12px 0 0 !important;
  border-top:1px solid var(--line) !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel .progressive-report-details > summary {
  min-height:50px !important;
  padding:0 14px !important;
  border-radius:14px !important;
  background:var(--surface) !important;
  font-size:15px !important;
  letter-spacing:0 !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel .progressive-report-fields {
  grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  gap:12px !important;
  padding:14px 0 0 !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel .progressive-report-fields .exam-search-field {
  grid-column:1 / -1 !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel #examDate,
body.preview-redesign:not(.quick-editor-mode) .details-panel #patientBirthDate {
  text-align:left !important;
  padding-inline:14px 10px !important;
  appearance:auto !important;
  -webkit-appearance:auto !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel input[type="date"]::-webkit-date-and-time-value {
  min-height:1.25em !important;
  margin:0 !important;
  text-align:left !important;
}
@media (max-width:430px) {
  body.preview-redesign:not(.quick-editor-mode) .editor-screen .report-form > .details-panel { padding:12px !important; border-radius:16px !important; }
  body.preview-redesign:not(.quick-editor-mode) .details-panel > .field-grid { gap:10px 8px !important; }
  body.preview-redesign:not(.quick-editor-mode) .details-panel label { font-size:12px !important; gap:5px !important; }
  body.preview-redesign:not(.quick-editor-mode) .details-panel label > input,
  body.preview-redesign:not(.quick-editor-mode) .details-panel label > select { padding-inline:11px !important; font-size:15px !important; border-radius:12px !important; }
  body.preview-redesign:not(.quick-editor-mode) .details-panel .progressive-report-fields { grid-template-columns:1fr !important; gap:10px !important; }
  body.preview-redesign:not(.quick-editor-mode) .details-panel .progressive-report-fields > * { grid-column:1 !important; }
}
@media (max-width:340px) {
  body.preview-redesign:not(.quick-editor-mode) .details-panel > .field-grid {
    grid-template-columns:1fr !important;
    grid-template-areas:"patient" "date" "folder" "category" "exam" "side" "more" "obstetric" !important;
  }
}

/* Override final: nenhuma regra legada do input nativo pode voltar a pintar
   ou alargar a data além da coluna. */
body.preview-redesign:not(.quick-editor-mode) .details-panel .exam-date-field {
  min-width:0 !important;
  max-width:100% !important;
  overflow:hidden !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel .date-field-shell {
  position:relative !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  width:100% !important;
  min-width:0 !important;
  max-width:100% !important;
  height:44px !important;
  min-height:44px !important;
  max-height:44px !important;
  overflow:hidden !important;
  box-sizing:border-box !important;
  border:1px solid var(--line) !important;
  border-radius:13px !important;
  background:var(--surface) !important;
  contain:layout paint !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel .date-field-display {
  position:absolute !important;
  inset:0 !important;
  z-index:1 !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  min-width:0 !important;
  padding:0 10px !important;
  overflow:hidden !important;
  box-sizing:border-box !important;
  color:var(--ink) !important;
  font-size:16px !important;
  font-weight:600 !important;
  line-height:1.2 !important;
  text-align:center !important;
  white-space:nowrap !important;
  text-overflow:ellipsis !important;
  pointer-events:none !important;
}
body.preview-redesign:not(.quick-editor-mode) .details-panel .date-field-shell > #examDate,
body.preview-redesign:not(.quick-editor-mode) .details-panel .date-field-shell > #patientBirthDate {
  position:absolute !important;
  inset:0 !important;
  z-index:2 !important;
  display:block !important;
  width:100% !important;
  min-width:0 !important;
  max-width:100% !important;
  height:100% !important;
  min-height:0 !important;
  max-height:100% !important;
  margin:0 !important;
  padding:0 !important;
  border:0 !important;
  opacity:0 !important;
  appearance:none !important;
  -webkit-appearance:none !important;
}
@media (max-width:430px) {
  body.preview-redesign:not(.quick-editor-mode) .details-panel .date-field-display {
    font-size:15px !important;
  }
}

/* Última camada do modo Tela cheia: evita que regras gerais do redesign
   comprimam as faixas e façam o cabeçalho sobrepor a barra de formatação. */
body.preview-redesign.editor-focus-mode .dictation-panel {
  display:flex !important;
  flex-direction:column !important;
  height:100dvh !important;
  min-height:0 !important;
  overflow:hidden !important;
}
body.preview-redesign.editor-focus-mode .dictation-panel > .dictation-header {
  display:grid !important;
  flex:0 0 auto !important;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr) !important;
  height:auto !important;
  min-height:82px !important;
  max-height:160px !important;
  padding:8px 12px !important;
  align-items:end !important;
  overflow:visible !important;
}
body.preview-redesign.editor-focus-mode .dictation-panel > .editor-toolbar {
  display:flex !important;
  flex:0 0 58px !important;
  width:calc(100% - 32px) !important;
  height:58px !important;
  min-height:58px !important;
  margin:8px 16px !important;
  overflow-x:auto !important;
  overflow-y:hidden !important;
  box-sizing:border-box !important;
}
body.preview-redesign.editor-focus-mode .dictation-panel > .report-editor {
  display:block !important;
  flex:1 1 auto !important;
  height:auto !important;
  min-height:0 !important;
  overflow-x:hidden !important;
  overflow-y:auto !important;
  padding:12px 14px 18px !important;
}
body.preview-redesign.editor-focus-mode .dictation-panel > .editor-bottom-bar {
  display:flex !important;
  position:relative !important;
  inset:auto !important;
  flex:0 0 68px !important;
  height:68px !important;
  min-height:68px !important;
  overflow:visible !important;
  padding:6px 10px max(8px,env(safe-area-inset-bottom)) !important;
}

/* O Editor rápido/PACS usa a barra flutuante como controle único de ditado.
   Oculta os gravadores legados e devolve integralmente o espaço ao texto. */
body.preview-redesign.quick-editor-mode .dictation-panel > .editor-bottom-bar,
body.preview-redesign.quick-editor-mode.editor-focus-mode .dictation-panel > .editor-bottom-bar,
body.preview-redesign.quick-editor-mode .dictation-panel > .paragraph-record-button {
  display:none !important;
}
body.preview-redesign.quick-editor-mode .dictation-panel > .report-editor {
  padding-bottom:18px !important;
}

/* O status inferior e o gravador principal ficam fora do editor em todos os
   modos. O microfone contextual volta ao lado do parágrafo selecionado. */
html body .dictation-panel > .editor-bottom-bar,
html body.preview-redesign.editor-focus-mode .dictation-panel > .editor-bottom-bar {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
html body .dictation-panel > .paragraph-record-button:not([hidden]) {
  display: grid !important;
  visibility: visible !important;
  pointer-events: auto !important;
}
html body .dictation-panel #recordButton,
html body .dictation-panel .record-activity-status,
html body .dictation-panel .record-control {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
html body.duty-mode .dictation-panel > .paragraph-record-button,
html body.template-manager-open .dictation-panel > .paragraph-record-button {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Ações do Editor rápido: uma única moldura leve, como a linha de ações dos
   rascunhos, em vez de três cartões concorrendo com o texto. */
body.preview-redesign.quick-editor-mode .quick-editor-inline-actions {
  display:grid !important;
  grid-template-columns:repeat(3,minmax(0,1fr)) !important;
  gap:0 !important;
  margin:8px 0 2px !important;
  padding:4px !important;
  border:1px solid var(--line) !important;
  border-radius:14px !important;
  background:color-mix(in srgb,var(--surface) 88%,transparent) !important;
}
body.preview-redesign.quick-editor-mode .quick-editor-inline-actions .quick-editor-copy-action {
  min-height:42px !important;
  min-width:0 !important;
  padding:6px 8px !important;
  border:0 !important;
  border-radius:9px !important;
  background:transparent !important;
  color:var(--ink) !important;
  box-shadow:none !important;
  font-size:.78rem !important;
  font-weight:700 !important;
  line-height:1.15 !important;
  white-space:normal !important;
}
body.preview-redesign.quick-editor-mode .quick-editor-inline-actions .quick-editor-copy-action + .quick-editor-copy-action {
  border-left:1px solid var(--line) !important;
  border-radius:0 9px 9px 0 !important;
}
body.preview-redesign.quick-editor-mode .quick-editor-inline-actions .quick-editor-copy-action:hover,
body.preview-redesign.quick-editor-mode .quick-editor-inline-actions .quick-editor-copy-action:focus-visible,
body.preview-redesign.quick-editor-mode .quick-editor-inline-actions .quick-editor-copy-action:active {
  background:color-mix(in srgb,var(--accent) 12%,transparent) !important;
  color:var(--accent-dark) !important;
}

/* Contadores da lista: a quantidade pode crescer horizontalmente, nunca
   verticalmente. O chevron permanece em sua própria coluna. */
.count-pill {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
  font-variant-numeric: tabular-nums !important;
  line-height: 1 !important;
}

.count-pill-year,
.count-pill-month {
  height: 42px !important;
  min-width: 64px !important;
  padding: 0 14px !important;
  border-radius: 21px !important;
  background: #e6f5f1 !important;
  color: #126a60 !important;
  font-size: 17px !important;
  font-weight: 700 !important;
}

.count-pill-day {
  height: 36px !important;
  min-width: 54px !important;
  padding: 0 12px !important;
  border: 1.5px solid var(--accent) !important;
  border-radius: 18px !important;
  background: transparent !important;
  color: var(--accent-dark) !important;
  font-size: 15px !important;
  font-weight: 600 !important;
}

.year-group-header,
.month-group-header {
  gap: 12px !important;
}

.date-group-header {
  grid-template-columns: minmax(0, 1fr) auto 24px !important;
  gap: 12px !important;
}

.year-group-chevron,
.month-group-chevron,
.date-group-chevron {
  flex: 0 0 24px;
  width: 24px;
  text-align: center;
}

body.dark-mode .list-screen .count-pill-year,
body.dark-mode .list-screen .count-pill-month {
  background: #dff6ef !important;
  color: #126a60 !important;
}

body.dark-mode .list-screen .count-pill-day {
  border-color: #4fd1bd !important;
  background: transparent !important;
  color: #8ce4d1 !important;
}

/* O mês aberto usa o mesmo contraste do agrupamento de ano ativo. */
body:not(.dark-mode) .list-screen .month-report-group.expanded .month-group-header {
  background: #0f766e !important;
  color: #ffffff !important;
}

body:not(.dark-mode) .list-screen .month-report-group.expanded .month-group-copy small,
body:not(.dark-mode) .list-screen .month-report-group.expanded .month-group-chevron {
  color: #e6fffa !important;
}

body:not(.dark-mode) .list-screen .month-report-group.expanded .month-group-count {
  background: #f3fffb !important;
  color: #0b5751 !important;
}

/* Cartões inferiores finais: ícone à esquerda, texto descritivo e chevron. */
.list-bottom-actions .list-bottom-action-button,
.list-bottom-actions .list-bottom-auto-draft-button,
.feedback-panel .feedback-open-button {
  display: grid !important;
  grid-template-columns: 40px minmax(0, 1fr) 24px !important;
  align-items: center !important;
  gap: 12px !important;
  width: 100% !important;
  min-height: 72px !important;
  padding: 12px 16px !important;
  border: 1px solid var(--line) !important;
  border-radius: 14px !important;
  background: var(--surface) !important;
  color: var(--ink) !important;
  box-shadow: none !important;
  text-align: left !important;
}
.list-bottom-actions .list-bottom-action-button::after { content: none !important; }
.list-bottom-actions .list-bottom-action-button > svg:first-child,
.list-bottom-actions .list-bottom-auto-draft-button > svg:first-child,
.feedback-panel .feedback-open-button > svg:first-child,
.feedback-panel .feedback-open-button > .feedback-open-icon {
  grid-column: 1 !important; grid-row: 1 !important; justify-self: center !important;
  align-self: center !important; display: block !important; margin: 0 !important;
  width: 30px !important; height: 30px !important; min-height: 30px !important;
  fill: none !important; stroke: currentColor !important; stroke-width: 1.8 !important;
  stroke-linecap: round; stroke-linejoin: round;
}
.feedback-panel .feedback-open-button > .feedback-open-icon {
  display: grid !important;
  place-items: center !important;
  transform: translateY(8px) !important;
}
.feedback-panel .feedback-open-button > .feedback-open-icon svg {
  display: block !important;
  width: 30px !important;
  height: 30px !important;
  margin: 0 !important;
}
.feedback-panel .feedback-open-button > .list-bottom-action-copy,
.feedback-panel .feedback-open-button > .list-bottom-action-chevron {
  position: relative !important;
  top: 8px !important;
}
.list-bottom-actions .list-bottom-new-symbol {
  display: grid !important; place-items: center !important; width: 36px !important; height: 36px !important;
  min-height: 36px !important; border-radius: 50% !important; background: #dff6ef !important; color: var(--accent-dark) !important;
}
.list-bottom-actions .list-bottom-new-symbol svg { width: 24px !important; height: 24px !important; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.list-bottom-actions .list-bottom-action-copy,
.feedback-panel .list-bottom-action-copy,
.list-bottom-actions .list-bottom-auto-draft-copy {
  display: grid !important; grid-column: 2 !important; grid-row: 1 !important; gap: 2px !important; min-width: 0 !important; width: 100% !important; justify-self: stretch !important; align-self: center !important; text-align: left !important;
}
.list-bottom-actions .list-bottom-action-copy strong,
.feedback-panel .list-bottom-action-copy strong { color: currentColor !important; font-size: 1rem; font-weight: 750; line-height: 1.2; }
.list-bottom-actions .list-bottom-action-copy small,
.feedback-panel .list-bottom-action-copy small,
.list-bottom-actions .list-bottom-auto-draft-copy small { color: var(--muted) !important; font-size: .82rem; font-weight: 500; line-height: 1.2; }
.list-bottom-actions .list-bottom-action-chevron,
.feedback-panel .list-bottom-action-chevron {
  grid-column: 3 !important; grid-row: 1 !important; justify-self: end !important; width: 24px !important; height: 24px !important; min-height: 24px !important;
  fill: none !important; stroke: currentColor !important; stroke-width: 1.8 !important; stroke-linecap: round; stroke-linejoin: round; opacity: .8;
}
.list-bottom-actions .list-bottom-action-button:hover,
.list-bottom-actions .list-bottom-action-button:focus-visible,
.feedback-panel .feedback-open-button:hover,
.feedback-panel .feedback-open-button:focus-visible { border-color: var(--accent) !important; background: color-mix(in srgb, var(--accent) 7%, var(--surface)) !important; color: var(--accent-dark) !important; }
.list-bottom-actions .list-bottom-auto-draft-button { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)) !important; background: #e7f8f2 !important; color: var(--accent-dark) !important; }
body.dark-mode .list-bottom-actions .list-bottom-action-button,
body.dark-mode .list-bottom-actions .list-bottom-auto-draft-button,
body.dark-mode .feedback-panel .feedback-open-button { border-color: #3a514b !important; background: #192321 !important; color: #f4faf7 !important; }
body.dark-mode .list-bottom-actions .list-bottom-action-button:hover,
body.dark-mode .list-bottom-actions .list-bottom-action-button:focus-visible,
body.dark-mode .feedback-panel .feedback-open-button:hover,
body.dark-mode .feedback-panel .feedback-open-button:focus-visible { border-color: #65cfc0 !important; background: #21332f !important; color: #c7fff6 !important; }
body.dark-mode .list-bottom-actions .list-bottom-action-copy small,
body.dark-mode .feedback-panel .list-bottom-action-copy small,
body.dark-mode .list-bottom-actions .list-bottom-auto-draft-copy small { color: #b7c9c4 !important; }
body.dark-mode .list-bottom-actions .list-bottom-new-symbol { background: #24534d !important; color: #a9f4e6 !important; }
body.dark-mode .list-bottom-actions .list-bottom-auto-draft-button { border-color: #42786f !important; background: #173e3a !important; color: #c7fff6 !important; }
/* Cores finais dos desenhos, separadas da cor do texto do cartão. */
.list-bottom-actions .list-bottom-action-button > svg:first-child,
.list-bottom-actions .list-bottom-auto-draft-button > svg:first-child,
.feedback-panel .feedback-open-button > svg:first-child,
.feedback-panel .feedback-open-button > .feedback-open-icon,
.feedback-panel .feedback-open-button > .feedback-open-icon svg,
.list-bottom-actions .list-bottom-new-symbol svg { color: #0f766e !important; }
body.dark-mode .list-bottom-actions .list-bottom-action-button > svg:first-child,
body.dark-mode .list-bottom-actions .list-bottom-auto-draft-button > svg:first-child,
body.dark-mode .feedback-panel .feedback-open-button > svg:first-child,
body.dark-mode .feedback-panel .feedback-open-button > .feedback-open-icon,
body.dark-mode .feedback-panel .feedback-open-button > .feedback-open-icon svg,
body.dark-mode .list-bottom-actions .list-bottom-new-symbol svg { color: #70e3d3 !important; }
.list-bottom-actions .list-bottom-draft-icon { stroke-width: 2.3 !important; }
.list-bottom-actions .auto-draft-return-icon {
  width: 32px !important;
  height: 32px !important;
  min-height: 32px !important;
  object-fit: contain;
  display: block;
}
@media (max-width:700px) {
  body.preview-redesign.editor-focus-mode .dictation-panel > .dictation-header {
    grid-template-columns:1fr !important;
    min-height:122px !important;
    max-height:190px !important;
    align-items:stretch !important;
    gap:4px !important;
  }
  body.preview-redesign.editor-focus-mode .dictation-panel > .editor-toolbar {
    flex-basis:54px !important;
    height:54px !important;
    min-height:54px !important;
  }
}

/* O cabeçalho do Editor rápido mantém o aviso em uma linha legível no
   celular, sem comprimir o seletor de microfone. */
@media (max-width: 700px) {
  body.preview-redesign.quick-editor-mode .dictation-header {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas: "title" "audio" "mode" !important;
    gap: 6px !important;
    min-height: 0 !important;
    padding: 8px 10px !important;
  }
  body.preview-redesign.quick-editor-mode .dictation-header > div:first-child {
    grid-area: title !important;
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) !important;
    align-items: baseline !important;
    gap: 4px 10px !important;
    min-width: 0 !important;
  }
  body.preview-redesign.quick-editor-mode .dictation-header > div:first-child h2 {
    grid-column: 1 !important;
    margin: 0 !important;
    white-space: nowrap !important;
  }
  body.preview-redesign.quick-editor-mode .dictation-header > div:first-child p {
    grid-column: 2 !important;
    min-width: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: .78rem !important;
  }
  body.preview-redesign.quick-editor-mode .dictation-header .audio-source-field { grid-area: audio !important; }
  body.preview-redesign.quick-editor-mode .dictation-header .dictation-mode-field { grid-area: mode !important; }
}

/* Aplicação final do padrão cápsula aos campos do cadastro e do laudo. */
body .patient-dialog input,
body .patient-dialog select,
body.preview-redesign:not(.quick-editor-mode) .details-panel input,
body.preview-redesign:not(.quick-editor-mode) .details-panel select,
body.preview-redesign .dictation-header select,
body.preview-redesign .dictation-mode-field select {
  border-radius: 999px !important;
}

/* Setas dos campos: mantemos uma area de toque confortavel e uma margem
   interna constante, sem deixar o chevron colado na borda. */
html body.preview-redesign select:not([multiple]):not(.editor-toolbar select):not(.audio-source-field select):not(.dictation-mode-field select) {
  appearance: none !important;
  -webkit-appearance: none !important;
  padding-right: 38px !important;
  background-repeat: no-repeat !important;
  background-position: right 14px center !important;
  background-size: 15px 15px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%230b5751' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}

html body.dark-mode.preview-redesign select:not([multiple]):not(.editor-toolbar select):not(.audio-source-field select):not(.dictation-mode-field select) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23b8fff3' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}

/* Selects nativos mantêm um único chevron pequeno. A imagem customizada
   anterior podia ser pintada junto com a seta do navegador, sobrepondo o
   texto em cápsulas estreitas como Clínica e Microfone. */
html body.preview-redesign .list-screen .clinic-filter-control select,
html body.preview-redesign .dictation-panel .audio-source-field select,
html body.preview-redesign .dictation-panel .dictation-mode-field select {
  appearance: auto !important;
  -webkit-appearance: auto !important;
  background: transparent !important;
  background-image: none !important;
  background-position: initial !important;
  background-size: auto !important;
  padding-right: 32px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

html body.preview-redesign .dictation-panel .audio-source-field {
  font-size: 0 !important;
}
html body.preview-redesign .dictation-panel .audio-source-field select {
  font-size: 13px !important;
  appearance: auto !important;
  -webkit-appearance: auto !important;
  background: transparent !important;
  background-image: none !important;
  padding-left: 6px !important;
  padding-right: 28px !important;
}

html body.preview-redesign .year-group-chevron,
html body.preview-redesign .month-group-chevron,
html body.preview-redesign .date-group-chevron {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  padding: 0 6px !important;
  line-height: 1 !important;
  transform: translateY(-2px) !important;
}

html body.preview-redesign .bulk-date-control .bulk-date-step {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  position: relative !important;
  padding: 0 !important;
  font-size: 0 !important;
  line-height: 1 !important;
}
html body.preview-redesign .bulk-date-control .bulk-date-step::before {
  content: "" !important;
  display: block !important;
  width: 12px !important;
  height: 12px !important;
  box-sizing: border-box !important;
  border: solid currentColor !important;
  border-width: 0 0 3px 3px !important;
  transform: rotate(45deg) !important;
  transform-origin: center !important;
}
html body.preview-redesign .bulk-date-control .bulk-date-step:last-child::before {
  border-width: 0 3px 3px 0 !important;
  transform: rotate(-45deg) !important;
}

/* Camada final do layout desktop: filtros sem sobreposição, máscaras
   acessíveis e barra de edição alinhada à coluna do editor. */
@media (min-width: 1100px) {
  body.preview-redesign .list-screen > .bulk-panel,
  body.preview-redesign .list-screen .list-filter-details,
  body.preview-redesign .list-screen .list-filter-grid {
    position: relative !important;
    z-index: 40 !important;
    overflow: visible !important;
  }
  body.preview-redesign .list-screen .bulk-folder-field,
  body.preview-redesign .list-screen .bulk-modality-field,
  body.preview-redesign .list-screen .bulk-exam-field {
    grid-column: 1 / -1 !important;
    min-width: 0 !important;
  }
  body.preview-redesign .list-screen .clinic-filter-control {
    grid-template-columns: minmax(0, 1fr) minmax(210px, 0.4fr) !important;
    min-width: 0 !important;
  }
  body.preview-redesign .editor-recent-sidebar {
    height: calc(100vh - 104px) !important;
    max-height: calc(100vh - 104px) !important;
  }
  body.preview-redesign .editor-recent-sidebar-content,
  body.preview-redesign .editor-recent-list {
    flex: 1 1 auto !important;
  }
  body.preview-redesign .editor-recent-list { max-height: none !important; }
  body.preview-redesign.quick-editor-mode .template-tools-card {
    grid-template-columns: minmax(250px, 0.8fr) minmax(0, 1fr) auto !important;
  }
  body.preview-redesign.quick-editor-mode #openTemplateManagerButton {
    display: inline-flex !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }
  body.preview-redesign:has(#editorScreen:not([hidden])) .duty-mode-floating {
    left: calc(max(0px, (100vw - 1560px) / 2) + 338px) !important;
    right: calc(max(0px, (100vw - 1560px) / 2) + 28px) !important;
    width: auto !important;
    max-width: none !important;
    justify-content: center !important;
  }
  body.preview-redesign:has(#editorScreen.recent-sidebar-collapsed:not([hidden])) .duty-mode-floating {
    left: calc(max(0px, (100vw - 1560px) / 2) + 100px) !important;
  }
  body.preview-redesign .editor-recent-filters:has([data-editor-recent-filter="clinic"]:not([hidden])) {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

.editor-recent-sidebar {
  display: none;
}

.editor-recent-sidebar-toggle,
.editor-recent-search svg,
.editor-recent-sidebar-toggle svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Aproveitamento de monitores largos.
   A interface móvel permanece em uma única coluna; no computador, a lista
   ganha uma coluna de trabalho para filtros/atalhos e outra para os exames. */
@media (min-width: 1100px) {
  body.preview-redesign .app-shell {
    padding: 24px clamp(24px, 3vw, 52px) 36px !important;
  }

  body.preview-redesign .list-screen:not([hidden]) {
    display: grid !important;
    grid-template-columns: minmax(350px, 410px) minmax(0, 1fr) !important;
    grid-template-areas:
      "header header"
      "filters reports"
      "shortcuts reports"
      "feedback reports"
      ". total" !important;
    width: min(1480px, 100%) !important;
    min-height: calc(100vh - 108px) !important;
    align-content: start !important;
    overflow: visible !important;
    position: relative !important;
  }

  body.preview-redesign .list-screen > .list-topbar {
    grid-area: header !important;
  }

  body.preview-redesign .list-screen > .bulk-panel {
    grid-area: filters !important;
    align-self: start !important;
    border-right: 1px solid var(--line) !important;
    border-bottom: 1px solid var(--line) !important;
    padding: 18px !important;
  }

  body.preview-redesign .list-screen > .queue-list,
  body.preview-redesign .list-screen > .list-results-column > .queue-list {
    grid-area: reports !important;
    align-self: stretch !important;
    min-width: 0 !important;
    min-height: 0 !important;
    border-left: 0 !important;
    background: var(--panel) !important;
  }

  body.preview-redesign .list-screen > .list-bottom-actions {
    grid-area: shortcuts !important;
    align-self: start !important;
    border-right: 1px solid var(--line) !important;
    padding: 14px 18px !important;
  }

  body.preview-redesign .list-screen > .feedback-panel {
    grid-area: feedback !important;
    align-self: start !important;
    border-right: 1px solid var(--line) !important;
    border-bottom: 1px solid var(--line) !important;
    padding: 14px 18px 18px !important;
  }

  body.preview-redesign .list-screen > .list-total-summary {
    grid-area: total !important;
  }

  /* A coluna de comandos fica compacta e estável; o histórico ocupa somente
     a coluna direita, sem empurrar Novo laudo, Rascunhos e Academia para o
     fim de uma faixa vazia. */
  body.preview-redesign .list-screen:not([hidden]) {
    grid-template-rows: auto auto !important;
    grid-template-areas: none !important;
  }
  body.preview-redesign .list-screen > .list-topbar { grid-column: 1 / -1 !important; grid-row: 1 !important; }
  body.preview-redesign .list-screen > .list-left-column {
    grid-column: 1 !important;
    grid-row: 2 !important;
    display: grid !important;
    align-content: start !important;
    position: relative !important;
    top: auto !important;
    align-self: start !important;
    max-height: calc(100vh - 32px) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    z-index: 2 !important;
  }
  body.preview-redesign .list-screen > .list-left-column.is-pinned {
    position: fixed !important;
    top: 0 !important;
    left: var(--list-column-left) !important;
    width: var(--list-column-width) !important;
    max-height: 100vh !important;
    z-index: 30 !important;
  }
  body.preview-redesign .list-screen > .list-left-column.is-at-end {
    position: absolute !important;
    inset: auto auto 0 0 !important;
    width: var(--list-column-width) !important;
    max-height: 100vh !important;
    z-index: 30 !important;
  }
  body.preview-redesign .list-screen > .list-left-column > .bulk-panel {
    position: static !important;
    border-right: 1px solid var(--line) !important;
    border-bottom: 1px solid var(--line) !important;
    padding: 18px !important;
  }
  body.preview-redesign .list-screen > .list-left-column > .list-bottom-actions {
    position: static !important;
    padding: 14px 18px !important;
    border-right: 1px solid var(--line) !important;
  }
  body.preview-redesign .list-screen > .list-left-column > .list-bottom-actions > .feedback-panel {
    position: static !important;
    margin: 0 !important;
    border: 0 !important;
    padding: 8px 0 0 !important;
  }
  body.preview-redesign .list-screen > .list-left-column > .list-bottom-actions > .feedback-panel {
    width: 100% !important;
    padding: 0 !important;
    background: transparent !important;
  }
  body.preview-redesign .list-screen > .list-left-column > .list-bottom-actions > .feedback-panel > .feedback-open-button {
    width: 100% !important;
    margin: 0 !important;
    border-radius: 14px !important;
  }
  body.preview-redesign .list-screen > .list-results-column {
    grid-column: 2 !important;
    grid-row: 2 !important;
    display: grid !important;
    grid-template-rows: auto auto !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-content: start !important;
    min-width: 0 !important;
    background: var(--panel) !important;
  }
  body.preview-redesign .list-screen > .list-results-column > .queue-list {
    grid-area: auto !important;
    grid-column: 1 !important;
    grid-row: 1 !important;
    min-height: 0 !important;
    overflow: visible !important;
  }
  body.preview-redesign .list-screen > .list-results-column > .list-total-summary {
    grid-area: auto !important;
    grid-column: 1 !important;
    grid-row: 2 !important;
    width: 100% !important;
    position: static !important;
  }

  /* Menus e caixas modais sempre ficam acima da coluna de filtros. */
  body.preview-redesign .list-screen,
  body.preview-redesign .list-screen > .bulk-panel,
  body.preview-redesign .list-screen .list-filter-details,
  body.preview-redesign .list-screen .list-filter-grid { z-index: 1 !important; }
  body.preview-redesign .productivity-gate:not([hidden]),
  body.preview-redesign .admin-gate:not([hidden]),
  body.preview-redesign .about-gate:not([hidden]),
  body.preview-redesign .academy-gate:not([hidden]),
  body.preview-redesign .template-manager-gate:not([hidden]),
  body.preview-redesign .draft-notebook-gate:not([hidden]) { z-index: 120 !important; }

  body.preview-redesign .workspace.editor-screen:not([hidden]) {
    display: grid !important;
    grid-template-columns: 310px minmax(0, 1fr) !important;
    align-items: start !important;
    width: min(1560px, 100%) !important;
  }

  body.preview-redesign .editor-screen.recent-sidebar-collapsed {
    grid-template-columns: 72px minmax(0, 1fr) !important;
  }

  body.preview-redesign .editor-screen > .topbar {
    grid-column: 1 / -1 !important;
    padding-inline: 28px !important;
  }

  body.preview-redesign .editor-screen > .report-form {
    grid-column: 2 !important;
    min-width: 0 !important;
    gap: 20px !important;
    padding: 24px 28px 32px !important;
  }

  body.preview-redesign .editor-recent-sidebar {
    display: flex;
    grid-column: 1;
    flex-direction: column;
    align-self: start;
    min-width: 0;
    height: calc(100vh - 104px) !important;
    max-height: calc(100vh - 104px) !important;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--panel) 94%, var(--accent) 6%);
    overflow: hidden;
    position: sticky;
    top: 16px;
  }

  body.preview-redesign .editor-recent-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 72px;
    padding: 14px 14px 12px 18px;
    border-bottom: 1px solid var(--line);
  }

  body.preview-redesign .editor-recent-sidebar-heading {
    display: grid;
    min-width: 0;
    gap: 2px;
  }

  body.preview-redesign .editor-recent-sidebar-heading .eyebrow {
    margin: 0;
    color: var(--accent-dark);
    font-size: 0.68rem;
    letter-spacing: 0.09em;
  }

  body.preview-redesign .editor-recent-sidebar-heading strong {
    overflow: hidden;
    font-size: 1rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.preview-redesign .editor-recent-sidebar-toggle {
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: transparent;
    color: var(--accent-dark);
  }

  body.preview-redesign .editor-recent-sidebar-toggle:hover,
  body.preview-redesign .editor-recent-sidebar-toggle:focus-visible {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
  }

  body.preview-redesign .editor-recent-sidebar-toggle svg {
    width: 20px;
    height: 20px;
  }

  body.preview-redesign .editor-recent-sidebar-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    padding: 14px;
    overflow: hidden;
    position: relative;
    z-index: 1;
  }

  body.preview-redesign .editor-recent-search {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
    flex: 0 0 auto;
    position: relative;
    z-index: 3;
  }

  body.preview-redesign .editor-recent-search:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
  }

  body.preview-redesign .editor-recent-search svg {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    color: var(--accent-dark);
  }

  body.preview-redesign .editor-recent-search input {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 0;
    border: 0 !important;
    border-radius: 0 !important;
    outline: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    color: var(--text);
    font: inherit;
    font-size: 0.84rem;
  }

  body.preview-redesign .editor-recent-search input:focus,
  body.preview-redesign .editor-recent-search input:focus-visible {
    border: 0 !important;
    outline: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body.preview-redesign .editor-recent-search input::-webkit-search-decoration,
  body.preview-redesign .editor-recent-search input::-webkit-search-results-button,
  body.preview-redesign .editor-recent-search input::-webkit-search-results-decoration {
    display: none;
  }

  body.preview-redesign .editor-recent-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    margin: 12px 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    flex: 0 0 auto;
    position: relative;
    z-index: 3;
  }

  body.preview-redesign .editor-recent-filters button {
    min-width: 0;
    min-height: 32px;
    padding: 5px 7px;
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
  }

  body.preview-redesign .editor-recent-filters button:last-child {
    border-right: 0;
  }

  body.preview-redesign .editor-recent-filters button.active {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent-dark);
  }

  body.preview-redesign.quick-editor-mode .editor-recent-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* As abas de máscaras formam uma única cápsula; as divisórias ficam
     somente entre os itens e o estado ativo preenche a sua faixa inteira. */
  html body.preview-redesign .editor-recent-filters {
    gap: 0 !important;
    border: 1px solid var(--line) !important;
    border-radius: 999px !important;
    overflow: hidden !important;
    background: var(--surface) !important;
  }

  html body.preview-redesign .editor-recent-filters button,
  html body.preview-redesign .editor-recent-filters button.active {
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  html body.preview-redesign .editor-recent-filters button + button {
    border-left: 1px solid color-mix(in srgb, var(--line) 86%, transparent) !important;
  }

html body.preview-redesign .editor-recent-filters button.active {
    background: color-mix(in srgb, var(--accent) 14%, var(--surface)) !important;
    color: var(--accent-dark) !important;
  }

  html body.preview-redesign .editor-template-modalities {
    display: grid;
    gap: 5px;
    margin: -4px 0 10px;
    padding: 7px 8px 8px;
    border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
    border-radius: 12px;
    background: color-mix(in srgb, var(--surface) 72%, var(--accent) 5%);
  }

  html body.preview-redesign .editor-template-modalities-label {
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  html body.preview-redesign .editor-template-modality-options {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
  }

  html body.preview-redesign .editor-template-modality-options button,
  html body.preview-redesign .editor-template-modality-options button.active {
    min-width: 0;
    min-height: 28px;
    padding: 4px 3px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--muted);
    font-size: 0.61rem;
    font-weight: 800;
    line-height: 1.1;
    white-space: nowrap;
  }

  html body.preview-redesign .editor-template-modality-options button + button {
    border-left: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
  }

  html body.preview-redesign .editor-template-modality-options button.active {
    background: color-mix(in srgb, var(--accent) 16%, var(--surface));
    color: var(--accent-dark);
  }

  body.preview-redesign .editor-clinic-chooser {
    position: absolute;
    top: 104px;
    left: 10px;
    right: 10px;
    z-index: 12;
    display: grid;
    gap: 4px;
    max-height: min(280px, 42vh);
    padding: 6px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: 0 14px 28px color-mix(in srgb, #123 18%, transparent);
  }
  body.preview-redesign .editor-clinic-chooser[hidden] { display: none !important; }
  body.preview-redesign .editor-clinic-chooser-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 5px 6px;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    font-size: .72rem;
  }
  body.preview-redesign .editor-clinic-chooser-header button {
    min-height: 26px;
    padding: 3px 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: transparent;
    color: var(--accent-dark);
    font-size: .68rem;
    font-weight: 700;
  }
  body.preview-redesign .editor-clinic-chooser-header button:hover,
  body.preview-redesign .editor-clinic-chooser-header button:focus-visible {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  }

  body.preview-redesign .editor-clinic-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--text);
    text-align: left;
  }

  body.preview-redesign .editor-clinic-option:hover,
  body.preview-redesign .editor-clinic-option:focus-visible,
  body.preview-redesign .editor-clinic-option.active {
    border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
    background: color-mix(in srgb, var(--accent) 12%, var(--surface));
    color: var(--accent-dark);
  }

  body.preview-redesign .editor-clinic-option > span {
    display: grid;
    gap: 2px;
    min-width: 0;
  }

  body.preview-redesign .editor-clinic-option strong,
  body.preview-redesign .editor-clinic-option small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.preview-redesign .editor-clinic-option strong { font-size: .78rem; }
  body.preview-redesign .editor-clinic-option small { color: var(--muted); font-size: .68rem; }
  body.preview-redesign .editor-clinic-option > svg {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    opacity: 0;
  }
  body.preview-redesign .editor-clinic-option.active > svg { opacity: 1; }
  body.preview-redesign .editor-clinic-chooser-empty {
    margin: 4px;
    color: var(--muted);
    font-size: .78rem;
  }

  /* O seletor de clínicas deve se destacar da lista sem repetir o formato
     de cápsula dos filtros superiores. */
  html body.preview-redesign .editor-clinic-chooser {
    padding: 8px !important;
    border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)) !important;
    border-radius: 12px !important;
    background: color-mix(in srgb, var(--surface) 92%, var(--accent) 8%) !important;
    box-shadow: 0 16px 30px color-mix(in srgb, #102a26 22%, transparent) !important;
  }
  html body.preview-redesign .editor-clinic-chooser-header {
    padding: 3px 5px 8px !important;
    border-bottom: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line)) !important;
    color: var(--text) !important;
    letter-spacing: .01em;
  }
  html body.preview-redesign .editor-clinic-chooser-header button {
    min-height: 26px !important;
    border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)) !important;
    border-radius: 7px !important;
    background: transparent !important;
    color: var(--accent-dark) !important;
  }
  html body.preview-redesign .editor-clinic-option,
  html body.preview-redesign .editor-clinic-option.active {
    min-height: 48px !important;
    padding: 8px 10px !important;
    border: 1px solid transparent !important;
    border-radius: 8px !important;
    background: transparent !important;
    color: var(--text) !important;
    text-align: left !important;
  }
  html body.preview-redesign .editor-clinic-option:hover,
  html body.preview-redesign .editor-clinic-option:focus-visible {
    border-color: color-mix(in srgb, var(--accent) 36%, var(--line)) !important;
    background: color-mix(in srgb, var(--accent) 8%, var(--surface)) !important;
  }
  html body.preview-redesign .editor-clinic-option.active {
    border-color: color-mix(in srgb, var(--accent) 58%, var(--line)) !important;
    background: color-mix(in srgb, var(--accent) 17%, var(--surface)) !important;
    color: var(--accent-dark) !important;
  }
  html body.preview-redesign .editor-clinic-option strong {
    font-size: .82rem !important;
    font-weight: 700 !important;
  }
  html body.preview-redesign .editor-clinic-option small {
    font-size: .7rem !important;
    font-weight: 500 !important;
    color: var(--muted) !important;
  }
  html body.preview-redesign .editor-clinic-option.active small {
    color: color-mix(in srgb, var(--accent-dark) 78%, var(--muted)) !important;
  }
  html body.preview-redesign .editor-clinic-option > svg {
    width: 17px !important;
    height: 17px !important;
    color: var(--accent-dark) !important;
  }
  html body.dark-mode.preview-redesign .editor-clinic-chooser {
    border-color: #3d756b !important;
    background: #263b37 !important;
    box-shadow: 0 18px 34px rgba(0, 0, 0, .38) !important;
  }
  html body.dark-mode.preview-redesign .editor-clinic-chooser-header {
    border-bottom-color: #315a53 !important;
    color: #f2fbf7 !important;
  }
  html body.dark-mode.preview-redesign .editor-clinic-chooser-header button {
    border-color: #4a9185 !important;
    color: #a9f4e6 !important;
  }
  html body.dark-mode.preview-redesign .editor-clinic-option,
  html body.dark-mode.preview-redesign .editor-clinic-option.active {
    color: #f2fbf7 !important;
    background: #1d302c !important;
  }
  html body.dark-mode.preview-redesign .editor-clinic-option + .editor-clinic-option {
    border-top-color: #315a53 !important;
  }
  html body.dark-mode.preview-redesign .editor-clinic-option:hover,
  html body.dark-mode.preview-redesign .editor-clinic-option:focus-visible {
    border-color: #4a9185 !important;
    background: #243d38 !important;
  }
  html body.dark-mode.preview-redesign .editor-clinic-option.active {
    border-color: #69cfc0 !important;
    background: #2b8073 !important;
    color: #d5fff6 !important;
  }
  html body.dark-mode.preview-redesign .editor-clinic-option small {
    color: #b7c9c4 !important;
  }
  html body.dark-mode.preview-redesign .editor-clinic-option.active small {
    color: #bff9ee !important;
  }

  body.preview-redesign .editor-recent-list {
    display: grid;
    align-content: start;
    grid-auto-rows: minmax(58px, max-content);
    gap: 0;
    min-height: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    position: relative;
    z-index: 1;
  }

  body.preview-redesign .editor-recent-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 4px 10px;
    width: 100%;
    min-width: 0;
    min-height: 58px;
    padding: 8px 10px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 5px !important;
    background: transparent;
    color: var(--text);
    text-align: left;
  }

  body.preview-redesign .editor-recent-sidebar .editor-recent-item,
  body.preview-redesign .editor-recent-sidebar .editor-template-item {
    width: calc(100% - 8px) !important;
    margin: 3px 4px !important;
    min-height: 58px !important;
    height: auto !important;
    border: 1px solid transparent !important;
    border-radius: 10px !important;
    box-shadow: none !important;
  }

  body.preview-redesign .editor-recent-item:last-child {
    border-bottom: 0;
  }

  body.preview-redesign .editor-recent-item:hover,
  body.preview-redesign .editor-recent-item:focus-visible {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, var(--panel));
    transform: none;
  }

  body.preview-redesign .editor-recent-item.active {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 11%, var(--panel));
    box-shadow: inset 3px 0 0 var(--accent);
  }

  body.preview-redesign .editor-recent-item-main {
    display: grid;
    min-width: 0;
    gap: 3px;
  }

  body.preview-redesign .editor-recent-item-main strong,
  body.preview-redesign .editor-recent-item-main small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.preview-redesign .editor-recent-item-main strong {
    font-size: 0.82rem;
    font-weight: 650;
  }

  body.preview-redesign .editor-recent-item-main small {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 500;
  }

  body.preview-redesign .editor-recent-item-meta {
    display: grid;
    justify-items: end;
    gap: 3px;
    color: var(--muted);
    font-size: 0.7rem;
  }

  body.preview-redesign .editor-recent-status {
    display: inline-flex;
    align-items: center;
    min-height: 0;
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: var(--accent-dark);
    font-weight: 800;
  }

  body.preview-redesign .editor-recent-status.draft {
    background: transparent;
    color: #9a6100;
  }

  body.preview-redesign .editor-recent-empty {
    margin: 10px 4px;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.45;
  }

  body.preview-redesign .editor-screen.recent-sidebar-collapsed .editor-recent-sidebar-header {
    justify-content: center;
    padding-inline: 10px;
  }

  body.preview-redesign .editor-screen.recent-sidebar-collapsed .editor-recent-sidebar-heading,
  body.preview-redesign .editor-screen.recent-sidebar-collapsed .editor-recent-sidebar-content {
    display: none;
  }

  body.preview-redesign .editor-screen.recent-sidebar-collapsed .editor-recent-sidebar-toggle svg {
    transform: rotate(180deg);
  }

  body.preview-redesign.editor-focus-mode .editor-screen {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.preview-redesign.editor-focus-mode .editor-recent-sidebar {
    display: none !important;
  }

  body.preview-redesign.editor-focus-mode .editor-screen > .report-form {
    grid-column: 1 !important;
  }

  body.preview-redesign .workspace.editor-screen:not([hidden]) {
    grid-template-columns: clamp(340px, 24vw, 380px) minmax(0, 1fr) !important;
  }

  body.preview-redesign .editor-screen.recent-sidebar-collapsed {
    grid-template-columns: 72px minmax(0, 1fr) !important;
  }

  /* No computador, o Editor PACS troca pacientes por máscaras na mesma
     coluna lateral. O cartão central fica apenas como barra de contexto e
     mantém as ações complementares disponíveis sem repetir o seletor. */
  body.preview-redesign.quick-editor-mode .template-tools-card {
    display: grid !important;
    grid-template-columns: minmax(270px, 1fr) auto auto !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 9px 10px !important;
    border-radius: 14px !important;
  }

  body.preview-redesign.quick-editor-mode .template-tools-current {
    min-width: 0 !important;
    padding: 0 !important;
    border-bottom: 0 !important;
  }

  body.preview-redesign.quick-editor-mode .template-tools-card .template-row-primary {
    display: flex !important;
    width: auto !important;
    gap: 6px !important;
  }

  body.preview-redesign.quick-editor-mode #openTemplateManagerButton {
    display: inline-grid !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  body.preview-redesign.quick-editor-mode .template-tools-card .template-row-primary .template-action-button {
    display: inline-grid !important;
    grid-template-columns: 18px minmax(0, auto) !important;
    width: auto !important;
    min-height: 38px !important;
    padding: 7px 10px !important;
    font-size: 0.75rem !important;
  }

  body.preview-redesign.quick-editor-mode .template-tools-card .template-row-primary .template-action-icon {
    width: 18px !important;
    height: 18px !important;
  }

  body.preview-redesign.quick-editor-mode .template-more-actions {
    padding-top: 0 !important;
    border-top: 0 !important;
  }

  body.preview-redesign.quick-editor-mode .template-more-actions summary {
    min-height: 38px !important;
    padding-inline: 12px !important;
    white-space: nowrap !important;
  }

  body.preview-redesign.quick-editor-mode .template-more-actions[open] {
    grid-column: 1 / -1 !important;
    width: 100% !important;
  }

  body.preview-redesign .editor-screen .details-panel .field-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
  }

  body.preview-redesign:not(.quick-editor-mode) .editor-screen .details-panel > .field-grid {
    grid-template-areas:
      "patient patient patient patient date date folder folder folder category category category"
      "exam exam exam exam exam exam side side side side more more"
      "obstetric obstetric obstetric obstetric obstetric obstetric obstetric obstetric obstetric obstetric obstetric obstetric" !important;
  }

  body.preview-redesign:not(.quick-editor-mode) .editor-screen .details-panel > .field-grid:has(#examSideField[hidden]) {
    grid-template-areas:
      "patient patient patient patient date date folder folder folder category category category"
      "exam exam exam exam exam exam exam exam exam exam more more"
      "obstetric obstetric obstetric obstetric obstetric obstetric obstetric obstetric obstetric obstetric obstetric obstetric" !important;
  }

  body.preview-redesign:not(.quick-editor-mode) .editor-screen .details-panel #examSideField {
    grid-area: side !important;
  }

  body.preview-redesign:not(.quick-editor-mode) .editor-screen .details-panel .progressive-report-details {
    grid-area: more !important;
  }

  body.preview-redesign:not(.quick-editor-mode) .editor-screen .details-panel .progressive-report-details[open] {
    grid-area: auto !important;
    grid-column: 1 / -1 !important;
    grid-row: 3 !important;
  }

  body.preview-redesign:not(.quick-editor-mode) .editor-screen .details-panel > .field-grid:has(.progressive-report-details[open]) .obstetric-configuration {
    grid-column: 1 / -1 !important;
    grid-row: 4 !important;
  }

  body.preview-redesign:not(.quick-editor-mode) .editor-screen .progressive-report-fields {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
  body.preview-redesign:not(.quick-editor-mode) .editor-screen .progressive-report-fields > :nth-child(1) { grid-column: 1 / 3 !important; }
  body.preview-redesign:not(.quick-editor-mode) .editor-screen .progressive-report-fields > :nth-child(2) { grid-column: 3 / 5 !important; }
  body.preview-redesign:not(.quick-editor-mode) .editor-screen .progressive-report-fields > :nth-child(3) { grid-column: 1 / 3 !important; }
  body.preview-redesign:not(.quick-editor-mode) .editor-screen .progressive-report-fields > .exam-search-field { grid-column: 3 / 5 !important; }

  body.preview-redesign .editor-screen .dictation-panel .report-editor {
    min-height: 520px !important;
  }
}

/* Ajuste final da barra compacta de microfone/contexto (após os estilos
   responsivos legados, para impedir sobreposição no celular). */
html body.preview-redesign .dictation-panel .dictation-header {
  display: flex !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
  min-height: 62px !important;
  height: auto !important;
  padding: 8px 10px !important;
  overflow: visible !important;
}
html body.preview-redesign .dictation-panel .dictation-header > div:first-child {
  flex: 0 0 auto !important;
  min-width: 0 !important;
}
html body.preview-redesign .dictation-panel .dictation-header h2 {
  margin: 0 !important;
  font-size: clamp(16px, 4.2vw, 20px) !important;
  line-height: 1.1 !important;
  white-space: nowrap !important;
}
html body.preview-redesign .dictation-panel .dictation-header > div:first-child p {
  display: none !important;
}
html body.preview-redesign .dictation-panel .dictation-header > .dictation-header-controls {
  display: flex !important;
  align-items: center !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  max-width: calc(100% - 52px) !important;
  margin-left: auto !important;
  gap: 6px !important;
  padding: 5px 7px !important;
  border: 1px solid var(--line) !important;
  border-radius: 999px !important;
  background: var(--panel) !important;
  overflow: hidden !important;
}
html body.preview-redesign .dictation-panel .dictation-header .audio-source-field {
  display: flex !important;
  align-items: center !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  max-width: none !important;
  gap: 4px !important;
  margin: 0 !important;
  font-size: clamp(10px, 2.5vw, 12px) !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}
html body.preview-redesign .dictation-panel .dictation-header .audio-source-field select {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  width: auto !important;
  max-width: none !important;
  min-height: 30px !important;
  height: 30px !important;
  padding: 0 20px 0 5px !important;
  border: 0 !important;
  background: transparent !important;
  font-size: clamp(11px, 2.8vw, 13px) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
html body.preview-redesign .dictation-panel .dictation-header .dictation-context-field {
  display: flex !important;
  align-items: center !important;
  flex: 0 1 auto !important;
  min-width: 0 !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
}
html body.preview-redesign .dictation-panel .dictation-header .contextual-generate-button {
  flex: 0 1 auto !important;
  width: auto !important;
  min-width: 102px !important;
  max-width: 132px !important;
  min-height: 30px !important;
  height: 30px !important;
  padding: 0 9px !important;
  border-radius: 999px !important;
  font-size: clamp(11px, 2.8vw, 13px) !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
@media (max-width: 380px) {
  html body.preview-redesign .dictation-panel .dictation-header {
    gap: 5px !important;
    padding-inline: 7px !important;
  }
  html body.preview-redesign .dictation-panel .dictation-header > .dictation-header-controls {
    gap: 3px !important;
    padding-inline: 5px !important;
    max-width: calc(100% - 48px) !important;
  }
  html body.preview-redesign .dictation-panel .dictation-header .audio-source-field {
    font-size: 0 !important;
  }
  html body.preview-redesign .dictation-panel .dictation-header .contextual-generate-button {
    min-width: 94px !important;
    padding-inline: 6px !important;
  }
}
