:root {
  --orange: #f7931e;
  --black: #111111;
  --ink: #171717;
  --muted: #6b7280;
  --line: #e6e1da;
  --paper: #fbfaf7;
  --surface: #ffffff;
  --green: #3f7f55;
  --red: #a53b2c;
  --shadow: 0 18px 50px rgba(17, 17, 17, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #f4f1ec;
  font-family: Arial, Helvetica, sans-serif;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  color: white;
  background: #111;
}

.logo {
  width: 100%;
  padding: 12px;
  background: white;
  border-radius: 14px;
}

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

.nav-item,
.ghost-button,
.primary-button {
  border: 0;
  border-radius: 12px;
  font-weight: 800;
}

.ghost-button:disabled,
.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.nav-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  color: rgba(255, 255, 255, 0.72);
  text-align: left;
  background: transparent;
}

.nav-item span {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 900;
}

.nav-item.active {
  color: #111;
  background: var(--orange);
}

.nav-item.active span {
  color: #111;
  border-color: rgba(17, 17, 17, 0.25);
  background: rgba(255, 255, 255, 0.45);
}

.nav-item.locked {
  opacity: 0.42;
}

.sidebar-note {
  margin-top: auto;
  padding: 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-note span,
.eyebrow,
.field span,
.stat-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-note span {
  color: rgba(255, 255, 255, 0.55);
}

.sidebar-note strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.main {
  padding: 28px;
}

.topbar,
.section-head,
.panel-head,
.form-top,
.report-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.topbar h1,
.section-head h2,
.panel h3,
.form-card h3,
.report-header h2 {
  margin: 0;
}

.topbar h1 {
  font-size: 42px;
  line-height: 1;
}

.eyebrow {
  margin: 0 0 8px;
  color: #946735;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ghost-button,
.primary-button {
  padding: 12px 16px;
  background: white;
  color: #191919;
  border: 1px solid var(--line);
}

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

.ghost-button.danger {
  color: var(--red);
}

.small {
  padding: 9px 12px;
  font-size: 13px;
}

.meta-grid {
  margin: 26px 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

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

.field input,
.field select,
.field textarea,
.score-input,
.ocr-box {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--ink);
  outline: 0;
}

.field input,
.field select,
.score-input {
  height: 46px;
  padding: 0 13px;
}

.view,
.panel,
.form-card,
.score-card,
.report-page {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.view {
  border-radius: 22px;
  padding: 24px;
}

.section-head {
  margin-bottom: 20px;
}

.section-head p {
  max-width: 820px;
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.status-pill,
.score-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 9px 13px;
  color: #8b4e08;
  background: rgba(247, 147, 30, 0.12);
  font-weight: 800;
  white-space: nowrap;
}

.score-badge {
  color: #103d21;
  background: rgba(63, 127, 85, 0.13);
}

.landing-view {
  min-height: 620px;
}

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

.choice-card {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 240px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
}

.choice-card h3 {
  margin: 0;
  font-size: 24px;
}

.choice-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.choice-card button {
  justify-self: start;
  margin-top: auto;
}

.choice-step {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 7px 11px;
  color: #8b4e08;
  background: rgba(247, 147, 30, 0.14);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-records-panel {
  margin-top: 18px;
}

.drop-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 2px dashed rgba(247, 147, 30, 0.45);
  border-radius: 20px;
  background: #fff8ef;
  text-align: center;
  color: #6a5238;
}

.drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-zone strong {
  font-size: 22px;
  color: #2b2117;
}

.drop-zone span {
  margin-top: 4px;
}

.upload-progress {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  box-shadow: var(--shadow);
}

.upload-progress > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.upload-progress span,
.upload-progress small {
  color: var(--muted);
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #ece8e1;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--orange);
  transition: width 180ms ease;
}

.capture-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
}

.panel,
.form-card,
.score-card {
  border-radius: 18px;
  padding: 18px;
}

.file-list,
.forms-list,
.records-list {
  display: grid;
  gap: 12px;
}

.file-item,
.record-item,
.comment-item {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}

.record-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.record-item span,
.record-item small,
.record-item em {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.record-item em {
  max-width: 620px;
  overflow: hidden;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-actions {
  display: flex;
  gap: 6px;
}

.records-page-size {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.records-page-size select {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  font-weight: 800;
}

.record-files {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}

.record-files span {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.record-files strong {
  margin-right: 2px;
  color: var(--ink);
}

.record-files a {
  color: #8b4e08;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.record-files a:hover {
  text-decoration: underline;
}

.records-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.records-pager > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-item strong {
  display: block;
}

.file-item small {
  color: var(--muted);
}

.file-item details {
  margin-top: 10px;
}

.file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.file-actions a {
  color: #8b4e08;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.file-actions a:hover {
  text-decoration: underline;
}

.file-item summary {
  color: #8b4e08;
  font-weight: 800;
  cursor: pointer;
}

.file-item pre {
  max-height: 220px;
  overflow: auto;
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 10px;
  background: white;
  color: #2b2117;
  white-space: pre-wrap;
}

.empty-state {
  color: var(--muted);
}

.ocr-box {
  min-height: 220px;
  resize: vertical;
  padding: 14px;
  line-height: 1.55;
}

.form-card {
  display: grid;
  gap: 16px;
}

.review-workbench {
  display: grid;
  grid-template-columns: minmax(460px, 0.95fr) minmax(420px, 1.05fr);
  gap: 18px;
  align-items: start;
}

.review-workbench .rating-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.review-workbench .comments-grid {
  grid-template-columns: 1fr;
}

.form-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.autosave-note {
  color: var(--muted);
  font-size: 13px;
}

.scan-preview-panel {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  box-shadow: var(--shadow);
  padding: 16px;
}

.scan-preview-head {
  display: grid;
  gap: 12px;
}

.scan-preview-head h3 {
  margin: 0;
}

.scan-preview-head p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.preview-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preview-page {
  padding: 9px 12px;
  font-size: 12px;
}

.preview-page.active {
  color: white;
  background: var(--black);
  border-color: var(--black);
}

.scan-frame {
  height: calc(100vh - 240px);
  min-height: 540px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7f7f7;
}

.scan-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.scan-empty,
.scan-empty-card {
  min-height: 320px;
  display: grid;
  place-items: center;
  text-align: center;
}

.scan-empty-card {
  align-content: center;
  gap: 12px;
  padding: 32px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: var(--paper);
}

.scan-empty-card strong {
  font-size: 20px;
}

.scan-empty-card span {
  max-width: 520px;
  color: var(--muted);
  line-height: 1.55;
}

.review-navigator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
}

.review-navigator.bottom {
  margin-top: 14px;
}

.review-navigator div {
  display: grid;
  gap: 3px;
  text-align: center;
}

.review-navigator strong {
  font-size: 18px;
}

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

.form-top h3 {
  font-size: 20px;
}

.score-detect-note {
  margin: 8px 0 0;
  color: #3f7f55;
  font-size: 13px;
  font-weight: 800;
}

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

.score-input {
  text-align: center;
  font-weight: 800;
}

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

.comments-grid textarea {
  min-height: 96px;
  padding: 12px;
  resize: vertical;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 16px;
}

.score-card h3 {
  margin: 0 0 8px;
}

.average-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 14px;
}

.average-line strong {
  font-size: 34px;
}

.bar-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  color: var(--muted);
  font-size: 13px;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #ece8e1;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--orange);
}

.report-page {
  max-width: 1200px;
  margin: 0 auto;
  background: transparent;
  box-shadow: none;
  border: 0;
}

.print-preview {
  display: block;
  width: 100%;
  min-height: 1180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.report-sheet {
  position: relative;
  min-height: 1060px;
  margin: 0 auto 22px;
  padding: 34px 38px 48px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.report-sheet::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--orange);
}

.report-header {
  position: relative;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 3px solid #111;
}

.report-header img {
  width: 170px;
}

.report-header p {
  margin: 0 0 4px;
  color: var(--orange);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

.report-header h2 {
  max-width: 560px;
  font-size: 28px;
  line-height: 1.1;
}

.report-summary {
  margin: 20px 0 14px;
  display: grid;
  grid-template-columns: 1.25fr repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.report-stat,
.report-hero-card,
.report-category-card {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.report-stat strong,
.report-hero-card strong,
.report-category-card strong {
  display: block;
  margin-top: 5px;
  font-size: 19px;
}

.report-hero-card {
  color: var(--ink);
  background: white;
  border-color: var(--line);
  border-left: 5px solid #111;
}

.report-hero-card span,
.report-hero-card small,
.report-category-card span,
.report-category-card small {
  color: var(--muted);
}

.report-hero-card span,
.report-hero-card small {
  color: var(--muted);
}

.report-hero-card strong {
  color: var(--ink);
  font-size: 30px;
}

.report-section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.report-section-title.compact {
  margin-top: 14px;
}

.report-section-title span {
  color: var(--orange);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.report-section-title strong {
  color: var(--muted);
  font-size: 12px;
}

.report-category-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.report-category-card {
  border-left: 5px solid var(--orange);
}

.report-scores {
  overflow: visible;
}

.report-matrix {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 7.2px;
  line-height: 1.22;
  background: white;
}

.report-matrix th,
.report-matrix td {
  border: 1px solid #cfcfcf;
  padding: 3px 2px;
  text-align: center;
  vertical-align: middle;
}

.report-matrix th {
  background: #151515;
  color: white;
  font-weight: 800;
}

.report-matrix th:first-child,
.report-matrix td:first-child {
  width: 18px;
}

.report-matrix th:nth-child(2),
.report-matrix td:nth-child(2) {
  width: 230px;
}

.report-matrix th:nth-last-child(1),
.report-matrix td:nth-last-child(1),
.report-matrix th:nth-last-child(2),
.report-matrix td:nth-last-child(2) {
  width: 30px;
}

.report-matrix .question-cell {
  text-align: left;
}

.matrix-section td {
  background: #f0f2f5;
  font-weight: 800;
  text-align: left;
}

.matrix-average td {
  background: #fff1e6;
  font-weight: 800;
}

.feedback-panel {
  position: relative;
}

.topic-list,
.comment-list {
  column-count: 2;
  column-gap: 14px;
}

.comment-list.continued {
  margin-top: 8px;
}

.comment-item {
  display: inline-block;
  width: 100%;
  margin: 0 0 7px;
  padding: 8px 10px;
  border: 1px solid #d9d3cb;
  border-left: 4px solid var(--orange);
  border-radius: 6px;
  background: white;
  color: #171717;
  font-size: 11px;
  line-height: 1.35;
  break-inside: avoid;
}

.comment-item.muted {
  color: var(--muted);
  border-left-color: #d9d3cb;
}

.report-footer {
  position: absolute;
  right: 38px;
  bottom: 20px;
  left: 38px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .meta-grid,
  .capture-grid,
  .landing-actions,
  .review-workbench,
  .comments-grid,
  .rating-grid,
  .report-category-strip,
  .report-summary {
    grid-template-columns: 1fr;
  }

  .scan-preview-panel {
    position: static;
  }

  .scan-frame {
    height: 70vh;
    min-height: 420px;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 6mm;
  }

  * {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  body {
    background: white !important;
  }

  .sidebar,
  .topbar,
  .meta-grid,
  .view:not(#report-view),
  #report-view > .section-head {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .main {
    padding: 0;
  }

  #report-view {
    display: block !important;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .report-page {
    border: 0;
    box-shadow: none;
    max-width: none;
    padding: 0;
    background: white !important;
  }

  .report-sheet {
    width: auto;
    height: 285mm;
    min-height: 0;
    margin: 0;
    padding: 7mm 7mm 10mm;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: white !important;
    break-after: page;
    page-break-after: always;
  }

  .report-sheet:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  .report-sheet::before {
    display: none;
  }

  .report-header {
    padding-bottom: 3.5mm;
    border-bottom-width: 1.2pt;
  }

  .report-header img {
    width: 34mm;
  }

  .report-header h2 {
    font-size: 16pt;
  }

  .report-header p {
    font-size: 7.5pt;
  }

  .report-header span {
    font-size: 8pt;
  }

  .report-summary {
    margin: 3.5mm 0 2mm;
    gap: 1.8mm;
  }

  .report-stat,
  .report-hero-card,
  .report-category-card {
    padding: 2mm;
    border-radius: 2mm;
    background: white !important;
  }

  .report-hero-card strong {
    font-size: 16pt;
  }

  .report-stat strong,
  .report-category-card strong {
    font-size: 10pt;
  }

  .report-hero-card span,
  .report-stat span,
  .report-category-card span,
  .report-hero-card small,
  .report-category-card small {
    font-size: 7pt;
  }

  .report-category-strip {
    gap: 1.8mm;
    margin-bottom: 1.2mm;
  }

  .report-section-title {
    margin: 2.6mm 0 1.3mm;
    padding-bottom: 1mm;
  }

  .report-section-title span,
  .report-section-title strong {
    font-size: 7.2pt;
  }

  .report-matrix {
    font-size: 4.45pt;
    line-height: 1.05;
  }

  .report-matrix th,
  .report-matrix td {
    padding: 0.55mm 0.25mm;
    border-color: #bdbdbd;
  }

  .report-matrix th:nth-child(2),
  .report-matrix td:nth-child(2) {
    width: 44mm;
  }

  .report-matrix th:first-child,
  .report-matrix td:first-child {
    width: 4.5mm;
  }

  .report-matrix th:nth-last-child(1),
  .report-matrix td:nth-last-child(1),
  .report-matrix th:nth-last-child(2),
  .report-matrix td:nth-last-child(2) {
    width: 7mm;
  }

  .topic-list,
  .comment-list {
    column-gap: 3mm;
  }

  .comment-item {
    margin-bottom: 1.25mm;
    padding: 1.35mm 1.8mm;
    border-radius: 1.4mm;
    font-size: 6.8pt;
    line-height: 1.2;
    background: white !important;
  }

  .report-footer {
    right: 7mm;
    bottom: 4mm;
    left: 7mm;
    font-size: 6.8pt;
  }
}
