:root {
  --ink: #111819;
  --ink-2: #2c3436;
  --muted: #687174;
  --line: #d9e0e2;
  --soft: #f4f7f7;
  --accent: #a7e92f;
  --accent-dark: #5a8b16;
  --panel: #ffffff;
  --page: #ffffff;
  --shadow: 0 18px 50px rgba(17, 24, 25, 0.16);
  --zoom: 0.82;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #e8eeee;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.text-generate-button.is-loading {
  border-color: var(--accent-dark);
  background: #f7ffe9;
}

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

.app-shell:has(#tab-content.active) {
  grid-template-columns: minmax(700px, 54vw) minmax(420px, 1fr);
}

.panel {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.brand-row img {
  width: 152px;
  height: auto;
  max-height: 48px;
  object-fit: contain;
}

.brand-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.brand-row a {
  color: inherit;
  text-decoration: none;
}

.brand-row a:hover {
  color: var(--ink);
}

.home-button {
  min-height: 34px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  display: inline-grid;
  place-items: center;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.home-button:hover {
  border-color: var(--accent-dark);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  background: var(--soft);
  border: 1px solid var(--line);
}

.tab {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tab.active {
  background: var(--ink);
  color: white;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: grid;
  gap: 14px;
}

.content-media-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(260px, 0.95fr);
  gap: 16px;
  align-items: start;
}

.content-column,
.media-column {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.media-column {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding-right: 2px;
}

label,
.file-button {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
  min-width: 0;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-dark);
  box-shadow: 0 0 0 3px rgba(167, 233, 47, 0.2);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.section-title {
  margin-top: 4px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.item-list,
.image-list,
.action-stack {
  display: grid;
  gap: 12px;
}

.export-checklist {
  border: 1px solid var(--line);
  background: var(--soft);
  padding: 12px;
  font-size: 12px;
  line-height: 1.45;
}

.export-checklist-title {
  margin-bottom: 8px;
  color: var(--ink);
  font-weight: 900;
  text-transform: uppercase;
}

.export-checklist ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.export-checklist li {
  position: relative;
  padding-left: 18px;
  color: var(--muted);
}

.export-checklist li::before {
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 900;
}

.export-checklist li.ok::before {
  content: "✓";
  color: var(--accent-dark);
}

.export-checklist li.warning::before {
  content: "!";
  color: #b47b16;
}

.export-checklist li.error::before {
  content: "×";
  color: #c7372f;
}

.export-checklist p {
  margin: 0;
  color: var(--muted);
}

.is-hidden {
  display: none !important;
}

.measurement-item,
.image-item {
  border: 1px solid var(--line);
  background: var(--soft);
  padding: 12px;
}

.item-row {
  display: grid;
  grid-template-columns: 1fr 24px 28px;
  gap: 7px;
  margin-bottom: 10px;
  align-items: start;
}

.measurement-order {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 3px;
}

.measurement-order .icon-button {
  width: 24px;
  min-height: 0;
  height: 22px;
  font-size: 13px;
}

.icon-button:disabled {
  cursor: default;
  opacity: 0.35;
}

.measurement-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.measurement-fields label {
  gap: 5px;
  font-size: 10px;
}

.measurement-fields input {
  padding: 8px;
}

.linked-graphs {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.linked-graphs-title {
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.linked-graph-card {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
}

.linked-graph-card.size-wide,
.linked-graph-card.size-large {
  grid-template-columns: 1fr;
}

.linked-graph-card > img {
  width: 132px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: white;
  border: 1px solid #eef1f1;
}

.linked-graph-card.size-wide > img,
.linked-graph-card.size-large > img {
  width: 100%;
  aspect-ratio: 16 / 7;
}

.linked-graph-card.size-large > img {
  aspect-ratio: 16 / 10;
}

.linked-graph-card.fit-contain > img {
  object-fit: contain;
}

.linked-graph-controls {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.linked-graph-caption {
  padding: 8px;
}

.linked-graph-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.linked-graph-actions .ghost-button {
  min-height: 34px;
  font-size: 11px;
}

.drop-zone {
  min-height: 128px;
  place-items: center;
  align-content: center;
  border: 2px dashed var(--line);
  background: var(--soft);
  text-align: center;
  color: var(--ink);
}

.drop-zone.compact {
  min-height: 86px;
}

.drop-zone input,
.file-button input {
  display: none;
}

.drop-zone span {
  font-size: 15px;
  font-weight: 900;
}

.drop-zone small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
}

.image-item {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
  align-items: start;
}

.image-item img {
  width: 96px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--ink);
  cursor: zoom-in;
}

.image-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.image-assignment {
  margin-top: 8px;
  font-size: 10px;
}

.image-controls label {
  font-size: 10px;
}

.image-controls select {
  padding: 8px;
}

.image-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 8px;
}

.image-actions .ghost-button {
  min-height: 34px;
  font-size: 11px;
}

.primary-button,
.ghost-button,
.danger-button,
.file-button,
.icon-button {
  min-height: 38px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font-weight: 900;
  display: inline-grid;
  place-items: center;
  text-align: center;
  text-transform: none;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
}

.danger-button {
  border-color: #f0c8c8;
  color: #9f2828;
}

.icon-button {
  min-height: 28px;
  width: 28px;
  font-size: 17px;
  line-height: 1;
}

.workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  min-height: 64px;
  padding: 12px 22px;
  background: rgba(255, 255, 255, 0.84);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  backdrop-filter: blur(12px);
}

.topbar strong,
.topbar span {
  display: block;
}

.topbar strong {
  font-size: 16px;
}

.topbar span {
  color: var(--muted);
  font-size: 13px;
}

.view-actions {
  display: grid;
  grid-template-columns: minmax(112px, auto) 34px 56px 34px;
  align-items: center;
  gap: 6px;
}

.view-actions button {
  height: 34px;
  border: 1px solid var(--line);
  background: white;
  font-size: 18px;
  font-weight: 900;
}

.view-actions .new-report-button {
  width: auto;
  padding: 0 12px;
  font-size: 12px;
  background: var(--ink);
  color: #fff;
}

.view-actions span {
  text-align: center;
  font-size: 12px;
  font-weight: 900;
  color: var(--muted);
}

.landing-page {
  min-height: 100vh;
  background: #e8eeee;
  color: var(--ink);
}

.landing-hero {
  min-height: 40vh;
  padding: 34px clamp(22px, 5vw, 72px);
  display: grid;
  align-content: end;
  background: var(--ink);
  color: white;
  position: relative;
  overflow: hidden;
}

.landing-hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 34mm;
  background: #1e2b2d;
}

.landing-hero::before {
  content: "";
  position: absolute;
  inset: auto auto 0 0;
  width: 10mm;
  height: 34mm;
  background: var(--accent);
  z-index: 1;
}

.landing-hero-inner {
  position: relative;
  z-index: 2;
  max-width: 920px;
}

.landing-logo {
  width: 178px;
  margin-bottom: 46px;
}

.landing-hero h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1;
}

.landing-hero p {
  max-width: 660px;
  color: #dde8e8;
  font-size: 17px;
  line-height: 1.5;
}

.landing-main {
  padding: 34px clamp(22px, 5vw, 72px) 72px;
}

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

.report-card {
  min-height: 250px;
  display: grid;
  align-content: space-between;
  gap: 24px;
  padding: 24px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: 0 16px 42px rgba(17, 24, 25, 0.08);
  color: var(--ink);
  text-decoration: none;
}

.report-card:hover {
  border-color: var(--accent-dark);
}

.report-card h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.12;
}

.report-card p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.report-card span {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.preview-wrap {
  overflow: auto;
  padding: 32px 32px 180px;
}

.report-page {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  zoom: var(--zoom);
  background: var(--page);
  box-shadow: var(--shadow);
  color: var(--ink);
  padding-bottom: 13mm;
}

.report-cover {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  row-gap: 8mm;
  min-height: 128mm;
  overflow: hidden;
  background: var(--ink);
  color: white;
  padding: 18mm;
}

.cover-photo {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.38;
  filter: saturate(0.95) contrast(1.05);
}

.report-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(17, 24, 25, 0.72), rgba(17, 24, 25, 0.5));
  pointer-events: none;
}

.cover-mark {
  position: absolute;
  inset: auto 0 0 0;
  height: 46mm;
  z-index: 1;
  background: rgba(30, 43, 45, 0.88);
}

.cover-mark::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 9mm;
  background: var(--accent);
}

.cover-logo {
  position: relative;
  z-index: 2;
  width: 48mm;
  height: auto;
  display: block;
  align-self: start;
  margin: 0;
}

.cover-copy {
  position: relative;
  z-index: 2;
  align-self: end;
  max-width: 148mm;
  padding-bottom: 13mm;
}

.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.cover-copy h1 {
  margin: 4mm 0 5mm;
  max-width: 145mm;
  font-size: clamp(25px, 3.8vw, 31px);
  line-height: 1.12;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.cover-copy p {
  margin: 0;
  max-width: 126mm;
  color: #dde8e8;
  font-size: 13px;
  line-height: 1.5;
}

.cover-meta {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10mm;
  align-self: end;
  max-width: 160mm;
  margin-left: 9mm;
}

.cover-meta div {
  border: 1px solid #354345;
  padding: 5mm;
}

.cover-meta span,
.kv span,
.section-heading span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.cover-meta strong,
.kv strong {
  display: block;
  margin-top: 2mm;
  overflow-wrap: anywhere;
}

.report-section {
  padding: 12mm 18mm 0;
  break-inside: avoid;
  page-break-inside: avoid;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 8mm;
  margin-bottom: 5mm;
  border-top: 1px solid var(--line);
  padding-top: 6mm;
}

.section-heading h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.12;
}

.section-heading h2::after {
  content: "";
  display: block;
  width: 34mm;
  height: 2px;
  margin-top: 2mm;
  background: var(--accent);
}

.kv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8mm 12mm;
  padding: 7mm;
  background: var(--soft);
  border: 1px solid var(--line);
}

.kv strong {
  font-size: 13px;
  line-height: 1.25;
}

.note-box,
.report-section > p {
  margin-top: 7mm;
  padding: 7mm;
  background: var(--soft);
  border: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  break-inside: avoid;
  page-break-inside: avoid;
}

.tech-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5mm 8mm;
  margin-top: 7mm;
  padding: 6mm;
  background: white;
  border: 1px solid var(--line);
  break-inside: avoid;
  page-break-inside: avoid;
}

.tech-box div {
  display: grid;
  gap: 1.5mm;
}

.tech-box span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.tech-box strong {
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
  break-inside: avoid;
  page-break-inside: avoid;
}

.result-table th {
  background: var(--ink);
  color: white;
  text-align: left;
  padding: 10px 11px;
  border: 1px solid var(--line);
}

.result-table td {
  padding: 10px 11px;
  border: 1px solid var(--line);
  background: white;
  overflow-wrap: anywhere;
}

.result-table tbody tr:nth-child(odd) td {
  background: var(--soft);
}

.profile-detail {
  padding: 13mm 18mm 0;
  break-inside: avoid;
  page-break-inside: avoid;
}

.profile-detail::before {
  content: "";
  display: block;
  height: 2mm;
  margin-bottom: 7mm;
  background: var(--profile-color, var(--accent));
}

.profile-detail h2 {
  margin: 0 0 5mm;
  padding-bottom: 3mm;
  border-bottom: 1px solid var(--line);
  font-size: 22px;
  line-height: 1.15;
}

.profile-param-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
  margin-bottom: 6mm;
}

.profile-param-table th {
  background: var(--profile-color, var(--ink));
  color: white;
  padding: 9px 10px;
  border: 1px solid var(--line);
}

.profile-param-table td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  text-align: center;
}

.profile-param-table tr:nth-child(odd) td {
  background: #f3f3f3;
}

.profile-chart-frame {
  margin: 0 auto;
  border: 1px solid #eef1f1;
  background: white;
  overflow: hidden;
  break-inside: avoid;
  page-break-inside: avoid;
}

.profile-chart-frame.size-half {
  width: 55%;
}

.profile-chart-frame.size-wide {
  width: 100%;
}

.profile-chart-frame.size-large {
  width: 100%;
}

.profile-chart {
  width: 100%;
  aspect-ratio: 1400 / 620;
  display: block;
  object-fit: cover;
  background: white;
}

.profile-chart-frame.size-large .profile-chart {
  aspect-ratio: 16 / 9;
}

.profile-chart-frame.fit-contain .profile-chart {
  object-fit: contain;
}

.profile-caption {
  margin: 2mm 0 7mm;
  color: var(--muted);
  font-size: 11px;
  font-style: italic;
  text-align: center;
}

.profile-point-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin: -2mm 0 7mm;
  font-size: 11px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.profile-point-table th {
  background: #f4f7f7;
  color: var(--muted);
  text-align: left;
  text-transform: uppercase;
  padding: 7px 9px;
  border: 1px solid var(--line);
}

.profile-point-table td {
  padding: 8px 9px;
  border: 1px solid var(--line);
  background: white;
}

.profile-screenshot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4mm;
  margin-top: 5mm;
}

.profile-media-card {
  margin: 0;
  border: 0;
  background: transparent;
  overflow: hidden;
  break-inside: avoid;
  page-break-inside: avoid;
}

.profile-media-card.size-wide,
.profile-media-card.size-large {
  grid-column: 1 / -1;
}

.profile-media-card img {
  width: 100%;
  aspect-ratio: 16 / 8;
  display: block;
  object-fit: cover;
}

.profile-media-card.size-wide img {
  aspect-ratio: 16 / 6.8;
}

.profile-media-card.size-large img {
  aspect-ratio: 16 / 9;
}

.profile-media-card.fit-contain img {
  object-fit: contain;
  background: transparent;
}

.profile-media-card figcaption {
  margin: 0;
  padding: 2.5mm 3mm;
  background: white;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.annotated-image {
  position: relative;
  background: var(--ink);
}

.annotated-image img {
  width: 100%;
  aspect-ratio: 16 / 8;
  display: block;
  object-fit: cover;
}

.image-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  min-width: 14px;
  min-height: 14px;
  display: inline-grid;
  place-items: center;
  border: 2px solid rgba(167, 233, 47, 0.78);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(17, 24, 25, 0.18);
}

.image-marker b {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 56px;
  max-width: 34mm;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  padding: 2px 4px;
  font-size: 7px;
}

.image-marker small {
  display: block;
  margin-top: 2px;
  color: var(--ink-2);
  font-size: 7px;
  font-weight: 700;
  line-height: 1.15;
  white-space: normal;
}

.image-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 24, 25, 0.72);
}

.image-preview-modal[hidden] {
  display: none;
}

.image-preview-dialog {
  width: min(1180px, 96vw);
  max-height: 94vh;
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 18px;
}

#imagePreviewLarge {
  width: 100%;
  max-height: calc(94vh - 95px);
  object-fit: contain;
  display: block;
  background: var(--ink);
}

.image-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 26;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 24, 25, 0.74);
}

.image-editor-modal[hidden] {
  display: none;
}

.image-editor-dialog {
  width: min(1180px, 96vw);
  max-height: 94vh;
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 18px;
}

#imageEditCanvas {
  width: 100%;
  height: auto;
  display: block;
  background: var(--ink);
  cursor: crosshair;
}

.image-editor-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.image-point-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin-top: 3mm;
  font-size: 10px;
}

.image-point-table th,
.image-point-table td {
  padding: 6px 7px;
  border: 1px solid var(--line);
  background: white;
  text-align: left;
}

.image-point-table th {
  color: var(--muted);
  background: var(--soft);
  text-transform: uppercase;
}

.profile-comment {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}

.profile-summary-table tbody tr.profile-row-0 td {
  background: #fdecea;
}

.profile-summary-table tbody tr.profile-row-1 td {
  background: #eaf4eb;
}

.profile-summary-table tbody tr.profile-row-2 td {
  background: #e8f3fb;
}

.media-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7mm;
}

.media-card {
  border: 1px solid var(--line);
  background: var(--soft);
  overflow: hidden;
}

.media-card.size-wide,
.media-card.size-large {
  grid-column: 1 / -1;
}

.media-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: var(--ink);
}

.media-card.size-wide img {
  aspect-ratio: 16 / 7;
}

.media-card.size-large img {
  aspect-ratio: 16 / 10;
}

.media-card.fit-contain img {
  object-fit: contain;
  padding: 3mm;
}

.media-card figcaption {
  margin: 0;
  padding: 4mm;
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.report-footer {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8mm;
  margin: 16mm 18mm 0;
  padding-top: 5mm;
  border-top: 1px solid var(--line);
}

.report-footer span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.report-footer strong {
  display: block;
  margin-top: 1.5mm;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.chart-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 24, 25, 0.62);
}

.chart-modal[hidden] {
  display: none;
}

.chart-dialog {
  width: min(1180px, 96vw);
  max-height: 94vh;
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 18px;
}

.chart-dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.chart-dialog-head strong,
.chart-dialog-head span {
  display: block;
}

.chart-dialog-head strong {
  font-size: 18px;
}

.chart-dialog-head span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

#chartCanvas {
  width: 100%;
  height: auto;
  display: block;
  background: var(--ink);
  cursor: crosshair;
}

.chart-point-panel {
  display: grid;
  grid-template-columns: 1fr 150px;
  gap: 12px;
  margin-top: 14px;
}

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

.chart-point {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr 2fr 28px;
  gap: 8px;
  align-items: start;
}

.chart-point.image-point {
  grid-template-columns: 1.3fr 2fr 28px;
}

.chart-point input,
.chart-point textarea {
  padding: 8px;
}

.chart-point textarea {
  min-height: 38px;
  resize: vertical;
  text-transform: none;
  font-weight: 600;
}

.chart-point .icon-button {
  min-height: 28px;
}

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

  .panel {
    position: relative;
    height: auto;
  }

  .report-page {
    margin-left: 0;
  }

  .report-picker {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .content-media-layout {
    grid-template-columns: 1fr;
  }

  .media-column {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
}

@media (max-width: 680px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .view-actions {
    grid-template-columns: minmax(112px, 1fr) 34px 56px 34px;
  }

  .report-picker {
    grid-template-columns: 1fr;
  }
}

@media print {
  html,
  body {
    background: white;
  }

  *,
  *::before,
  *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .panel,
  .topbar,
  .chart-modal,
  .image-preview-modal {
    display: none !important;
  }

  .app-shell,
  .workspace,
  .preview-wrap {
    display: block;
    padding: 0;
    overflow: visible;
  }

  .report-page {
    width: 210mm;
    min-height: 297mm;
    zoom: 1;
    box-shadow: none;
    margin: 0;
    padding-bottom: 13mm;
    background: white !important;
  }

  .report-cover {
    background: #111819 !important;
    color: white !important;
    break-inside: avoid;
    page-break-inside: avoid;
    break-after: page;
    page-break-after: always;
  }

  .cover-photo {
    display: block;
    z-index: 0 !important;
    opacity: 0.42 !important;
  }

  .cover-mark {
    background: rgba(30, 43, 45, 0.88) !important;
  }

  .cover-mark::before {
    background: #a7e92f !important;
  }

  .report-cover::after {
    background: linear-gradient(180deg, rgba(17, 24, 25, 0.72), rgba(17, 24, 25, 0.5)) !important;
  }

  .report-section,
  .note-box,
  .tech-box,
  .result-table,
  .media-card,
  .profile-param-table,
  .profile-chart-frame,
  .profile-point-table,
  .profile-media-card,
  .profile-comment {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  img,
  figure,
  table {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .profile-detail,
  .conclusion-section {
    break-before: page;
  }

  .profile-detail {
    break-inside: auto;
    page-break-inside: auto;
  }

  .profile-detail h2,
  .profile-param-table,
  .profile-chart-frame,
  .profile-point-table,
  .profile-media-card,
  .profile-comment {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  @page {
    size: A4;
    margin: 0;
  }
}
