:root {
  --bg: #f0eee9;
  --surface: #ffffff;
  --border: #dddad3;
  --text: #1a1814;
  --muted: #7a756c;
  --accent: #4e448a;
  --accent-light: #eeebf5;
  --success: #2d6a4f;
  --radius: 10px;
  --shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
}

html {
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.signature-app {
  min-height: 100vh;
}

/* Header */
.app-header {
  background: var(--accent);
  color: #fff;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-header h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.app-header span {
  margin-left: auto;
  font-size: 0.75rem;
  opacity: 0.7;
}

.hdot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7cb4d4;
  flex-shrink: 0;
}

/* Layout */
.app {
  display: grid;
  grid-template-columns: 363px 1fr;
  gap: 24px;
  padding: 0px 0px 24px 0px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.panel-form {
  padding: 24px;
  position: sticky;
  top: 24px;
}

.panel-preview {
  padding: 24px;
  border-radius: var(--radius);
  margin-top : 24px;
}

.panel-head {
  margin-bottom: 18px;
}

.panel-head-inline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.2;
  color: var(--text);
}

/* Form */
.form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  padding: 11px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(78, 68, 138, 0.12);
}

.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 12 12'%3E%3Cpath fill='%237A756C' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}

/* Actions */
.actions {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 600;
  padding: 11px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(78, 68, 138, 0.22);
}

.copy-status {
  margin: 0;
  min-height: 20px;
  font-size: 0.9rem;
  color: var(--muted);
}

.help-box {
  margin-top: 8px;
  padding: 14px;
  font-size: 0.9rem;
  line-height: 1.5;
  background: #f7f7fb;
  border: 1px solid #d9dbeb;
  border-radius: 8px;
  color: #4c495f;
}

/* Preview */
.preview-shell {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.preview-toolbar {
  background: #f7f5f2;
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.preview-toolbar .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.preview-toolbar .dot:nth-child(1) {
  background: #ff6057;
}

.preview-toolbar .dot:nth-child(2) {
  background: #febc2e;
}

.preview-toolbar .dot:nth-child(3) {
  background: #28c840;
}

.preview-toolbar-label {
  margin-left: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.preview-body {
  padding: 24px;
  background: #fff;
}

/* Important: on isole la zone de preview */
#signature-preview {
  overflow-x: auto;
}

/* Responsive */
@media (max-width: 960px) {
  .app {
    grid-template-columns: 1fr;
  }

  .panel-form {
    position: static;
    top: auto;
  }
}