:root {
  --forest-950: #061c14;
  --forest-900: #082d20;
  --forest-800: #0d4630;
  --forest-700: #126640;
  --forest-600: #168451;
  --forest-100: #dceee3;
  --forest-50: #eef7f1;
  --gold-500: #cda94f;
  --gold-100: #f4e9c8;
  --ink: #10251d;
  --muted: #617168;
  --line: #d9e1dc;
  --paper: #ffffff;
  --canvas: #f3f6f3;
  --danger: #a63c35;
  --danger-soft: #f7e8e6;
  --shadow: 0 12px 34px rgba(6, 28, 20, 0.12);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.58; }

[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid rgba(205, 169, 79, 0.55);
  outline-offset: 2px;
}

.boot {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: var(--muted);
}

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--forest-100);
  border-top-color: var(--forest-600);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
  background: var(--forest-950);
}

.login-panel {
  width: min(100%, 430px);
  padding: 34px;
  background: var(--paper);
  border: 1px solid rgba(205, 169, 79, 0.55);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand img { object-fit: contain; }
.brand-login { padding-bottom: 25px; border-bottom: 1px solid var(--line); }
.brand-name { display: block; color: var(--forest-900); font-family: Georgia, serif; font-size: 21px; font-weight: 700; }
.brand-context { display: block; margin-top: 1px; color: var(--muted); font-size: 12px; font-weight: 650; }
.login-heading { padding: 28px 0 22px; }
.eyebrow { margin: 0 0 6px; color: var(--forest-600); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.login-heading h1, .queue-heading h1 { margin: 0; color: var(--forest-950); }
.login-heading h1 { font-size: 28px; line-height: 1.18; }
.login-heading > p:last-child { margin: 10px 0 0; color: var(--muted); line-height: 1.5; }
.login-form { display: grid; gap: 9px; }
.login-form label { margin-top: 8px; font-size: 13px; font-weight: 750; }
.captcha-slot { width: 100%; min-height: 4px; margin-top: 8px; }
.captcha-slot:not(:empty) { min-height: 65px; }
.captcha-slot iframe { max-width: 100%; }
input, textarea {
  width: 100%;
  border: 1px solid #bfcac3;
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
}
input { height: 46px; padding: 0 13px; }
textarea { min-height: 94px; padding: 11px 13px; resize: vertical; line-height: 1.45; }
input:focus, textarea:focus { border-color: var(--forest-600); box-shadow: 0 0 0 3px rgba(22, 132, 81, 0.12); outline: none; }
.form-error { margin: 8px 0 0; color: var(--danger); font-size: 13px; font-weight: 650; }
.login-security { margin: 20px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

.button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 16px;
  font-weight: 750;
}
.button-wide { width: 100%; min-height: 48px; margin-top: 12px; }
.button-primary { color: #fff; background: var(--forest-700); }
.button-primary:hover { background: var(--forest-800); }
.button-secondary { color: var(--forest-800); border-color: #b9c8bf; background: #fff; }
.button-secondary:hover { background: var(--forest-50); }
.button-danger { color: var(--danger); border-color: #e1b9b5; background: var(--danger-soft); }
.button-quiet { min-height: 34px; color: var(--forest-800); border-color: var(--line); background: #fff; }

.portal { min-height: 100vh; }
.topbar {
  height: 68px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid #153d2e;
  background: var(--forest-900);
}
.topbar .brand-name { color: #fff; font-size: 19px; }
.topbar .brand-context { color: #bed1c5; }
.reviewer-menu { display: flex; align-items: center; gap: 14px; min-width: 0; }
.reviewer-email { max-width: 260px; overflow: hidden; color: #e6eee9; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.secure-state { display: inline-flex; align-items: center; gap: 7px; color: #cce2d4; font-size: 12px; font-weight: 750; }
.secure-state span { width: 8px; height: 8px; border-radius: 50%; background: #50c57e; box-shadow: 0 0 0 3px rgba(80, 197, 126, 0.15); }

.workspace {
  min-height: calc(100vh - 68px);
  display: grid;
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
}
.queue-pane { border-right: 1px solid var(--line); background: #f8faf8; }
.queue-heading { padding: 24px 20px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.queue-heading h1 { font-size: 21px; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; color: var(--forest-700); background: #fff; font-size: 23px; line-height: 1; }
.icon-button:hover { background: var(--forest-50); }
.status-filters { padding: 0 20px 15px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.filter-button { height: 34px; min-width: 0; padding: 0 7px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: #fff; font-size: 11px; font-weight: 750; }
.filter-button.is-active { color: #fff; border-color: var(--forest-700); background: var(--forest-700); }
.queue-summary { min-height: 36px; padding: 9px 20px; border-block: 1px solid var(--line); color: var(--muted); background: var(--forest-50); font-size: 12px; font-weight: 700; }
.queue-list { max-height: calc(100vh - 227px); overflow-y: auto; }
.queue-item {
  width: 100%;
  padding: 15px 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  background: transparent;
  text-align: left;
}
.queue-item:hover { background: #fff; }
.queue-item.is-selected { background: #fff; box-shadow: inset 4px 0 0 var(--gold-500); }
.queue-item-title { overflow: hidden; font-size: 14px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.queue-item-scientific { margin-top: 3px; overflow: hidden; color: var(--muted); font-family: Georgia, serif; font-size: 12px; font-style: italic; text-overflow: ellipsis; white-space: nowrap; }
.queue-item-meta { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11px; }
.status-pill { align-self: start; padding: 3px 7px; border-radius: 999px; color: #795d17; background: var(--gold-100); font-size: 10px; font-weight: 850; text-transform: uppercase; }
.status-pill.reviewing { color: var(--forest-700); background: var(--forest-100); }
.status-pill.resolved { color: #56635b; background: #e8ece9; }

.detail-pane { min-width: 0; background: var(--paper); }
.detail-empty, .queue-empty, .queue-loading { min-height: 360px; display: grid; place-content: center; justify-items: center; padding: 30px; color: var(--muted); text-align: center; }
.detail-empty h2, .queue-empty h2 { margin: 12px 0 3px; color: var(--ink); font-size: 20px; }
.detail-empty p, .queue-empty p { margin: 0; }
.empty-mark { width: 54px; height: 54px; display: grid; place-items: center; border: 1px solid #bcd5c5; border-radius: 50%; color: var(--forest-600); background: var(--forest-50); font-size: 24px; }
.review-detail { min-height: calc(100vh - 68px); }
.detail-header { min-height: 86px; padding: 18px 28px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.detail-header h2 { margin: 0; font-size: 23px; }
.detail-header p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.detail-body { display: grid; grid-template-columns: minmax(300px, 0.9fr) minmax(380px, 1.1fr); }
.evidence-column { padding: 24px 28px 36px; border-right: 1px solid var(--line); background: #f8faf8; }
.evidence-image-shell { position: relative; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 6px; background: var(--forest-950); }
.evidence-image { width: 100%; height: 100%; display: block; object-fit: contain; }
.media-state { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 20px; color: #d9e4dd; text-align: center; }
.media-state .spinner { border-color: rgba(255,255,255,0.25); border-top-color: #fff; }
.evidence-caption { margin-top: 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fact { min-width: 0; }
.fact-label { display: block; margin-bottom: 3px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.fact-value { display: block; overflow-wrap: anywhere; font-size: 13px; font-weight: 680; }
.review-column { padding: 24px 30px 42px; }
.section { padding: 0 0 22px; }
.section + .section { padding-top: 22px; border-top: 1px solid var(--line); }
.section-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section h3 { margin: 0 0 12px; font-size: 14px; }
.identification-name { margin: 0; font-family: Georgia, serif; font-size: 28px; font-weight: 700; }
.scientific-name { margin: 4px 0 0; color: var(--muted); font-family: Georgia, serif; font-size: 17px; font-style: italic; }
.identification-meta { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 7px; }
.meta-chip { padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; color: #415048; background: #f8faf8; font-size: 11px; font-weight: 700; }
.reporter-note { margin: 0; padding: 13px 15px; border-left: 3px solid var(--gold-500); color: #3e4d45; background: #fbf7eb; line-height: 1.5; }
.matches { display: grid; gap: 7px; }
.match-row { min-height: 46px; padding: 8px 10px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 5px; }
.match-row-button { width: 100%; color: inherit; background: #fff; text-align: left; }
.match-row-button:hover { border-color: #9cb9a8; background: var(--forest-50); }
.match-row-button:active { background: var(--forest-100); }
.match-row-button .match-name, .match-row-button .match-scientific { display: block; }
.match-name { font-size: 12px; font-weight: 760; }
.match-scientific { margin-top: 2px; color: var(--muted); font-family: Georgia, serif; font-size: 11px; font-style: italic; }
.location-loading { min-height: 90px; }
.location-candidate-tools { display: grid; gap: 9px; }
.location-candidate-tools p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.location-candidate-menus { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.location-candidate-menus label { display: grid; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 800; }
.location-candidate-menus select { width: 100%; height: 40px; padding: 0 31px 0 10px; border: 1px solid #bfcac3; border-radius: 5px; color: var(--ink); background-color: #fff; font: inherit; font-size: 11px; }
.location-candidate-menus select:focus { border-color: var(--forest-500); outline: 2px solid rgba(24, 126, 75, 0.15); outline-offset: 1px; }
.location-candidate-list { max-height: 360px; margin-top: 8px; overflow-y: auto; border: 1px solid var(--line); border-radius: 5px; background: #fff; }
.location-candidate { width: 100%; min-height: 49px; padding: 8px 10px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; border: 0; border-bottom: 1px solid var(--line); color: inherit; background: #fff; text-align: left; }
.location-candidate:last-child { border-bottom: 0; }
button.location-candidate:hover { background: var(--forest-50); }
.location-candidate strong, .location-candidate em { display: block; }
.location-candidate strong { font-size: 12px; }
.location-candidate em { margin-top: 2px; color: var(--muted); font-family: Georgia, serif; font-size: 11px; }
.location-candidate > span:last-child { color: var(--muted); font-size: 10px; text-align: right; }
.location-empty { min-height: 90px; }
.location-more { width: 100%; margin-top: 8px; }
.match-confidence { color: var(--forest-700); font-size: 12px; font-weight: 850; }
.action-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.review-form { margin-top: 16px; padding: 16px; border: 1px solid #cbd8d0; border-radius: 6px; background: var(--forest-50); }
.review-form h4 { margin: 0 0 5px; font-size: 15px; }
.review-form > p { margin: 0 0 14px; color: var(--muted); font-size: 12px; }
.review-form label { display: block; margin: 13px 0 6px; font-size: 12px; font-weight: 800; }
.species-results { max-height: 240px; margin-top: 6px; overflow-y: auto; border: 1px solid var(--line); border-radius: 5px; background: #fff; }
.species-result { width: 100%; padding: 10px 11px; display: flex; justify-content: space-between; gap: 12px; border: 0; border-bottom: 1px solid var(--line); color: inherit; background: #fff; text-align: left; }
.species-result:last-child { border-bottom: 0; }
.species-result:hover, .species-result.is-selected { background: #edf7f0; }
.species-result strong { display: block; font-size: 12px; }
.species-result em { display: block; margin-top: 2px; color: var(--muted); font-family: Georgia, serif; font-size: 11px; }
.species-result span { align-self: center; color: var(--muted); font-size: 10px; }
.selected-species { margin-top: 8px; padding: 10px 11px; border: 1px solid #a9cbb5; border-radius: 5px; background: #fff; }
.selected-species strong, .selected-species em { display: block; }
.selected-species em { margin-top: 2px; color: var(--muted); font-family: Georgia, serif; }
.resolution-summary { padding: 13px 15px; border: 1px solid var(--line); border-radius: 5px; background: #f8faf8; color: #46544c; font-size: 13px; line-height: 1.45; }

.confirm-dialog { width: min(92vw, 480px); padding: 0; border: 0; border-radius: 8px; box-shadow: var(--shadow); }
.confirm-dialog::backdrop { background: rgba(4, 20, 14, 0.68); }
.confirm-content { padding: 26px; }
.confirm-content h2 { margin: 0; font-size: 22px; }
.confirm-content > p:not(.eyebrow) { margin: 10px 0 0; color: var(--muted); line-height: 1.5; }
.confirm-actions { margin-top: 24px; display: flex; justify-content: flex-end; gap: 8px; }
.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 10; display: grid; gap: 8px; }
.toast { width: min(360px, calc(100vw - 36px)); padding: 13px 15px; border-radius: 6px; color: #fff; background: var(--forest-900); box-shadow: var(--shadow); font-size: 13px; font-weight: 680; }
.toast.error { background: #7f302b; }

@media (max-width: 980px) {
  .detail-body { grid-template-columns: 1fr; }
  .evidence-column { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 760px) {
  .topbar { height: auto; min-height: 68px; padding: 10px 14px; }
  .topbar .brand-context, .secure-state, .reviewer-email { display: none; }
  .workspace { display: block; }
  .queue-pane { border-right: 0; }
  .queue-list { max-height: none; }
  .detail-pane { border-top: 8px solid var(--canvas); }
  .detail-header { padding: 17px 18px; }
  .detail-header h2 { font-size: 20px; }
  .evidence-column, .review-column { padding: 20px 18px 30px; }
  .detail-empty { min-height: 240px; }
  .login-panel { padding: 27px 22px; }
  .location-candidate-menus { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
