:root {
  --ink: #20294f;
  --muted: #5f6678;
  --line: #40aa76;
  --soft-line: #d9efe4;
  --surface: #ffffff;
  --page: #f3f7f5;
  --accent: #40aa76;
  --accent-dark: #20294f;
  --danger: #a83d32;
  --shadow: 0 18px 60px rgba(27, 45, 39, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(620px, 1fr);
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto;
  align-items: start;
}

.editor-panel,
.preview-panel {
  background: var(--surface);
  border: 1px solid #dce8e2;
  box-shadow: var(--shadow);
}

.editor-panel {
  padding: 24px;
}

.panel-heading {
  margin-bottom: 22px;
}

.eyebrow,
.preview-toolbar p {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 6px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  line-height: 1.15;
}

.controls {
  display: grid;
  gap: 16px;
}

.field,
.range-field {
  display: grid;
  gap: 7px;
  color: #403b33;
  font-size: 13px;
  font-weight: 700;
}

.field input {
  width: 100%;
  border: 1px solid #d8d3c8;
  background: #fff;
  padding: 11px 12px;
  color: var(--ink);
  outline: none;
}

.field input:focus,
.upload-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(64, 170, 118, 0.16);
}

.upload-box {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px dashed #8bcdaa;
  background: #f7fcf9;
  cursor: pointer;
}

.upload-title {
  color: #403b33;
  font-size: 13px;
  font-weight: 700;
}

.upload-copy {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.upload-box input {
  width: 100%;
  color: var(--muted);
  font-size: 12px;
}

.adjustments {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}

.range-field input {
  accent-color: var(--accent);
}

.ghost-button,
.copy-button {
  border: 0;
  cursor: pointer;
  font-weight: 700;
}

.ghost-button {
  min-height: 39px;
  padding: 0 12px;
  color: #4c463b;
  background: #e2f3ea;
}

.copy-button {
  min-height: 40px;
  padding: 0 18px;
  color: #fff;
  background: var(--accent-dark);
}

.copy-button:hover,
.ghost-button:hover {
  filter: brightness(0.95);
}

.status {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

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

.preview-panel {
  overflow: hidden;
}

.preview-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid #e0ebe5;
}

.signature-stage {
  overflow-x: auto;
  padding: 34px;
  background: #fafafa;
}

.signature-card {
  width: 700px;
  background: #fff;
  padding: 20px 26px;
}

.sig-table {
  width: 648px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
}

.sig-photo-cell {
  width: 152px;
  vertical-align: middle;
}

.photo-frame {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  overflow: hidden;
  background: #edf3ef;
  cursor: grab;
  position: relative;
  user-select: none;
  touch-action: none;
}

.photo-frame:active {
  cursor: grabbing;
}

.photo-frame img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: translate(calc(-50% + var(--photo-x, 0px)), calc(-50% + var(--photo-y, 0px))) scale(var(--photo-scale, 1.28));
  transform-origin: center;
  pointer-events: none;
}

.sig-info-cell {
  width: 330px;
  padding-right: 18px;
  vertical-align: middle;
}

.sig-name {
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  line-height: 1.08;
  white-space: nowrap;
}

.sig-title {
  margin-top: 7px;
  color: #cccccc;
  font-size: 11px;
  font-weight: 700;
}

.contact-grid {
  margin-top: 10px;
  width: 100%;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  line-height: 1.3;
}

.contact-grid td {
  width: 50%;
  padding: 4px 12px 4px 0;
  white-space: nowrap;
  vertical-align: middle;
}

.contact-grid .address-cell {
  width: 100%;
  white-space: normal;
}

.contact-grid img {
  width: 13px;
  height: 13px;
  margin-right: 5px;
  vertical-align: -2px;
}

.sig-divider {
  width: 2px;
  background: var(--line);
}

.sig-brand-cell {
  width: 156px;
  padding-left: 22px;
  text-align: center;
  vertical-align: middle;
}

.brand-logo {
  width: 112px;
  height: auto;
  display: block;
  margin: 0 auto 8px;
}

.site-footer {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.site-footer a {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 980px) {
  .app-shell {
    padding: 18px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .signature-stage {
    padding: 20px;
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding: 0;
  }

  .editor-panel,
  .preview-panel {
    border-left: 0;
    border-right: 0;
  }

  .adjustments,
  .preview-toolbar {
    grid-template-columns: 1fr;
    display: grid;
  }
}
