.signatures-workspace [hidden] {
  display: none !important;
}

.signatures-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.signatures-section-hero {
  border-bottom: 1px solid rgba(211, 165, 126, 0.32);
}

.signatures-summary-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid #d8cbc2;
  background: #fffaf6;
}

.signatures-summary-band > div {
  min-height: 92px;
  padding: 18px 20px;
  display: grid;
  align-content: center;
  gap: 5px;
  border-right: 1px solid #e2d7d0;
}

.signatures-summary-band > div:last-child {
  border-right: 0;
}

.signatures-summary-band span,
.signatures-tool-group > span,
.signatures-asset-select > span {
  color: #8f6748;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.signatures-summary-band strong {
  color: #1a1411;
  font: 700 1.35rem/1.1 Georgia, serif;
}

.signatures-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid #d8cbc2;
  background: #eee3dd;
}

.signatures-tabs button {
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #554840;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.signatures-tabs button.is-active {
  background: #17120f;
  color: #fffaf6;
}

.signatures-tab-panel {
  min-width: 0;
}

.signatures-start-band {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(340px, 1.1fr);
  gap: clamp(28px, 5vw, 72px);
  padding: clamp(28px, 5vw, 58px);
  border: 1px solid #d8cbc2;
  background: #fffaf6;
}

.signatures-band-copy {
  align-self: center;
}

.signatures-band-copy h2,
.signatures-editor-header h2,
.signatures-asset-form h2,
.signatures-history h2 {
  margin: 5px 0 10px;
}

.signatures-band-copy p:last-child,
.signatures-asset-form > div p:last-child,
.signatures-editor-header p:last-child {
  max-width: 62ch;
  color: #75675f;
  line-height: 1.65;
}

.signatures-upload-form,
.signatures-asset-form {
  display: grid;
  gap: 15px;
}

.signatures-upload-form label,
.signatures-asset-form label,
.signatures-asset-select {
  display: grid;
  gap: 7px;
  color: #2a211d;
  font-weight: 700;
}

.signatures-upload-form input,
.signatures-asset-form input,
.signatures-asset-form select,
.signatures-asset-select select {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid #cfc0b6;
  border-radius: 4px;
  background: #fff;
  color: #1a1411;
  font: inherit;
}

.signatures-file-field {
  padding: 16px;
  border: 1px dashed #b99d89;
  background: #f8f0eb;
}

.signatures-file-field input {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.signatures-file-field small,
.signatures-tool-group small {
  color: #786a61;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.5;
}

.signatures-editor {
  border: 1px solid #d8cbc2;
  background: #fffaf6;
}

.signatures-editor-header {
  padding: 24px 26px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  border-bottom: 1px solid #e2d7d0;
}

.signatures-notice {
  margin: 20px 26px 0;
  padding: 13px 15px;
  border: 1px solid #cdbbad;
  background: #f3e9e2;
  color: #4d4038;
  line-height: 1.55;
}

.signatures-notice.is-success {
  border-color: #769b8d;
  background: #e3eee9;
  color: #245544;
}

.signatures-notice.is-danger {
  border-color: #b86760;
  background: #f4dfdc;
  color: #8e312b;
}

.signatures-editor-layout {
  padding: 26px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 340px);
  gap: 24px;
  align-items: start;
}

.signatures-document-stage {
  min-width: 0;
  padding: 12px;
  border: 1px solid #d8cbc2;
  background: #e8ddd6;
}

.signatures-page-toolbar {
  min-height: 44px;
  padding: 0 8px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #554840;
  font-size: 0.82rem;
}

.signatures-page-toolbar button {
  width: 36px;
  height: 36px;
  border: 1px solid #c9b9af;
  border-radius: 4px;
  background: #fffaf6;
  color: #17120f;
  cursor: pointer;
}

.signatures-page-canvas {
  position: relative;
  width: min(100%, 860px);
  margin: 0 auto;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 12px 28px rgba(34, 25, 20, 0.13);
}

.signatures-page-canvas > img {
  display: block;
  width: 100%;
  height: auto;
}

.signatures-placement-layer {
  position: absolute;
  inset: 0;
  cursor: crosshair;
}

.signatures-placement-marker {
  position: absolute;
  min-width: 20px;
  min-height: 18px;
  display: grid;
  place-items: center;
  overflow: visible;
  border: 1px dashed #986c4d;
  background: transparent;
  color: #4b3020;
  font-size: 0.65rem;
  font-weight: 800;
  cursor: grab;
  touch-action: none;
  user-select: none;
  z-index: 1;
}

.signatures-placement-marker:active {
  cursor: grabbing;
}

.signatures-placement-marker.is-selected {
  border-width: 2px;
  border-color: #6d4126;
  box-shadow: 0 0 0 2px rgba(255, 250, 246, 0.9);
  z-index: 3;
}

.signatures-placement-text {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 2px 4px;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.signatures-placement-marker img {
  position: absolute;
  inset: 2px;
  width: calc(100% - 4px);
  height: calc(100% - 4px);
  object-fit: contain;
  pointer-events: none;
  transform-origin: center;
}

.signatures-placement-rotate,
.signatures-placement-resize,
.signatures-placement-remove {
  position: absolute;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 2px solid #fffaf6;
  border-radius: 50%;
  background: #17120f;
  box-shadow: 0 4px 12px rgba(23, 18, 15, 0.24);
  color: #fffaf6;
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: grab;
  touch-action: none;
  z-index: 5;
}

.signatures-placement-rotate {
  right: -4px;
  top: -4px;
}

.signatures-placement-resize {
  right: -4px;
  bottom: -4px;
  background: #986c4d;
  cursor: nwse-resize;
}

.signatures-placement-remove {
  top: -4px;
  left: -4px;
  background: #fffaf6;
  color: #8b2f2f;
  font-size: 1.25rem;
  font-weight: 800;
  cursor: pointer;
}

.signatures-placement-rotate:active,
.signatures-placement-resize:active,
.signatures-placement-remove:active {
  cursor: grabbing;
}

.signatures-placement-rotate:focus-visible,
.signatures-placement-resize:focus-visible,
.signatures-placement-remove:focus-visible {
  outline: 2px solid #b97745;
  outline-offset: 2px;
}

.signatures-tools-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid #d8cbc2;
  background: #fff;
  position: sticky;
  top: 18px;
}

.signatures-tools-panel h3 {
  margin: 4px 0 8px;
  font-size: 1.08rem;
}

.signatures-tools-panel p {
  margin: 0;
  color: #75675f;
  font-size: 0.86rem;
  line-height: 1.55;
}

.signatures-tools-heading {
  padding-bottom: 14px;
  border-bottom: 1px solid #eadfd8;
}

.signatures-tool-group {
  display: grid;
  gap: 9px;
}

.signatures-tool-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.signatures-tool-buttons button {
  min-height: 42px;
  border: 1px solid #cdbbad;
  border-radius: 4px;
  background: #fffaf6;
  color: #2c221d;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 750;
  cursor: pointer;
}

.signatures-tool-buttons button.is-active {
  border-color: #17120f;
  background: #17120f;
  color: #fffaf6;
}

.signatures-asset-select[hidden] {
  display: none;
}

.signatures-placement-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #5f5048;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.signatures-placement-heading small {
  min-width: 26px;
  padding: 4px 7px;
  border-radius: 999px;
  background: #eee3dd;
  color: #5f4130;
  text-align: center;
}

.signatures-placement-list {
  display: grid;
  gap: 8px;
  max-height: 290px;
  overflow: auto;
}

.signatures-placement-row {
  padding: 11px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid #dfd3cb;
  background: #fff;
}

.signatures-placement-row strong,
.signatures-placement-row small {
  display: block;
}

.signatures-placement-row strong {
  font-size: 0.8rem;
}

.signatures-placement-row small {
  margin-top: 3px;
  color: #7e7067;
}

.signatures-placement-row button {
  width: auto;
  height: 34px;
  padding: 0 9px;
  border: 1px solid #dfb9b4;
  border-radius: 4px;
  background: #fff;
  color: #9b3a33;
  cursor: pointer;
}

.signatures-editor-actions {
  display: grid;
  gap: 8px;
}

.signatures-assets-layout {
  display: grid;
  grid-template-columns: minmax(290px, 0.42fr) minmax(0, 0.58fr);
  gap: 30px;
  padding: clamp(24px, 4vw, 44px);
  border: 1px solid #d8cbc2;
  background: #fffaf6;
}

.signatures-asset-form {
  align-self: start;
}

.signatures-assets-grid {
  margin-top: 18px;
  display: grid;
  gap: 22px;
}

.signature-asset-group {
  display: grid;
  gap: 10px;
}

.signature-asset-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.signature-asset-group-heading h3 {
  margin: 0;
  font-size: 0.92rem;
}

.signature-asset-group-heading > span {
  color: #8f6748;
  font-size: 0.76rem;
  font-weight: 800;
}

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

.signature-asset-card {
  min-width: 0;
  padding: 14px;
  display: grid;
  gap: 11px;
  border: 1px solid #d8cbc2;
  background: #fff;
}

.signature-asset-preview {
  position: relative;
  height: 116px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #eee2da;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #f1e9e4 25%, transparent 25%),
    linear-gradient(-45deg, #f1e9e4 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f1e9e4 75%),
    linear-gradient(-45deg, transparent 75%, #f1e9e4 75%);
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
  background-size: 12px 12px;
}

.signature-asset-preview img {
  position: absolute;
  inset: 8px;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  object-fit: contain;
}

.signature-asset-card header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.signature-asset-card header strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.signature-asset-card header span {
  flex: 0 0 auto;
  color: #8f6748;
  font-size: 0.67rem;
  font-weight: 800;
  text-transform: uppercase;
}

.signature-asset-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.signature-asset-actions button {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #d2c3ba;
  border-radius: 4px;
  background: #fffaf6;
  color: #2a211d;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 750;
  cursor: pointer;
}

.signature-asset-actions button[data-signature-delete-asset] {
  margin-left: auto;
  color: #9b3a33;
}

.signature-asset-actions .signature-treatment-action {
  flex: 1 1 150px;
  border-color: #b78966;
  background: #f8eee7;
  color: #704a31;
}

.signature-asset-actions .signature-primary-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-color: transparent;
  background: transparent;
  color: #6e5c52;
}

.signature-primary-control > span:first-child {
  width: 13px;
  height: 13px;
  border: 1px solid #a98a73;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px #fff;
}

.signature-primary-control[aria-pressed="true"] {
  color: #704a31;
  opacity: 1;
}

.signature-primary-control[aria-pressed="true"] > span:first-child {
  background: #9f744f;
}

.signatures-history {
  padding: clamp(24px, 4vw, 44px);
  border: 1px solid #d8cbc2;
  background: #fffaf6;
}

.signatures-history-limit {
  width: fit-content;
  min-width: 190px;
  margin-top: 18px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid #d8cbc2;
  background: #f8f0eb;
}

.signatures-history-limit span {
  color: #75675f;
  font-size: 0.76rem;
  font-weight: 750;
}

.signatures-history-limit strong {
  color: #1a1411;
  font: 700 1rem/1 Georgia, serif;
}

.signatures-history-list {
  margin-top: 20px;
  display: grid;
  gap: 10px;
}

.signature-history-row {
  min-width: 0;
  padding: 17px 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border: 1px solid #ddd1c9;
  background: #fff;
}

.signature-history-row h3 {
  margin: 0;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.signature-history-row p {
  margin: 5px 0 0;
  color: #796c63;
  font-size: 0.78rem;
}

.signature-history-actions {
  display: flex;
  gap: 8px;
}

.signature-history-actions a,
.signature-history-actions button {
  min-height: 38px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cfbeb2;
  border-radius: 4px;
  background: #fffaf6;
  color: #251c18;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.signatures-empty {
  padding: 24px;
  border: 1px dashed #cdbbad;
  color: #75675f;
  text-align: center;
}

@media (max-width: 1040px) {
  .signatures-summary-band {
    grid-template-columns: 1fr 1fr;
  }

  .signatures-summary-band > div:nth-child(2) {
    border-right: 0;
  }

  .signatures-summary-band > div:nth-child(-n + 2) {
    border-bottom: 1px solid #e2d7d0;
  }

  .signatures-editor-layout,
  .signatures-assets-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .signatures-summary-band {
    grid-template-columns: 1fr 1fr;
  }

  .signatures-summary-band > div {
    min-height: 78px;
    border-bottom: 1px solid #e2d7d0;
  }

  .signatures-summary-band > div:nth-child(odd) {
    border-right: 1px solid #e2d7d0;
  }

  .signatures-summary-band > div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .signatures-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .signatures-tabs button {
    min-width: 0;
    padding: 0 7px;
    font-size: 0.78rem;
    overflow-wrap: anywhere;
  }

  .signatures-start-band {
    grid-template-columns: 1fr;
    padding: 24px 18px;
  }

  .signatures-editor-header {
    padding: 20px 16px;
    align-items: stretch;
    flex-direction: column;
  }

  .signatures-editor-layout {
    padding: 16px;
  }

  .signatures-tools-panel {
    padding: 16px;
    position: static;
  }

  .signatures-notice {
    margin: 16px 16px 0;
  }

  .signatures-assets-layout,
  .signatures-history {
    padding: 22px 16px;
  }

  .signature-asset-group-grid {
    grid-template-columns: 1fr;
  }

  .signature-history-row {
    grid-template-columns: 1fr;
  }

  .signature-history-actions {
    flex-wrap: wrap;
  }
}
