:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #5d6a75;
  --line: #d9e0e6;
  --paper: #f7f9fb;
  --surface: #ffffff;
  --teal: #126c67;
  --teal-dark: #0d514e;
  --amber: #a9651b;
  --danger: #b3261e;
  --shadow: 0 18px 45px rgba(23, 32, 42, 0.12);
}

* {
  box-sizing: border-box;
}

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

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

button {
  border: 0;
  cursor: pointer;
}

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

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  min-height: 100vh;
}

.tool-pane {
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 28px;
}

.brand-row,
.preview-toolbar,
.actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.status-pill.ready {
  border-color: rgba(18, 108, 103, 0.35);
  color: var(--teal-dark);
}

.status-pill.error {
  border-color: rgba(179, 38, 30, 0.35);
  color: var(--danger);
}

.upload-zone {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 92px;
  border: 1px dashed #b8c4ce;
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

.upload-zone.dragging {
  border-color: var(--teal);
  background: #eef8f6;
}

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

.upload-zone label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
}

.upload-zone label strong {
  color: var(--ink);
  font-size: 16px;
}

.field-label,
.control-grid label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

textarea {
  min-height: 88px;
  resize: vertical;
  padding: 12px;
  line-height: 1.35;
}

input,
select {
  min-height: 38px;
  padding: 8px 10px;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(18, 108, 103, 0.12);
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 80px 112px;
  gap: 10px;
}

.meta-grid div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.meta-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.meta-grid strong {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.advanced-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.advanced-panel summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 700;
}

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

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 750;
}

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

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

.secondary-button {
  min-width: 104px;
  border: 1px solid var(--teal);
  background: #ffffff;
  color: var(--teal-dark);
}

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

.full-width {
  width: 100%;
  margin-top: 12px;
}

.message-line {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.message-line.error {
  color: var(--danger);
}

.preview-pane {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  padding: 22px;
}

.preview-toolbar {
  min-height: 42px;
}

.preview-toolbar span {
  color: var(--muted);
  font-size: 13px;
}

#pdfPreview {
  width: 100%;
  height: calc(100vh - 86px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e8edf1;
  box-shadow: var(--shadow);
}

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

  .tool-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  #pdfPreview {
    height: 70vh;
  }
}

@media (max-width: 560px) {
  .tool-pane,
  .preview-pane {
    padding: 18px;
  }

  .brand-row,
  .actions-row {
    align-items: stretch;
    flex-direction: column;
  }

  .meta-grid,
  .control-grid,
  .upload-zone {
    grid-template-columns: 1fr;
  }

  .secondary-button {
    width: 100%;
  }
}
