/* The approved desktop reference is docs/design/reference/01-workspace.png.
   Keep the large left-hand anatomy panel and separate right-hand input cards.
   Mobile stacks the same controls without shrinking the touch targets. */
@font-face {
  font-family: Noto;
  src: url("/static/fonts/NotoSans-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

.ui-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}
.organ-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
}
.shell:has(.editor-main) {
  --bg: #f0f5f3;
  --surface: #fff;
  --surface-soft: #f4f7f6;
  --ink: #142b33;
  --muted: #617078;
  --line: #dde5e7;
  --green: #205e50;
  --green-hover: #184c40;
  --selected: #e6f1ec;
  --radius: 10px;
  --radius-lg: 16px;
  background: var(--bg);
  color: var(--ink);
}
.shell:has(.editor-main) .app-header {
  min-height: 72px;
  border-color: var(--line);
  background: #f8fbfa;
}
.shell:has(.editor-main) .nav-link {
  border-radius: 0;
  padding: 24px 14px 21px;
  border-bottom: 3px solid transparent;
}
.shell:has(.editor-main) .nav-link.active {
  background: transparent;
  border-bottom-color: var(--green);
  color: var(--ink);
}
.editor-main {
  max-width: 1664px;
  padding: 20px 32px 140px;
  font-variant-numeric: tabular-nums;
}
.editor-main > .notice-strip {
  padding: 0 10px;
  margin: 0 0 16px;
  font-size: 11px;
  line-height: 20px;
}
.editor-main .patient-card,
.editor-main .map-column,
.editor-main .inspector-section,
.editor-main .finding-head,
.editor-main .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow:
    0 2px 4px #233d3509,
    0 8px 24px #233d3503;
}
.editor-main .patient-card {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 18px 22px;
  margin-bottom: 20px;
}
.patient-identity {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}
.patient-avatar {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--surface-soft);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.patient-avatar .ui-icon {
  width: 31px;
  height: 31px;
}
.editor-main .patient-context h1 {
  font:
    700 21px/1.4 Noto,
    system-ui,
    sans-serif;
  letter-spacing: -0.6px;
  text-wrap: pretty;
}
.editor-main .patient-context p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.editor-main .patient-context .separator {
  padding: 0 7px;
}
.editor-main .patient-card .badge {
  border-radius: 24px;
  padding: 9px 16px;
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 12px;
}
.study-context {
  display: grid;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 13px;
}
.study-context strong {
  font-weight: 400;
  font-size: 15px;
  color: var(--ink);
}
.patient-more {
  align-self: stretch;
  text-align: left;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 0 0 0 24px;
  font-size: 13px;
  color: var(--muted);
  gap: 14px;
}
.patient-more .ui-icon:first-child {
  color: var(--ink);
}
.organ-navigation {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 20px;
  min-width: 0;
}
.editor-main .organ-strip {
  flex: 1;
  padding: 2px 2px 6px;
  gap: 8px;
  align-items: stretch;
  min-width: 0;
  margin: -2px -2px -6px;
  scroll-snap-type: x proximity;
}
.editor-main .organ-tab {
  flex: 1 0 auto;
  min-height: 64px;
  gap: 16px;
  font-size: 14px;
  padding: 12px 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 2px 5px #233d3507;
  scroll-snap-align: start;
}
.editor-main .organ-tab.active {
  background: var(--green);
  color: var(--on-green);
  border-color: var(--green);
  box-shadow:
    inset 0 1px 0 #ffffff12,
    0 4px 10px #205e5012;
}
.editor-main .organ-tab.active .count {
  background: #ffffff24;
  color: inherit;
}
.editor-main .add-organ-button {
  position: static;
  min-width: 52px;
  width: 52px;
  border-radius: 12px;
  box-shadow: 0 2px 5px #233d3507;
  padding: 12px;
  flex: 0 0 auto;
}
.editor-main .editor-content {
  gap: 24px;
}
.editor-main .organ-card {
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}
.editor-main .exam-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.editor-main .map-column {
  grid-column: 1;
  padding: 24px;
  position: sticky;
  top: 20px;
  min-width: 0;
}
.editor-main .organ-head {
  border: 0;
  padding: 0;
  gap: 16px;
  align-items: center;
}
.editor-main .organ-head h2 {
  font:
    700 clamp(25px, 2.25vw, 34px) / 1.25 Noto,
    system-ui,
    sans-serif;
  letter-spacing: -0.8px;
}
.editor-main .organ-family {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}
.editor-main .remove-organ {
  color: var(--muted);
  background: var(--surface-soft);
  border-color: var(--line);
}
.editor-main .remove-organ:hover {
  color: var(--red);
  background: var(--danger-bg);
}
.editor-main .map-instruction {
  font-size: 13px;
  margin: 8px 0 12px;
  min-height: 0;
}
.editor-main .map-stage {
  max-width: 500px;
  width: 100%;
  padding: 0;
}
.editor-main .organ-map {
  border-radius: 12px;
  overflow: hidden;
}
.editor-main .map-caption {
  margin: 10px 0 16px;
  font-size: 11px;
  text-align: left;
}
.map-legend {
  margin-top: 10px;
  border-bottom: 1px solid var(--line);
}
.map-legend > summary {
  font-size: 12px;
  color: var(--muted);
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.map-legend > summary::after {
  content: "+";
  font-size: 20px;
}
.map-legend[open] > summary::after {
  content: "−";
}
.map-legend .anatomy-legend {
  padding: 8px 0 16px;
}
.editor-main .map-actions {
  gap: 8px;
}
.editor-main .map-actions > button {
  flex: 0 1 auto;
  font-size: 13px;
}
.finding-register-title {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 20px 0 0;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.finding-register-title h3 {
  font-size: 14px;
}
.finding-register-title > span {
  color: var(--muted);
  font-size: 12px;
}
.editor-main .finding-list {
  margin-top: 10px;
}
.editor-main .map-empty {
  margin-top: 8px;
  font-size: 12px;
}
.editor-main .organ-inspector {
  border: 0;
  padding: 0;
  grid-column: 2;
  min-width: 0;
}
.editor-main .inspector-tabs {
  margin: 0 0 12px;
  padding: 4px;
  background: #e1eae6;
  border-radius: 12px;
  width: fit-content;
}
.editor-main .inspector-tabs button.active {
  background: var(--surface);
  box-shadow: 0 1px 4px #17382e1f;
}
.editor-main .inspector-section {
  padding: 20px;
  margin: 0 0 16px;
}
.editor-main .inspector-section:last-child {
  margin-bottom: 0;
}
.editor-main .inspector-section .section-title {
  margin-bottom: 14px;
}
.editor-main .inspector-section h3 {
  font-size: 21px;
  letter-spacing: -0.5px;
  font-weight: 700;
}
.editor-main .section-title .text-button {
  font-size: 12px;
  padding: 8px 0 8px 10px;
}
.editor-main .measurements {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 0;
}
.editor-main .measurements:has(> :nth-child(4)):not(:has(> :nth-child(5))) {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.editor-main .measure-label {
  font-size: 12px;
  min-height: 34px;
  margin-bottom: 8px;
}
.editor-main .measure-value {
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
  gap: 5px;
  min-height: 62px;
  padding: 10px 15px;
  background: var(--surface);
  border-color: #d7e0e2;
  border-radius: 10px;
}
.editor-main .measure-value:hover {
  border-color: var(--green);
  background: var(--surface-soft);
}
.editor-main .measure-value strong {
  font-size: 29px;
  font-weight: 700;
  letter-spacing: -0.8px;
}
.editor-main .measure-value span {
  font-size: 13px;
}
.editor-main .choice-field {
  margin: 18px 0;
}
.editor-main .choice-field:last-child {
  margin-bottom: 0;
}
.editor-main .choice-field legend {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 9px;
}
.editor-main .choice span {
  font-size: 13px;
  min-height: 46px;
}
.organ-characteristics .choice-group {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  border-radius: 9px;
}
.organ-characteristics .choice-field {
  margin-block: 12px 0;
}
.organ-characteristics .choice-field legend {
  float: left;
  width: 110px;
  margin: 0;
  padding: 13px 12px 0 0;
}
.organ-characteristics .choice-group {
  margin-left: 110px;
}
.organ-characteristics .choice {
  flex: 1 1 0;
  min-width: 0;
  margin-right: -1px;
}
.organ-characteristics .choice span {
  border-radius: 0;
  padding: 11px 6px;
  text-align: center;
  background: var(--surface-soft);
  height: 100%;
}
.organ-characteristics .choice:first-child span {
  border-radius: 9px 0 0 9px;
}
.organ-characteristics .choice:last-child {
  margin-right: 0;
}
.organ-characteristics .choice:last-child span {
  border-radius: 0 9px 9px 0;
}
.organ-characteristics .choice input:checked + span {
  background: var(--green);
  color: var(--on-green);
  border-color: var(--green);
  box-shadow: none;
  position: relative;
}
.organ-characteristics .choice input[value=""]:checked + span {
  background: var(--selected);
  color: var(--green);
  border-color: #a9c7ba;
}
.organ-characteristics .choice:has(input:focus-visible) {
  z-index: 1;
}
.editor-main .finding-head {
  padding: 18px 20px;
  margin-bottom: 16px;
}
.editor-main .finding-head h3 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.editor-main .finding .measurements {
  margin-bottom: 20px;
}
.editor-main details.inspector-section > summary {
  font-size: 15px;
  min-height: 44px;
}
.editor-main .editor-section {
  padding: 24px;
}
.conclusion-fields {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
}
.editor-main .conclusion-section textarea {
  min-height: 140px;
}
.editor-main .conclusion-section .quiet-note {
  margin-top: 14px;
}
.journal-totals {
  font-size: 12px;
  color: var(--muted);
}
.conclusion-actions {
  text-align: right;
}
.register-shortcut {
  margin-bottom: 12px;
}
.editor-main .odintsov-parameters .section-title h3 {
  font:
    700 21px/1.4 Noto,
    system-ui,
    sans-serif;
}
.editor-main .odintsov-workspace {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 16px;
  box-shadow: 0 2px 4px #233d3509;
}
.editor-main .odintsov-types {
  gap: 8px;
  background: transparent;
  border: 0;
}
.editor-main .odintsov-type {
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12px;
}
.editor-main .odintsov-general > summary {
  padding: 12px 20px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.report-tools {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  align-items: center;
}
.report-documents .actions {
  margin-top: 10px;
}
.editor-main .protocol-switch {
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
}
.editor-main .protocol-switch .choice-field {
  margin: 0;
}
.editor-main .savebar {
  padding: 14px max(32px, calc((100vw - 1600px) / 2));
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  border-radius: 18px 18px 0 0;
  background: var(--surface);
  box-shadow: 0 -3px 20px #233d3507;
}
.save-status {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}
.editor-main .savebar .actions {
  gap: 12px;
}
.editor-main .savebar button {
  min-height: 50px;
  padding-inline: 24px;
  font-size: 14px;
}
.editor-main .savebar .primary {
  min-width: 174px;
  box-shadow:
    inset 0 1px 0 #ffffff16,
    0 3px 8px #205e5017;
}
.editor-main .savebar-conclusion {
  border-color: var(--green);
  color: var(--green);
}
.editor-main .savebar-next {
  margin-right: 4px;
  padding-inline: 8px;
  font-size: 12px;
}

@media (max-width: 1199px) {
  .editor-main {
    padding-inline: 24px;
  }
  .editor-main .patient-card {
    gap: 18px;
  }
  .patient-more {
    padding-left: 18px;
  }
  .patient-more span {
    display: none;
  }
  .editor-main .organ-tab {
    padding-inline: 16px;
    gap: 10px;
  }
  .editor-main .exam-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
  }
  .editor-main .map-column,
  .editor-main .inspector-section {
    padding: 18px;
  }
  .editor-main .savebar-next {
    display: none;
  }
  .editor-main .measurements {
    gap: 8px;
  }
  .editor-main .measure-value {
    padding-inline: 10px;
  }
  .organ-characteristics .choice-field legend {
    float: none;
    width: auto;
    padding: 0;
    margin-bottom: 9px;
  }
  .organ-characteristics .choice-group {
    margin-left: 0;
  }
  .editor-main .measurements:has(> :nth-child(4)):not(:has(> :nth-child(5))) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 1023px) {
  .shell:has(.editor-main) .app-header {
    min-height: 66px;
  }
  .shell:has(.editor-main) .nav-link {
    padding: 12px 10px;
  }
  .editor-main .patient-card {
    flex-wrap: wrap;
    gap: 12px 18px;
  }
  .patient-identity {
    flex: 1;
  }
  .study-context {
    margin-left: 76px;
  }
  .patient-more {
    margin-left: auto;
    border-left: 0;
  }
  .patient-more span {
    display: inline;
  }
  .editor-main .exam-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .editor-main .map-column {
    position: static;
  }
  .editor-main .organ-inspector {
    grid-column: 1;
  }
  .editor-main .map-stage {
    max-width: 500px;
  }
  .editor-main .savebar {
    padding-inline: 24px;
  }
  .editor-main .savebar .primary {
    min-width: 140px;
  }
}
@media (max-width: 767px) {
  .editor-main {
    padding: 16px 16px 146px;
  }
  .editor-main > .notice-strip {
    padding: 0 4px;
    font-size: 10px;
    line-height: 1.6;
    margin-bottom: 14px;
  }
  .editor-main .patient-card {
    padding: 16px;
    gap: 12px;
    margin-bottom: 16px;
  }
  .patient-avatar {
    width: 44px;
    height: 44px;
    border-radius: 13px;
  }
  .patient-avatar .ui-icon {
    width: 25px;
    height: 25px;
  }
  .patient-identity {
    flex: 1 0 100%;
    gap: 12px;
    align-items: flex-start;
  }
  .editor-main .patient-context h1 {
    font-size: 18px;
    line-height: 1.35;
    letter-spacing: -0.4px;
  }
  .editor-main .patient-context p {
    font-size: 12px;
    line-height: 1.7;
  }
  .editor-main .patient-context .separator {
    padding: 0 3px;
  }
  .editor-main .patient-card .badge {
    font-size: 11px;
    padding: 7px 12px;
  }
  .study-context {
    margin-left: auto;
    font-size: 11px;
    gap: 1px;
  }
  .study-context strong {
    font-size: 13px;
  }
  .patient-more {
    min-width: 44px;
    padding: 8px;
    background: var(--surface-soft);
    border-radius: 10px;
    margin: 0;
  }
  .patient-more span,
  .patient-more .ui-icon:last-child {
    display: none;
  }
  .organ-navigation {
    margin-bottom: 16px;
    gap: 8px;
  }
  .editor-main .organ-strip {
    gap: 8px;
  }
  .editor-main .organ-tab {
    flex: 0 0 auto;
    min-height: 58px;
    gap: 10px;
    padding: 10px 14px;
    font-size: 13px;
  }
  .organ-icon {
    width: 28px;
    height: 28px;
  }
  .editor-main .add-organ-button {
    min-width: 44px;
    width: 44px;
    padding: 8px;
  }
  .editor-main .map-column,
  .editor-main .inspector-section,
  .editor-main .editor-section {
    padding: 18px;
  }
  .editor-main .organ-head h2 {
    font-size: 26px;
  }
  .editor-main .organ-family {
    font-size: 11px;
  }
  .editor-main .map-stage {
    max-width: 440px;
  }
  .editor-main .map-instruction {
    font-size: 12px;
  }
  .editor-main .map-caption {
    font-size: 11px;
  }
  .editor-main .map-actions > button {
    flex: 1;
  }
  .editor-main .organ-inspector {
    scroll-margin-top: 16px;
  }
  .editor-main .inspector-section h3 {
    font-size: 20px;
  }
  .editor-main .section-title {
    gap: 12px;
  }
  .editor-main .section-title .text-button {
    font-size: 11px;
  }
  .editor-main .measurements {
    gap: 8px;
  }
  .editor-main .measure-label {
    font-size: 11px;
    min-height: 32px;
  }
  .editor-main .measure-value {
    min-height: 68px;
    padding: 10px 6px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  .editor-main .measure-value strong {
    font-size: 28px;
  }
  .editor-main .measure-value span {
    font-size: 12px;
  }
  .editor-main .choice span {
    font-size: 13px;
    padding: 10px 11px;
    min-height: 46px;
  }
  .organ-characteristics .choice-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .organ-characteristics .choice {
    margin: 0;
  }
  .organ-characteristics .choice span,
  .organ-characteristics .choice:first-child span,
  .organ-characteristics .choice:last-child span {
    border-radius: 9px;
  }
  .conclusion-fields {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .conclusion-section .section-title {
    display: block;
  }
  .journal-totals {
    margin-top: 8px;
  }
  .report-tools {
    display: grid;
    gap: 24px;
  }
  .editor-main .savebar {
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
    padding: 10px 16px max(14px, env(safe-area-inset-bottom));
    gap: 8px;
  }
  .save-status {
    gap: 7px;
  }
  .save-status .ui-icon {
    width: 17px;
    height: 17px;
  }
  .editor-main .save-state {
    font-size: 11px;
  }
  .editor-main .savebar .actions {
    display: flex;
    width: 100%;
    gap: 10px;
  }
  .editor-main .savebar button {
    flex: 1;
    min-width: 0;
    white-space: normal;
    min-height: 48px;
    padding: 10px;
    gap: 6px;
  }
  .editor-main .savebar button .ui-icon {
    width: 20px;
    height: 20px;
  }
  .editor-main .savebar .primary {
    min-width: 0;
    flex: 1.25;
  }
  .editor-main .savebar .savebar-conclusion {
    display: inline-flex;
    flex: 0 0 44px;
    padding: 8px;
  }
  .editor-main .savebar-conclusion span {
    display: none;
  }
  .conclusion-actions {
    text-align: left;
  }
}
@media (max-width: 359px) {
  .editor-main {
    padding-inline: 12px;
  }
  .editor-main .patient-card {
    padding: 14px;
  }
  .editor-main .map-column,
  .editor-main .inspector-section {
    padding: 14px;
  }
  .editor-main .measure-value strong {
    font-size: 25px;
  }
  .editor-main .measure-label {
    font-size: 10px;
  }
  .editor-main .organ-head h2 {
    font-size: 23px;
  }
}
@media (prefers-color-scheme: dark) {
  .shell:has(.editor-main) {
    --bg: #172421;
    --surface: #21332f;
    --surface-soft: #2a3e38;
    --ink: #e5f0eb;
    --muted: #b1c4ba;
    --line: #496157;
    --green: #a4d5bf;
    --green-hover: #c0e4d4;
    --selected: #365346;
  }
  .shell:has(.editor-main) .app-header {
    background: #1c2d27;
  }
  .editor-main .measure-value {
    border-color: var(--line);
  }
  .editor-main .inspector-tabs {
    background: var(--bg);
  }
  .editor-main .organ-tab.active .count {
    background: #152c2220;
  }
}
/* Choose the study before creating its report; keep the existing editor composition. */
.new-report-dialog {
  max-width: 820px;
}
.study-selection h3 {
  margin-bottom: 6px;
}
.study-selection .choice-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.study-selection .choice span {
  justify-content: flex-start;
  gap: 10px;
  height: 100%;
  min-height: 52px;
  text-align: left;
}
.study-selection .choice .organ-icon,
.study-selection .choice .ui-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
}
.study-selection .choice b {
  font-weight: inherit;
}
.new-report-dialog .patient-results {
  max-height: 200px;
  overflow-y: auto;
  padding: 4px;
}
.plate-selection {
  fill: none;
  stroke: #245d50;
  stroke-width: .55;
  pointer-events: none;
}
@media (max-width: 479px) {
  .study-selection .choice span {
    font-size: 12px;
    padding: 9px;
  }
}


/* Organ picker: use the same anatomical illustrations as the examination maps. */
.organ-picker .preset-illustrations {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 82px;
  padding: 4px;
  background: #faf7f2;
  border-radius: 10px;
  overflow: hidden;
}
.organ-picker .organ-thumbnail {
  display: block;
  width: 78px;
  height: 78px;
  min-width: 0;
  object-fit: contain;
  border-radius: 8px;
  background: #faf7f2;
}
.organ-picker .preset-illustrations .organ-thumbnail { flex: 0 1 78px; }
.organ-picker .organ-thumbnail.mirrored { transform: scaleX(-1); }
.organ-picker .exam-set { gap: 10px; }
.organ-picker .organ-option { display: flex; align-items: center; gap: 12px; }
.organ-picker .organ-option .organ-thumbnail { width: 52px; height: 52px; flex: 0 0 52px; }
.organ-picker .organ-option-name { flex: 1; color: inherit; font-size: 13px; }
@media (max-width: 480px) {
  .organ-picker .preset-illustrations { min-height: 64px; gap: 2px; }
  .organ-picker .preset-illustrations .organ-thumbnail { height: 60px; flex-basis: 60px; }
}
