:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f8fa;
  color: #172026;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: #f6f8fa;
}

button,
input {
  font: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

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

.topbar {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 24px;
  border-bottom: 1px solid #d8dee4;
  background: #ffffff;
}

.eyebrow {
  margin: 0 0 4px;
  color: #0f766e;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: min(70vw, 920px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 22px;
  line-height: 1.25;
  font-weight: 750;
}

.status-text {
  margin: 6px 0 0;
  color: #59636e;
  font-size: 14px;
}

.status-text[data-variant="ready"] {
  color: #0f766e;
  font-weight: 650;
}

.status-text[data-variant="error"] {
  color: #b42318;
  font-weight: 650;
}

.topbar-actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.secondary-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid #c7d0d9;
  border-radius: 7px;
  background: #ffffff;
  color: #27313a;
  cursor: pointer;
  font-weight: 650;
}

.secondary-button:hover {
  border-color: #0f766e;
  color: #0f766e;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
}

.action-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 18px;
  border-right: 1px solid #d8dee4;
  background: #ffffff;
}

.file-summary {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin: -7px;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  transition:
    background-color 120ms ease,
    border-color 120ms ease;
}

.file-summary[draggable="true"] {
  cursor: grab;
}

.file-summary[draggable="true"]:hover {
  border-color: #d8dee4;
  background: #f6f8fa;
}

.file-summary[draggable="true"]:active {
  cursor: grabbing;
}

.pdf-badge {
  width: 48px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #e7f5f2;
  color: #0f766e;
  font-size: 13px;
  font-weight: 850;
}

.file-summary strong,
.file-summary span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-summary strong {
  font-size: 15px;
  line-height: 1.35;
}

.file-summary span {
  margin-top: 3px;
  color: #59636e;
  font-size: 13px;
}

.drag-handle {
  width: 100%;
  min-height: 78px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #0f766e;
  border-radius: 8px;
  background: #0f766e;
  color: #ffffff;
  cursor: grab;
  text-align: left;
  box-shadow: 0 1px 2px rgb(15 118 110 / 20%);
}

.drag-handle-all {
  background: #0b5f8a;
  border-color: #0b5f8a;
  box-shadow: 0 1px 2px rgb(11 95 138 / 20%);
}

.drag-handle:active {
  cursor: grabbing;
}

.drag-handle:disabled {
  border-color: #c5ccd3;
  background: #eef2f6;
  color: #697782;
  cursor: not-allowed;
  box-shadow: none;
}

.drag-title,
.drag-hint {
  display: block;
  overflow-wrap: anywhere;
}

.drag-title {
  font-size: 16px;
  line-height: 1.25;
  font-weight: 800;
}

.drag-hint {
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 600;
  opacity: 0.9;
}

.drag-mark {
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  border-radius: 5px;
  position: relative;
}

.drag-mark::before,
.drag-mark::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-top: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

.drag-mark::after {
  transform: rotate(90deg);
}

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

.document-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid #d8dee4;
  border-radius: 8px;
  background: #ffffff;
}

.document-item[data-active="true"] {
  border-color: #0f766e;
  box-shadow: 0 0 0 1px rgb(15 118 110 / 18%);
}

.document-item[data-status="preparing"] {
  background: #f7fafc;
}

.document-item[draggable="true"] {
  cursor: grab;
}

.document-item[draggable="true"]:active {
  cursor: grabbing;
}

.document-select,
.document-remove {
  border: 0;
  background: transparent;
  color: inherit;
}

.document-select {
  min-width: 0;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
}

.document-index {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #e7f5f2;
  color: #0f766e;
  font-size: 12px;
  font-weight: 850;
}

.document-name,
.document-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-name {
  font-size: 13px;
  font-weight: 750;
}

.document-meta {
  margin-top: 2px;
  color: #59636e;
  font-size: 12px;
}

.document-remove {
  border-left: 1px solid #d8dee4;
  color: #59636e;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.document-remove:hover {
  color: #b42318;
  background: #fff1f0;
}

.action-help {
  margin: -4px 0 0;
  color: #59636e;
  font-size: 13px;
  line-height: 1.45;
}

.version-text {
  margin: auto 0 0;
  color: #7a858f;
  font-size: 12px;
  line-height: 1.4;
}

.diagnostics {
  margin-top: 0;
  padding-top: 16px;
  border-top: 1px solid #d8dee4;
}

.diagnostics summary {
  cursor: pointer;
  color: #59636e;
  font-size: 13px;
  font-weight: 700;
}

.capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.capability {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #eef2f6;
  color: #4b5563;
  font-size: 12px;
  font-weight: 700;
}

.capability.ok {
  background: #e7f5f2;
  color: #0f766e;
}

.capability.missing {
  background: #fff1f0;
  color: #b42318;
}

.event-log {
  min-height: 120px;
  max-height: 220px;
  overflow: auto;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid #d8dee4;
  border-radius: 8px;
  background: #f9fafb;
  color: #59636e;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.viewer-panel {
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: #dfe5eb;
}

.viewer-panel iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: #ffffff;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  color: #59636e;
}

.empty-state strong {
  color: #172026;
  font-size: 20px;
}

.empty-state span {
  max-width: 420px;
  font-size: 14px;
  line-height: 1.45;
}

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

  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    max-width: 100%;
    white-space: normal;
  }

  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(420px, 1fr);
  }

  .action-panel {
    border-right: 0;
    border-bottom: 1px solid #d8dee4;
  }
}
