* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--catalog-shell-text);
  background: var(--catalog-shell-bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.patent-shell {
  --catalog-shell-bg: #f7f2ec;
  --catalog-shell-panel: #fffdf9;
  --catalog-shell-border: #decfc4;
  --catalog-shell-text: #211c18;
  --catalog-shell-muted: #786d64;
  --catalog-shell-accent: #2a231f;
  --catalog-shell-accent-weak: #efe4dc;
}

.patent-search-form {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.patent-shell .side-title-row h1 {
  font-size: 20px;
  line-height: 1.25;
}

.field-label {
  color: var(--catalog-shell-muted);
  font-size: 12px;
  font-weight: 700;
}

.patent-select,
.patent-query-row input {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--catalog-shell-border);
  border-radius: 6px;
  background: #fffdf9;
  color: var(--catalog-shell-text);
}

.patent-select {
  padding: 0 10px;
}

.patent-query-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.patent-query-row input {
  padding: 0 10px;
}

.library-note {
  min-height: 34px;
  margin: 10px 0 0;
  color: var(--catalog-shell-muted);
  font-size: 12px;
  line-height: 1.45;
}

.patent-results {
  overflow: auto;
  min-height: 0;
  padding: 10px 10px 14px;
}

.patent-result-row {
  width: 100%;
  text-align: left;
  border: 1px solid var(--catalog-shell-border);
  border-radius: 6px;
  background: #fffdf9;
  padding: 10px;
  white-space: normal;
}

.patent-result-row:hover,
.patent-result-row.selected {
  border-color: #b8967e;
  background: #f5eee7;
}

.patent-result-title {
  font-size: 14px;
  font-weight: 760;
  line-height: 1.35;
}

.patent-result-meta {
  margin-top: 5px;
  color: var(--catalog-shell-muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.patent-result-snippet {
  margin-top: 7px;
  color: #4f433b;
  font-size: 12px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.source-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--catalog-shell-border);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--catalog-shell-text);
  text-decoration: none;
  background: #fffdf9;
  white-space: nowrap;
  transition: background-color .2s ease, border-color .2s ease, transform .2s ease;
}

.source-link:hover {
  border-color: #b8967e;
  background: #faf7f2;
  transform: translateY(-1px);
}

.patent-content {
  background:
    linear-gradient(90deg, rgba(184, 150, 126, .055) 1px, transparent 1px),
    linear-gradient(rgba(184, 150, 126, .055) 1px, transparent 1px),
    #fffdf9;
  background-size: 54px 54px;
}

.patent-pane {
  display: none;
  max-width: 1080px;
  line-height: 1.72;
  font-size: 16px;
}

.patent-pane.active {
  display: block;
}

.patent-generated {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.patent-original {
  margin: 0;
  max-width: 1080px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #211c18;
  font: 14px/1.72 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.more-button {
  margin-top: 18px;
}

.inline-status {
  color: var(--catalog-shell-muted);
}

.inline-error {
  color: #9f2f2f;
}

@media (max-width: 900px) and (orientation: portrait) {
  .patent-query-row {
    grid-template-columns: 1fr;
  }

  .patent-query-row button {
    width: 100%;
  }
}
