:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #64748b;
  --border: #d7dee8;
  --accent: #0f7b67;
  --accent-strong: #095c4d;
  --danger: #b42318;
  --soft: #eef4f1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

.public-header {
  display: flex;
  align-items: center;
  min-height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-weight: 800;
}

.brand img {
  width: 42px;
  height: 42px;
}

.service-shell {
  display: grid;
  grid-template-columns: minmax(420px, 0.88fr) minmax(620px, 1.12fr);
  gap: 24px;
  max-width: 1560px;
  margin: 0 auto;
  padding: 24px;
}

.form-pane,
.preview-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.form-pane {
  padding: 22px;
}

.preview-pane {
  position: sticky;
  top: 24px;
  align-self: start;
}

.preview-card {
  padding: 20px;
  overflow: auto;
}

.pane-title,
.button-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.2;
}

.pane-title p {
  margin-top: 5px;
  color: var(--muted);
}

fieldset {
  margin: 22px 0 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

legend {
  padding: 0 6px;
  font-weight: 800;
}

label {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

input:focus {
  outline: 2px solid rgba(15, 123, 103, 0.18);
  border-color: var(--accent);
}

input[readonly] {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #475569;
  cursor: not-allowed;
}

input:not([readonly])[data-service-field] {
  border-color: rgba(15, 123, 103, 0.45);
  background: #fbfffd;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.field-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.field-badge.editable {
  border: 1px solid rgba(15, 123, 103, 0.25);
  background: var(--soft);
  color: var(--accent-strong);
}

.field-badge.locked {
  border: 1px solid #d7dee8;
  background: #f8fafc;
  color: var(--muted);
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.primary {
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
}

.primary:hover {
  background: var(--accent-strong);
}

.secondary {
  padding: 0 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
}

.upload-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfd;
}

.notice-box {
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(15, 123, 103, 0.2);
  border-radius: 8px;
  background: var(--soft);
  color: var(--accent-strong);
  font-weight: 700;
}

.notice-box.error {
  border-color: rgba(180, 35, 24, 0.25);
  background: #fff4f2;
  color: var(--danger);
}

.service-actions {
  margin-top: 18px;
  justify-content: flex-end;
}

.service-preview {
  min-width: 620px;
  padding: 10px;
  background: #fff;
  color: #111827;
}

.service-preview-title {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 58px;
  border: 1px solid #111827;
}

.service-preview-title h2 {
  text-align: center;
  font-size: 28px;
  line-height: 1.2;
}

.service-preview-title img {
  position: absolute;
  right: 18px;
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.service-party-table,
.service-preview-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.service-party-table {
  font-size: 14px;
}

.service-party-table th,
.service-party-table td {
  height: 42px;
  padding: 6px 10px;
  border: 1px solid #111827;
  vertical-align: middle;
}

.service-party-table th {
  width: 82px;
  text-align: left;
  font-weight: 800;
}

.service-party-table td {
  font-weight: 700;
}

.service-party-table .blank-row {
  height: 40px;
}

.service-party-table .blank-row.small {
  height: 28px;
}

.service-preview-table {
  font-size: 13px;
}

.service-preview-table th,
.service-preview-table td {
  height: 38px;
  padding: 6px;
  border: 1px solid #111827;
  text-align: center;
  vertical-align: middle;
  word-break: break-word;
}

.service-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px 290px;
  gap: 16px;
  min-height: 110px;
  padding: 18px 4px 0;
  font-size: 16px;
  line-height: 1.8;
}

.service-summary p {
  margin: 0;
}

.stamp-preview {
  display: grid;
  place-items: center;
  align-self: start;
  min-height: 76px;
  border: 1px dashed #94a3b8;
  color: #64748b;
  font-size: 13px;
}

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

  .preview-pane {
    position: static;
  }
}

@media (max-width: 680px) {
  .public-header {
    padding: 14px 18px;
  }

  .service-shell {
    padding: 14px;
  }

  .form-pane,
  .preview-card {
    padding: 14px;
  }

  .grid.two,
  .grid.three,
  .upload-panel,
  .service-summary {
    grid-template-columns: 1fr;
  }
}
