:root {
  color-scheme: light;
  --ink: #17372d;
  --muted: #65796f;
  --paper: #ffffff;
  --canvas: #f3f7f3;
  --line: #dbe6df;
  --green: #176f4d;
  --green-dark: #0c5037;
  --green-soft: #e4f3ea;
  --lime: #b9dc72;
  --red: #b23a35;
  --red-dark: #8e2925;
  --red-soft: #fae9e7;
  --gold: #8c6817;
  --gold-soft: #fff5d9;
  --shadow: 0 22px 60px rgba(20, 55, 43, 0.11);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 5%, rgba(185, 220, 114, 0.2), transparent 26rem),
    linear-gradient(180deg, #fbfdfa, var(--canvas));
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-card {
  width: min(480px, 100%);
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: white;
  background: var(--green);
  box-shadow: 0 9px 24px rgba(23, 111, 77, 0.23);
  font-family: Georgia, serif;
  font-size: 25px;
  font-weight: 700;
}

.brand-lockup strong,
.brand-lockup small {
  display: block;
}

.brand-lockup strong {
  font-size: 18px;
  letter-spacing: -0.02em;
}

.brand-lockup small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.auth-form {
  margin-top: 42px;
}

.eyebrow {
  margin: 0;
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -0.035em;
}

.auth-form h1 {
  margin: 8px 0 7px;
  font-size: 42px;
}

.intro,
.mode-description,
.form-help {
  color: var(--muted);
}

.auth-form .intro {
  margin: 0 0 24px;
  line-height: 1.55;
}

label {
  display: block;
  margin-top: 17px;
  font-size: 13px;
  font-weight: 780;
}

label small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-weight: 500;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 7px;
  border: 1px solid #c6d4cb;
  border-radius: 11px;
  padding: 12px 13px;
  color: var(--ink);
  background: #fbfcfb;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(185, 220, 114, 0.34);
  border-color: var(--green);
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

.button {
  min-height: 43px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 10px 14px;
  font-weight: 800;
  transition: 0.16s ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: default;
  opacity: 0.5;
}

.button.wide {
  width: 100%;
  margin-top: 25px;
}

.button.primary {
  color: white;
  background: var(--green);
}

.button.primary:hover:not(:disabled) {
  background: var(--green-dark);
}

.button.quiet,
.button.external {
  color: var(--ink);
  border-color: var(--line);
  background: white;
}

.button.external {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--green-dark);
  text-decoration: none;
}

.button.adjust {
  color: #5f480b;
  border-color: #e0ca78;
  background: #f5e9b7;
}

.button.reject {
  color: var(--red);
  border-color: #e8b8b4;
  background: white;
}

.button.danger {
  color: white;
  background: var(--red);
}

.form-error {
  margin: 18px 0 0;
  border-radius: 10px;
  padding: 11px 12px;
  color: var(--red-dark);
  background: var(--red-soft);
  font-size: 13px;
  line-height: 1.45;
}

.portal-shell {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 0 34px 60px;
}

.topbar {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(23, 55, 45, 0.09);
}

.brand-lockup.compact .brand-mark {
  width: 43px;
  height: 43px;
  font-size: 22px;
}

.account-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.signed-in-user {
  color: var(--muted);
  font-size: 13px;
}

.text-button {
  border: 0;
  padding: 8px;
  color: var(--green-dark);
  background: transparent;
  font-weight: 750;
}

.review-main {
  padding-top: 30px;
}

.mode-row,
.section-heading,
.plant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.mode-description {
  margin: 6px 0 0;
  font-size: 13px;
}

.plant-header {
  align-items: end;
  margin: 42px 0 22px;
}

.plant-id {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.plant-header h1,
.section-heading h1 {
  margin: 8px 0 0;
  font-size: clamp(34px, 4vw, 56px);
  line-height: 1.05;
}

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

.photo-grid.single {
  grid-template-columns: minmax(0, 820px);
  justify-content: center;
}

.photo-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: white;
  box-shadow: var(--shadow);
}

.image-frame {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: #eaf0eb;
}

.image-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

@media (hover: hover) and (pointer: fine) {
  .image-frame.zoomable {
    cursor: zoom-in;
  }
}

.image-magnifier {
  position: fixed;
  z-index: 50;
  width: min(518px, calc(100vw - 24px), calc(100vh - 24px));
  height: min(518px, calc(100vw - 24px), calc(100vh - 24px));
  border: 5px solid rgba(255, 255, 255, 0.96);
  border-radius: 50%;
  background-color: #eaf0eb;
  background-repeat: no-repeat;
  box-shadow:
    0 22px 60px rgba(9, 34, 25, 0.32),
    0 0 0 1px rgba(12, 80, 55, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.9);
  transition:
    opacity 90ms ease,
    transform 120ms ease;
  will-change: left, top, background-position;
}

.image-magnifier::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  border: 2px solid rgba(255, 255, 255, 0.96);
  border-radius: 50%;
  background: rgba(12, 80, 55, 0.68);
  box-shadow: 0 1px 4px rgba(9, 34, 25, 0.35);
  transform: translate(-50%, -50%);
}

.image-magnifier.visible {
  opacity: 1;
  transform: scale(1);
}

.photo-index,
.score {
  position: absolute;
  top: 15px;
  font-weight: 850;
}

.photo-index {
  left: 15px;
  border-radius: 999px;
  padding: 7px 11px;
  color: white;
  background: rgba(14, 45, 35, 0.79);
  backdrop-filter: blur(7px);
  font-size: 12px;
}

.score {
  right: 15px;
  min-width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--green-dark);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 25px rgba(14, 45, 35, 0.17);
  font-size: 20px;
}

.score.low {
  color: var(--red);
}

.score.missing {
  width: auto;
  height: auto;
  border-radius: 999px;
  padding: 8px 11px;
  color: var(--muted);
  font-size: 11px;
}

.photo-body {
  padding: 18px;
}

.filename {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.feedback-panel {
  position: relative;
  margin-top: 13px;
  border: 1px solid #e1e8e3;
  border-radius: 11px;
  background: #f8faf8;
}

.feedback-panel > span {
  display: block;
  padding: 11px 13px;
  color: var(--green-dark);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.feedback-panel p {
  display: none;
  margin: 0;
  border-top: 1px solid #e1e8e3;
  padding: 12px 13px;
  color: #52675e;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.feedback-panel.open p,
.feedback-panel:focus p {
  display: block;
}

@media (hover: hover) {
  .feedback-panel:not(.open):hover p {
    position: absolute;
    z-index: 5;
    left: 0;
    right: 0;
    display: block;
    border: 1px solid #d4dfd7;
    border-radius: 0 0 11px 11px;
    background: white;
    box-shadow: 0 15px 35px rgba(20, 55, 43, 0.15);
  }
}

.photo-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.admin-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
}

.empty-state,
.loading-state {
  min-height: 420px;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  border: 1px dashed #c8d7ce;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.65);
}

.empty-state h1 {
  margin: 16px 0 6px;
  font-size: 34px;
}

.empty-state p,
.loading-state p {
  margin: 0;
  color: var(--muted);
}

.empty-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--green);
  background: var(--green-soft);
  font-size: 25px;
  font-weight: 900;
}

.spinner {
  width: 35px;
  height: 35px;
  margin-bottom: 14px;
  border: 4px solid #dfe9e2;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

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

.users-view {
  max-width: 980px;
  margin: 0 auto;
}

.create-user-form {
  display: grid;
  grid-template-columns: 1.4fr 1.4fr 0.8fr auto;
  align-items: end;
  gap: 12px;
  margin-top: 32px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
}

.create-user-form label {
  margin: 0;
}

.form-help {
  margin: 10px 4px 24px;
  font-size: 12px;
}

.user-list {
  display: grid;
  gap: 9px;
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 14px 15px;
  background: white;
}

.user-row strong,
.user-row span {
  display: block;
}

.user-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.modal {
  width: min(520px, calc(100vw - 32px));
  border: 0;
  border-radius: 20px;
  padding: 0;
  box-shadow: 0 30px 90px rgba(17, 39, 31, 0.3);
}

.modal::backdrop {
  background: rgba(11, 35, 27, 0.58);
  backdrop-filter: blur(3px);
}

.modal form {
  padding: 28px;
}

.modal h2 {
  margin: 14px 0 8px;
  font-size: 29px;
}

.modal p {
  color: var(--muted);
  line-height: 1.55;
}

.modal-icon {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  font-size: 21px;
  font-weight: 900;
}

.modal-icon.danger {
  color: white;
  background: var(--red);
}

.modal-icon.adjust {
  color: #5f480b;
  background: #f5e9b7;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 24px;
  bottom: 24px;
  max-width: min(430px, calc(100vw - 48px));
  border-radius: 12px;
  padding: 13px 16px;
  color: white;
  background: #123d2f;
  box-shadow: 0 15px 40px rgba(12, 43, 33, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translateY(22px);
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: var(--red-dark);
}

@media (max-width: 900px) {
  .portal-shell {
    padding: 0 18px 38px;
  }

  .topbar {
    align-items: flex-start;
    padding: 17px 0;
  }

  .account-nav {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .signed-in-user {
    display: none;
  }

  .plant-header,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

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

  .create-user-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .image-magnifier {
    width: min(405px, calc(100vw - 24px), calc(100vh - 24px));
    height: min(405px, calc(100vw - 24px), calc(100vh - 24px));
  }
}

@media (max-width: 600px) {
  .auth-shell {
    padding: 14px;
  }

  .auth-card {
    padding: 25px;
  }

  .topbar,
  .mode-row {
    align-items: stretch;
    flex-direction: column;
  }

  .account-nav {
    justify-content: flex-start;
  }

  .photo-actions {
    grid-template-columns: 1fr;
  }

  .admin-actions {
    flex-direction: column;
  }
}

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