:root {
  color-scheme: light;
  --kit-green: #00876c;
  --kit-green-dark: #006855;
  --ink: #18211f;
  --muted: #687571;
  --line: #d9e4e1;
  --surface: #ffffff;
  --soft: #eef6f4;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f8fbfa;
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.topbar {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 48px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  align-items: center;
  display: flex;
  font-weight: 700;
  gap: 12px;
  text-decoration: none;
}

.brand img {
  height: 36px;
  width: auto;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: flex-end;
}

nav a {
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}

main {
  margin: 0 auto;
  max-width: 1200px;
  padding: clamp(18px, 4vw, 48px);
}

.upload-page main {
  padding-top: clamp(18px, 6vw, 72px);
}

.hero,
.page-heading {
  align-items: end;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 24px;
}

.hero {
  align-items: center;
  background: linear-gradient(135deg, var(--kit-green), #37aa8f);
  border-radius: 8px;
  color: white;
  min-height: 220px;
  padding: clamp(24px, 5vw, 56px);
}

.upload-logo {
  background: white;
  border-radius: 8px;
  display: block;
  margin-bottom: 24px;
  max-width: 220px;
  padding: 14px;
  width: 55vw;
}

.eyebrow {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2rem, 7vw, 4rem);
  line-height: 1;
  margin: 0;
}

.lede {
  font-size: 1.15rem;
  margin: 14px 0 0;
  max-width: 620px;
}

.upload-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 18px;
  margin: 0 auto;
  max-width: 760px;
  padding: clamp(18px, 4vw, 32px);
}

label {
  display: grid;
  font-weight: 700;
  gap: 8px;
}

input {
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  padding: 14px;
  width: 100%;
}

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

.source-button {
  align-items: center;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--kit-green-dark);
  cursor: pointer;
  display: grid;
  gap: 10px;
  min-height: 132px;
  padding: 20px;
  text-align: center;
}

.source-button:hover {
  background: #dcefeb;
}

.camera-source {
  background: #dff5ef;
}

.source-icon {
  align-items: center;
  background: white;
  border-radius: 999px;
  color: var(--kit-green-dark);
  display: inline-flex;
  height: 52px;
  justify-content: center;
  justify-self: center;
  width: 52px;
}

.source-icon svg {
  fill: none;
  height: 28px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 28px;
}

.upload-hint {
  margin: -6px 0 0;
}

.visually-hidden {
  height: 1px;
  left: -10000px;
  overflow: hidden;
  position: absolute;
  top: auto;
  width: 1px;
}

.preview-panel {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.preview-panel[hidden] {
  display: none;
}

.preview-panel img {
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  display: block;
  max-height: 360px;
  object-fit: contain;
  width: 100%;
}

.preview-panel p {
  color: var(--muted);
  font-weight: 700;
  margin: 0;
  overflow-wrap: anywhere;
}

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

.hint,
small,
.tile-meta span,
.empty-note {
  color: var(--muted);
  font-weight: 500;
}

button,
.button {
  align-items: center;
  background: var(--kit-green);
  border: 0;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 800;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  text-decoration: none;
}

button:hover,
.button:hover {
  background: var(--kit-green-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.secondary {
  background: var(--soft);
  color: var(--kit-green-dark);
}

.secondary:hover {
  background: #dcefeb;
}

.danger {
  background: var(--danger);
}

.messages {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.message {
  border-radius: 8px;
  font-weight: 700;
  margin: 0;
  padding: 12px 14px;
}

.message.success {
  background: #dff5ef;
  color: #075846;
}

.message.error {
  background: #fee4e2;
  color: var(--danger);
}

.gallery-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.photo-tile,
.empty-tile,
.admin-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.photo-tile img {
  aspect-ratio: 1;
  display: block;
  height: auto;
  object-fit: cover;
  width: 100%;
}

.tile-meta {
  display: grid;
  gap: 3px;
  padding: 12px;
}

.empty-tile {
  align-items: center;
  aspect-ratio: 1;
  display: flex;
  justify-content: center;
}

.empty-tile img {
  filter: grayscale(0.15);
  max-width: 70%;
  opacity: 0.38;
}

.gallery-tools {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.gallery-tools p {
  margin: 0;
}

body.gallery-fullscreen {
  background: #f8fbfa;
  overflow: auto;
}

body.gallery-fullscreen .topbar,
body.gallery-fullscreen .page-heading,
body.gallery-fullscreen .messages {
  display: none;
}

body.gallery-fullscreen main {
  max-width: none;
  padding: 14px;
}

body.gallery-fullscreen .gallery-grid {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

.actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

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

.admin-row {
  align-items: center;
  display: grid;
  gap: 16px;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  padding: 12px;
}

.admin-row img {
  aspect-ratio: 1;
  border-radius: 6px;
  object-fit: cover;
  width: 96px;
}

.admin-row p {
  margin: 5px 0;
}

@media (max-width: 720px) {
  .topbar,
  .hero,
  .page-heading,
  .admin-row {
    align-items: stretch;
    flex-direction: column;
  }

  .field-grid,
  .photo-source-grid,
  .admin-row {
    grid-template-columns: 1fr;
  }

  .row-actions,
  .actions {
    justify-content: stretch;
  }

  .row-actions > *,
  .actions > *,
  .row-actions form,
  .actions form {
    width: 100%;
  }
}
