:root {
  --ink: #16211d;
  --muted: #5c6a63;
  --paper: #f7f5ef;
  --panel: #ffffff;
  --line: #d9ded6;
  --accent: #1f7a5d;
  --danger: #a63d2f;
  --soft: #eef3ef;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--paper);
  color: var(--ink);
  overflow-x: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(22, 33, 29, 0.08);
}
.brand { font-weight: 800; color: var(--ink); text-decoration: none; }
.navlinks { display: flex; gap: 14px; flex-wrap: wrap; }
.navlinks a { color: var(--muted); text-decoration: none; font-weight: 700; }
.page { padding: 28px; max-width: 1500px; margin: 0 auto; }

.hero {
  min-height: 190px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 28px;
  margin-bottom: 24px;
  color: white;
  background:
    linear-gradient(rgba(13, 35, 27, 0.58), rgba(13, 35, 27, 0.58)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='360' viewBox='0 0 1200 360'%3E%3Crect width='1200' height='360' fill='%233d6b55'/%3E%3Cpath d='M0 285c160-55 290-75 430-34s243 30 390-22 260-43 380-8v139H0z' fill='%231f3d31'/%3E%3Cpath d='M0 235c120-45 220-52 330-22s208 19 350-39 290-45 520 15v171H0z' fill='%232b5746' opacity='.75'/%3E%3C/svg%3E");
  background-size: cover;
  border-radius: 8px;
}
.hero.compact { min-height: 120px; }
.hero h1 { font-size: 44px; margin: 4px 0 0; letter-spacing: 0; }
.eyebrow { margin: 0 0 6px; color: inherit; opacity: 0.75; text-transform: uppercase; font-size: 12px; font-weight: 800; }
.hero-stat { text-align: right; }
.hero-stat span { display: block; opacity: 0.75; }
.hero-stat strong { font-size: 44px; }

.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  min-width: 0;
  overflow: hidden;
}
.panel h2 { margin: 0 0 12px; font-size: 18px; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td { padding: 9px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; min-width: 0; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
td:last-child, th:last-child { text-align: right; width: 84px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrap-cell {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.species-emoji {
  display: inline-block;
  width: 1.8em;
  margin-right: 4px;
}
.species-only-emoji {
  display: inline-block;
  min-width: 2em;
  text-align: center;
  font-size: 18px;
}
.recent-table {
  table-layout: auto;
}
.recent-table th,
.recent-table td {
  width: auto;
}
.recent-table th:nth-child(1),
.recent-table td:nth-child(1) {
  white-space: nowrap;
  width: 76px;
}
.recent-table th:nth-child(2),
.recent-table td:nth-child(2),
.recent-table th:nth-child(4),
.recent-table td:nth-child(4),
.recent-table th:nth-child(5),
.recent-table td:nth-child(5),
.recent-table th:nth-child(6),
.recent-table td:nth-child(6) {
  white-space: nowrap;
  width: 1%;
}
.path-cell {
  min-width: 180px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.report {
  max-width: 820px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
}
.report h1 { margin-top: 0; }
.report .eyebrow { color: var(--accent); }
.report p { font-size: 18px; line-height: 1.55; }

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #eef2ef;
}
.login-box {
  width: min(380px, calc(100vw - 32px));
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.1);
}
.login-box h1 { margin-top: 0; font-size: 24px; }
.login-box label { display: grid; gap: 6px; margin: 14px 0; color: var(--muted); font-weight: 700; }
.login-box input {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}
.login-box button {
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  font-weight: 800;
}
.error { color: var(--danger); font-weight: 700; }

@media (max-width: 1000px) {
  .grid.four, .grid.three, .grid.two { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 14px;
  }
  .navlinks {
    width: 100%;
    gap: 8px;
  }
  .navlinks a {
    flex: 1 1 auto;
    min-width: 86px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    text-align: center;
    background: white;
  }
  .page {
    width: 100%;
    padding: 10px;
  }
  .hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    padding: 18px;
    margin-bottom: 14px;
  }
  .hero.compact {
    min-height: 0;
  }
  .hero h1 {
    font-size: 30px;
    line-height: 1.05;
  }
  .hero-stat {
    text-align: left;
  }
  .hero-stat strong {
    font-size: 32px;
  }
  .grid {
    gap: 12px;
    margin-bottom: 12px;
  }
  .panel {
    padding: 12px;
    max-width: 100%;
  }
  .panel h2 {
    font-size: 17px;
  }
  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    width: 100%;
  }
  thead {
    display: none;
  }
  tr {
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
  }
  tr:last-child {
    border-bottom: 0;
  }
  td,
  td:last-child {
    display: block;
    width: 100%;
    padding: 6px 0;
    border-bottom: 0;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  td::before {
    display: block;
    margin-bottom: 2px;
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.35;
    text-transform: uppercase;
  }
  td:empty {
    display: none;
  }
  td:empty::before {
    content: none;
  }
  .truncate {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }
  .wrap-cell,
  .path-cell,
  td {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .recent-table,
  .recent-table th,
  .recent-table td,
  .recent-table th:nth-child(1),
  .recent-table td:nth-child(1),
  .recent-table th:nth-child(2),
  .recent-table td:nth-child(2),
  .recent-table th:nth-child(4),
  .recent-table td:nth-child(4),
  .recent-table th:nth-child(5),
  .recent-table td:nth-child(5),
  .recent-table th:nth-child(6),
  .recent-table td:nth-child(6) {
    width: 100%;
    min-width: 0;
    white-space: normal;
  }
  .path-cell {
    min-width: 0;
  }
  .species-only-emoji {
    min-width: 0;
    text-align: left;
  }
  .report {
    padding: 18px;
  }
  .report p {
    font-size: 16px;
  }
  .login-box {
    padding: 18px;
  }
}
