:root {
  color-scheme: dark;
  --bg: #05070d;
  --panel: #0a1018;
  --panel-soft: #0d141e;
  --panel-hover: #111a25;
  --line: #222d3a;
  --line-soft: #18222e;
  --text: #f2f4f7;
  --muted: #929aa6;
  --red: #f4232b;
  --red-dark: #cb151d;
  --red-soft: rgb(244 35 43 / 11%);
  --green: #10c995;
  --blue: #18a6e8;
  --danger: #ff5b61;
  --radius: 16px;
  --font: Inter, "Segoe UI", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; min-width: 320px; min-height: 100vh; overflow-x: hidden; background: radial-gradient(circle at 100% 0, rgb(80 6 18 / 22%), transparent 34rem), var(--bg); color: var(--text); font: 14px/1.4 var(--font); }
body.modal-open { overflow: hidden; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 999; top: 8px; left: 8px; transform: translateY(-150%); padding: 9px 12px; border-radius: 8px; background: var(--red); color: #fff; }
.skip-link:focus { transform: translateY(0); }

.app-header { position: sticky; z-index: 30; top: 0; display: grid; grid-template-columns: 250px 1fr auto; align-items: center; min-height: 78px; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgb(5 7 13 / 94%); backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; height: 68px; }
.brand img { display: block; width: auto; height: 64px; object-fit: contain; }
.app-header__title { display: flex; align-items: center; gap: 12px; }
.app-header__title > div { display: flex; flex-direction: column; }
.app-header__title strong { font-size: 16px; }
.app-header__title span:not(.header-icon) { color: var(--muted); font-size: 12px; }
.header-icon, .section-icon { display: grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; border-radius: 11px; background: var(--red-soft); color: var(--red); }
.header-icon svg, .section-icon svg, .button svg, .icon-button svg, .dropzone svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app-header__actions { display: flex; align-items: center; gap: 18px; }
.draft-status { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.draft-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgb(16 201 149 / 10%); }

.app-shell { width: min(1320px, calc(100% - 40px)); margin: 0 auto; padding: 24px 0 40px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 16px; padding: 0 2px; }
.page-heading p, .modal__header p { margin: 0 0 3px; color: var(--red); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.page-heading h1 { margin: 0; font-size: 25px; line-height: 1.2; letter-spacing: -.025em; }
.page-heading > span { color: var(--muted); font-size: 12px; }

.report-form { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); gap: 14px; }
.form-card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgb(13 20 30 / 98%), rgb(8 13 20 / 98%)); box-shadow: 0 12px 32px rgb(0 0 0 / 10%); }
.form-card--evidence { grid-column: 1 / -1; }
.evidence-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, .95fr); align-items: start; gap: 22px; }
.section-heading { display: flex; align-items: center; margin-bottom: 16px; gap: 11px; }
.section-heading--inline { margin-bottom: 12px; }
.section-heading h2 { margin: 0; font-size: 15px; letter-spacing: -.01em; }
.section-heading p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.section-icon { width: 34px; height: 34px; border-radius: 9px; background: rgb(24 166 232 / 10%); color: var(--blue); }
.section-icon--red { background: var(--red-soft); color: var(--red); }
.section-icon svg { width: 18px; height: 18px; }

.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 7px 12px; }
.field { min-width: 0; }
.field--3 { grid-column: span 3; }
.field--4 { grid-column: span 4; }
.field--5 { grid-column: span 5; }
.field--6 { grid-column: span 6; }
.field--7 { grid-column: span 7; }
.field--8 { grid-column: span 8; }
.field--full { grid-column: 1 / -1; }
.field label { display: flex; align-items: center; justify-content: space-between; min-height: 18px; margin-bottom: 4px; color: #c6ccd4; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .035em; }
.field label > span { color: var(--danger); }
.field label small { color: #66707d; font-size: 9px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.field input, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; outline: 0; background: #070b12; color: var(--text); transition: border-color 140ms, box-shadow 140ms, background 140ms; }
.field input { height: 38px; padding: 0 11px; }
.field textarea { min-height: 62px; padding: 9px 11px; line-height: 1.4; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: #525d69; }
.field input:hover, .field textarea:hover { border-color: #344255; }
.field input:focus, .field textarea:focus { border-color: var(--red); background: #090d15; box-shadow: 0 0 0 3px rgb(244 35 43 / 10%); }
.field.has-error input, .field.has-error textarea { border-color: var(--danger); }
.field-error { min-height: 11px; margin: 2px 0 0; color: var(--danger); font-size: 9px; font-weight: 600; }
.field-meta { display: flex; justify-content: space-between; min-height: 11px; }
.character-counter { margin-top: 2px; color: #5f6975; font-size: 9px; }

.evidence-column { min-width: 0; }
.dropzone { display: flex; align-items: center; justify-content: center; min-height: 82px; padding: 13px; border: 1px dashed #394657; border-radius: 10px; outline: 0; background: #070b12; color: var(--muted); gap: 11px; text-align: left; transition: border-color 140ms, background 140ms; }
.dropzone:hover, .dropzone:focus-visible, .dropzone.is-dragging { border-color: var(--red); background: var(--red-soft); }
.dropzone__icon { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 9px; background: var(--red-soft); color: var(--red); }
.dropzone > span:last-child { display: flex; flex-direction: column; }
.dropzone strong { color: var(--text); font-size: 12px; }
.dropzone small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.image-preview-list { display: flex; overflow-x: auto; padding-bottom: 2px; gap: 7px; scrollbar-width: thin; }
.image-card { position: relative; overflow: hidden; flex: 0 0 88px; width: 88px; aspect-ratio: 4 / 3; border: 1px solid var(--line); border-radius: 8px; background: #070b12; }
.image-card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.image-card__overlay { position: absolute; right: 0; bottom: 0; left: 0; display: flex; align-items: center; justify-content: flex-end; padding: 14px 4px 4px; background: linear-gradient(transparent, rgb(0 0 0 / 78%)); }
.image-card__name { display: none; }
.image-card__remove { display: grid; place-items: center; width: 23px; height: 23px; padding: 0; border: 0; border-radius: 6px; background: rgb(244 35 43 / 88%); color: #fff; }
.image-card__remove svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 2; }
.notes-column { display: grid; align-content: start; gap: 5px; }
.notes-column .field textarea { min-height: 58px; }

.form-summary { grid-column: 1 / -1; padding: 10px 13px; border: 1px solid rgb(255 91 97 / 36%); border-radius: 9px; background: rgb(255 91 97 / 9%); color: #ff8c91; font-size: 11px; }
.form-summary[hidden] { display: none; }
.mobile-submit { display: none; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 16px; border: 1px solid transparent; border-radius: 9px; gap: 8px; color: #fff; font-size: 11px; font-weight: 800; white-space: nowrap; }
.button--primary { background: linear-gradient(135deg, var(--red), var(--red-dark)); box-shadow: 0 8px 22px rgb(244 35 43 / 20%); }
.button--primary:hover, .button--primary:focus-visible { filter: brightness(1.08); }
.button svg { width: 16px; height: 16px; }
.button--secondary { border-color: var(--line); background: var(--panel); color: var(--text); }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--muted); }

.modal { position: fixed; z-index: 100; inset: 0; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgb(0 0 0 / 78%); backdrop-filter: blur(5px); }
.modal__dialog { position: absolute; inset: 18px; display: flex; flex-direction: column; width: min(1120px, calc(100% - 36px)); margin: auto; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); outline: 0; background: var(--bg); box-shadow: 0 24px 80px rgb(0 0 0 / 55%); }
.modal__header { display: flex; align-items: center; justify-content: space-between; padding: 13px 17px; border-bottom: 1px solid var(--line); background: var(--panel); gap: 18px; }
.modal__header h2 { margin: 0; font-size: 17px; }
.modal__header p { margin-bottom: 2px; }
.modal__actions { display: flex; gap: 8px; }
.modal__body { flex: 1; overflow: auto; padding: 24px 16px 45px; }

.technical-report { width: min(794px, 100%); min-height: 1123px; margin: 0 auto; padding: 55px 60px; background: #fff; color: #17222d; box-shadow: 0 10px 40px rgb(0 0 0 / 30%); font-family: Arial, sans-serif; }
.document-header { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 20px; border-bottom: 3px solid #e81e27; gap: 24px; }
.document-brand { display: flex; align-items: center; padding: 7px 11px; border-radius: 8px; background: #05070d; }
.document-brand img { display: block; width: auto; height: 65px; object-fit: contain; }
.document-title { text-align: right; }
.document-title p { margin: 0 0 4px; color: #6e7d89; font-size: 8px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.document-title h1 { margin: 0; color: #17222d; font-size: 20px; text-transform: uppercase; }
.document-title span { display: block; margin-top: 5px; color: #6e7d89; font-size: 8px; }
.report-section { margin-top: 26px; }
.report-section__title { display: flex; align-items: center; margin: 0 0 12px; color: #e81e27; font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
.report-section__title::after { content: ""; flex: 1; height: 1px; margin-left: 10px; background: #dce4e9; }
.report-data-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 24px; }
.report-data-item--full { grid-column: 1 / -1; }
.report-data-item small { display: block; margin-bottom: 2px; color: #75818c; font-size: 8px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.report-data-item p, .report-text { margin: 0; color: #263542; font-size: 10px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.report-photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.report-photo { margin: 0; break-inside: avoid; }
.report-photo img { display: block; width: 100%; aspect-ratio: 4 / 3; border: 1px solid #dce4e9; border-radius: 4px; object-fit: contain; background: #f5f7f8; }
.report-photo figcaption { margin-top: 4px; color: #75818c; font-size: 8px; text-align: center; }
.report-empty { padding: 15px; border: 1px dashed #c7d2da; border-radius: 5px; color: #75818c; font-size: 9px; text-align: center; }
.document-footer { display: flex; justify-content: space-between; margin-top: 36px; padding-top: 10px; border-top: 1px solid #dce4e9; color: #84929c; font-size: 7px; }

.toast-region { position: fixed; z-index: 200; right: 16px; bottom: 16px; display: grid; width: min(330px, calc(100% - 32px)); gap: 8px; }
.toast { padding: 11px 13px; border: 1px solid var(--line); border-left: 3px solid var(--blue); border-radius: 9px; background: #101722; box-shadow: 0 14px 35px rgb(0 0 0 / 42%); color: var(--muted); font-size: 10px; }
.toast--success { border-left-color: var(--green); }
.toast--error { border-left-color: var(--danger); }
.toast strong { display: block; margin-bottom: 1px; color: var(--text); font-size: 11px; }

@media (max-width: 900px) {
  .app-header { grid-template-columns: auto 1fr auto; padding: 0 18px; }
  .draft-status { display: none; }
  .app-shell { width: calc(100% - 28px); }
  .report-form { grid-template-columns: 1fr; }
  .form-card--evidence { grid-column: auto; }
}

@media (max-width: 680px) {
  .app-header { min-height: 66px; padding: 0 12px; gap: 10px; }
  .brand { height: 58px; }
  .brand img { height: 54px; }
  .app-header__title { gap: 8px; }
  .header-icon { display: none; }
  .app-header__title strong { font-size: 14px; }
  .app-header__title span:not(.header-icon) { font-size: 10px; }
  .app-header__actions .button { display: none; }
  .app-shell { width: calc(100% - 20px); padding: 18px 0 84px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .page-heading h1 { font-size: 21px; }
  .form-card { padding: 16px; border-radius: 13px; }
  .evidence-layout { grid-template-columns: 1fr; gap: 15px; }
  .field--3, .field--4, .field--5, .field--6, .field--7, .field--8 { grid-column: span 6; }
  .field--8, .field--7 { grid-column: 1 / -1; }
  .mobile-submit { position: fixed; z-index: 25; right: 10px; bottom: 10px; left: 10px; display: block; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: rgb(5 7 13 / 92%); backdrop-filter: blur(12px); }
  .mobile-submit .button { width: 100%; }
  .modal__dialog { inset: 0; width: 100%; border: 0; border-radius: 0; }
  .modal__header { padding: 11px; }
  .modal__header .button--secondary { width: 40px; padding: 0; font-size: 0; }
  .modal__body { padding: 12px 6px 35px; }
  .technical-report { min-height: auto; padding: 30px 23px; }
  .document-header { flex-direction: column; gap: 14px; }
  .document-title { text-align: left; }
  .report-data-grid, .report-photo-grid { grid-template-columns: 1fr; }
  .report-data-item--full { grid-column: auto; }
}

@media (max-width: 390px) {
  .field--3, .field--4, .field--5, .field--6, .field--7, .field--8 { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@page { size: A4; margin: 12mm; }
@media print {
  body { background: #fff; }
  body > *:not(#report-modal) { display: none !important; }
  #report-modal, .modal__dialog, .modal__body { position: static; display: block !important; width: auto; height: auto; margin: 0; padding: 0; overflow: visible; border: 0; background: #fff; }
  .modal__backdrop, .modal__header { display: none !important; }
  .technical-report { width: 100%; min-height: 0; margin: 0; padding: 0; box-shadow: none; }
  .report-section, .report-photo, .report-data-item { break-inside: avoid; }
}
