:root {
  color-scheme: dark;
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #20242c;
  --surface-3: #2a303a;
  --text: #f4f7fb;
  --muted: #aab3c0;
  --subtle: #737f91;
  --line: #303743;
  --accent: #61d4c7;
  --accent-2: #8ab4ff;
  --danger: #ff7a90;
  --ok: #79d487;
  --warning: #ffd166;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.66;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 48% 12%, rgba(97, 212, 199, 0.11), transparent 34%),
    linear-gradient(145deg, #0f1115 0%, #151923 100%);
}

.login-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #141820;
  box-shadow: var(--shadow);
  padding: 24px;
  display: grid;
  gap: 18px;
}

.login-brand {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.login-form {
  display: grid;
  gap: 14px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #11141a;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #f4f7fb;
  color: #11141a;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

.brand p,
.small-muted {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-button {
  width: 100%;
  border: 1px solid transparent;
  color: var(--muted);
  background: transparent;
  padding: 11px 12px;
  border-radius: 8px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-button.active {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text);
}

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.topbar {
  height: 72px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.topbar h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: 0;
}

.content {
  overflow: auto;
  padding: 28px;
}

.screen {
  max-width: 1380px;
  margin: 0 auto;
}

.wide-screen {
  max-width: 1680px;
}

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

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

.clinical-flow {
  display: grid;
  gap: 18px;
}

.clinical-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.clinical-card {
  --accent-local: var(--accent);
  --accent-soft: rgba(97, 212, 199, 0.12);
  background:
    radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--accent-soft) 72%, transparent) 0%, transparent 38%),
    linear-gradient(135deg, color-mix(in srgb, var(--accent-soft) 48%, rgba(255, 255, 255, 0.012)) 0%, rgba(255, 255, 255, 0.018) 42%, rgba(7, 10, 15, 0.14) 100%),
    #131720;
  border: 1px solid color-mix(in srgb, var(--accent-local) 14%, var(--line));
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 14px;
  min-width: 0;
  align-content: start;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.026),
    0 14px 36px rgba(0, 0, 0, 0.12);
}

.clinical-card--deep {
  --accent-local: #5fa8ff;
  --accent-soft: rgba(95, 168, 255, 0.115);
}

.clinical-card--limb {
  --accent-local: #7dd3c7;
  --accent-soft: rgba(125, 211, 199, 0.085);
}

.wide-card {
  grid-column: 1 / -1;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  border-bottom: 1px solid rgba(48, 55, 67, 0.78);
  padding-bottom: 12px;
}

.section-title h4 {
  margin: 0;
  font-size: 13.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: color-mix(in srgb, var(--accent-local) 72%, var(--text));
}

.section-title span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: right;
}

.mini-section {
  --accent-local: #7dd3c7;
  --accent-soft: rgba(125, 211, 199, 0.1);
  display: grid;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--accent-local) 13%, rgba(48, 55, 67, 0.82));
  border-radius: 8px;
  padding: 13px;
  background:
    radial-gradient(circle at 14% 0%, color-mix(in srgb, var(--accent-soft) 68%, transparent) 0%, transparent 42%),
    linear-gradient(135deg, color-mix(in srgb, var(--accent-soft) 40%, rgba(255, 255, 255, 0.012)) 0%, rgba(16, 20, 27, 0.74) 52%, rgba(12, 16, 22, 0.84) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.mini-section strong {
  font-size: 13px;
  color: color-mix(in srgb, var(--accent-local) 62%, var(--text));
}

.mini-section:first-of-type {
  border-top: 1px solid rgba(48, 55, 67, 0.82);
  padding-top: 13px;
}

.mini-section--vsi {
  --accent-local: #61d4c7;
  --accent-soft: rgba(97, 212, 199, 0.105);
}

.mini-section--vse {
  --accent-local: #8aa7ff;
  --accent-soft: rgba(138, 167, 255, 0.095);
}

.mini-section--phlebitis {
  --accent-local: #ff7a90;
  --accent-soft: rgba(255, 122, 144, 0.09);
}

.mini-section--collaterals {
  --accent-local: #f6ad55;
  --accent-soft: rgba(246, 173, 85, 0.09);
}

.mini-section--perforators {
  --accent-local: #e6c75f;
  --accent-soft: rgba(230, 199, 95, 0.085);
}

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

.summary-badge {
  color: color-mix(in srgb, var(--accent-local) 54%, #ffffff);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent-soft) 84%, rgba(255, 255, 255, 0.02)), rgba(255, 255, 255, 0.018));
  border: 1px solid color-mix(in srgb, var(--accent-local) 28%, var(--line));
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 720;
  max-width: 58%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.variant-subsection {
  --accent-local: #8aa0b7;
  --accent-soft: rgba(138, 160, 183, 0.12);
  display: grid;
  gap: 10px;
  border: 1px solid color-mix(in srgb, var(--accent-local) 13%, rgba(48, 55, 67, 0.72));
  border-radius: 8px;
  background:
    radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--accent-soft) 58%, transparent) 0%, transparent 44%),
    linear-gradient(135deg, color-mix(in srgb, var(--accent-soft) 34%, rgba(255, 255, 255, 0.012)) 0%, rgba(255, 255, 255, 0.017) 58%, rgba(8, 11, 16, 0.1) 100%);
  padding: 11px;
}

.variant-subsection--accessory {
  --accent-local: #78c7bd;
  --accent-soft: rgba(120, 199, 189, 0.07);
}

.variant-subsection--giacomini {
  --accent-local: #7894aa;
  --accent-soft: rgba(120, 148, 170, 0.085);
}

.variant-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.variant-title strong {
  font-size: 12.5px;
  color: color-mix(in srgb, var(--accent-local) 60%, var(--text));
}

.compact-grid {
  gap: 10px;
}

.accessory-grid {
  align-items: end;
}

.reveal-block {
  background: color-mix(in srgb, var(--accent-soft) 58%, rgba(255, 255, 255, 0.015));
  border: 1px solid color-mix(in srgb, var(--accent-local) 22%, rgba(48, 55, 67, 0.75));
  border-radius: 8px;
  padding: 12px;
}

.detail-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  background: #10141b;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 12px;
}

.tiny-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 3px 4px;
  font-size: 12px;
}

.compact-action {
  justify-self: start;
  min-height: 36px;
}

.output-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(420px, 0.86fr);
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-header h3 {
  margin: 0;
  font-size: 15px;
}

.panel-body {
  padding: 20px;
}

.stack {
  display: grid;
  gap: 16px;
}

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

.form-grid.three-cols {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid.four-cols {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.mini-section label,
.clinical-card label {
  color: #b7c0ce;
}

input,
select,
textarea {
  width: 100%;
  color: var(--text);
  background: #11141a;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  outline: none;
}

textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.48;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(97, 212, 199, 0.14);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  background: rgba(9, 12, 18, 0.72);
  border: 1px solid rgba(48, 55, 67, 0.82);
  border-radius: 8px;
  padding: 4px;
}

.segmented.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segmented.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.segment {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #94a0b2;
  padding: 8px 10px;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.15;
  text-align: center;
}

.segmented.three .segment,
.segmented.four .segment {
  font-size: 12px;
  min-height: 42px;
  padding-left: 6px;
  padding-right: 6px;
}

.segment.active {
  background: var(--accent-soft);
  color: color-mix(in srgb, var(--accent-local) 44%, #ffffff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-local) 44%, transparent);
  font-weight: 760;
}

.segment:disabled,
.disabled-field {
  opacity: 0.5;
}

.chip-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.chip {
  border: 1px solid var(--line);
  background: #10141b;
  color: var(--muted);
  border-radius: 8px;
  padding: 9px 10px;
  text-align: left;
  min-height: 40px;
}

.chip.active {
  border-color: color-mix(in srgb, var(--accent-local) 58%, var(--accent));
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 720;
}

.chip.danger-chip.active {
  border-color: rgba(255, 122, 144, 0.7);
  background: rgba(255, 122, 144, 0.12);
}

.check-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.check-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 500;
}

.check-row input {
  width: 16px;
  height: 16px;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.document-actions {
  margin-top: 14px;
}

.btn {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
}

.btn.primary {
  background: var(--accent);
  color: #0c1214;
  border-color: transparent;
  font-weight: 750;
}

.btn.subtle {
  background: transparent;
}

.btn.danger {
  border-color: rgba(255, 122, 144, 0.4);
  color: var(--danger);
}

.operator-list,
.history-list {
  display: grid;
  gap: 10px;
}

.history-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.history-table {
  display: grid;
  gap: 8px;
}

.history-row {
  display: grid;
  grid-template-columns: 1.05fr 1.3fr 0.8fr 1.35fr 1fr 0.75fr 1.1fr 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  background: rgba(19, 23, 32, 0.9);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
}

.history-row--head {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: transparent;
}

.history-row small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.history-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.history-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(97, 212, 199, 0.12);
  border: 1px solid rgba(97, 212, 199, 0.22);
  color: #b9fff5;
  font-weight: 750;
}

.history-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}

.history-detail-grid--wide {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.history-detail-grid > div,
.history-readonly-card {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(24, 31, 44, 0.98), rgba(16, 22, 32, 0.98));
  border-radius: 8px;
  padding: 14px;
}

.history-detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.history-readonly-card h4 {
  margin: 0 0 10px;
  color: #f8fafc;
}

.history-report-card {
  color: #eef6ff;
  line-height: 1.65;
}

.history-report-card .clinical-report-body,
.history-report-card p {
  color: #e5edf8;
}

.history-report-card strong {
  color: #ffffff;
}

.history-conclusion {
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(97, 212, 199, 0.08);
  border: 1px solid rgba(97, 212, 199, 0.18);
}

.history-edit-banner {
  display: grid;
  gap: 4px;
}

.operator-item,
.history-item,
.signer-item {
  border: 1px solid var(--line);
  background: #131720;
  border-radius: 8px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.operator-item.active {
  border-color: var(--accent);
  background: rgba(97, 212, 199, 0.08);
}

.operator-item strong,
.history-item strong,
.signer-item strong {
  display: block;
  margin-bottom: 3px;
}

.preview {
  background: #f8fafc;
  color: #16202f;
  border-radius: 8px;
  padding: 42px 46px;
  min-height: 760px;
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.08);
  font-family: Inter, Arial, Helvetica, sans-serif;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(4, 8, 14, 0.74);
  display: grid;
  place-items: center;
  padding: 24px;
}

.preview-modal {
  width: min(1120px, 96vw);
  max-height: 92vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: #11141a;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.gmail-modal {
  width: min(640px, 94vw);
  max-height: 92vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: #11141a;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.gmail-modal .panel-body {
  overflow: auto;
}

.preview-modal-header {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.preview-modal-header h3 {
  margin: 0 0 4px;
}

.preview-modal-header p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.preview-modal-body {
  overflow: auto;
  padding: 18px;
  background: #20242c;
}

.preview-modal-body .preview,
.preview-modal-body .map-sheet,
.preview-modal-body .mapping-pdf-sheet {
  margin: 0 auto;
  max-width: 920px;
}

.preview-modal-body .map-sheet {
  background: #fbfcff;
}

.mapping-preview-body {
  background: #313742;
}

.mapping-pdf-sheet {
  width: min(794px, 100%);
  min-height: 1123px;
  background: #ffffff;
  padding: 28px 34px 24px;
  box-sizing: border-box;
  color: #0f172a;
}

.mapping-pdf-sheet .map-sheet {
  box-shadow: none;
  border-radius: 0;
  background: #ffffff;
  padding: 0;
}

.mapping-pdf-sheet .map-header {
  grid-template-columns: 96px minmax(0, 1fr);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.mapping-pdf-sheet .map-header h3 {
  font-size: 22px;
}

.mapping-pdf-sheet .map-header p {
  font-size: 13px;
}

.mapping-pdf-sheet .map-logo {
  width: 90px;
  height: 52px;
}

.mapping-pdf-sheet .vascular-svg {
  border: 0;
  border-radius: 0;
  background: #ffffff;
}

.screen-only {
  display: none;
}

.classic-header {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  border-bottom: 2px solid #c7d1df;
  padding-bottom: 22px;
  margin-bottom: 30px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 2px solid #d7dee8;
  padding-bottom: 18px;
  margin-bottom: 22px;
}

.preview-logo {
  width: 108px;
  height: 58px;
  object-fit: contain;
  background: #ffffff;
  border: 1px solid #dbe2ec;
  border-radius: 6px;
}

.logo-empty {
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #17202e;
}

.preview h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0;
}

.preview h4 {
  margin: 30px 0 12px;
  color: #1f2d40;
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 0.08em;
  border-top: 1px solid #d7dee8;
  padding-top: 16px;
}

.preview p {
  margin: 0 0 12px;
  line-height: 1.7;
  font-size: 14px;
}

.preview pre {
  white-space: pre-wrap;
  line-height: 1.65;
  font-size: 14px;
  font-family: Inter, Arial, Helvetica, sans-serif;
}

.clinical-report-body {
  margin-top: 26px;
}

.clinical-report-body p {
  margin: 0 0 7px;
  line-height: 1.65;
  font-size: 14px;
}

.report-main-title {
  margin: 24px 0 18px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
  color: #0f172a;
}

.report-section-title,
.report-limb-title {
  margin: 20px 0 8px;
  font-size: 14px;
  font-weight: 800;
  color: #172033;
}

.report-limb-title {
  border-top: 1px solid #d7dee8;
  padding-top: 14px;
}

.report-space {
  height: 8px;
}

.report-editor {
  min-height: 360px;
}

.conclusion-editor {
  min-height: 120px;
}

.patient-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 20px;
  color: #334155;
  font-size: 13px;
}

.signature-line {
  margin-top: 42px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}

.signature-box {
  border-top: 1px solid #98a5b8;
  padding-top: 8px;
  min-height: 76px;
}

.signature-img {
  display: block;
  max-height: 58px;
  max-width: 210px;
  object-fit: contain;
  margin-bottom: 6px;
}

.map-placeholder {
  background: #11141a;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  display: grid;
  place-items: center;
  min-height: 360px;
}

.map-sheet {
  background: #fbfcff;
  color: #0f172a;
  border-radius: 8px;
  padding: 18px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.1);
}

.map-header {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid #d6dde8;
  padding-bottom: 14px;
  margin-bottom: 14px;
}

.map-header h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.map-header p {
  margin: 0;
  color: #475569;
  font-size: 12px;
}

.map-logo {
  width: 88px;
  height: 52px;
  object-fit: contain;
  border: 1px solid #dbe2ec;
  border-radius: 6px;
  background: #ffffff;
}

.vascular-svg {
  width: 100%;
  display: block;
  border: 1px solid #dbe2ec;
  border-radius: 8px;
  background: #fbfcff;
}

.mapping-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  border: 1px solid #dbe2ec;
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
  margin-bottom: 12px;
}

.mapping-toolbar strong {
  display: block;
  font-size: 13px;
  color: #0f172a;
}

.mapping-toolbar p {
  margin: 3px 0 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
}

.mapping-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.mapping-toolbar .btn,
.arrow-edit-panel .btn {
  border-color: #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  font-weight: 700;
}

.mapping-toolbar .btn:hover,
.arrow-edit-panel .btn:hover {
  background: #eef2f7;
}

.mapping-toolbar .btn.subtle,
.arrow-edit-panel .btn.subtle {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}

.mapping-toolbar .btn.primary {
  background: var(--accent);
  color: #071314;
  border-color: #4fc6ba;
}

.mapping-toolbar .btn.danger,
.arrow-edit-panel .btn.danger {
  background: #111827;
  color: #ff9aae;
  border-color: rgba(255, 122, 144, 0.55);
}

.mapping-toolbar .btn:disabled,
.arrow-edit-panel .btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.mapping-message {
  display: inline-block;
  margin-top: 8px;
  color: #047857;
  font-size: 12px;
  font-weight: 700;
}

.arrow-edit-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  border: 1px solid #dbe2ec;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.arrow-edit-panel strong {
  display: block;
  font-size: 13px;
  color: #0f172a;
}

.arrow-edit-panel p {
  margin: 3px 0 0;
  color: #64748b;
  font-size: 12px;
}

.arrow-color-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.arrow-color-button {
  border: 1px solid #dbe2ec;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 8px;
  padding: 8px 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
}

.arrow-color-button.active {
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.14);
}

.arrow-color-button:disabled,
.arrow-edit-panel .btn:disabled,
.permanent-toggle:disabled {
  opacity: 0.45;
  cursor: default;
}

.arrow-color-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
}

.arrow-color-dot.red {
  background: #d7263d;
}

.arrow-color-dot.black {
  background: #111827;
}

.arrow-color-dot.blue {
  background: #1d4ed8;
}

.mapping-editing .vascular-svg {
  border-color: #5eead4;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}

.measure-box.editable {
  cursor: move;
  touch-action: none;
}

.measure-box.permanent {
  cursor: default;
}

.measure-box.selected .measure-box-frame {
  stroke: #0f766e;
  stroke-width: 2;
  filter: drop-shadow(0 3px 6px rgba(15, 118, 110, 0.16));
}

.measure-box.editable .measure-box-frame {
  stroke: #0f766e;
  stroke-width: 2;
  stroke-dasharray: 5 4;
  filter: drop-shadow(0 4px 8px rgba(15, 118, 110, 0.18));
}

.measure-box.editable:hover .measure-box-frame {
  fill: #f0fdfa;
}

.mapping-arrow.editable {
  cursor: move;
}

.mapping-arrow.permanent .mapping-arrow-line {
  stroke-dasharray: none;
}

.permanent-toggle {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  border-radius: 8px;
  padding: 8px 10px;
  font-weight: 700;
  min-height: 36px;
}

.permanent-toggle.active {
  background: #111827;
  color: #ffffff;
  border-color: #111827;
}

.permanent-dot {
  fill: #111827;
  stroke: #ffffff;
  stroke-width: 1.5;
  pointer-events: none;
}

.mapping-arrow-line {
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(15, 23, 42, 0.12));
}

.mapping-arrow.selected .mapping-arrow-line {
  stroke-width: 3;
  filter: drop-shadow(0 2px 5px rgba(15, 118, 110, 0.2));
}

.mapping-arrow-hit {
  cursor: move;
  touch-action: none;
}

.arrow-handle {
  fill: #ffffff;
  stroke: #0f766e;
  stroke-width: 2;
  cursor: crosshair;
  filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.16));
}

.leg-map {
  max-width: 260px;
  width: 100%;
}

.hint {
  color: var(--subtle);
  font-size: 12px;
  line-height: 1.5;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #11141a;
  display: grid;
  gap: 4px;
}

.metric strong {
  color: var(--accent);
  font-size: 18px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

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

.perforator-list {
  display: grid;
  gap: 8px;
}

.tag-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #10141b;
}

.empty.tight {
  padding: 12px;
}

.email-preflight {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #11141a;
  padding: 14px;
  display: grid;
  gap: 12px;
}

.file-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.file-pills span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: #171a21;
  color: var(--muted);
  font-size: 12px;
}

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

.span-2 {
  grid-column: 1 / -1;
}

.settings-signer-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr);
  gap: 18px;
}

.oauth-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #11141a;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.gmail-state {
  display: grid;
  gap: 6px;
}

.gmail-state-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.gmail-badge {
  border: 1px solid rgba(174, 184, 199, 0.24);
  border-radius: 999px;
  background: rgba(174, 184, 199, 0.08);
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  padding: 5px 9px;
}

.gmail-badge.connected {
  border-color: rgba(97, 212, 199, 0.36);
  background: rgba(97, 212, 199, 0.12);
  color: #8ee6db;
}

.backup-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hidden-file-input {
  display: none;
}

.status {
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

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

.status.success {
  color: #8ee6db;
  background: rgba(97, 212, 199, 0.08);
  border-color: rgba(97, 212, 199, 0.24);
}

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

.status.warning {
  color: #f8c76c;
  background: rgba(255, 209, 102, 0.08);
  border-color: rgba(255, 209, 102, 0.24);
}

.warning-text {
  color: #f8c76c;
}

.canvas-pad {
  width: 100%;
  height: 150px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid var(--line);
  touch-action: none;
}

.empty {
  color: var(--subtle);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  text-align: center;
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav {
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    overflow: auto;
  }

  .output-grid,
  .clinical-grid,
  .settings-grid,
  .settings-signer-grid,
  .segment-grid,
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .wide-card,
  .span-2 {
    grid-column: auto;
  }

  .chip-grid,
  .form-grid.three-cols,
  .form-grid.four-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .topbar,
  .content {
    padding-left: 16px;
    padding-right: 16px;
  }

  .form-grid,
  .form-grid.three-cols,
  .form-grid.four-cols,
  .chip-grid,
  .patient-meta,
  .signature-line,
  .metric-row {
    grid-template-columns: 1fr;
  }

  .preview {
    padding: 20px;
  }
}

@media print {
  .mapping-toolbar {
    display: none;
  }

  .arrow-edit-panel {
    display: none;
  }

  .arrow-handle,
  .mapping-arrow-hit {
    display: none;
  }
}
/* Platform controls are isolated from the legacy mapping/PDF layout. */
.platform-shell { max-width: 1150px; margin: auto; overflow-wrap: anywhere; }
.platform-shell .topbar { flex-wrap: wrap; gap: 16px; height: auto; min-height: 0; position: static; padding: 12px 0; }
.platform-shell .field { display: grid; gap: 6px; }
.platform-shell input, .platform-shell select, .platform-shell textarea { width: 100%; min-width: 0; padding: 10px; border: 1px solid #cbd5e1; border-radius: 6px; font: inherit; }
.platform-card { padding: 18px; border: 1px solid var(--line); border-radius: 10px; margin: 12px 0; background: var(--surface-2); }
.platform-shell details { padding: 14px 0; }
.platform-shell summary { cursor: pointer; font-weight: 600; }
.platform-list { display: grid; gap: 12px; }
.platform-text { white-space: pre-wrap; }
.platform-images { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.platform-images figure { margin: 0; }
.platform-images img { width: 100%; max-height: 320px; object-fit: contain; background: #111827; }
.platform-shell .btn { margin: 4px; white-space: normal; }
@media(max-width:720px) { .platform-card { padding: 12px; } .platform-shell .topbar { display: block; } .nav { grid-template-columns: repeat(3,minmax(0,1fr)); } }
.platform-source-preview { display: block; width: 100%; max-width: 400px; height: auto; background: white; margin-bottom: 12px; }
