.tool-view {
  padding: 42px 0 64px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 26px;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: color 160ms ease;
}

.back-link:hover {
  color: var(--mint-dark);
}

.tool-header {
  display: flex;
  margin-bottom: 30px;
  gap: 18px;
  align-items: center;
}

.tool-header .tool-icon {
  width: 60px;
  height: 60px;
  margin: 0;
}

.tool-header h1 {
  margin-bottom: 6px;
  font-size: 30px;
  letter-spacing: -0.04em;
}

.tool-header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.workspace {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.toolbar {
  display: flex;
  margin-bottom: 14px;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.action-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.editor-wrap {
  position: relative;
}

.editor-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fbfdfc;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.editor-shell:focus-within {
  border-color: rgba(104, 189, 156, 0.72);
  box-shadow: 0 0 0 4px rgba(104, 189, 156, 0.08);
}

.editor-shell:has(.editor.invalid) {
  border-color: rgba(207, 93, 93, 0.68);
  box-shadow: 0 0 0 4px rgba(207, 93, 93, 0.08);
}

.line-numbers {
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  left: 0;
  width: 54px;
  overflow: hidden;
  padding-top: 24px;
  border-right: 1px solid #edf2f0;
  background: #f6f9f7;
  color: #9aa9a4;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 24.08px;
  text-align: right;
  user-select: none;
}

.line-numbers div div {
  position: relative;
  display: flex;
  height: 24.08px;
  padding-right: 13px;
  align-items: center;
  justify-content: flex-end;
}

.fold-toggle {
  position: absolute;
  left: 3px;
  display: grid;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #6e8d82;
  cursor: pointer;
  font-family: Arial, sans-serif;
  font-size: 17px;
  line-height: 1;
  place-items: center;
}

.fold-toggle:hover {
  background: #e4f1ec;
  color: var(--mint-dark);
}

.hierarchy-guides {
  position: absolute;
  z-index: 0;
  top: 0;
  right: 0;
  bottom: 0;
  left: 78px;
  overflow: hidden;
  padding-top: 24px;
  pointer-events: none;
}

.hierarchy-line {
  position: relative;
  width: max-content;
  min-width: 100%;
  height: 24.08px;
}

.hierarchy-line span {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc((var(--guide-level) - 1) * 16.86px + 1px);
  border-left: 1px solid rgba(104, 189, 156, 0.24);
}

.editor {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  min-height: 480px;
  resize: vertical;
  padding: 24px 24px 24px 78px;
  border: 0;
  outline: none;
  background: transparent;
  color: #263d37;
  caret-color: var(--mint-dark);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.72;
  tab-size: 2;
}

.editor:focus,
.editor.invalid {
  outline: none;
}

.editor[readonly] {
  cursor: default;
}

.editor-meta {
  display: flex;
  padding: 12px 4px 1px;
  color: var(--muted);
  font-size: 12px;
  justify-content: space-between;
}

.status-error {
  color: var(--danger);
}
