﻿:root {
  --bg-page: #ececec;
  --bg-card: #ffffff;
  --bg-head: #dbe7f3;
  --bg-toolbar: #303237;
  --text-main: #273443;
  --text-muted: #5f6f82;
  --line: #d5dde6;
  --accent: #0f7d67;
  --accent-dark: #0c6856;
  --input-bg: #ffffff;
  --shadow: 0 3px 12px rgba(18, 38, 63, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Manrope', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text-main);
  background: var(--bg-page);
}

.page {
  width: min(1160px, calc(100% - 28px));
  margin: 22px auto;
  display: grid;
  grid-template-columns: minmax(330px, 1fr) minmax(420px, 1fr);
  gap: 24px;
  align-items: start;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  background: var(--bg-head);
  border-bottom: 1px solid var(--line);
  padding: 22px 24px;
}

.card-footer {
  border-top: 1px solid var(--line);
  padding: 18px 24px;
  background: #f8f8f8;
}

.controls-card {
  min-height: 740px;
  display: flex;
  flex-direction: column;
}

.controls-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.title-wrap h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.03em;
  line-height: 1;
}

.title-wrap p {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 15px;
}

.mode-switch {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  min-width: 130px;
}

.mode-btn {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text-main);
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 16px;
  font-weight: 600;
}

.mode-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: transparent;
}

.mode-btn:disabled {
  opacity: 0.9;
  cursor: not-allowed;
}

.controls-body {
  padding: 18px 24px 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 16px;
  font-weight: 600;
}

.required {
  color: #d14343;
}

input,
select {
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
  font-size: 16px;
  color: var(--text-main);
  background: var(--input-bg);
  padding: 8px 14px;
  outline: none;
}

input:focus,
select:focus {
  border-color: #7eb6ff;
  box-shadow: 0 0 0 3px rgba(126, 182, 255, 0.2);
}

.file-picker {
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  grid-template-columns: 120px 108px 1fr;
  overflow: hidden;
  background: #ffffff;
}

.file-label,
.file-btn,
.file-name {
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 16px;
}

.file-label,
.file-btn {
  border-right: 1px solid var(--line);
}

.file-btn {
  cursor: pointer;
  user-select: none;
  background: #f6f8fb;
}

.file-btn:hover {
  background: #edf2f8;
}

.file-name {
  color: #3d4f63;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.controls-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.submit-btn,
.download-btn {
  border: 0;
  background: var(--accent);
  color: #ffffff;
  border-radius: 8px;
  padding: 10px 28px;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
}

.submit-btn:hover,
.download-btn:hover {
  background: var(--accent-dark);
}

.download-btn:disabled {
  background: #b7c9c5;
  cursor: not-allowed;
}

.branding-copy {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #3f5d56;
}

.preview-card {
  display: flex;
  flex-direction: column;
  min-height: 740px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.preview-header h2 {
  margin: 0;
  font-size: 22px;
}

.preview-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.preview-toolbar {
  height: 58px;
  background: var(--bg-toolbar);
  color: #f5f5f5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
}

.toolbar-page {
  font-weight: 700;
  min-width: 64px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 4px;
  padding: 4px 8px;
}

.toolbar-btn {
  border: 0;
  background: transparent;
  color: #f5f5f5;
  width: 34px;
  height: 34px;
  border-radius: 4px;
  font-size: 19px;
  font-weight: 700;
  cursor: pointer;
}

.toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.zoom-label {
  margin-left: auto;
  font-weight: 700;
}

.preview-shell {
  position: relative;
  height: 530px;
  overflow: auto;
  background: #d7d7d7;
  border-top: 1px solid #2f3136;
  border-bottom: 1px solid var(--line);
  padding: 10px;
}

.empty-message {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  color: #5f6570;
  font-size: 16px;
  padding: 20px;
}

#previewCanvas {
  display: none;
  background: #ffffff;
  border: 1px solid #b8b8b8;
  transform-origin: top left;
}

.preview-footer {
  display: flex;
  justify-content: center;
  background: #eeeeee;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
}

@media (max-width: 960px) {
  .page {
    grid-template-columns: 1fr;
  }

  .controls-card,
  .preview-card {
    min-height: auto;
  }

  .preview-shell {
    height: 440px;
  }
}
