:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --panel: #ffffff;
  --panel-alt: #f9faf8;
  --line: #dfe5dc;
  --line-strong: #c7d1c4;
  --text: #17211a;
  --muted: #637067;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --blue: #2563eb;
  --amber: #b45309;
  --rose: #be123c;
  --shadow: 0 18px 50px rgba(23, 33, 26, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  min-height: 96px;
  padding: 20px clamp(18px, 4vw, 48px);
}

.eyebrow {
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 6px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.55rem, 2.5vw, 2.2rem);
  line-height: 1.12;
}

h2 {
  font-size: 1.12rem;
  line-height: 1.25;
}

p {
  color: var(--muted);
}

.tabs {
  background: #eef3ec;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  padding: 4px;
}

.tab {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  min-height: 40px;
  padding: 0 16px;
}

.tab.is-active {
  background: var(--panel);
  box-shadow: 0 1px 3px rgba(23, 33, 26, 0.12);
  color: var(--text);
  font-weight: 700;
}

.shell {
  margin: 0 auto;
  max-width: 1180px;
  padding: 28px clamp(16px, 4vw, 48px) 56px;
}

.intake,
.table-wrap,
.list-head {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.intake {
  display: grid;
  gap: 24px;
  padding: clamp(18px, 4vw, 34px);
}

.form-head,
.list-head,
.form-actions,
.list-actions,
.modal-head {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.status {
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.92rem;
  min-height: 32px;
  padding: 6px 10px;
}

.status[data-kind="success"] {
  background: #e7f6ef;
  color: #116149;
}

.status[data-kind="error"] {
  background: #fde8ee;
  color: var(--rose);
}

.status[data-kind="warning"] {
  background: #fff3d6;
  color: var(--amber);
}

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

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

.field,
.upload-field {
  display: grid;
  gap: 8px;
}

.field-label {
  color: #2b372f;
  font-size: 0.92rem;
  font-weight: 700;
}

.field input,
.field select {
  background: var(--panel-alt);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--text);
  min-height: 46px;
  padding: 0 12px;
  width: 100%;
}

.field input:focus,
.field select:focus,
.upload-field input:focus + .drop-zone,
.button:focus-visible,
.tab:focus-visible,
.icon-button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  outline-offset: 2px;
}

.upload-field input {
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  overflow: hidden;
  position: absolute;
}

.drop-zone {
  align-content: center;
  background: var(--panel-alt);
  border: 1px dashed #9daf9b;
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  min-height: 230px;
  overflow: hidden;
  padding: 18px;
  text-align: center;
}

.drop-zone.has-image {
  align-content: end;
  background-position: center;
  background-size: cover;
  border-style: solid;
  min-height: 280px;
  position: relative;
}

.drop-zone.has-image::before {
  background: linear-gradient(180deg, transparent 20%, rgba(0, 0, 0, 0.64));
  content: "";
  inset: 0;
  position: absolute;
}

.drop-zone.has-image .drop-title,
.drop-zone.has-image .drop-meta {
  color: #ffffff;
  position: relative;
}

.drop-title {
  color: var(--text);
  font-weight: 800;
}

.drop-meta {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 4px;
}

.button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  text-decoration: none;
  white-space: nowrap;
}

.button.primary {
  background: var(--teal);
  color: #ffffff;
}

.button.primary:hover {
  background: var(--teal-dark);
}

.button.secondary {
  background: #ffffff;
  border-color: var(--line-strong);
  color: var(--text);
}

.button.danger {
  background: var(--rose);
  color: #ffffff;
}

.button.danger:hover {
  background: #9f1239;
}

.button[disabled] {
  cursor: wait;
  opacity: 0.62;
}

.list-head {
  margin-bottom: 18px;
  padding: 18px 20px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 1080px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f0f4ef;
  color: #334139;
  font-size: 0.84rem;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: #f7faf6;
}

.action-cell {
  white-space: nowrap;
}

.table-delete {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 6px;
  color: var(--rose);
  cursor: pointer;
  font-weight: 800;
  min-height: 32px;
  padding: 0 10px;
}

.table-delete:hover {
  background: #ffe4e6;
}

.empty {
  color: var(--muted);
  cursor: default;
  padding: 32px 16px;
  text-align: center;
}

.pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 4px 9px;
}

.pill.completed {
  background: #e7f6ef;
  color: #116149;
}

.pill.error {
  background: #fde8ee;
  color: var(--rose);
}

.modal {
  inset: 0;
  position: fixed;
  z-index: 20;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  background: rgba(12, 19, 15, 0.56);
  border: 0;
  cursor: pointer;
  inset: 0;
  position: absolute;
  width: 100%;
}

.modal-panel {
  background: var(--panel);
  border-radius: 8px 8px 0 0;
  bottom: 0;
  box-shadow: var(--shadow);
  left: 50%;
  max-height: 92vh;
  max-width: 1080px;
  overflow: hidden;
  position: absolute;
  transform: translateX(-50%);
  width: min(1080px, calc(100vw - 24px));
}

.modal-head {
  border-bottom: 1px solid var(--line);
  padding: 18px 22px;
}

.icon-button {
  align-items: center;
  background: #f1f4f0;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font-size: 1.4rem;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.modal-body {
  display: grid;
  gap: 22px;
  max-height: calc(92vh - 82px);
  overflow: auto;
  padding: 22px;
}

.image-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.image-tile h3 {
  background: #f0f4ef;
  font-size: 0.92rem;
  margin: 0;
  padding: 12px 14px;
}

.image-stage {
  background: #eef2eb;
  overflow: hidden;
  position: relative;
}

.image-stage img {
  background: #eef2eb;
  display: block;
  max-height: 420px;
  object-fit: contain;
  transform-origin: var(--zoom-x, 50%) var(--zoom-y, 50%);
  transition: transform 120ms ease-out;
  width: 100%;
}

.image-stage.is-zoomable {
  cursor: zoom-in;
}

.image-stage.is-zoomable:hover img {
  transform: scale(3);
}

.image-delete {
  background: rgba(190, 18, 60, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
  min-height: 34px;
  padding: 0 12px;
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 2;
}

.image-delete:hover {
  background: #9f1239;
}

.confirm-modal {
  z-index: 40;
}

.confirm-panel {
  background: var(--panel);
  border-radius: 8px;
  box-shadow: var(--shadow);
  left: 50%;
  max-width: 440px;
  overflow: hidden;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(440px, calc(100vw - 32px));
}

.confirm-head,
.confirm-body,
.confirm-actions {
  padding: 18px 20px;
}

.confirm-head {
  border-bottom: 1px solid var(--line);
}

.confirm-body {
  display: grid;
  gap: 12px;
}

.confirm-actions {
  align-items: center;
  background: #f8faf7;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

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

.detail-item {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.detail-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  margin-bottom: 5px;
}

.detail-value {
  color: var(--text);
  overflow-wrap: anywhere;
}

@media (max-width: 820px) {
  .topbar,
  .form-head,
  .list-head,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs,
  .list-actions {
    width: 100%;
  }

  .tab,
  .list-actions .button,
  .form-actions .button {
    flex: 1;
  }

  .upload-grid,
  .field-grid,
  .image-grid,
  .details-grid {
    grid-template-columns: 1fr;
  }

  .drop-zone,
  .drop-zone.has-image {
    min-height: 210px;
  }
}