:root {
  --green: #2e7d32;
  --green-dark: #1b5e20;
  --green-soft: #e8f5e9;
  --bg: #f4f6f4;
  --card: #ffffff;
  --text: #18211b;
  --muted: #6a766d;
  --line: #dde6df;
  --danger: #c62828;
  --shadow: 0 8px 24px rgba(25, 69, 32, 0.08);
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: 86px;
  background: var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 18px 18px 14px;
  background: rgba(244, 246, 244, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(221, 230, 223, 0.7);
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: 24px;
  line-height: 1.2;
}

.title-block {
  min-width: 0;
}

.topbar-action {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.topbar-action form {
  margin: 0;
}

.back-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--green-dark);
  background: #fff;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.icon-action {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  font-size: 28px;
  line-height: 1;
  box-shadow: var(--shadow);
}

.password-button,
.logout-button {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.password-button {
  font-size: 11px;
  font-weight: 800;
}

.content {
  padding: 16px;
}

.login-shell {
  display: grid;
  align-items: center;
  padding-bottom: 0;
}

.login-shell .content {
  width: 100%;
}

.login-panel {
  display: grid;
  gap: 18px;
  width: min(100%, 420px);
  margin: 0 auto;
}

.login-heading h1 {
  margin: 4px 0 0;
  font-size: 28px;
}

.login-form {
  padding: 18px;
}

.alert {
  margin-bottom: 12px;
  padding: 12px 14px;
  color: var(--danger);
  background: #ffebee;
  border: 1px solid #ffcdd2;
  border-radius: 8px;
}

.success-alert {
  padding: 12px 14px;
  color: var(--green-dark);
  background: var(--green-soft);
  border: 1px solid #a5d6a7;
  border-radius: 8px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card,
.form-card,
.record-card,
.species-card,
.spot-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 14px;
}

.stat-card.wide {
  grid-column: 1 / -1;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 2px 10px;
}

.section-head h2,
.time-editor h2 {
  margin: 0;
  font-size: 18px;
}

.section-head a {
  color: var(--green);
  font-weight: 700;
}

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

.record-card {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 12px;
  min-height: 116px;
  padding: 10px;
}

.thumb,
.species-img {
  overflow: hidden;
  border-radius: 8px;
  background: var(--green-soft);
}

.thumb img,
.species-img img,
.preview-img,
.image-picker img,
.empty-state img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.record-body {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 6px;
}

.record-title {
  font-size: 18px;
  font-weight: 800;
}

.meta-row {
  display: flex;
  gap: 8px;
  color: var(--green-dark);
  font-weight: 700;
}

.muted,
.record-body time,
.spot-card p,
.spot-card span,
.map-hint {
  color: var(--muted);
  font-size: 13px;
}

.muted,
.spot-card p,
.spot-card span {
  white-space: pre-line;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 38px 20px;
  color: var(--muted);
  text-align: center;
}

.empty-state img {
  width: 120px;
  height: 90px;
  border-radius: 8px;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.map-search button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.primary-btn {
  width: 100%;
  color: #fff;
  background: var(--green);
}

.secondary-btn {
  width: 100%;
  color: var(--green-dark);
  background: var(--green-soft);
}

.danger-btn {
  width: 100%;
  color: #fff;
  background: var(--danger);
}

.form-card {
  display: grid;
  gap: 14px;
  padding: 14px;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.12);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.preview-img {
  height: 180px;
  border-radius: 8px;
}

.danger-zone {
  margin-top: 14px;
}

.species-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.species-card {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.species-img {
  aspect-ratio: 4 / 3;
}

.species-card strong {
  font-size: 17px;
}

.image-picker {
  display: grid;
  gap: 10px;
}

.image-picker img {
  height: 220px;
  border-radius: 8px;
  background: var(--green-soft);
}

.file-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  color: var(--green-dark);
  background: var(--green-soft);
  border: 1px solid #c8e6c9;
  border-radius: 8px;
  cursor: pointer;
}

.file-picker input {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.time-editor {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.time-table {
  display: grid;
  grid-template-columns: 74px repeat(5, minmax(54px, 1fr));
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.table-cell {
  min-width: 54px;
  min-height: 44px;
  padding: 7px 4px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 12px;
  text-align: center;
}

.heading,
.row-head {
  display: grid;
  place-items: center;
  background: #f8faf8;
  color: var(--muted);
  font-weight: 800;
}

.toggle-cell {
  cursor: pointer;
}

.toggle-cell.good {
  color: var(--green-dark);
  background: var(--green-soft);
  font-weight: 800;
}

.toggle-cell.bad {
  color: #7b1f1f;
  background: #fff5f5;
}

.spot-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
}

.spot-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 18px;
}

.spot-card p {
  margin: 0 0 6px;
}

.chevron {
  color: var(--green);
  font-size: 28px;
}

.map-panel {
  display: grid;
  gap: 10px;
}

.map-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 8px;
}

.map-search button {
  color: #fff;
  background: var(--green);
}

.map-box,
.detail-map {
  width: 100%;
  height: 280px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--green-soft);
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(100%, 760px);
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.06);
}

.tab-item {
  display: grid;
  justify-items: center;
  gap: 3px;
  min-height: 64px;
  padding: 8px 4px 10px;
  color: var(--muted);
  font-size: 12px;
}

.tab-item.active {
  color: var(--green);
  font-weight: 800;
}

.tab-icon {
  font-size: 22px;
  line-height: 1;
}

@media (min-width: 720px) {
  .content {
    padding: 22px;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .stat-card.wide {
    grid-column: auto;
  }

  .species-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
