:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #61706a;
  --line: #d8e2dd;
  --surface: #ffffff;
  --field: #f7faf8;
  --accent: #0b6b57;
  --accent-strong: #08483b;
  --amber: #b56a00;
  --rose: #a73544;
  --shadow: 0 18px 45px rgba(23, 33, 29, 0.12);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.workspace {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 20px;
}

.intro {
  display: grid;
  grid-template-columns: 1.2fr minmax(260px, 0.8fr);
  align-items: stretch;
  min-height: 260px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.intro > div {
  padding: clamp(24px, 5vw, 64px);
  display: grid;
  align-content: center;
  gap: 14px;
}

.intro img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 260px;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4.8vw, 4.3rem);
  line-height: 1;
  max-width: 12ch;
}

h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
}

.lede {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 58ch;
}

.control-surface,
.saved-profiles,
.results-area {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.control-surface {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

label:first-child {
  grid-column: span 2;
}

input,
select {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--ink);
  padding: 10px 12px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(11, 107, 87, 0.28);
  outline-offset: 2px;
}

.actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button {
  min-height: 44px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  padding: 10px 16px;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

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

.secondary {
  background: transparent;
  color: var(--accent);
}

.secondary:hover {
  color: white;
}

.text-button {
  min-height: auto;
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 6px 0;
}

.text-button:hover {
  background: transparent;
  color: var(--accent-strong);
}

.saved-profiles,
.results-area {
  padding: 20px;
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.results-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.results-tools button {
  min-height: 38px;
  padding: 8px 12px;
}

.profile-list,
.results-list {
  display: grid;
  gap: 12px;
}

.profile-card,
.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 16px;
}

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

.profile-card strong,
.result-card strong {
  display: block;
  margin-bottom: 5px;
}

.publication-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.publication-number {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

.publication-details div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px;
}

.publication-details dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.publication-details dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.94rem;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.meta span,
.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  background: white;
}

.status-pill {
  white-space: nowrap;
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 800;
}

.status-pill.error {
  color: var(--rose);
}

.status-pill.loading {
  color: var(--amber);
}

.status-message {
  color: var(--muted);
  line-height: 1.5;
}

.result-text {
  color: #28352f;
  line-height: 1.55;
  white-space: pre-wrap;
}

.result-link {
  color: var(--accent);
  font-weight: 800;
}

.result-actions {
  min-height: 24px;
}

.publication-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.publication-actions button {
  min-height: 38px;
  padding: 8px 12px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
}

#page-label {
  min-width: 82px;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  background: #fbfdfc;
}

@media (max-width: 900px) {
  .intro,
  .control-surface {
    grid-template-columns: 1fr;
  }

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

  label:first-child {
    grid-column: auto;
  }

  .intro img {
    max-height: 280px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 12px;
  }

  .intro > div,
  .saved-profiles,
  .results-area {
    padding: 18px;
  }

  .profile-card,
  .publication-header,
  .section-heading,
  .pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .publication-details {
    grid-template-columns: 1fr;
  }

  .pagination button,
  .actions button {
    width: 100%;
  }
}

@media print {
  body {
    background: white;
  }

  .app-shell {
    padding: 0;
  }

  .intro,
  .control-surface,
  .saved-profiles,
  .results-tools,
  .publication-actions,
  .pagination {
    display: none;
  }

  .workspace {
    width: 100%;
  }

  .results-area,
  .result-card {
    border: 0;
    box-shadow: none;
  }

  .results-area {
    padding: 0;
  }

  .result-card {
    break-inside: avoid;
    border-top: 1px solid #d8e2dd;
    border-radius: 0;
    padding: 16px 0;
  }

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

  .result-link {
    color: #17211d;
  }
}
