* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f5f7fa;
  color: #17202a;
  font-family: Arial, Helvetica, sans-serif;
}

main {
  width: min(100% - 32px, 980px);
  margin: 0 auto;
  padding: 48px 0;
}

header {
  margin-bottom: 24px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.2;
}

h2 {
  font-size: 20px;
  line-height: 1.25;
}

h3 {
  font-size: 16px;
  line-height: 1.3;
}

.upload-panel,
.files-panel,
.process-panel {
  background: #fff;
  border: 1px solid #dde3ea;
  border-radius: 8px;
}

.upload-panel {
  margin-bottom: 20px;
}

form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: end;
  padding: 20px;
}

form h2,
form p {
  grid-column: 1 / -1;
}

input,
button {
  min-height: 44px;
  font: inherit;
}

input {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #b8c2cc;
  border-radius: 6px;
  background: #fff;
}

button {
  padding: 10px 16px;
  border: 0;
  border-radius: 6px;
  background: #1463ff;
  color: #fff;
  cursor: pointer;
}

button.secondary {
  border: 1px solid #b8c2cc;
  background: #fff;
  color: #17202a;
}

button:disabled {
  background: #8da6d8;
  cursor: wait;
}

button.secondary:disabled {
  background: #eef2f6;
  color: #6b7785;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.panel-heading {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid #dde3ea;
}

.file-list {
  display: grid;
  gap: 8px;
  max-height: 520px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  list-style: none;
}

.file-row {
  display: grid;
  width: 100%;
  min-height: 72px;
  gap: 6px;
  padding: 12px;
  border: 1px solid #dde3ea;
  border-radius: 6px;
  background: #fff;
  color: #17202a;
  text-align: left;
}

.file-row:hover,
.file-row[aria-pressed="true"] {
  border-color: #1463ff;
  background: #edf4ff;
}

.file-name {
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta,
#selected-file-meta,
#extraction-meta {
  overflow-wrap: anywhere;
  color: #52606d;
  font-size: 13px;
  line-height: 1.4;
}

.empty-state,
#status,
#file-status,
#process-status {
  min-height: 20px;
  color: #52606d;
  font-size: 14px;
  line-height: 1.4;
}

#status {
  color: #17202a;
}

#file-status,
#process-status {
  padding: 0 20px 18px;
}

.process-panel[hidden] {
  display: none;
}

.process-panel .panel-heading {
  align-items: start;
}

.process-panel .panel-heading > div {
  min-width: 0;
}

#selected-file-title {
  overflow-wrap: anywhere;
}

#extraction {
  display: grid;
  gap: 10px;
  margin: 0 20px 20px;
  padding: 16px;
  border-left: 4px solid #2f855a;
  background: #f2fbf6;
}

#extraction[hidden] {
  display: none;
}

#extraction-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

@media (max-width: 760px) {
  main {
    width: min(100% - 24px, 560px);
    padding: 28px 0;
  }

  form,
  .workspace {
    grid-template-columns: 1fr;
  }

  form button {
    width: 100%;
  }

  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-heading button {
    width: 100%;
  }
}
