:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #5d6b78;
  --line: #d7e0e4;
  --panel: #ffffff;
  --page: #f3f6f5;
  --green: #2f946f;
  --green-dark: #1f6f54;
  --blue: #245f95;
  --amber: #b96f22;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #eef5f2 0%, var(--page) 42%, #edf1f5 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.pdf-shell {
  width: 100%;
  min-height: 100vh;
  padding: max(20px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
}

.pdf-tool {
  width: min(100%, 680px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 20px 48px rgba(23, 33, 43, 0.12);
  padding: clamp(18px, 4vw, 32px);
}

.pdf-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.brand-mark {
  color: var(--green-dark);
  font-size: 1.15rem;
  line-height: 1;
  letter-spacing: 0;
}

.pdf-heading h1 {
  margin: 0;
  font-size: clamp(1.35rem, 6vw, 2rem);
  line-height: 1.1;
  text-align: right;
}

.pdf-form {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 7px;
  font-size: 0.9rem;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 48px;
  border: 1px solid #bfcbd2;
  border-radius: 8px;
  padding: 0 13px;
  color: var(--ink);
  font: inherit;
  background: #fbfdfd;
}

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

.upload-panel {
  min-height: 176px;
  border: 2px dashed #aab8bf;
  border-radius: 8px;
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  background: #f9fbfb;
}

.upload-panel.has-image {
  border-style: solid;
  border-color: var(--green);
  background: #f3fbf7;
}

.upload-panel img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  background: #e6ecef;
}

.upload-panel:focus-within {
  outline: 3px solid rgba(47, 148, 111, 0.22);
  border-color: var(--green);
}

.upload-panel input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
}

.upload-panel strong {
  font-size: 1.05rem;
}

.upload-panel small,
.status-message {
  color: var(--muted);
}

.upload-options {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.picker-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0 10px;
  font-weight: 800;
  cursor: pointer;
}

.picker-button-secondary {
  background: #fff;
  color: var(--blue);
  border-color: #9bb7cb;
}

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

button,
.download-link {
  min-height: 48px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 16px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-grid;
  place-items: center;
  text-align: center;
}

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

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

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

.secondary-button {
  background: #fff;
  color: var(--blue);
  border-color: #9bb7cb;
}

.secondary-button:not(:disabled):hover {
  background: #eef6fb;
}

.download-link {
  background: #fff8ed;
  color: var(--amber);
  border: 1px solid #e5bd83;
}

.status-message {
  min-height: 1.4em;
  margin: 0;
  line-height: 1.4;
}

@media (max-width: 560px) {
  .pdf-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .pdf-heading h1 {
    text-align: left;
  }

  .upload-grid,
  .upload-options,
  .actions {
    grid-template-columns: 1fr;
  }
}
