:root {
  --bg: #f6f7f2;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-strong: #ffffff;
  --ink: #101914;
  --muted: #66766b;
  --line: rgba(17, 28, 23, 0.08);
  --green: #10251b;
  --green-soft: #edf4ea;
  --amber: #fff7e8;
  --amber-ink: #7a531f;
  --red: #9b2d28;
  --red-soft: #fff0ef;
  --radius: 16px;
  --shadow: 0 24px 70px rgba(20, 32, 26, 0.1);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(236, 242, 232, 0.65), rgba(246, 247, 242, 0)),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

.admin-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 100;
  max-width: min(520px, calc(100vw - 40px));
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--green);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.45;
  box-shadow: 0 18px 48px rgba(20, 32, 26, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.admin-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.admin-toast.warn {
  background: #7a531f;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 20px;
  background: rgba(255, 255, 255, 0.72);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 4px 28px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--green);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
}

.brand-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  height: 46px;
  border: 0;
  border-radius: 14px;
  padding: 0 12px;
  background: transparent;
  color: #28352e;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: #eef3ea;
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: #2f5d42;
}

svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-foot {
  margin-top: auto;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--amber);
}

.foot-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--amber-ink);
}

.foot-text {
  margin-top: 8px;
  color: #765d37;
  font-size: 13px;
  line-height: 1.55;
}

.main {
  padding: 32px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 4vw, 52px);
  letter-spacing: 0;
  line-height: 1.05;
}

.topbar p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.button,
.file-button {
  min-width: 86px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  padding: 0 16px;
  background: var(--green);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.button.ghost {
  background: #fff;
  color: var(--green);
  border: 1px solid var(--line);
}

.button.compact {
  min-width: 64px;
  height: 38px;
  border-radius: 12px;
}

.file-button input {
  display: none;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 30px 0 18px;
}

.stat-card {
  min-height: 108px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 18px 44px rgba(20, 32, 26, 0.06);
  padding: 20px;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.stat-card strong {
  display: block;
  margin-top: 12px;
  font-size: 38px;
  line-height: 1;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 18px;
  align-items: start;
}

.workspace.plant-workspace {
  grid-template-columns: minmax(360px, 0.82fr) minmax(620px, 1.18fr);
  gap: 16px;
}

.queue-panel,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.toolbar {
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.search-field {
  min-width: 240px;
  height: 42px;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-radius: 14px;
  background: #f1f3ee;
}

.search-field svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}

.segmented {
  display: flex;
  padding: 4px;
  gap: 4px;
  border-radius: 14px;
  background: #f1f3ee;
}

.segment {
  height: 34px;
  border: 0;
  border-radius: 11px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.segment.active {
  background: #fff;
  color: var(--green);
  box-shadow: 0 8px 18px rgba(20, 32, 26, 0.08);
}

.report-list {
  display: grid;
  gap: 1px;
  background: var(--line);
}

.plant-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.plant-search {
  min-width: 0;
}

.plant-list {
  display: grid;
  gap: 1px;
  background: var(--line);
}

.overview-list {
  display: grid;
  gap: 1px;
  background: var(--line);
}

.overview-row {
  background: #fff;
  padding: 18px;
  display: grid;
  gap: 6px;
}

.overview-row strong {
  font-size: 17px;
}

.overview-row span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.report-row {
  border: 0;
  background: #fff;
  padding: 16px;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  text-align: left;
}

.report-row:hover,
.report-row.active,
.plant-row:hover,
.plant-row.active {
  background: #fbfcf8;
}

.plant-row {
  width: 100%;
  border: 0;
  background: #fff;
  padding: 16px;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  text-align: left;
}

.report-thumb {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  object-fit: cover;
  background: #dfe8d8;
}

.report-name {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.25;
}

.report-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status-pending {
  background: var(--amber);
  color: var(--amber-ink);
}

.status-approved {
  background: var(--green-soft);
  color: #245b3a;
}

.status-rejected {
  background: var(--red-soft);
  color: var(--red);
}

.detail-panel {
  position: sticky;
  top: 24px;
}

.plant-workspace .queue-panel,
.plant-workspace .detail-panel {
  max-height: calc(100vh - 132px);
  overflow: auto;
}

.plant-workspace .detail-panel {
  top: 16px;
}

.detail-image-wrap {
  position: relative;
  height: 280px;
  background: #dfe8d8;
}

.detail-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-image-shade {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 120px;
  background: linear-gradient(180deg, rgba(8, 18, 13, 0), rgba(8, 18, 13, 0.8));
}

.detail-image-title {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 18px;
  color: #fff;
}

.detail-image-title h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.08;
}

.detail-image-title p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 14px;
}

.detail-body {
  padding: 18px;
}

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

.mini-card {
  padding: 14px;
  border-radius: 14px;
  background: #f4f6f1;
}

.mini-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mini-value {
  margin-top: 7px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.note-card {
  margin-top: 12px;
  padding: 14px;
  border-radius: 14px;
  background: #f4f6f1;
}

.merge-card {
  margin-top: 12px;
  padding: 14px;
  border-radius: 14px;
  background: #f4f6f1;
}

.note-card p {
  margin: 7px 0 0;
  color: #33443a;
  font-size: 14px;
  line-height: 1.55;
}

.map-card {
  margin-top: 12px;
  min-height: 116px;
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(16, 37, 27, 0.07) 1px, transparent 1px),
    linear-gradient(0deg, rgba(16, 37, 27, 0.07) 1px, transparent 1px),
    #edf4ea;
  background-size: 22px 22px;
  position: relative;
  overflow: hidden;
}

.map-pin {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--green);
  border: 4px solid #fff;
  transform: translate(-50%, -50%);
  box-shadow: 0 8px 18px rgba(16, 37, 27, 0.22);
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.field-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field-control {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  outline: 0;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
}

.field-control:focus {
  border-color: rgba(47, 93, 66, 0.45);
  box-shadow: 0 0 0 3px rgba(47, 93, 66, 0.1);
}

.textarea {
  min-height: 96px;
  padding: 11px 12px;
  line-height: 1.5;
  resize: vertical;
}

.textarea.small {
  min-height: 72px;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  color: #33443a;
  font-size: 13px;
  font-weight: 700;
}

.check-line input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

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

.plant-workspace .plant-form {
  grid-template-columns: minmax(240px, 0.92fr) minmax(320px, 1.08fr);
  gap: 12px;
  padding: 16px;
}

.plant-preview {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  align-items: end;
  min-height: 128px;
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, #edf4ea, #fff);
}

.plant-workspace .plant-preview {
  grid-column: 1;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  min-height: 100px;
  padding: 12px;
}

.plant-preview img {
  width: 92px;
  height: 92px;
  border-radius: 16px;
  object-fit: cover;
  background: #dfe8d8;
}

.plant-workspace .plant-preview img {
  width: 72px;
  height: 72px;
  border-radius: 14px;
}

.plant-preview h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.1;
}

.plant-workspace .plant-preview h2 {
  font-size: 22px;
}

.plant-preview p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.image-manager {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8faf5;
}

.plant-workspace .image-manager {
  grid-column: 2;
  grid-row: 1 / span 4;
  align-self: start;
}

.image-manager-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.image-manager-head p {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.detail-images-head {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.main-image-card,
.detail-image-preview {
  width: 100%;
  border: 0;
  padding: 0;
  overflow: hidden;
  background: #dfe8d8;
}

.main-image-card {
  position: relative;
  height: 230px;
  border-radius: 16px;
}

.plant-workspace .main-image-card {
  height: 180px;
}

.main-image-card img,
.detail-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 160ms ease;
}

.main-image-card:hover img,
.detail-image-preview:hover img {
  transform: scale(1.025);
}

.detail-image-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.detail-image-card {
  position: relative;
  overflow: hidden;
  min-height: 112px;
  border-radius: 14px;
  background: #dfe8d8;
}

.detail-image-preview {
  height: 112px;
  border-radius: 14px;
}

.plant-workspace .detail-image-preview {
  height: 92px;
}

.plant-workspace .detail-image-card {
  min-height: 92px;
}

.image-badge,
.image-main-action {
  position: absolute;
  left: 8px;
  top: 8px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(16, 25, 20, 0.1);
}

.image-main-action {
  top: auto;
  bottom: 8px;
  cursor: pointer;
}

.image-main-action:hover {
  background: var(--green);
  color: #fff;
}

.plant-workspace .field-control {
  min-height: 38px;
}

.plant-workspace .textarea {
  min-height: 82px;
}

.plant-workspace .textarea.small {
  min-height: 58px;
}

.plant-workspace .form-grid {
  grid-column: 1;
  gap: 10px;
}

.plant-workspace .action-row,
.plant-workspace .form-hint {
  grid-column: 1 / -1;
}

.image-delete {
  position: absolute;
  right: 8px;
  top: 8px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(16, 25, 20, 0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.image-delete:hover {
  background: var(--red);
}

.image-empty {
  grid-column: 1 / -1;
  min-height: 98px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(16, 37, 27, 0.18);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  text-align: center;
}

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

.form-hint {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.button.reject {
  background: var(--red-soft);
  color: var(--red);
}

.button.approve {
  background: var(--green);
}

.empty-detail {
  min-height: 520px;
  display: grid;
  place-items: center;
  align-content: center;
  padding: 36px;
  text-align: center;
}

.empty-circle {
  width: 68px;
  height: 68px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  color: #2f5d42;
  background: #edf4ea;
}

.empty-circle svg {
  width: 30px;
  height: 30px;
}

.empty-detail h2 {
  margin: 18px 0 0;
  font-size: 24px;
}

.empty-detail p {
  margin: 8px 0 0;
  color: var(--muted);
}

.empty-list {
  min-height: 260px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #fff;
  font-size: 14px;
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 18px;
    overflow-x: auto;
  }

  .nav-list {
    display: flex;
  }

  .sidebar-foot {
    display: none;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }
}

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

  .plant-workspace .queue-panel,
  .plant-workspace .detail-panel {
    max-height: none;
  }

  .plant-workspace .detail-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 22px;
  }

  .topbar {
    flex-direction: column;
  }

  .stat-strip {
    grid-template-columns: 1fr;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-field {
    min-width: 0;
  }

  .report-row {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .report-row .status-pill {
    grid-column: 2;
    justify-self: start;
  }

  .plant-workspace .plant-form {
    grid-template-columns: 1fr;
  }

  .plant-workspace .image-manager,
  .plant-workspace .plant-preview,
  .plant-workspace .form-grid,
  .plant-workspace .action-row,
  .plant-workspace .form-hint {
    grid-column: 1;
  }

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