.heading-tool {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 18px;
  margin: 0 0 1.5rem;
}

.heading-tool__input,
.heading-tool__result {
  min-width: 0;
  padding: 18px;
  border: 1px solid #eedfca;
}

.heading-tool__input {
  background: #fffaf2;
}

.heading-tool__result {
  background: #fff;
}

.heading-label {
  display: block;
  margin-bottom: 7px;
  color: #334954;
  font-weight: 700;
}

.heading-tool textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid #d8c8af;
  background: #fff;
  color: #263943;
  font: inherit;
  resize: vertical;
}

.heading-tool textarea:focus {
  outline: 2px solid #fff0d8;
  outline-offset: 1px;
  border-color: #ee9e2d;
}

.heading-actions,
.heading-panel__head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.heading-actions {
  margin-top: 10px;
  justify-content: flex-start;
}

.heading-actions button,
.heading-panel__head button {
  border: 1px solid #ee9e2d;
  border-radius: 5px;
  padding: 9px 12px;
  background: #ee9e2d;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.heading-actions .heading-secondary,
.heading-panel__head button {
  background: #fff;
  color: #a76500;
}

.heading-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.heading-summary div {
  padding: 12px 8px;
  border: 1px solid #e6e9ec;
  background: #fafbfc;
  text-align: center;
}

.heading-summary strong,
.heading-summary span {
  display: block;
}

.heading-summary strong {
  color: #263943;
  font-size: 1.25rem;
}

.heading-summary span {
  margin-top: 3px;
  color: #71808a;
  font-size: .78rem;
  font-weight: 700;
}

.heading-state {
  margin-bottom: 13px;
  padding: 10px 12px;
  border-left: 4px solid #ee9e2d;
  background: #fff7e9;
  color: #52616c;
}

.heading-state[data-state="ok"] {
  border-left-color: #16b864;
  background: #effcf3;
}

.heading-state[data-state="warning"] {
  border-left-color: #ee9e2d;
}

.heading-state[data-state="error"] {
  border-left-color: #d25565;
  background: #fff0f2;
}

.heading-panel {
  margin-top: 13px;
  padding: 14px;
  border: 1px solid #e2e7ea;
  background: #fff;
}

.heading-panel h3 {
  margin: 0;
}

.heading-tree {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.heading-tree__item {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin: 6px 0;
  padding: 8px 10px;
  border-left: 4px solid #ee9e2d;
  background: #fafafa;
}

.heading-tree__item--h2 { margin-left: 18px; }
.heading-tree__item--h3 { margin-left: 36px; }
.heading-tree__item--h4 { margin-left: 54px; }
.heading-tree__item--h5 { margin-left: 72px; }
.heading-tree__item--h6 { margin-left: 90px; }

.heading-tree__badge {
  flex: 0 0 auto;
  min-width: 30px;
  padding: 2px 5px;
  border-radius: 4px;
  background: #ee9e2d;
  color: #fff;
  text-align: center;
  font-size: .75rem;
  font-weight: 800;
}

.heading-tree__text {
  min-width: 0;
  color: #334954;
  overflow-wrap: anywhere;
}

.heading-issues {
  margin: 10px 0 0;
  padding-left: 20px;
}

.heading-issue {
  margin: 6px 0;
}

.heading-issue--error { color: #b33d4c; }
.heading-issue--warning { color: #9b6400; }
.heading-issue--info { color: #516a78; }

.heading-copy-status {
  min-height: 1.4em;
  margin: 8px 0 0;
  padding: 0;
  color: #9b6400;
  font-size: .88rem;
  font-weight: 700;
}

@media (max-width: 920px) {
  .heading-tool {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .heading-tool__input,
  .heading-tool__result {
    padding: 14px;
  }

  .heading-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .heading-tree__item--h2 { margin-left: 10px; }
  .heading-tree__item--h3 { margin-left: 20px; }
  .heading-tree__item--h4 { margin-left: 30px; }
  .heading-tree__item--h5 { margin-left: 40px; }
  .heading-tree__item--h6 { margin-left: 50px; }
}