:root {
  --ink: #17363e;
  --muted: #587079;
  --green: #166c59;
  --line: #d2ded8;
  --paper: #f4f6f2;
  --soft: #e5eee8;
  --white: #fff;
  --error: #ac2e35;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}
a {
  color: var(--green);
}
a:hover {
  color: #094c3d;
}
button {
  background: var(--green);
  color: white;
  border: 1px solid var(--green);
  padding: 10px 15px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}
button:hover:not(:disabled) {
  background: #0d5746;
}
button.secondary {
  background: var(--white);
  color: var(--ink);
  border-color: var(--line);
}
button.secondary:hover:not(:disabled) {
  background: var(--soft);
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}
:focus-visible {
  outline: 3px solid #57a994;
  outline-offset: 3px;
}
.site-header,
main {
  max-width: 1160px;
  margin: auto;
  padding: 24px;
}
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  gap: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 1px;
}
.brand small {
  display: block;
  font-size: 10px;
  letter-spacing: 2px;
  margin-top: 5px;
}
.site-header nav {
  display: flex;
  gap: 20px;
  font-size: 14px;
}
.intro {
  margin: 12px 0 24px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 2px;
  font-weight: 700;
  color: var(--green);
}
h1 {
  font-size: 32px;
  margin: 8px 0;
}
p {
  line-height: 1.5;
}
.intro p,
.hint,
.scope-help {
  color: var(--muted);
}
#notice {
  padding: 12px 15px;
  background: var(--soft);
  border-radius: 7px;
}
.error,
#publishError {
  color: var(--error);
}
#notice.error {
  background: #fae7e8;
}
.controls {
  display: flex;
  align-items: end;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}
label {
  display: block;
  font-size: 13px;
  font-weight: 700;
}
input,
select,
textarea {
  border: 1px solid #a9bbb1;
  background: white;
  color: var(--ink);
  border-radius: 5px;
  padding: 10px;
  width: 100%;
  min-width: 0;
}
select,
input[type="search"] {
  margin-top: 6px;
}
.controls > label {
  flex: 1;
  min-width: 180px;
}
.controls > .search {
  flex: 1.4;
}
.controls > .changed-toggle {
  flex: 0 1 auto;
  min-width: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  font-weight: 400;
  white-space: nowrap;
}
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
}
.hint {
  font-size: 13px;
}
.scope-help {
  font-size: 14px;
}
.savebar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--soft);
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.savebar > div {
  display: flex;
  gap: 8px;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.section-title h2 {
  font-size: 21px;
}
.section-title > span {
  font-size: 13px;
  color: var(--muted);
}
.text-item {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 14px;
}
.text-item.dirty {
  border-left: 4px solid var(--green);
}
.text-item h3 {
  font-size: 15px;
  margin: 0 0 10px;
  overflow-wrap: anywhere;
}
.item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.item-top label {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  font-weight: 400;
}
.text-item textarea {
  line-height: 1.45;
  resize: vertical;
  min-height: 76px;
  font-size: 15px;
}
.text-item textarea:disabled {
  background: #f1f4f1;
  color: var(--muted);
}
.item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}
.item-foot button {
  font-size: 12px;
  padding: 6px 10px;
}
.tokens {
  font-size: 12px;
  color: var(--muted);
}
code {
  background: var(--soft);
  padding: 2px 4px;
  border-radius: 3px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.field-error {
  margin: 7px 0 0;
  font-size: 13px;
  color: var(--error);
}
[aria-invalid="true"] {
  border: 2px solid var(--error);
}
.history {
  margin: 30px 0;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.history summary {
  cursor: pointer;
  font-weight: 700;
}
.history p {
  font-size: 14px;
  color: var(--muted);
}
.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  font-size: 14px;
}
dialog {
  width: min(900px, calc(100% - 24px));
  max-height: 90dvh;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  overscroll-behavior: contain;
  color: var(--ink);
  background: var(--paper);
}
dialog::backdrop {
  background: #10282aab;
}
body:has(dialog[open]) {
  overflow: hidden;
}
.dialog-heading,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.dialog-heading h2 {
  margin: 0;
  font-size: 23px;
}
.dialog-actions {
  justify-content: flex-end;
  position: sticky;
  bottom: -24px;
  background: var(--paper);
  padding: 18px 0;
}
.diff {
  padding: 15px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 12px 0;
}
.diff h3 {
  font-size: 15px;
  overflow-wrap: anywhere;
}
.diff-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.diff-columns p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
}
.diff-columns strong {
  font-size: 12px;
  color: var(--muted);
}
[hidden] {
  display: none !important;
}
@media (max-width: 650px) {
  .site-header,
  main {
    padding: 16px;
  }
  .site-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .site-header nav {
    gap: 16px;
  }
  .controls {
    padding: 14px;
    gap: 12px;
  }
  .controls > label {
    min-width: 100%;
    flex: 1;
  }
  .controls > .changed-toggle {
    padding: 0;
  }
  .savebar {
    flex-wrap: wrap;
  }
  .savebar > div {
    width: 100%;
  }
  .savebar button {
    flex: 1;
    font-size: 14px;
  }
  .item-top {
    align-items: flex-start;
    flex-direction: column;
  }
  .text-item {
    padding: 14px;
  }
  .diff-columns {
    grid-template-columns: 1fr;
  }
  .history-row {
    align-items: flex-start;
    flex-direction: column;
  }
  dialog {
    padding: 16px;
  }
  .dialog-actions {
    bottom: -16px;
  }
  .item-foot {
    align-items: flex-start;
    flex-direction: column;
  }
}

.group-actions{display:flex;gap:8px;margin:12px 0}
.text-group{border:1px solid var(--line,#cedbd3);border-radius:8px;margin-bottom:12px;overflow:hidden}
.text-group>summary{display:flex;align-items:center;gap:12px;padding:14px;background:#eaf2ec;font-weight:700;cursor:pointer;list-style:none}
.text-group>summary::before{content:"▸"}.text-group[open]>summary::before{content:"▾"}
.group-count{margin-left:auto;font-size:12px;font-weight:400;color:#526961}
.text-group>.text-item{margin:12px}
.text-group[hidden],.text-item[hidden]{display:none}
