:root {
  color-scheme: dark;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-synthesis: none;
  font-weight: 400;
  color: #e5e9e6;
  background: #101311;
  --surface: #171b18;
  --surface-raised: #1d231f;
  --surface-selected: #222a25;
  --line: #2b332e;
  --line-strong: #39443d;
  --text: #e5e9e6;
  --muted: #9ba69e;
  --green: #49bd83;
  --green-soft: #1e382b;
  --document: #f1f3f1;
  --document-text: #232a25;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  height: 100%;
  overflow: hidden;
  background: #101311;
}

body {
  min-width: 320px;
  height: 100%;
  overflow: hidden;
  margin: 0;
  background: #101311;
  color: var(--text);
}

button,
textarea,
input {
  font: inherit;
}

button {
  color: inherit;
}

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

button:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

.page-shell {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.composer-view {
  display: grid;
  grid-template-rows: minmax(0, 1fr) minmax(0, auto) minmax(0, 0.4fr);
  align-items: end;
  justify-items: center;
  height: 100%;
  min-height: 0;
  padding: 0 4vw 7vh;
}

.composer-spacer {
  width: 100%;
}

.composer-card {
  display: grid;
  grid-template-rows: auto minmax(5rem, max-content) minmax(0, 1fr) auto;
  gap: 0.8rem;
  width: min(66vw, 72rem);
  min-width: min(100%, 28rem);
  min-height: 0;
  max-height: 79dvh;
  overflow: hidden;
  margin: 0;
  padding: 1.25rem;
  border: 1px solid #262e29;
  border-radius: 1.2rem;
  background: var(--surface);
}

.composer-label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

#prompt-input {
  display: block;
  width: 100%;
  min-height: 5rem;
  max-height: 34vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.25rem 0;
  resize: vertical;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: clamp(1rem, 1.2vw, 1.25rem);
  line-height: 1.55;
}

#prompt-input::placeholder {
  color: #77827a;
}

#prompt-input:focus-visible {
  outline: none;
}

.attachment-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 0.55rem;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0;
  padding: 0;
  list-style: none;
}

.attachment-chip {
  display: grid;
  grid-template-columns: 1.25rem minmax(0, 1fr) minmax(0, 6.8rem) auto 1.7rem;
  grid-template-rows: 1.7rem;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 0.72rem;
  background: #202622;
  color: var(--text);
}

.attachment-chip[data-state="rejected"],
.attachment-chip[data-state="expired"] {
  border-color: var(--line-strong);
}

.attachment-file-icon,
.material-icon,
.icon-button svg,
.remove-attachment svg,
.back-button svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.attachment-file-icon {
  grid-column: 1;
  grid-row: 1;
  flex: 0 0 auto;
  color: var(--muted);
}

.attachment-name {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
  font-weight: 600;
}

.attachment-status {
  grid-column: 3;
  grid-row: 1;
  min-width: 0;
  flex: 0 1 auto;
  max-width: 13rem;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-reattach {
  grid-column: 4;
  grid-row: 1;
  flex: 0 0 auto;
  min-height: 1.7rem;
  padding: 0.2rem 0.35rem;
  border: 0;
  border-radius: 0.35rem;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  cursor: pointer;
}

.attachment-reattach:hover {
  background: var(--surface-selected);
  color: var(--text);
}

.remove-attachment,
.icon-button,
.back-button,
.secondary-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.remove-attachment {
  grid-column: 5;
  grid-row: 1;
  flex: 0 0 auto;
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border: 0;
  border-radius: 0.4rem;
  color: var(--muted);
}

.remove-attachment:hover,
.icon-button:hover:not(:disabled),
.back-button:hover,
.secondary-button:hover:not(:disabled) {
  background: var(--surface-selected);
}

.remove-attachment svg {
  width: 1rem;
  height: 1rem;
}

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.2rem;
}

.icon-button {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border-radius: 0.75rem;
}

.attach-button {
  color: var(--muted);
}

.attach-button svg {
  width: 1.4rem;
  height: 1.4rem;
}

.composer-submit {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.8rem;
  min-width: 0;
}

.composer-hint {
  max-width: 28rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.35;
  text-align: right;
}

.send-button {
  flex: 0 0 auto;
  width: 2.8rem;
  height: 2.8rem;
  border-color: var(--green);
  border-radius: 50%;
  background: var(--green);
  color: #102017;
}

.send-button:hover:not(:disabled),
.primary-button:hover:not(:disabled) {
  border-color: #5dca94;
  background: #5dca94;
}

.send-button svg {
  width: 1.35rem;
  height: 1.35rem;
}

.review-view {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.review-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 3.8rem;
  padding: 0.65rem 1.4rem;
  border-bottom: 1px solid var(--line);
}

.review-header h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 650;
}

.back-button {
  gap: 0.55rem;
  min-height: 2.5rem;
  padding: 0.35rem 0.8rem;
  border-radius: 0.7rem;
  font-weight: 600;
}

.back-button svg {
  width: 1.1rem;
  height: 1.1rem;
}

.review-grid {
  display: grid;
  grid-template-columns: minmax(16rem, 19rem) minmax(0, 1fr) minmax(18rem, 23rem);
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  background: #101311;
}

.materials-pane,
.preview-pane,
.findings-section {
  min-width: 0;
  min-height: 0;
  padding: 1.1rem 1rem;
}

.materials-pane,
.preview-pane {
  border-right: 1px solid var(--line);
}

.materials-pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #111512;
  overscroll-behavior: contain;
}

.materials-pane h2,
.findings-section h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
}

.materials-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: max-content;
  align-content: start;
  justify-content: start;
  align-self: stretch;
  gap: 0.45rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.materials-download-area {
  display: grid;
  gap: 0.55rem;
  flex: 0 0 auto;
  margin: 0.8rem -1rem -1.1rem;
  padding: 0.8rem 1rem 1.1rem;
  border-top: 1px solid var(--line);
  background: #111512;
}

.materials-list li {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 3.15rem;
  gap: 0.2rem;
}

.material-button {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 3rem;
  padding: 0.65rem;
  border: 1px solid transparent;
  border-radius: 0.7rem;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex: 0 0 auto;
  min-height: 2.4rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}

.download-button:not(:disabled) {
  cursor: pointer;
}

.download-button:not(:disabled):hover,
.download-button:focus-visible {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--text);
}

.download-button:disabled {
  opacity: 0.46;
  cursor: not-allowed;
}

.download-button svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.material-button:hover,
.material-button[aria-current="true"] {
  border-color: var(--line-strong);
  background: var(--surface-raised);
}

.material-button[aria-current="true"] {
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px rgb(73 189 131 / 12%);
}

.material-button[aria-current="true"] .material-icon {
  color: var(--green);
}

.material-icon {
  flex: 0 0 auto;
  color: var(--muted);
}

.material-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  width: 100%;
  min-width: 0;
}

.material-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
  font-weight: 600;
}

.material-status,
.attachment-status {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.material-status {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 0.22rem;
  margin-left: auto;
  min-width: 6.15rem;
  justify-content: flex-end;
  white-space: nowrap;
}

.material-status.is-complete {
  color: var(--green);
}

.material-status.is-active {
  color: var(--green);
}

.material-status.is-error {
  color: #e8877b;
}

.material-status svg {
  width: 0.9rem;
  height: 0.9rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.material-status .material-spinner {
  width: 0.9rem;
  height: 0.9rem;
  animation: process-spin 850ms linear infinite;
}

.material-spinner path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.preview-pane {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  overflow: hidden;
  padding-right: 1.8vw;
  padding-left: 1.8vw;
}

.preview-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
}

.preview-title-group {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.preview-header h2 {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
  font-weight: 650;
}

.preview-download-button {
  min-height: 2.25rem;
  padding: 0.35rem 0.7rem;
  color: var(--text);
  white-space: nowrap;
}

.download-all-button {
  width: 100%;
  min-height: 2.65rem;
  border-color: var(--green);
  background: var(--green);
  color: #07110b;
  font-weight: 650;
}

.download-all-button:not(:disabled):hover,
.download-all-button:focus-visible {
  border-color: #56d190;
  background: #56d190;
  color: #07110b;
}

.download-all-button:disabled {
  border-color: var(--line);
  background: var(--surface);
  color: var(--muted);
}

.preview-count,
.preview-status,
.preview-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.preview-status:empty {
  display: none;
}

.processing-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  min-height: 3rem;
  flex: 0 0 auto;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: var(--surface);
  animation: process-appear 180ms ease-out both;
}

.processing-status.is-error {
  border-color: var(--line-strong);
}

.processing-spinner {
  flex: 0 0 auto;
  width: 1.2rem;
  height: 1.2rem;
  fill: none;
  stroke: var(--green);
  stroke-width: 2;
  stroke-linecap: round;
  animation: process-spin 850ms linear infinite;
}

.processing-title {
  margin: 0;
}

.processing-title {
  font-size: 0.86rem;
  font-weight: 650;
}

.processing-status.is-error .processing-spinner {
  display: none;
}

.preview-content {
  display: grid;
  flex: 1 1 auto;
  align-content: start;
  gap: 0.8rem;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  padding: 0.9rem 0;
  overscroll-behavior: contain;
}

.preview-content.is-plain-text {
  display: block;
  padding: 1.1rem 1rem;
}

.plain-text-document {
  width: min(100%, 72ch);
  margin: 0 auto;
  color: var(--text);
  font-size: clamp(0.95rem, 1.05vw, 1.08rem);
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.preview-text-line {
  min-height: 1.45em;
  margin: 0;
  white-space: pre-wrap;
}

.preview-block {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: var(--surface-raised);
  color: var(--text);
}

.preview-block-locator {
  margin: 0;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.preview-block-text {
  padding: 0.9rem 1rem;
  font-size: 0.95rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.preview-sheet {
  display: grid;
  gap: 0.55rem;
}

.preview-sheet-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.preview-spreadsheet-row {
  display: grid;
  gap: 0.3rem;
}

.preview-row-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
}

.preview-cell-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
  gap: 0.35rem;
}

.preview-cell {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: var(--surface-raised);
  color: var(--text);
}

.preview-cell-locator {
  margin: 0;
  padding: 0.28rem 0.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 650;
}

.preview-cell-text {
  min-height: 2.4rem;
  padding: 0.45rem 0.55rem;
  font-size: 0.83rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.finding-highlight {
  border-radius: 0.15rem;
  padding: 0 0.06em;
  background: rgb(73 189 131 / 22%);
  color: inherit;
  box-shadow: inset 0 -2px 0 var(--green);
}

.finding-highlight.is-selected {
  background: rgb(73 189 131 / 34%);
  box-shadow: inset 0 0 0 1px var(--green), inset 0 -3px 0 var(--green);
  outline: 2px solid rgb(73 189 131 / 75%);
  outline-offset: 2px;
}

.preview-empty {
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  color: var(--muted);
  line-height: 1.5;
}

.findings-section {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  overflow: auto;
  background: #111512;
  overscroll-behavior: contain;
}

.findings-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.selected-material-stage {
  min-width: 0;
  margin-left: auto;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finding-count {
  color: var(--muted);
  font-size: 0.78rem;
}

.findings-notice,
.check-stop-reason {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.check-stop-reason {
  padding: 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.6rem;
  background: var(--surface-raised);
}

.findings-list {
  display: grid;
  gap: 0.55rem;
  align-content: start;
  margin: 0;
  padding: 0;
  list-style: none;
}

.finding-card {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: var(--surface-raised);
  transition: border-color 140ms ease, background 140ms ease;
}

.finding-card-button {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
  width: 100%;
  min-height: 4rem;
  padding: 0.72rem 0.8rem;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.finding-card-button:hover,
.finding-card-button:focus-visible {
  background: var(--surface-selected);
}

.finding-card-button.is-selected {
  background: #26372d;
}

.finding-card:has(.finding-card-button.is-selected) {
  border-color: var(--green);
}

.finding-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  width: 100%;
}

.finding-card-identity {
  display: inline-flex;
  align-items: center;
  gap: 0.58rem;
  min-width: 0;
}

.finding-risk-icon {
  flex: 0 0 auto;
  width: 1.15rem;
  height: 1.15rem;
  color: var(--green);
}

.finding-card-arrow {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  color: var(--muted);
}

.finding-category-label {
  color: var(--text);
  font-size: 0.87rem;
  font-weight: 650;
}

.finding-category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.55rem;
  min-width: 0;
}

.finding-location {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.finding-note {
  margin: 0.35rem 0 0 2.1rem;
  color: var(--amber, #d8a34f);
  font-size: 0.75rem;
  line-height: 1.4;
}

.decision-status {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.4;
  text-align: left;
}

.decision-status[hidden],
.decision-status-spinner[hidden] {
  display: none;
}

.decision-status.is-warning {
  color: var(--amber, #e0ad58);
}

.decision-status-spinner {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  animation: process-spin 0.9s linear infinite;
}

.secondary-button,
.primary-button {
  min-height: 2.6rem;
  padding: 0.55rem 1rem;
  border-radius: 0.65rem;
  font-size: 0.9rem;
  font-weight: 650;
}

.secondary-button {
  background: var(--surface-raised);
}

.primary-button {
  border-color: var(--green);
  background: var(--green);
  color: #102017;
  min-width: min(27rem, 88vw);
  min-height: 2.9rem;
  padding-inline: 1.25rem;
  box-shadow: 0 0.3rem 1rem rgb(73 189 131 / 12%);
}

.save-status,
.draft-state,
.status-message,
#extract-documents,
.document-extraction-result {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.view-enter {
  animation: screen-enter 220ms ease-out both;
}

@keyframes screen-enter {
  from {
    opacity: 0;
    transform: translateY(0.45rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes process-appear {
  from {
    opacity: 0;
    transform: translateY(0.25rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes process-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 70rem) {
  .review-grid {
    grid-template-columns: minmax(12rem, 0.9fr) minmax(0, 2fr);
    grid-template-rows: minmax(0, 3fr) minmax(0, 2fr);
  }

  .findings-section {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
  }

  .preview-pane {
    border-right: 0;
  }

  .findings-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 42rem) {
  .composer-view {
    grid-template-rows: minmax(0, 1fr) minmax(0, auto) minmax(0, 0.2fr);
    padding: 0 1rem 1.5rem;
  }

  .composer-card {
    width: 100%;
    min-width: 0;
    padding: 0.9rem;
    border-radius: 1rem;
  }

  .attachment-name {
    max-width: 58vw;
  }

  .composer-submit {
    flex: 1 1 auto;
  }

  .composer-hint {
    display: none;
  }

  .review-header {
    min-height: 3.6rem;
    padding: 0.55rem 0.8rem;
  }

  .review-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1.35fr) minmax(0, 1.5fr) minmax(0, 1.15fr);
  }

  .materials-pane {
    display: flex;
    flex-direction: column;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 0.6rem 0.85rem;
  }

  .materials-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.2rem;
    margin-top: 0.65rem;
    padding-bottom: 0.3rem;
  }

  .materials-list li {
    width: 100%;
    max-width: none;
  }

  .material-button {
    width: 100%;
    max-width: none;
    padding: 0.5rem;
  }

  .preview-pane {
    border-bottom: 1px solid var(--line);
    padding: 0.9rem;
  }

  .findings-section {
    grid-column: auto;
    padding: 0.9rem;
  }

  .findings-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .materials-download-area {
    margin: 0.4rem -0.85rem -0.6rem;
    padding: 0.4rem 0.85rem 0.6rem;
  }
}

.preview-loading,
.preview-error-note,
.preview-limit-notice,
.preview-source-excerpt {
  margin: 0;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.preview-error-note {
  border-color: var(--line-strong);
  color: var(--text);
}

.image-preview-shell,
.pdf-preview-shell,
.workbook-preview {
  display: grid;
  gap: 0.8rem;
  min-width: 0;
}

.pdf-properties-section {
  display: grid;
  gap: 0.55rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--surface);
}

.pdf-properties-title,
.pdf-property-label,
.pdf-property-value {
  margin: 0;
}

.pdf-properties-title {
  color: var(--text);
  font-size: 0.9rem;
}

.pdf-property-item {
  display: grid;
  grid-template-columns: minmax(8rem, 0.25fr) minmax(0, 1fr);
  gap: 0.8rem;
  align-items: baseline;
  padding-top: 0.45rem;
  border-top: 1px solid var(--line);
}

.pdf-property-label {
  color: var(--muted);
  font-size: 0.8rem;
}

.pdf-property-value {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.86rem;
}

.image-preview-frame,
.pdf-preview-frame {
  position: relative;
  display: grid;
  width: fit-content;
  max-width: 100%;
  max-height: 72vh;
  margin: 0 auto;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: #202522;
}

.pdf-preview-shell {
  width: 100%;
  box-sizing: border-box;
  padding: 0 clamp(0.65rem, 1.1vw, 1.1rem) 0.8rem;
}

.pdf-preview-frame {
  display: block;
  width: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  overflow: hidden;
}

.image-preview {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.pdf-preview-page {
  display: block;
  width: 100%;
  max-width: none;
  max-height: none;
  height: auto;
}

.image-finding-overlay {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.image-finding-region {
  position: absolute;
  min-width: 0.25rem;
  min-height: 0.25rem;
}

.image-finding-region::before {
  content: "";
  position: absolute;
  inset: -0.16rem -0.14rem;
  border: 1px solid var(--green);
  border-radius: 0.25rem;
  background: rgb(73 189 131 / 12%);
}

.image-finding-region.is-selected::before {
  background: rgb(73 189 131 / 22%);
  box-shadow: 0 0 0 1px rgb(73 189 131 / 65%);
}

.format-preview-toolbar,
.workbook-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  min-width: 0;
}

.preview-page-button,
.workbook-sheet-select {
  min-height: 2.35rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: var(--surface-raised);
  color: var(--text);
  font-size: 0.82rem;
}

.preview-page-button {
  cursor: pointer;
}

.pdf-zoom-button {
  display: inline-grid;
  width: 2.35rem;
  min-width: 2.35rem;
  place-items: center;
  padding: 0.45rem;
}

.pdf-zoom-button svg {
  width: 1rem;
  height: 1rem;
}

.preview-page-label,
.workbook-range-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.workbook-range-label {
  margin-left: auto;
}

.workbook-table-host {
  max-width: 100%;
  max-height: 68vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--surface);
  overscroll-behavior: contain;
}

.workbook-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--text);
  font-size: 0.84rem;
}

.workbook-table th,
.workbook-table td {
  min-width: 8.5rem;
  max-width: 24rem;
  padding: 0.65rem 0.75rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.workbook-table thead th {
  position: sticky;
  z-index: 1;
  top: 0;
  background: #252c28;
  color: var(--muted);
  font-weight: 650;
}

.workbook-table th.workbook-row-heading {
  position: sticky;
  z-index: 2;
  left: 0;
  min-width: 3.5rem;
  max-width: 5rem;
  background: #202622;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.workbook-table thead th.workbook-row-heading {
  z-index: 3;
}

.workbook-table .workbook-cell-value {
  display: block;
  min-height: 1.2rem;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.workbook-table .workbook-cell-value.is-formula {
  color: #c5d4cb;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.78rem;
}

.workbook-table .workbook-formula-label {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 0.4rem;
  padding: 0.12rem 0.38rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.workbook-table .workbook-result-label {
  margin-top: 0.4rem;
  text-transform: none;
}

.workbook-table .workbook-cell.has-finding {
  background: rgb(73 189 131 / 12%);
  box-shadow: inset 0 0 0 1px rgb(73 189 131 / 70%), inset 0 -3px 0 var(--green);
}

.workbook-table .workbook-cell.is-selected-finding {
  position: relative;
  background: #294035;
  box-shadow: inset 0 0 0 2px var(--green), inset 0 -4px 0 var(--green);
  outline: 2px solid rgb(73 189 131 / 80%);
  outline-offset: -2px;
}

.workbook-table .is-original-hidden {
  background-image: repeating-linear-gradient(
    135deg,
    transparent,
    transparent 0.45rem,
    rgb(155 166 158 / 7%) 0.45rem,
    rgb(155 166 158 / 7%) 0.9rem
  );
}

.workbook-cell-note,
.workbook-cell-comment {
  display: block;
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.74rem;
}

.workbook-cell-comment summary {
  cursor: pointer;
}

.workbook-cell-comment p {
  margin: 0.45rem 0 0;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.preview-source-excerpt {
  color: var(--text);
}

.preview-excerpt-label {
  margin: 0 0 0.45rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.preview-excerpt-text {
  margin: 0;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.finding-highlight {
  border-radius: 0.16rem;
  padding: 0 0.06em;
  background: rgb(73 189 131 / 22%);
  color: inherit;
  box-shadow: inset 0 -2px 0 var(--green);
}

.finding-highlight.is-selected {
  background: rgb(73 189 131 / 34%);
  box-shadow: inset 0 0 0 1px var(--green), inset 0 -3px 0 var(--green);
  outline: 2px solid rgb(73 189 131 / 75%);
  outline-offset: 2px;
}

.docx-preview-frame {
  display: block;
  width: 100%;
  min-height: 72vh;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: var(--document);
}

@media (max-width: 42rem) {
  .pdf-property-item {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .image-preview-frame {
    max-height: 60vh;
  }

  .image-preview {
    max-height: 58vh;
  }

  .workbook-toolbar {
    align-items: stretch;
  }

  .workbook-range-label {
    flex-basis: 100%;
    margin-left: 0;
  }

  .workbook-table-host {
    max-height: 58vh;
  }

  .docx-preview-frame {
    min-height: 60vh;
  }
}
