:root {
  --bg: #f4efe6;
  --paper: rgba(255, 252, 247, 0.78);
  --ink: #16251f;
  --muted: #58655f;
  --accent: #0f766e;
  --accent-2: #bc6c25;
  --line: rgba(22, 37, 31, 0.12);
  --shadow: 0 24px 70px rgba(24, 35, 30, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(188, 108, 37, 0.16), transparent 24%),
    linear-gradient(180deg, #f8f4ec, #efe6d7 70%, #e7dcc9);
}

.page {
  width: min(1320px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.hero,
.panel,
.footer {
  backdrop-filter: blur(10px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 28px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: clamp(2.8rem, 7vw, 5.6rem);
  line-height: 0.92;
}

.lede {
  max-width: 64ch;
  color: var(--muted);
  font-size: 1.08rem;
}

.hero-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.auth-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 18px;
}

.auth-bar input {
  min-width: min(360px, 100%);
  flex: 1;
}

.auth-status {
  margin: 0;
  color: var(--muted);
}

.stat {
  min-width: 180px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line);
}

.stat span {
  display: block;
  font-size: 2rem;
  font-weight: 700;
}

.stat label {
  color: var(--muted);
}

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

.panel {
  padding: 18px;
}

.panel-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header h2,
.empty-state h2,
.detail-header h2 {
  margin: 0;
}

.archive-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.archive-filter-button {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  border-color: var(--line);
}

.archive-filter-button.is-active {
  background: var(--accent);
  color: white;
  border-color: transparent;
}

input[type="search"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 16px;
  font: inherit;
  background: rgba(255, 255, 255, 0.9);
}

select,
textarea,
button {
  font: inherit;
}

textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.92);
}

button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 11px 16px;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  border-color: var(--line);
}

.species-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 70vh;
  overflow: auto;
}

.species-card {
  text-align: left;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(241, 237, 230, 0.95));
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease;
}

.species-card:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 118, 110, 0.45);
}

.species-card-archived {
  border-style: dashed;
  background: linear-gradient(180deg, rgba(247, 241, 231, 0.98), rgba(233, 226, 214, 0.98));
}

.species-name,
.species-meta,
.species-snippet {
  display: block;
}

.species-name {
  font-size: 1.05rem;
  font-weight: 700;
}

.species-meta,
.species-snippet,
.detail-scientific-name,
.detail-summary,
.footer p,
.error {
  color: var(--muted);
}

.species-snippet {
  margin-top: 6px;
  font-size: 0.92rem;
}

.species-state-badge,
.detail-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(188, 108, 37, 0.32);
  background: rgba(188, 108, 37, 0.12);
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.species-state-badge {
  margin-left: 8px;
}

.empty-state {
  min-height: 320px;
  display: grid;
  place-items: center;
  text-align: center;
}

.detail.hidden,
.hidden {
  display: none;
}

.detail-header {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.detail-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.detail-code {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-2);
  font-size: 0.8rem;
}

.detail-scientific-name {
  margin-top: 6px;
  font-style: italic;
}

.detail-archive-note {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(188, 108, 37, 0.1);
  border: 1px solid rgba(188, 108, 37, 0.2);
  color: var(--accent-2);
}

.detail-sections {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.detail-section {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.66);
}

.detail-section h3 {
  margin-top: 0;
  color: var(--accent);
}

.editor-panel {
  margin-top: 18px;
}

.editor-label {
  display: block;
  margin: 0 0 8px;
  font-weight: 700;
}

.editor-label + select,
.editor-label + textarea {
  margin-bottom: 14px;
}

.archive-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  color: var(--ink);
  font-weight: 700;
}

.archive-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-2);
}

.editor-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.editor-status {
  margin: 0;
  color: var(--muted);
}

.audit-list {
  display: grid;
  gap: 12px;
}

.audit-entry {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.audit-meta {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.section-editor {
  min-height: 220px;
  margin-bottom: 12px;
  white-space: pre-wrap;
  font-family: "Courier New", monospace;
  font-size: 0.92rem;
  line-height: 1.45;
}

.diagnostic-list {
  margin: 0;
  padding-left: 18px;
}

.diagnostic-list li + li {
  margin-top: 8px;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: "Courier New", monospace;
  font-size: 0.92rem;
  line-height: 1.45;
}

.footer {
  margin-top: 20px;
  padding: 18px 22px;
}

@media (max-width: 960px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .species-list {
    max-height: 40vh;
  }
}
